Use the JSVal member functions to replace JSVAL_IS_* and JSVAL_TO_*.

This commit is contained in:
Ms2ger 2014-03-09 11:29:23 +01:00
parent 84b0f45ed5
commit 9709dce07a
7 changed files with 32 additions and 57 deletions

View file

@ -6,7 +6,7 @@ use dom::bindings::utils::Reflectable;
use js::jsapi::{JSContext, JSObject, JS_WrapObject, JS_ObjectIsCallable}; use js::jsapi::{JSContext, JSObject, JS_WrapObject, JS_ObjectIsCallable};
use js::jsapi::{JS_GetProperty, JSTracer, JS_CallTracer}; use js::jsapi::{JS_GetProperty, JSTracer, JS_CallTracer};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::{JSVAL_IS_OBJECT, JSVAL_TO_OBJECT, JSTRACE_OBJECT}; use js::JSTRACE_OBJECT;
use std::cast; use std::cast;
use std::libc; use std::libc;
@ -67,8 +67,8 @@ impl CallbackInterface {
return false; return false;
} }
if !JSVAL_IS_OBJECT(*callable) || if !callable.is_object() ||
JS_ObjectIsCallable(cx, JSVAL_TO_OBJECT(*callable)) == 0 { JS_ObjectIsCallable(cx, callable.to_object()) == 0 {
//ThrowErrorMessage(cx, MSG_NOT_CALLABLE, description.get()); //ThrowErrorMessage(cx, MSG_NOT_CALLABLE, description.get());
return false; return false;
} }

View file

@ -290,7 +290,7 @@ class CGMethodCall(CGThing):
# also allow the unwrapping test to skip having to do codegen # also allow the unwrapping test to skip having to do codegen
# for the null-or-undefined case, which we already handled # for the null-or-undefined case, which we already handled
# above. # above.
caseBody.append(CGGeneric("if JSVAL_IS_OBJECT(%s) {" % caseBody.append(CGGeneric("if (%s).is_object() {" %
(distinguishingArg))) (distinguishingArg)))
for idx, sig in enumerate(interfacesSigs): for idx, sig in enumerate(interfacesSigs):
caseBody.append(CGIndenter(CGGeneric("loop {"))); caseBody.append(CGIndenter(CGGeneric("loop {")));
@ -570,11 +570,11 @@ def getJSToNativeConversionTemplate(type, descriptorProvider, failureCode=None,
# Handle the non-object cases by wrapping up the whole # Handle the non-object cases by wrapping up the whole
# thing in an if cascade. # thing in an if cascade.
templateBody = ( templateBody = (
"if JSVAL_IS_OBJECT(${val}) {\n" + "if (${val}).is_object() {\n" +
CGIndenter(CGGeneric(templateBody)).define() + "\n") CGIndenter(CGGeneric(templateBody)).define() + "\n")
if type.nullable(): if type.nullable():
templateBody += ( templateBody += (
"} else if RUST_JSVAL_IS_NULL(${val}) != 0 || RUST_JSVAL_IS_VOID(${val}) != 0 {\n" "} else if (${val}).is_null_or_undefined() {\n"
" %s;\n" % codeToSetNull) " %s;\n" % codeToSetNull)
templateBody += ( templateBody += (
"} else {\n" + "} else {\n" +
@ -799,7 +799,7 @@ for (uint32_t i = 0; i < length; ++i) {
if any([arrayObject, dateObject, nonPlatformObject, object]): if any([arrayObject, dateObject, nonPlatformObject, object]):
templateBody.prepend(CGGeneric("JSObject& argObj = ${val}.toObject();")) templateBody.prepend(CGGeneric("JSObject& argObj = ${val}.toObject();"))
templateBody = CGWrapper(CGIndenter(templateBody), templateBody = CGWrapper(CGIndenter(templateBody),
pre="if JSVAL_IS_OBJECT(${val}) {\n", pre="if (${val}).is_object() {\n",
post="\n}") post="\n}")
else: else:
templateBody = CGGeneric() templateBody = CGGeneric()
@ -844,7 +844,7 @@ for (uint32_t i = 0; i < length; ++i) {
nonConstDecl = "${declName}" nonConstDecl = "${declName}"
def handleNull(templateBody, setToNullVar, extraConditionForNull=""): def handleNull(templateBody, setToNullVar, extraConditionForNull=""):
null = CGGeneric("if %s(RUST_JSVAL_IS_NULL(${val}) != 0 || RUST_JSVAL_IS_VOID(${val}) != 0) {\n" null = CGGeneric("if %s((${val}).is_null_or_undefined()) {\n"
" %s = None;\n" " %s = None;\n"
"}" % (extraConditionForNull, setToNullVar)) "}" % (extraConditionForNull, setToNullVar))
templateBody = CGWrapper(CGIndenter(templateBody), pre="{\n", post="\n}") templateBody = CGWrapper(CGIndenter(templateBody), pre="{\n", post="\n}")
@ -900,7 +900,7 @@ for (uint32_t i = 0; i < length; ++i) {
if descriptor.interface.isCallback(): if descriptor.interface.isCallback():
name = descriptor.nativeType name = descriptor.nativeType
declType = CGGeneric("Option<%s>" % name); declType = CGGeneric("Option<%s>" % name);
conversion = (" ${declName} = Some(%s::new(JSVAL_TO_OBJECT(${val})));\n" % name) conversion = (" ${declName} = Some(%s::new((${val}).to_object()));\n" % name)
template = wrapObjectTemplate(conversion, type, template = wrapObjectTemplate(conversion, type,
"${declName} = None", "${declName} = None",
@ -922,7 +922,7 @@ for (uint32_t i = 0; i < length; ++i) {
if failureCode is not None: if failureCode is not None:
templateBody += str(CastableObjectUnwrapper( templateBody += str(CastableObjectUnwrapper(
descriptor, descriptor,
"JSVAL_TO_OBJECT(${val})", "(${val}).to_object()",
"${declName}", "${declName}",
failureCode, failureCode,
isOptional or type.nullable(), isOptional or type.nullable(),
@ -930,7 +930,7 @@ for (uint32_t i = 0; i < length; ++i) {
else: else:
templateBody += str(FailureFatalCastableObjectUnwrapper( templateBody += str(FailureFatalCastableObjectUnwrapper(
descriptor, descriptor,
"JSVAL_TO_OBJECT(${val})", "(${val}).to_object()",
"${declName}", "${declName}",
isOptional or type.nullable())) isOptional or type.nullable()))
else: else:
@ -4360,7 +4360,7 @@ class CGProxyUnwrap(CGAbstractMethod):
obj = js::UnwrapObject(obj); obj = js::UnwrapObject(obj);
}*/ }*/
//MOZ_ASSERT(IsProxy(obj)); //MOZ_ASSERT(IsProxy(obj));
let box_: *Box<%s> = cast::transmute(RUST_JSVAL_TO_PRIVATE(GetProxyPrivate(obj))); let box_: *Box<%s> = cast::transmute(GetProxyPrivate(obj).to_private());
return ptr::to_unsafe_ptr(&(*box_).data);""" % (self.descriptor.concreteType) return ptr::to_unsafe_ptr(&(*box_).data);""" % (self.descriptor.concreteType)
class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod): class CGDOMJSProxyHandler_getOwnPropertyDescriptor(CGAbstractExternMethod):
@ -4682,7 +4682,7 @@ class CGAbstractClassHook(CGAbstractExternMethod):
def finalizeHook(descriptor, hookName, context): def finalizeHook(descriptor, hookName, context):
release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj)); release = """let val = JS_GetReservedSlot(obj, dom_object_slot(obj));
let _: %s %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val)); let _: %s %s = cast::transmute(val.to_private());
debug!("%s finalize: {:p}", this); debug!("%s finalize: {:p}", this);
""" % (DOMObjectPointerType(descriptor), descriptor.concreteType, descriptor.concreteType) """ % (DOMObjectPointerType(descriptor), descriptor.concreteType, descriptor.concreteType)
return release return release
@ -4719,7 +4719,7 @@ class CGClassConstructHook(CGAbstractExternMethod):
def generate_code(self): def generate_code(self):
preamble = """ preamble = """
let global = global_object_for_js_object(RUST_JSVAL_TO_OBJECT(JS_CALLEE(cx, &*vp))); let global = global_object_for_js_object(JS_CALLEE(cx, &*vp).to_object());
let obj = global.reflector().get_jsobject(); let obj = global.reflector().get_jsobject();
""" """
nativeName = MakeNativeName(self._ctor.identifier.name) nativeName = MakeNativeName(self._ctor.identifier.name)
@ -5012,8 +5012,8 @@ class CGDictionary(CGThing):
"${initParent}" "${initParent}"
" let mut found: JSBool = 0;\n" " let mut found: JSBool = 0;\n"
" let temp: JSVal = NullValue();\n" " let temp: JSVal = NullValue();\n"
" let isNull = RUST_JSVAL_IS_NULL(val) != 0 || RUST_JSVAL_IS_VOID(val) != 0;\n" " let isNull = val.is_null_or_undefined();\n"
" if !isNull && RUST_JSVAL_IS_PRIMITIVE(val) != 0 {\n" " if !isNull && val.is_primitive() {\n"
" return 0; //XXXjdm throw properly here\n" " return 0; //XXXjdm throw properly here\n"
" //return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n" " //return Throw(cx, NS_ERROR_XPC_BAD_CONVERT_JS);\n"
" }\n" " }\n"
@ -5073,15 +5073,15 @@ class CGDictionary(CGThing):
if True: #XXXjdm hack until 'static mut' exists for global jsids if True: #XXXjdm hack until 'static mut' exists for global jsids
propName = member.identifier.name propName = member.identifier.name
propCheck = ('"%s".to_c_str().with_ref(|s| { JS_HasProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&found)) })' % propCheck = ('"%s".to_c_str().with_ref(|s| { JS_HasProperty(cx, val.to_object(), s, ptr::to_unsafe_ptr(&found)) })' %
propName) propName)
propGet = ('"%s".to_c_str().with_ref(|s| { JS_GetProperty(cx, RUST_JSVAL_TO_OBJECT(val), s, ptr::to_unsafe_ptr(&temp)) })' % propGet = ('"%s".to_c_str().with_ref(|s| { JS_GetProperty(cx, val.to_object(), s, ptr::to_unsafe_ptr(&temp)) })' %
propName) propName)
else: else:
propId = self.makeIdName(member.identifier.name); propId = self.makeIdName(member.identifier.name);
propCheck = ("JS_HasPropertyById(cx, RUST_JSVAL_TO_OBJECT(val), %s, ptr::to_unsafe_ptr(&found))" % propCheck = ("JS_HasPropertyById(cx, val.to_object(), %s, ptr::to_unsafe_ptr(&found))" %
propId) propId)
propGet = ("JS_GetPropertyById(cx, RUST_JSVAL_TO_OBJECT(val), %s, ptr::to_unsafe_ptr(&temp))" % propGet = ("JS_GetPropertyById(cx, val.to_object(), %s, ptr::to_unsafe_ptr(&temp))" %
propId) propId)
conversionReplacements = { conversionReplacements = {
@ -5236,7 +5236,6 @@ class CGBindingRoot(CGThing):
'js::{JSCLASS_RESERVED_SLOTS_MASK, JSID_VOID, JSJitInfo}', 'js::{JSCLASS_RESERVED_SLOTS_MASK, JSID_VOID, JSJitInfo}',
'js::{JSPROP_ENUMERATE, JSPROP_NATIVE_ACCESSORS, JSPROP_SHARED}', 'js::{JSPROP_ENUMERATE, JSPROP_NATIVE_ACCESSORS, JSPROP_SHARED}',
'js::{JSRESOLVE_ASSIGNING, JSRESOLVE_QUALIFIED}', 'js::{JSRESOLVE_ASSIGNING, JSRESOLVE_QUALIFIED}',
'js::{JSVAL_IS_OBJECT, JSVAL_TO_OBJECT}',
'js::jsapi::{JS_CallFunctionValue, JS_GetClass, JS_GetGlobalForObject}', 'js::jsapi::{JS_CallFunctionValue, JS_GetClass, JS_GetGlobalForObject}',
'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}', 'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}',
'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot}', 'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot}',
@ -5254,9 +5253,6 @@ class CGBindingRoot(CGThing):
'js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps}', 'js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps}',
'js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO}', 'js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO}',
'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}', 'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}',
'js::glue::{RUST_JSVAL_IS_NULL, RUST_JSVAL_IS_PRIMITIVE}',
'js::glue::{RUST_JSVAL_IS_VOID, RUST_JSVAL_TO_OBJECT}',
'js::glue::{RUST_JSVAL_TO_PRIVATE}',
'dom::types::*', 'dom::types::*',
'dom::bindings::js::JS', 'dom::bindings::js::JS',
'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}', 'dom::bindings::utils::{CreateDOMGlobal, CreateInterfaceObjects2}',
@ -6435,7 +6431,6 @@ class GlobalGenRoots():
'js::{JSCLASS_RESERVED_SLOTS_MASK, JSID_VOID, JSJitInfo}', 'js::{JSCLASS_RESERVED_SLOTS_MASK, JSID_VOID, JSJitInfo}',
'js::{JSPROP_ENUMERATE, JSPROP_NATIVE_ACCESSORS, JSPROP_SHARED}', 'js::{JSPROP_ENUMERATE, JSPROP_NATIVE_ACCESSORS, JSPROP_SHARED}',
'js::{JSRESOLVE_ASSIGNING, JSRESOLVE_QUALIFIED}', 'js::{JSRESOLVE_ASSIGNING, JSRESOLVE_QUALIFIED}',
'js::{JSVAL_IS_OBJECT, JSVAL_TO_OBJECT}',
'js::jsapi::{JS_CallFunctionValue, JS_GetClass, JS_GetGlobalForObject}', 'js::jsapi::{JS_CallFunctionValue, JS_GetClass, JS_GetGlobalForObject}',
'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}', 'js::jsapi::{JS_GetObjectPrototype, JS_GetProperty, JS_GetPropertyById}',
'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot}', 'js::jsapi::{JS_GetPropertyDescriptorById, JS_GetReservedSlot}',
@ -6451,10 +6446,7 @@ class GlobalGenRoots():
'js::glue::{CallJitMethodOp, CallJitPropertyOp, CreateProxyHandler}', 'js::glue::{CallJitMethodOp, CallJitPropertyOp, CreateProxyHandler}',
'js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps}', 'js::glue::{GetProxyPrivate, NewProxyObject, ProxyTraps}',
'js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO}', 'js::glue::{RUST_FUNCTION_VALUE_TO_JITINFO}',
'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}', 'js::glue::{RUST_JS_NumberValue, RUST_JSID_IS_STRING}',], [], curr)
'js::glue::{RUST_JSVAL_IS_NULL, RUST_JSVAL_IS_PRIMITIVE}',
'js::glue::{RUST_JSVAL_IS_VOID, RUST_JSVAL_TO_OBJECT}',
'js::glue::{RUST_JSVAL_TO_PRIVATE}',], [], curr)
# Add the auto-generated comment. # Add the auto-generated comment.
curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT) curr = CGWrapper(curr, pre=AUTOGENERATED_WARNING_COMMENT)

View file

@ -9,7 +9,6 @@ use js::jsapi::{JS_ValueToUint16, JS_ValueToNumber, JS_ValueToBoolean};
use js::jsval::JSVal; use js::jsval::JSVal;
use js::jsval::{NullValue, BooleanValue, Int32Value, UInt32Value}; use js::jsval::{NullValue, BooleanValue, Int32Value, UInt32Value};
use js::glue::RUST_JS_NumberValue; use js::glue::RUST_JS_NumberValue;
use js::glue::{RUST_JSVAL_IS_NULL, RUST_JSVAL_IS_VOID};
pub trait JSValConvertible { pub trait JSValConvertible {
fn to_jsval(&self) -> JSVal; fn to_jsval(&self) -> JSVal;
@ -161,7 +160,7 @@ impl<T: JSValConvertible> JSValConvertible for Option<T> {
} }
fn from_jsval(cx: *JSContext, value: JSVal) -> Result<Option<T>, ()> { fn from_jsval(cx: *JSContext, value: JSVal) -> Result<Option<T>, ()> {
if unsafe { RUST_JSVAL_IS_NULL(value) != 0 || RUST_JSVAL_IS_VOID(value) != 0 } { if value.is_null_or_undefined() {
Ok(None) Ok(None)
} else { } else {
let result: Result<T, ()> = JSValConvertible::from_jsval(cx, value); let result: Result<T, ()> = JSValConvertible::from_jsval(cx, value);

View file

@ -7,7 +7,7 @@ use js::jsapi::{JSContext, jsid, JSPropertyDescriptor, JSObject, JSString, jscha
use js::jsapi::{JS_GetPropertyDescriptorById, JS_NewUCString, JS_malloc, JS_free}; use js::jsapi::{JS_GetPropertyDescriptorById, JS_NewUCString, JS_malloc, JS_free};
use js::jsapi::{JSBool, JS_DefinePropertyById, JS_NewObjectWithGivenProto}; use js::jsapi::{JSBool, JS_DefinePropertyById, JS_NewObjectWithGivenProto};
use js::jsval::ObjectValue; use js::jsval::ObjectValue;
use js::glue::{RUST_JSVAL_IS_VOID, RUST_JSVAL_TO_OBJECT, GetProxyExtra}; use js::glue::GetProxyExtra;
use js::glue::{GetObjectProto, GetObjectParent, SetProxyExtra, GetProxyHandler}; use js::glue::{GetObjectProto, GetObjectParent, SetProxyExtra, GetProxyHandler};
use js::glue::InvokeGetOwnPropertyDescriptor; use js::glue::InvokeGetOwnPropertyDescriptor;
use js::crust::{JS_StrictPropertyStub}; use js::crust::{JS_StrictPropertyStub};
@ -98,10 +98,10 @@ pub fn GetExpandoObject(obj: *JSObject) -> *JSObject {
unsafe { unsafe {
assert!(is_dom_proxy(obj)); assert!(is_dom_proxy(obj));
let val = GetProxyExtra(obj, JSPROXYSLOT_EXPANDO); let val = GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
if RUST_JSVAL_IS_VOID(val) == 1 { if val.is_undefined() {
ptr::null() ptr::null()
} else { } else {
RUST_JSVAL_TO_OBJECT(val) val.to_object()
} }
} }
} }

View file

@ -43,19 +43,6 @@ use js::JSPROP_SETTER;
use js::{JSFUN_CONSTRUCTOR, JSPROP_READONLY}; use js::{JSFUN_CONSTRUCTOR, JSPROP_READONLY};
use js; use js;
mod jsval {
use js::glue::{RUST_JSVAL_IS_NULL, RUST_JSVAL_IS_VOID};
use js::jsval::JSVal;
pub fn is_null(v: JSVal) -> bool {
unsafe { RUST_JSVAL_IS_NULL(v) == 1 }
}
pub fn is_undefined(v: JSVal) -> bool {
unsafe { RUST_JSVAL_IS_VOID(v) == 1 }
}
}
pub struct GlobalStaticData { pub struct GlobalStaticData {
proxy_handlers: HashMap<uint, *libc::c_void>, proxy_handlers: HashMap<uint, *libc::c_void>,
attribute_ids: HashMap<uint, ~[jsid]>, attribute_ids: HashMap<uint, ~[jsid]>,
@ -98,7 +85,7 @@ pub unsafe fn dom_object_slot(obj: *JSObject) -> u32 {
pub unsafe fn unwrap<T>(obj: *JSObject) -> T { pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
let slot = dom_object_slot(obj); let slot = dom_object_slot(obj);
let val = JS_GetReservedSlot(obj, slot); let val = JS_GetReservedSlot(obj, slot);
cast::transmute(RUST_JSVAL_TO_PRIVATE(val)) cast::transmute(val.to_private())
} }
pub unsafe fn get_dom_class(obj: *JSObject) -> Result<DOMClass, ()> { pub unsafe fn get_dom_class(obj: *JSObject) -> Result<DOMClass, ()> {
@ -144,7 +131,7 @@ pub fn unwrap_jsmanaged<T: Reflectable>(obj: *JSObject,
pub fn unwrap_value<T>(val: *JSVal, proto_id: PrototypeList::id::ID, proto_depth: uint) -> Result<T, ()> { pub fn unwrap_value<T>(val: *JSVal, proto_id: PrototypeList::id::ID, proto_depth: uint) -> Result<T, ()> {
unsafe { unsafe {
let obj = RUST_JSVAL_TO_OBJECT(*val); let obj = (*val).to_object();
unwrap_object(obj, proto_id, proto_depth) unwrap_object(obj, proto_id, proto_depth)
} }
} }
@ -182,7 +169,7 @@ pub enum StringificationBehavior {
pub fn jsval_to_str(cx: *JSContext, v: JSVal, pub fn jsval_to_str(cx: *JSContext, v: JSVal,
nullBehavior: StringificationBehavior) -> Result<DOMString, ()> { nullBehavior: StringificationBehavior) -> Result<DOMString, ()> {
if jsval::is_null(v) && nullBehavior == Empty { if v.is_null() && nullBehavior == Empty {
Ok(~"") Ok(~"")
} else { } else {
let jsstr = unsafe { JS_ValueToString(cx, v) }; let jsstr = unsafe { JS_ValueToString(cx, v) };
@ -196,7 +183,7 @@ pub fn jsval_to_str(cx: *JSContext, v: JSVal,
} }
pub fn jsval_to_domstring(cx: *JSContext, v: JSVal) -> Result<Option<DOMString>, ()> { pub fn jsval_to_domstring(cx: *JSContext, v: JSVal) -> Result<Option<DOMString>, ()> {
if jsval::is_null(v) || jsval::is_undefined(v) { if v.is_null_or_undefined() {
Ok(None) Ok(None)
} else { } else {
let jsstr = unsafe { JS_ValueToString(cx, v) }; let jsstr = unsafe { JS_ValueToString(cx, v) };
@ -310,7 +297,7 @@ pub struct DOMJSClass {
pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject { pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject {
unsafe { unsafe {
/*assert ((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0;*/ /*assert ((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0;*/
cast::transmute(RUST_JSVAL_TO_PRIVATE(JS_GetReservedSlot(global, DOM_PROTOTYPE_SLOT))) cast::transmute(JS_GetReservedSlot(global, DOM_PROTOTYPE_SLOT).to_private())
} }
} }

View file

@ -33,7 +33,6 @@ use extra::url::Url;
use geom::point::Point2D; use geom::point::Point2D;
use geom::size::Size2D; use geom::size::Size2D;
use js::global::DEBUG_FNS; use js::global::DEBUG_FNS;
use js::glue::RUST_JSVAL_TO_OBJECT;
use js::jsapi::{JSObject, JS_InhibitGC, JS_AllowGC, JS_CallFunctionValue}; use js::jsapi::{JSObject, JS_InhibitGC, JS_AllowGC, JS_CallFunctionValue};
use js::jsval::NullValue; use js::jsval::NullValue;
use js::rust::{Compartment, Cx, CxUtils, RtUtils}; use js::rust::{Compartment, Cx, CxUtils, RtUtils};
@ -651,9 +650,7 @@ impl ScriptTask {
window.get_mut().active_timers.remove(&TimerHandle { handle: timer_data.handle, cancel_chan: None }); window.get_mut().active_timers.remove(&TimerHandle { handle: timer_data.handle, cancel_chan: None });
let js_info = page.js_info(); let js_info = page.js_info();
let this_value = if timer_data.args.len() > 0 { let this_value = if timer_data.args.len() > 0 {
unsafe { fail!("NYI")
RUST_JSVAL_TO_OBJECT(timer_data.args[0])
}
} else { } else {
js_info.get().get_ref().js_compartment.borrow().global_obj.borrow().ptr js_info.get().get_ref().js_compartment.borrow().global_obj.borrow().ptr
}; };

@ -1 +1 @@
Subproject commit e993175799354c94224f89e2e2bdc5676998dcd5 Subproject commit 85dc7859ef52da2efdee7dde905f76c17cdc79fb