mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
auto merge of #821 : brson/servo/master, r=brson,metajack,metajack
Still needs https://github.com/mozilla-servo/glfw-rs/pull/5 and https://github.com/mozilla-servo/rust-mozjs/pull/31
This commit is contained in:
commit
c532c73964
42 changed files with 156 additions and 75 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 0a677bcf6e359f6f013a7e580ef467b5f389e5b7
|
||||
Subproject commit c822d1070ac39871165df30ac8d09e733a6e7fb9
|
|
@ -1,4 +1,4 @@
|
|||
# If this file is modified, then rust will be forcibly cleaned and then rebuilt.
|
||||
# The actual contents of this file do not matter, but to trigger a change on the
|
||||
# build bots then the contents should be changed so git updates the mtime.
|
||||
2013-08-15
|
||||
2013-08-30
|
||||
|
|
|
@ -363,6 +363,7 @@ impl Font {
|
|||
|
||||
|
||||
impl Font {
|
||||
#[fixed_stack_segment]
|
||||
pub fn draw_text_into_context(&mut self,
|
||||
rctx: &RenderContext,
|
||||
run: &TextRun,
|
||||
|
|
|
@ -62,6 +62,7 @@ pub struct FontHandle {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for FontHandle {
|
||||
#[fixed_stack_segment]
|
||||
fn drop(&self) {
|
||||
assert!(self.face.is_not_null());
|
||||
unsafe {
|
||||
|
@ -99,6 +100,7 @@ impl FontHandleMethods for FontHandle {
|
|||
Err(()) => Err(())
|
||||
};
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn create_face_from_buffer(lib: FT_Library,
|
||||
cbuf: *u8, cbuflen: uint, pt_size: float)
|
||||
-> Result<FT_Face, ()> {
|
||||
|
@ -130,12 +132,14 @@ impl FontHandleMethods for FontHandle {
|
|||
fn family_name(&self) -> ~str {
|
||||
unsafe { str::raw::from_c_str((*self.face).family_name) }
|
||||
}
|
||||
#[fixed_stack_segment]
|
||||
fn face_name(&self) -> ~str {
|
||||
unsafe { str::raw::from_c_str(FT_Get_Postscript_Name(self.face)) }
|
||||
}
|
||||
fn is_italic(&self) -> bool {
|
||||
unsafe { (*self.face).style_flags & FT_STYLE_FLAG_ITALIC != 0 }
|
||||
}
|
||||
#[fixed_stack_segment]
|
||||
fn boldness(&self) -> CSSFontWeight {
|
||||
let default_weight = FontWeight400;
|
||||
if unsafe { (*self.face).style_flags & FT_STYLE_FLAG_BOLD == 0 } {
|
||||
|
@ -178,6 +182,7 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn glyph_index(&self,
|
||||
codepoint: char) -> Option<GlyphIndex> {
|
||||
assert!(self.face.is_not_null());
|
||||
|
@ -192,6 +197,7 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn glyph_h_advance(&self,
|
||||
glyph: GlyphIndex) -> Option<FractionalPixel> {
|
||||
assert!(self.face.is_not_null());
|
||||
|
@ -242,6 +248,7 @@ impl FontHandleMethods for FontHandle {
|
|||
}
|
||||
|
||||
impl<'self> FontHandle {
|
||||
#[fixed_stack_segment]
|
||||
fn set_char_size(face: FT_Face, pt_size: float) -> Result<(), ()>{
|
||||
let char_width = float_to_fixed_ft(pt_size) as FT_F26Dot6;
|
||||
let char_height = float_to_fixed_ft(pt_size) as FT_F26Dot6;
|
||||
|
@ -254,6 +261,7 @@ impl<'self> FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn new_from_file(fctx: &FontContextHandle, file: ~str,
|
||||
style: &SpecifiedFontStyle) -> Result<FontHandle, ()> {
|
||||
unsafe {
|
||||
|
@ -281,6 +289,7 @@ impl<'self> FontHandle {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn new_from_file_unstyled(fctx: &FontContextHandle, file: ~str)
|
||||
-> Result<FontHandle, ()> {
|
||||
unsafe {
|
||||
|
|
|
@ -17,6 +17,7 @@ struct FreeTypeLibraryHandle {
|
|||
}
|
||||
|
||||
impl Drop for FreeTypeLibraryHandle {
|
||||
#[fixed_stack_segment]
|
||||
fn drop(&self) {
|
||||
assert!(self.ctx.is_not_null());
|
||||
unsafe {
|
||||
|
@ -30,6 +31,7 @@ pub struct FontContextHandle {
|
|||
}
|
||||
|
||||
impl FontContextHandle {
|
||||
#[fixed_stack_segment]
|
||||
pub fn new() -> FontContextHandle {
|
||||
unsafe {
|
||||
let ctx: FT_Library = ptr::null();
|
||||
|
|
|
@ -39,6 +39,7 @@ impl FontListHandle {
|
|||
FontListHandle { fctx: fctx.clone() }
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn get_available_families(&self) -> FontFamilyMap {
|
||||
let mut family_map : FontFamilyMap = HashMap::new();
|
||||
unsafe {
|
||||
|
@ -62,6 +63,7 @@ impl FontListHandle {
|
|||
return family_map;
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn load_variations_for_family(&self, family: @mut FontFamily) {
|
||||
debug!("getting variations for %?", family);
|
||||
unsafe {
|
||||
|
@ -138,6 +140,7 @@ struct AutoPattern {
|
|||
}
|
||||
|
||||
impl Drop for AutoPattern {
|
||||
#[fixed_stack_segment]
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
FcPatternDestroy(self.pattern);
|
||||
|
@ -145,6 +148,7 @@ impl Drop for AutoPattern {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn path_from_identifier(name: ~str, style: &UsedFontStyle) -> Result<~str, ()> {
|
||||
unsafe {
|
||||
let config = FcConfigGetCurrent();
|
||||
|
|
|
@ -62,6 +62,7 @@ pub struct ShapedGlyphEntry {
|
|||
}
|
||||
|
||||
impl ShapedGlyphData {
|
||||
#[fixed_stack_segment]
|
||||
pub fn new(buffer: *hb_buffer_t) -> ShapedGlyphData {
|
||||
unsafe {
|
||||
let glyph_count = 0;
|
||||
|
@ -142,6 +143,7 @@ pub struct Shaper {
|
|||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for Shaper {
|
||||
#[fixed_stack_segment]
|
||||
fn drop(&self) {
|
||||
unsafe {
|
||||
assert!(self.hb_face.is_not_null());
|
||||
|
@ -157,6 +159,7 @@ impl Drop for Shaper {
|
|||
}
|
||||
|
||||
impl Shaper {
|
||||
#[fixed_stack_segment]
|
||||
pub fn new(font: @mut Font) -> Shaper {
|
||||
unsafe {
|
||||
// Indirection for Rust Issue #6248, dynamic freeze scope artifically extended
|
||||
|
@ -166,7 +169,7 @@ impl Shaper {
|
|||
};
|
||||
let hb_face: *hb_face_t = hb_face_create_for_tables(get_font_table_func,
|
||||
font_ptr as *c_void,
|
||||
null());
|
||||
None);
|
||||
let hb_font: *hb_font_t = hb_font_create(hb_face);
|
||||
|
||||
// Set points-per-em. if zero, performs no hinting in that direction.
|
||||
|
@ -181,9 +184,9 @@ impl Shaper {
|
|||
// configure static function callbacks.
|
||||
// NB. This funcs structure could be reused globally, as it never changes.
|
||||
let hb_funcs: *hb_font_funcs_t = hb_font_funcs_create();
|
||||
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, null(), null());
|
||||
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, null(), null());
|
||||
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *c_void, null());
|
||||
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, null(), None);
|
||||
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, null(), None);
|
||||
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *c_void, None);
|
||||
|
||||
Shaper {
|
||||
font: font,
|
||||
|
@ -210,6 +213,7 @@ impl Shaper {
|
|||
impl ShaperMethods for Shaper {
|
||||
/// Calculate the layout metrics associated with the given text when rendered in a specific
|
||||
/// font.
|
||||
#[fixed_stack_segment]
|
||||
fn shape_text(&self, text: &str, glyphs: &mut GlyphStore) {
|
||||
unsafe {
|
||||
let hb_buffer: *hb_buffer_t = hb_buffer_create();
|
||||
|
|
|
@ -521,7 +521,7 @@ impl CompositorTask {
|
|||
};
|
||||
|
||||
// Enter the main event loop.
|
||||
let tm = Timer::new().unwrap();
|
||||
let mut tm = Timer::new().unwrap();
|
||||
while !done {
|
||||
// Check for new messages coming from the rendering task.
|
||||
check_for_messages(&self.port);
|
||||
|
|
|
@ -136,7 +136,7 @@ fn run(opts: Opts) {
|
|||
let profiler_chan = profiler_chan.clone();
|
||||
let period = (period * 1000f) as u64;
|
||||
do spawn {
|
||||
let tm = Timer::new().unwrap();
|
||||
let mut tm = Timer::new().unwrap();
|
||||
loop {
|
||||
tm.sleep(period);
|
||||
profiler_chan.send(PrintMsg);
|
||||
|
|
|
@ -1952,8 +1952,8 @@ class MethodDefiner(PropertyDefiner):
|
|||
decls = ''.join([stringDecl(m) for m in array])
|
||||
return decls + self.generatePrefableArray(
|
||||
array, name,
|
||||
' JSFunctionSpec {name: &%s_name as *u8 as *libc::c_char, call: JSNativeWrapper {op: %s, info: %s}, nargs: %s, flags: %s as u16, selfHostedName: 0 as *libc::c_char }',
|
||||
' JSFunctionSpec {name: 0 as *libc::c_char, call: JSNativeWrapper {op: 0 as *u8, info: 0 as *JSJitInfo}, nargs: 0, flags: 0, selfHostedName: 0 as *libc::c_char }',
|
||||
' JSFunctionSpec {name: &%s_name as *u8 as *libc::c_char, call: JSNativeWrapper {op: Some(%s), info: %s}, nargs: %s, flags: %s as u16, selfHostedName: 0 as *libc::c_char }',
|
||||
' JSFunctionSpec {name: 0 as *libc::c_char, call: JSNativeWrapper {op: None, info: 0 as *JSJitInfo}, nargs: 0, flags: 0, selfHostedName: 0 as *libc::c_char }',
|
||||
'JSFunctionSpec',
|
||||
pref, specData, doIdArrays)
|
||||
|
||||
|
@ -1974,16 +1974,16 @@ class AttrDefiner(PropertyDefiner):
|
|||
def getter(attr):
|
||||
native = ("genericLenientGetter" if attr.hasLenientThis()
|
||||
else "genericGetter")
|
||||
return ("JSPropertyOpWrapper {op: %(native)s, info: &%(name)s_getterinfo as *JSJitInfo}"
|
||||
return ("JSPropertyOpWrapper {op: Some(%(native)s), info: &%(name)s_getterinfo as *JSJitInfo}"
|
||||
% {"name" : attr.identifier.name,
|
||||
"native" : native})
|
||||
|
||||
def setter(attr):
|
||||
if attr.readonly:
|
||||
return "JSStrictPropertyOpWrapper {op: 0 as *u8, info: 0 as *JSJitInfo}"
|
||||
return "JSStrictPropertyOpWrapper {op: None, info: 0 as *JSJitInfo}"
|
||||
native = ("genericLenientSetter" if attr.hasLenientThis()
|
||||
else "genericSetter")
|
||||
return ("JSStrictPropertyOpWrapper {op: %(native)s, info: &%(name)s_setterinfo as *JSJitInfo}"
|
||||
return ("JSStrictPropertyOpWrapper {op: Some(%(native)s), info: &%(name)s_setterinfo as *JSJitInfo}"
|
||||
% {"name" : attr.identifier.name,
|
||||
"native" : native})
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ class AttrDefiner(PropertyDefiner):
|
|||
return decls + self.generatePrefableArray(
|
||||
array, name,
|
||||
' JSPropertySpec { name: &%s_name as *u8 as *libc::c_char, tinyid: 0, flags: ((%s) & 0xFF) as u8, getter: %s, setter: %s }',
|
||||
' JSPropertySpec { name: 0 as *libc::c_char, tinyid: 0, flags: 0, getter: JSPropertyOpWrapper {op: 0 as *u8, info: 0 as *JSJitInfo}, setter: JSStrictPropertyOpWrapper {op: 0 as *u8, info: 0 as *JSJitInfo} }',
|
||||
' JSPropertySpec { name: 0 as *libc::c_char, tinyid: 0, flags: 0, getter: JSPropertyOpWrapper {op: None, info: 0 as *JSJitInfo}, setter: JSStrictPropertyOpWrapper {op: None, info: 0 as *JSJitInfo} }',
|
||||
'JSPropertySpec',
|
||||
PropertyDefiner.getControllingPref, specData, doIdArrays)
|
||||
|
||||
|
@ -2206,7 +2206,7 @@ class CGDOMJSClass(CGThing):
|
|||
#return "extern DOMJSClass Class;\n"
|
||||
return ""
|
||||
def define(self):
|
||||
traceHook = TRACE_HOOK_NAME if self.descriptor.customTrace else '0 as *u8'
|
||||
traceHook = "Some(%s)" % TRACE_HOOK_NAME if self.descriptor.customTrace else 'None'
|
||||
return """
|
||||
static Class_name: [u8, ..%i] = %s;
|
||||
static Class: DOMJSClass = DOMJSClass {
|
||||
|
@ -2219,11 +2219,11 @@ static Class: DOMJSClass = DOMJSClass {
|
|||
enumerate: crust::JS_EnumerateStub,
|
||||
resolve: crust::JS_ResolveStub,
|
||||
convert: crust::JS_ConvertStub,
|
||||
finalize: %s, /* finalize */
|
||||
checkAccess: 0 as *u8, /* checkAccess */
|
||||
call: 0 as *u8, /* call */
|
||||
hasInstance: 0 as *u8, /* hasInstance */
|
||||
construct: 0 as *u8, /* construct */
|
||||
finalize: Some(%s), /* finalize */
|
||||
checkAccess: None, /* checkAccess */
|
||||
call: None, /* call */
|
||||
hasInstance: None, /* hasInstance */
|
||||
construct: None, /* construct */
|
||||
trace: %s, /* trace */
|
||||
reserved: (0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 05
|
||||
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 10
|
||||
|
@ -2266,12 +2266,12 @@ static PrototypeClass: JSClass = JSClass {
|
|||
enumerate: crust::JS_EnumerateStub,
|
||||
resolve: crust::JS_ResolveStub,
|
||||
convert: crust::JS_ConvertStub,
|
||||
finalize: 0 as *u8, /* finalize */
|
||||
checkAccess: 0 as *u8, /* checkAccess */
|
||||
call: 0 as *u8, /* call */
|
||||
hasInstance: 0 as *u8, /* hasInstance */
|
||||
construct: 0 as *u8, /* construct */
|
||||
trace: 0 as *u8, /* trace */
|
||||
finalize: None, /* finalize */
|
||||
checkAccess: None, /* checkAccess */
|
||||
call: None, /* call */
|
||||
hasInstance: None, /* hasInstance */
|
||||
construct: None, /* construct */
|
||||
trace: None, /* trace */
|
||||
reserved: (0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 05
|
||||
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 10
|
||||
0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, 0 as *libc::c_void, // 15
|
||||
|
@ -2407,12 +2407,16 @@ class CGAbstractMethod(CGThing):
|
|||
def _decorators(self):
|
||||
decorators = []
|
||||
if self.alwaysInline:
|
||||
decorators.append('#[inline(always)]')
|
||||
# FIXME Rust #8801 #[inline(always)] and #[fixed_stack_segment] not compatible
|
||||
# decorators.append('#[inline(always)]')
|
||||
pass
|
||||
elif self.inline:
|
||||
#decorators.append('inline')
|
||||
pass
|
||||
if self.extern:
|
||||
decorators.append('extern')
|
||||
if not self.extern:
|
||||
decorators.append('#[fixed_stack_segment]')
|
||||
if self.static:
|
||||
#decorators.append('static')
|
||||
pass
|
||||
|
@ -2701,7 +2705,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
%s);""" % (
|
||||
"&PrototypeClass" if needInterfacePrototypeObject else "ptr::null()",
|
||||
"&InterfaceObjectClass" if needInterfaceObjectClass else "ptr::null()",
|
||||
constructHook if needConstructor else "ptr::null()",
|
||||
"Some(%s)" % constructHook if needConstructor else "None",
|
||||
constructArgs,
|
||||
domClass,
|
||||
arrayPtr("methods"), arrayPtr("attrs"),
|
||||
|
@ -3176,13 +3180,13 @@ class CGGenericMethod(CGAbstractBindingMethod):
|
|||
"""
|
||||
def __init__(self, descriptor):
|
||||
args = [Argument('*JSContext', 'cx'), Argument('libc::c_uint', 'argc'),
|
||||
Argument('*JSVal', 'vp')]
|
||||
Argument('*mut JSVal', 'vp')]
|
||||
CGAbstractBindingMethod.__init__(self, descriptor, 'genericMethod', args)
|
||||
|
||||
def generate_code(self):
|
||||
return CGIndenter(CGGeneric(
|
||||
"let _info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));\n"
|
||||
"return CallJitMethodOp(_info, cx, obj, this as *libc::c_void, argc, vp);"))
|
||||
"let _info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, &*vp));\n"
|
||||
"return CallJitMethodOp(_info, cx, obj, this as *libc::c_void, argc, &*vp);"))
|
||||
|
||||
class CGAbstractStaticMethod(CGAbstractMethod):
|
||||
"""
|
||||
|
@ -3229,8 +3233,8 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||
A class for generating the C++ code for an IDL attribute getter.
|
||||
"""
|
||||
def __init__(self, descriptor, lenientThis=False):
|
||||
args = [Argument('*JSContext', 'cx'), Argument('uint', 'argc'),
|
||||
Argument('*JSVal', 'vp')]
|
||||
args = [Argument('*JSContext', 'cx'), Argument('libc::c_uint', 'argc'),
|
||||
Argument('*mut JSVal', 'vp')]
|
||||
if lenientThis:
|
||||
name = "genericLenientGetter"
|
||||
unwrapFailureCode = (
|
||||
|
@ -3245,8 +3249,8 @@ class CGGenericGetter(CGAbstractBindingMethod):
|
|||
|
||||
def generate_code(self):
|
||||
return CGIndenter(CGGeneric(
|
||||
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, vp));\n"
|
||||
"return CallJitPropertyOp(info, cx, obj, this as *libc::c_void, vp);"))
|
||||
"let info: *JSJitInfo = RUST_FUNCTION_VALUE_TO_JITINFO(JS_CALLEE(cx, &*vp));\n"
|
||||
"return CallJitPropertyOp(info, cx, obj, this as *libc::c_void, &*vp);"))
|
||||
|
||||
class CGSpecializedGetter(CGAbstractExternMethod):
|
||||
"""
|
||||
|
@ -3284,7 +3288,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
A class for generating the Rust code for an IDL attribute setter.
|
||||
"""
|
||||
def __init__(self, descriptor, lenientThis=False):
|
||||
args = [Argument('*JSContext', 'cx'), Argument('uint', 'argc'),
|
||||
args = [Argument('*JSContext', 'cx'), Argument('libc::c_uint', 'argc'),
|
||||
Argument('*mut JSVal', 'vp')]
|
||||
if lenientThis:
|
||||
name = "genericLenientSetter"
|
||||
|
@ -3362,7 +3366,7 @@ class CGMemberJITInfo(CGThing):
|
|||
failstr = "true" if infallible else "false"
|
||||
return ("\n"
|
||||
"static %s: JSJitInfo = JSJitInfo {\n"
|
||||
" op: %s,\n"
|
||||
" op: %s as *u8,\n"
|
||||
" protoID: %s,\n"
|
||||
" depth: %s,\n"
|
||||
" isInfallible: %s, /* False in setters. */\n"
|
||||
|
@ -4393,6 +4397,7 @@ class CGDictionary(CGThing):
|
|||
" return true;\n"
|
||||
" }\n"
|
||||
"\n" if not self.workers else "") +
|
||||
" #[fixed_stack_segment]\n" +
|
||||
" pub fn Init(&mut self, cx: *JSContext, val: JSVal) -> JSBool {\n"
|
||||
" unsafe {\n" +
|
||||
# NOTE: jsids are per-runtime, so don't use them in workers
|
||||
|
|
|
@ -12,12 +12,14 @@ pub trait JSValConvertible {
|
|||
}
|
||||
|
||||
impl JSValConvertible for u32 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_UINT_TO_JSVAL(*self)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<u32> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_INT(val) as u32)
|
||||
|
@ -26,12 +28,14 @@ impl JSValConvertible for u32 {
|
|||
}
|
||||
|
||||
impl JSValConvertible for i32 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_UINT_TO_JSVAL(*self as u32)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<i32> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_INT(val) as i32)
|
||||
|
@ -40,12 +44,14 @@ impl JSValConvertible for i32 {
|
|||
}
|
||||
|
||||
impl JSValConvertible for u16 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_UINT_TO_JSVAL(*self as u32)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<u16> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_INT(val) as u16)
|
||||
|
@ -74,12 +80,14 @@ impl JSValConvertible for bool {
|
|||
}
|
||||
|
||||
impl JSValConvertible for f32 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_DOUBLE_TO_JSVAL(*self as f64)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<f32> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_DOUBLE(val) as f32)
|
||||
|
@ -88,12 +96,14 @@ impl JSValConvertible for f32 {
|
|||
}
|
||||
|
||||
impl JSValConvertible for f64 {
|
||||
#[fixed_stack_segment]
|
||||
fn to_jsval(&self) -> JSVal {
|
||||
unsafe {
|
||||
RUST_DOUBLE_TO_JSVAL(*self as f64)
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn from_jsval(val: JSVal) -> Option<f64> {
|
||||
unsafe {
|
||||
Some(RUST_JSVAL_TO_DOUBLE(val) as f64)
|
||||
|
|
|
@ -34,6 +34,7 @@ impl DerivedWrapper for DOMParser {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -44,10 +44,11 @@ pub extern fn getPropertyDescriptor(cx: *JSContext, proxy: *JSObject, id: jsid,
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn defineProperty_(cx: *JSContext, proxy: *JSObject, id: jsid,
|
||||
desc: *JSPropertyDescriptor) -> JSBool {
|
||||
unsafe {
|
||||
if ((*desc).attrs & JSPROP_GETTER) != 0 && (*desc).setter == JS_StrictPropertyStub {
|
||||
if ((*desc).attrs & JSPROP_GETTER) != 0 && (*desc).setter == Some(JS_StrictPropertyStub) {
|
||||
/*return JS_ReportErrorFlagsAndNumber(cx,
|
||||
JSREPORT_WARNING | JSREPORT_STRICT |
|
||||
JSREPORT_STRICT_MODE_ERROR,
|
||||
|
@ -71,6 +72,7 @@ pub extern fn defineProperty(cx: *JSContext, proxy: *JSObject, id: jsid,
|
|||
defineProperty_(cx, proxy, id, desc)
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
||||
unsafe {
|
||||
let name = str::raw::from_c_str(className);
|
||||
|
@ -93,6 +95,7 @@ pub fn _obj_toString(cx: *JSContext, className: *libc::c_char) -> *JSString {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn GetExpandoObject(obj: *JSObject) -> *JSObject {
|
||||
unsafe {
|
||||
assert!(is_dom_proxy(obj));
|
||||
|
@ -105,6 +108,7 @@ pub fn GetExpandoObject(obj: *JSObject) -> *JSObject {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn EnsureExpandoObject(cx: *JSContext, obj: *JSObject) -> *JSObject {
|
||||
unsafe {
|
||||
assert!(is_dom_proxy(obj));
|
||||
|
@ -125,7 +129,7 @@ pub fn EnsureExpandoObject(cx: *JSContext, obj: *JSObject) -> *JSObject {
|
|||
pub fn FillPropertyDescriptor(desc: &mut JSPropertyDescriptor, obj: *JSObject, readonly: bool) {
|
||||
desc.obj = obj;
|
||||
desc.attrs = if readonly { JSPROP_READONLY } else { 0 } | JSPROP_ENUMERATE;
|
||||
desc.getter = ptr::null();
|
||||
desc.setter = ptr::null();
|
||||
desc.getter = None;
|
||||
desc.setter = None;
|
||||
desc.shortid = 0;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,9 @@ use dom::bindings::node;
|
|||
use dom::node::{AbstractNode, ScriptView};
|
||||
use script_task::page_from_context;
|
||||
|
||||
use std::libc::c_uint;
|
||||
use std::cast;
|
||||
use std::cell::Cell;
|
||||
use std::hashmap::HashMap;
|
||||
use std::libc;
|
||||
use std::ptr;
|
||||
|
@ -28,6 +30,8 @@ use js::jsapi::{JS_NewStringCopyN, JS_DefineFunctions, JS_DefineProperty};
|
|||
use js::jsapi::{JS_ValueToString, JS_GetReservedSlot, JS_SetReservedSlot};
|
||||
use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative};
|
||||
use js::jsapi::{JSFunctionSpec, JSPropertySpec, JSVal, JSPropertyDescriptor};
|
||||
use js::jsapi::{JSFreeOp, JSTracer};
|
||||
use js::jsapi::{JSPropertyOp, JSStrictPropertyOp, JSEnumerateOp, JSResolveOp, JSConvertOp};
|
||||
use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType;
|
||||
use js::rust::Compartment;
|
||||
use js::{JSPROP_ENUMERATE, JSVAL_NULL};
|
||||
|
@ -55,7 +59,7 @@ pub fn GlobalStaticData() -> GlobalStaticData {
|
|||
}
|
||||
}
|
||||
|
||||
extern fn InterfaceObjectToString(cx: *JSContext, _argc: uint, vp: *mut JSVal) -> JSBool {
|
||||
extern fn InterfaceObjectToString(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let callee = RUST_JSVAL_TO_OBJECT(*JS_CALLEE(cx, cast::transmute(&vp)));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(&vp));
|
||||
|
@ -125,6 +129,7 @@ fn is_dom_class(clasp: *JSClass) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn is_dom_proxy(obj: *JSObject) -> bool {
|
||||
unsafe {
|
||||
(js_IsObjectProxyClass(obj) || js_IsFunctionProxyClass(obj)) &&
|
||||
|
@ -132,6 +137,7 @@ pub fn is_dom_proxy(obj: *JSObject) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
|
||||
let clasp = JS_GetClass(obj);
|
||||
let slot = if is_dom_class(clasp) {
|
||||
|
@ -144,6 +150,7 @@ pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
|
|||
cast::transmute(RUST_JSVAL_TO_PRIVATE(val))
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub unsafe fn get_dom_class(obj: *JSObject) -> Result<DOMClass, ()> {
|
||||
let clasp = JS_GetClass(obj);
|
||||
if is_dom_class(clasp) {
|
||||
|
@ -174,6 +181,7 @@ pub fn unwrap_object<T>(obj: *JSObject, proto_id: PrototypeList::id::ID, proto_d
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn unwrap_value<T>(val: *JSVal, proto_id: PrototypeList::id::ID, proto_depth: uint) -> Result<T, ()> {
|
||||
unsafe {
|
||||
let obj = RUST_JSVAL_TO_OBJECT(*val);
|
||||
|
@ -188,6 +196,7 @@ pub unsafe fn squirrel_away<T>(x: @mut T) -> *rust_box<T> {
|
|||
}
|
||||
|
||||
//XXX very incomplete
|
||||
#[fixed_stack_segment]
|
||||
pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> {
|
||||
unsafe {
|
||||
let jsstr;
|
||||
|
@ -207,6 +216,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal) -> Result<~str, ()> {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal {
|
||||
match string {
|
||||
&null_string => {
|
||||
|
@ -288,7 +298,7 @@ pub struct NativeProperties {
|
|||
|
||||
pub struct NativePropertyHooks {
|
||||
resolve_own_property: *u8,
|
||||
resolve_property: *u8,
|
||||
resolve_property: extern "C" fn(*JSContext, *JSObject, jsid, bool, *mut JSPropertyDescriptor) -> bool,
|
||||
enumerate_own_properties: *u8,
|
||||
enumerate_properties: *u8,
|
||||
proto_hooks: *NativePropertyHooks
|
||||
|
@ -329,6 +339,7 @@ pub struct DOMJSClass {
|
|||
dom_class: DOMClass
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject {
|
||||
unsafe {
|
||||
/*assert ((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0;*/
|
||||
|
@ -336,9 +347,10 @@ pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
||||
protoProto: *JSObject, protoClass: *JSClass,
|
||||
constructorClass: *JSClass, constructor: JSNative,
|
||||
constructorClass: *JSClass, constructor: Option<JSNative>,
|
||||
ctorNargs: u32,
|
||||
domClass: *DOMClass,
|
||||
methods: *JSFunctionSpec,
|
||||
|
@ -362,7 +374,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
|||
}
|
||||
|
||||
let mut interface = ptr::null();
|
||||
if constructorClass.is_not_null() || constructor.is_not_null() {
|
||||
if constructorClass.is_not_null() || constructor.is_some() {
|
||||
interface = do name.to_c_str().with_ref |s| {
|
||||
CreateInterfaceObject(cx, global, receiver, constructorClass,
|
||||
constructor, ctorNargs, proto,
|
||||
|
@ -380,8 +392,9 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
||||
constructorClass: *JSClass, constructorNative: JSNative,
|
||||
constructorClass: *JSClass, constructorNative: Option<JSNative>,
|
||||
ctorNargs: u32, proto: *JSObject,
|
||||
staticMethods: *JSFunctionSpec,
|
||||
constants: *ConstantSpec,
|
||||
|
@ -395,7 +408,6 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
|||
JS_NewObject(cx, constructorClass, functionProto, global)
|
||||
}
|
||||
} else {
|
||||
assert!(constructorNative.is_not_null());
|
||||
let fun = JS_NewFunction(cx, constructorNative, ctorNargs,
|
||||
JSFUN_CONSTRUCTOR, global, name);
|
||||
if fun.is_null() {
|
||||
|
@ -451,7 +463,7 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
|||
|
||||
if alreadyDefined == 0 &&
|
||||
JS_DefineProperty(cx, receiver, name, RUST_OBJECT_TO_JSVAL(constructor),
|
||||
ptr::null(), ptr::null(), 0) == 0 {
|
||||
None, None, 0) == 0 {
|
||||
return ptr::null();
|
||||
}
|
||||
|
||||
|
@ -459,6 +471,7 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn DefineConstants(cx: *JSContext, obj: *JSObject, constants: *ConstantSpec) -> bool {
|
||||
let mut i = 0;
|
||||
loop {
|
||||
|
@ -477,8 +490,8 @@ fn DefineConstants(cx: *JSContext, obj: *JSObject, constants: *ConstantSpec) ->
|
|||
VoidVal => JSVAL_VOID
|
||||
};
|
||||
if JS_DefineProperty(cx, obj, spec.name,
|
||||
jsval, ptr::null(),
|
||||
ptr::null(),
|
||||
jsval, None,
|
||||
None,
|
||||
JSPROP_ENUMERATE | JSPROP_READONLY |
|
||||
JSPROP_PERMANENT) == 0 {
|
||||
return false;
|
||||
|
@ -488,18 +501,21 @@ fn DefineConstants(cx: *JSContext, obj: *JSObject, constants: *ConstantSpec) ->
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn DefineMethods(cx: *JSContext, obj: *JSObject, methods: *JSFunctionSpec) -> bool {
|
||||
unsafe {
|
||||
JS_DefineFunctions(cx, obj, methods) != 0
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn DefineProperties(cx: *JSContext, obj: *JSObject, properties: *JSPropertySpec) -> bool {
|
||||
unsafe {
|
||||
JS_DefineProperties(cx, obj, properties) != 0
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn CreateInterfacePrototypeObject(cx: *JSContext, global: *JSObject,
|
||||
parentProto: *JSObject, protoClass: *JSClass,
|
||||
methods: *JSFunctionSpec,
|
||||
|
@ -527,11 +543,12 @@ fn CreateInterfacePrototypeObject(cx: *JSContext, global: *JSObject,
|
|||
}
|
||||
}
|
||||
|
||||
pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: uint, _vp: *JSVal) -> JSBool {
|
||||
pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: c_uint, _vp: *mut JSVal) -> JSBool {
|
||||
//XXX should trigger exception here
|
||||
return 0;
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn initialize_global(global: *JSObject) {
|
||||
let protoArray = @mut ([0 as *JSObject, ..PrototypeList::id::_ID_Count as uint]);
|
||||
unsafe {
|
||||
|
@ -573,6 +590,7 @@ impl WrapperCache {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
|
||||
value: @mut CacheableWrapper,
|
||||
vp: *mut JSVal) -> bool {
|
||||
|
@ -596,6 +614,7 @@ pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn WrapNativeParent(cx: *JSContext, scope: *JSObject, mut p: Option<@mut CacheableWrapper>) -> *JSObject {
|
||||
match p {
|
||||
Some(ref mut p) => {
|
||||
|
@ -616,6 +635,7 @@ pub trait BindingObject {
|
|||
fn GetParentObject(&self, cx: *JSContext) -> Option<@mut CacheableWrapper>;
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn GetPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid, found: *mut bool,
|
||||
vp: *JSVal) -> bool {
|
||||
unsafe {
|
||||
|
@ -639,6 +659,7 @@ pub fn GetPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid, found:
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn GetArrayIndexFromId(_cx: *JSContext, id: jsid) -> Option<u32> {
|
||||
unsafe {
|
||||
if RUST_JSID_IS_INT(id) != 0 {
|
||||
|
@ -662,6 +683,7 @@ pub fn GetArrayIndexFromId(_cx: *JSContext, id: jsid) -> Option<u32> {
|
|||
}*/
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn XrayResolveProperty(cx: *JSContext,
|
||||
wrapper: *JSObject,
|
||||
id: jsid,
|
||||
|
@ -688,9 +710,9 @@ pub fn XrayResolveProperty(cx: *JSContext,
|
|||
|
||||
RUST_SET_JITINFO(fun, attr.getter.info);
|
||||
let funobj = JS_GetFunctionObject(fun);
|
||||
(*desc).getter = funobj as *u8;
|
||||
(*desc).getter = Some(funobj as JSPropertyOp);
|
||||
(*desc).attrs |= JSPROP_GETTER;
|
||||
if attr.setter.op.is_not_null() {
|
||||
if attr.setter.op.is_some() {
|
||||
let fun = JS_NewFunction(cx, attr.setter.op, 1, 0, global, ptr::null());
|
||||
if fun.is_null() {
|
||||
return false
|
||||
|
@ -698,10 +720,10 @@ pub fn XrayResolveProperty(cx: *JSContext,
|
|||
|
||||
RUST_SET_JITINFO(fun, attr.setter.info);
|
||||
let funobj = JS_GetFunctionObject(fun);
|
||||
(*desc).setter = funobj as *u8;
|
||||
(*desc).setter = Some(funobj as JSStrictPropertyOp);
|
||||
(*desc).attrs |= JSPROP_SETTER;
|
||||
} else {
|
||||
(*desc).setter = ptr::null();
|
||||
(*desc).setter = None;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -711,6 +733,7 @@ pub fn XrayResolveProperty(cx: *JSContext,
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn InternJSString(cx: *JSContext, chars: *libc::c_char) -> Option<jsid> {
|
||||
unsafe {
|
||||
let s = JS_InternString(cx, chars);
|
||||
|
@ -743,6 +766,7 @@ pub trait DerivedWrapper {
|
|||
}
|
||||
|
||||
impl DerivedWrapper for AbstractNode<ScriptView> {
|
||||
#[fixed_stack_segment]
|
||||
fn wrap(&mut self, cx: *JSContext, _scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let cache = self.get_wrappercache();
|
||||
let wrapper = cache.get_wrapper();
|
||||
|
@ -771,6 +795,7 @@ pub struct EnumEntry {
|
|||
length: uint
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn FindEnumStringIndex(cx: *JSContext,
|
||||
v: JSVal,
|
||||
values: &[EnumEntry]) -> Result<uint, ()> {
|
||||
|
|
|
@ -88,6 +88,7 @@ impl DerivedWrapper for ClientRect {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -87,6 +87,7 @@ pub struct Document {
|
|||
}
|
||||
|
||||
impl Document {
|
||||
#[fixed_stack_segment]
|
||||
pub fn new(root: AbstractNode<ScriptView>, window: Option<@mut Window>, doctype: DocumentType) -> Document {
|
||||
let compartment = unsafe {(*window.get_ref().page).js_info.get_ref().js_compartment };
|
||||
do root.with_base |base| {
|
||||
|
@ -151,6 +152,7 @@ impl BindingObject for AbstractDocument {
|
|||
}
|
||||
|
||||
impl DerivedWrapper for AbstractDocument {
|
||||
#[fixed_stack_segment]
|
||||
fn wrap(&mut self, _cx: *JSContext, _scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let cache = self.get_wrappercache();
|
||||
let wrapper = cache.get_wrapper();
|
||||
|
@ -448,6 +450,7 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn teardown(&self) {
|
||||
unsafe {
|
||||
let compartment = (*self.window.get_ref().page).js_info.get_ref().js_compartment;
|
||||
|
|
|
@ -139,6 +139,7 @@ impl DerivedWrapper for Event {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -53,6 +53,7 @@ impl DerivedWrapper for EventTarget {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -76,6 +76,7 @@ impl DerivedWrapper for FormData {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -165,6 +165,7 @@ impl DerivedWrapper for MouseEvent {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -139,6 +139,7 @@ impl DerivedWrapper for UIEvent {
|
|||
fail!(~"nyi")
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
fn wrap_shared(@mut self, cx: *JSContext, scope: *JSObject, vp: *mut JSVal) -> i32 {
|
||||
let obj = self.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
|
|
|
@ -14,9 +14,11 @@ use servo_msg::compositor_msg::ScriptListener;
|
|||
|
||||
use js::glue::*;
|
||||
use js::jsapi::{JSObject, JSContext};
|
||||
use js::jsapi::{JSPropertyOp, JSStrictPropertyOp};
|
||||
use js::{JSVAL_NULL, JSPROP_ENUMERATE};
|
||||
|
||||
use std::cast;
|
||||
use std::cell::Cell;
|
||||
use std::comm;
|
||||
use std::comm::SharedChan;
|
||||
use std::io;
|
||||
|
@ -146,9 +148,10 @@ impl Window {
|
|||
|
||||
// Post a delayed message to the per-window timer task; it will dispatch it
|
||||
// to the relevant script handler that will deal with it.
|
||||
let tm = Timer::new().unwrap();
|
||||
let tm = Cell::new(Timer::new().unwrap());
|
||||
let chan = self.timer_chan.clone();
|
||||
do spawn {
|
||||
let mut tm = tm.take();
|
||||
tm.sleep(timeout);
|
||||
chan.send(TimerMessage_Fire(~TimerData {
|
||||
funval: callback,
|
||||
|
@ -164,6 +167,7 @@ impl Window {
|
|||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn new(page: *mut Page, script_chan: ScriptChan, compositor: @ScriptListener)
|
||||
-> @mut Window {
|
||||
let script_chan_clone = script_chan.clone();
|
||||
|
@ -194,8 +198,8 @@ impl Window {
|
|||
win.wrap_object_shared(compartment.cx.ptr, ptr::null()); //XXXjdm proper scope
|
||||
compartment.define_property(~"window",
|
||||
RUST_OBJECT_TO_JSVAL((*cache).wrapper),
|
||||
GetJSClassHookStubPointer(PROPERTY_STUB) as *u8,
|
||||
GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as *u8,
|
||||
GetJSClassHookStubPointer(PROPERTY_STUB) as JSPropertyOp,
|
||||
GetJSClassHookStubPointer(STRICT_PROPERTY_STUB) as JSStrictPropertyOp,
|
||||
JSPROP_ENUMERATE);
|
||||
}
|
||||
win
|
||||
|
|
|
@ -368,6 +368,7 @@ pub struct ScriptTask {
|
|||
}
|
||||
|
||||
/// Returns the relevant page from the associated JS Context.
|
||||
#[fixed_stack_segment]
|
||||
pub fn page_from_context(js_context: *JSContext) -> *mut Page {
|
||||
unsafe {
|
||||
JS_GetContextPrivate(js_context) as *mut Page
|
||||
|
@ -503,6 +504,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
/// Handles a timer that fired.
|
||||
#[fixed_stack_segment]
|
||||
fn handle_fire_timer_msg(&mut self, id: PipelineId, timer_data: ~TimerData) {
|
||||
let page = self.page_tree.find(id).expect("ScriptTask: received fire timer msg for a
|
||||
pipeline ID not associated with this script task. This is a bug.").page;
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 25495d9a80f11fdde4fa3cc6bcb3c0ea7462e0bb
|
||||
Subproject commit fcc8d5865e0002d8d75f1098e956c120d8131c8d
|
|
@ -1 +1 @@
|
|||
Subproject commit c5dafee99adea0a31acea07dce09d4f81271a14a
|
||||
Subproject commit 9755a007a0294294740d728ba14de30b45b769e5
|
|
@ -1 +1 @@
|
|||
Subproject commit 479bccc6f323bc698856f3dc5a9ab93f4ffc8958
|
||||
Subproject commit 4c4662a5d6077b547466d33c9a00cb33df9f6f26
|
|
@ -1 +1 @@
|
|||
Subproject commit d0c3681561eb83b85773207e44bd2c22aa8445d2
|
||||
Subproject commit 36b060d0aef4b3d3f644ef221a0aaca4cd31bcdb
|
|
@ -1 +1 @@
|
|||
Subproject commit 0679efa35b682863d25ac19fdb520c35f9a364a5
|
||||
Subproject commit e775ce635a063bf1d5d6b5b0c5339cbb818116ab
|
|
@ -1 +1 @@
|
|||
Subproject commit 3f4841a48534b167284ea04b0c2b5952fef936e7
|
||||
Subproject commit 6fbd1581ae7baede892c543c05f3509ded1ce8ed
|
|
@ -1 +1 @@
|
|||
Subproject commit cb2c8b0e28b9e5bd957217109709f2603d7a5e78
|
||||
Subproject commit f564836fb59e3a37b7cd9c903bd6282b61a2fea4
|
|
@ -1 +1 @@
|
|||
Subproject commit 77921ee3f243ab90944ec44131ec98d20bc9551f
|
||||
Subproject commit 8700565717e8c94f6615761f074dafe8e6283d9f
|
|
@ -1 +1 @@
|
|||
Subproject commit 16fe7a91f0cb201a461b8d05340b859e8f578a8f
|
||||
Subproject commit 49ae834012a9875dfbc6c42206aa083b69a2aade
|
|
@ -1 +1 @@
|
|||
Subproject commit ca00f10d255757d4f112a68b17f37afdc5462147
|
||||
Subproject commit 1ed1ed819a90fc6c559282d3a5c02fc8cf3fba09
|
|
@ -1 +1 @@
|
|||
Subproject commit b99f72ccde8ca973add1246426540849ffc50792
|
||||
Subproject commit df7d4e1467a2341a4b4186d848df1d1d0adf9b7c
|
|
@ -1 +1 @@
|
|||
Subproject commit a55ab9e2834b1cc898e68a02795ab68861f95f73
|
||||
Subproject commit 0793c920f33c5928323358f7aba7da3253019c60
|
|
@ -1 +1 @@
|
|||
Subproject commit ec61bd34561ec6dd22d792713d385f7480863d38
|
||||
Subproject commit 6286216e162319c049e3aa7c8435478668bb06d2
|
|
@ -1 +1 @@
|
|||
Subproject commit d01eb726c0dcd46d71611e524ede00d28f382f29
|
||||
Subproject commit 698124d5994d99183cbc51d07d15d1c16b0f75a4
|
|
@ -1 +1 @@
|
|||
Subproject commit e677e2586128acfbae7517a4916e7ea826ab3206
|
||||
Subproject commit 8dc1939cdf37dda742d4910e3265cf03c0fc9609
|
|
@ -1 +1 @@
|
|||
Subproject commit 9278870fc5b79678a04ebd2d9eca305ac1706892
|
||||
Subproject commit d951d00382c7ad95d64b87f876188df7f0254f00
|
|
@ -1 +1 @@
|
|||
Subproject commit 2fdf1f166a7e8d0930b9e55a91601a4fcb35357f
|
||||
Subproject commit fed8ed305e4bf0e3ff283da1a45768e5d2e19ed2
|
|
@ -1 +1 @@
|
|||
Subproject commit 89029c798d3b4a95a41c695e565d13b47b4a5b90
|
||||
Subproject commit 881bdb753b3a51023d54b653cd88b7e266788476
|
|
@ -57,6 +57,7 @@ fn test_options(config: Config) -> TestOpts {
|
|||
ratchet_metrics: None,
|
||||
ratchet_noise_percent: None,
|
||||
save_metrics: None,
|
||||
test_shard: None,
|
||||
logfile: None
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue