diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/Cargo.toml | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 16 | ||||
-rw-r--r-- | components/script/dom/bindings/reflector.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/trace.rs | 2 | ||||
-rw-r--r-- | components/script/dom/customelementregistry.rs | 4 | ||||
-rw-r--r-- | components/script/dom/history.rs | 2 | ||||
-rw-r--r-- | components/script/dom/promise.rs | 6 | ||||
-rw-r--r-- | components/script/timers.rs | 2 |
8 files changed, 19 insertions, 17 deletions
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 209ce6c2ee1..f9a4aadf6d9 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -64,7 +64,7 @@ metrics = {path = "../metrics"} mitochondria = "1.1.2" mime = "0.2.1" mime_guess = "1.8.0" -mozjs = { version = "0.6", features = ["promises"]} +mozjs = { version = "0.7.1", features = ["promises"]} msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.1.32" diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index e7423c670eb..01b52d916ae 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -361,7 +361,7 @@ class CGMethodCall(CGThing): for i in range(0, distinguishingIndex)] # Select the right overload from our set. - distinguishingArg = "args.get(%d)" % distinguishingIndex + distinguishingArg = "HandleValue::from_raw(args.get(%d))" % distinguishingIndex def pickFirstSignature(condition, filterLambda): sigs = filter(filterLambda, possibleSignatures) @@ -1284,7 +1284,7 @@ class CGArgumentConverter(CGThing): } replacementVariables = { - "val": string.Template("${args}.get(${index})").substitute(replacer), + "val": string.Template("HandleValue::from_raw(${args}.get(${index}))").substitute(replacer), } info = getJSToNativeConversionInfo( @@ -1328,7 +1328,7 @@ class CGArgumentConverter(CGThing): else: assert argument.optional variadicConversion = { - "val": string.Template("${args}.get(variadicArg)").substitute(replacer), + "val": string.Template("HandleValue::from_raw(${args}.get(variadicArg))").substitute(replacer), } innerConverter = [instantiateJSToNativeConversionTemplate( template, variadicConversion, declType, "slot")] @@ -3365,7 +3365,7 @@ class CGPerSignatureCall(CGThing): return 'infallible' not in self.extendedAttributes def wrap_return_value(self): - return wrapForType('args.rval()') + return wrapForType('MutableHandleValue::from_raw(args.rval())') def define(self): return (self.cgRoot.define() + "\n" + self.wrap_return_value()) @@ -3516,7 +3516,7 @@ class CGSpecializedMethod(CGAbstractExternMethod): self.descriptor, self.method), pre="let this = &*this;\n" "let args = &*args;\n" - "let argc = args._base.argc_;\n") + "let argc = args.argc_;\n") @staticmethod def makeNativeName(descriptor, method): @@ -3675,7 +3675,7 @@ if !v.is_object() { return false; } rooted!(in(cx) let target_obj = v.to_object()); -JS_SetProperty(cx, target_obj.handle(), %s as *const u8 as *const libc::c_char, args.get(0)) +JS_SetProperty(cx, target_obj.handle(), %s as *const u8 as *const libc::c_char, HandleValue::from_raw(args.get(0))) """ % (str_to_const_array(attrName), attrName, str_to_const_array(forwardToAttrName))) @@ -3693,7 +3693,7 @@ class CGSpecializedReplaceableSetter(CGSpecializedSetter): assert all(ord(c) < 128 for c in name) return CGGeneric("""\ JS_DefineProperty(cx, obj, %s as *const u8 as *const libc::c_char, - args.get(0), JSPROP_ENUMERATE, None, None)""" % name) + HandleValue::from_raw(args.get(0)), JSPROP_ENUMERATE, None, None)""" % name) class CGMemberJITInfo(CGThing): @@ -5514,7 +5514,7 @@ if !JS_WrapObject(cx, element.handle_mut()) { JS_SetPrototype(cx, element.handle(), prototype.handle()); -(result).to_jsval(cx, args.rval()); +(result).to_jsval(cx, MutableHandleValue::from_raw(args.rval())); return true; """ % self.descriptor.name) else: diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 953348b2d75..416c3c3f552 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -48,7 +48,7 @@ impl Reflector { #[inline] pub fn get_jsobject(&self) -> HandleObject { // We're rooted, so it's safe to hand out a handle to object in Heap - unsafe { self.object.handle() } + unsafe { HandleObject::from_raw(self.object.handle()) } } /// Initialize the reflector. (May be called only once.) diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index a12d9f5140a..794a3618820 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -798,7 +798,7 @@ impl<T> RootedTraceableBox<Heap<T>> T: GCMethods + Copy, { pub fn handle(&self) -> Handle<T> { - unsafe { (*self.ptr).handle() } + unsafe { Handle::from_raw((*self.ptr).handle()) } } } diff --git a/components/script/dom/customelementregistry.rs b/components/script/dom/customelementregistry.rs index 98fc1eae5bd..b4a07750f7a 100644 --- a/components/script/dom/customelementregistry.rs +++ b/components/script/dom/customelementregistry.rs @@ -32,7 +32,7 @@ use js::glue::UnwrapObject; use js::jsapi::{Heap, IsCallable, IsConstructor, HandleValueArray}; use js::jsapi::{JSAutoCompartment, JSContext, JSObject}; use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue}; -use js::rust::{HandleObject, MutableHandleValue}; +use js::rust::{HandleObject, HandleValue, MutableHandleValue}; use js::rust::wrappers::{JS_GetProperty, Construct1, JS_SameValue}; use microtask::Microtask; use script_thread::ScriptThread; @@ -612,7 +612,7 @@ impl CustomElementReaction { CustomElementReaction::Upgrade(ref definition) => upgrade_element(definition.clone(), element), CustomElementReaction::Callback(ref callback, ref arguments) => { // We're rooted, so it's safe to hand out a handle to objects in Heap - let arguments = arguments.iter().map(|arg| unsafe { arg.handle() }).collect(); + let arguments = arguments.iter().map(|arg| unsafe { HandleValue::from_raw(arg.handle()) }).collect(); let _ = callback.Call_(&*element, arguments, ExceptionHandling::Report); } } diff --git a/components/script/dom/history.rs b/components/script/dom/history.rs index 51f9a42c06c..1f3b652b0e9 100644 --- a/components/script/dom/history.rs +++ b/components/script/dom/history.rs @@ -120,7 +120,7 @@ impl History { PopStateEvent::dispatch_jsval( self.window.upcast::<EventTarget>(), &*self.window, - unsafe { self.state.handle() } + unsafe { HandleValue::from_raw(self.state.handle()) } ); } diff --git a/components/script/dom/promise.rs b/components/script/dom/promise.rs index c96f9fd2baf..1a4300a2b45 100644 --- a/components/script/dom/promise.rs +++ b/components/script/dom/promise.rs @@ -258,8 +258,10 @@ unsafe extern fn native_handler_callback(cx: *mut JSContext, argc: u32, vp: *mut rooted!(in(cx) let v = *GetFunctionNativeReserved(args.callee(), SLOT_NATIVEHANDLER_TASK)); match v.to_int32() { - v if v == NativeHandlerTask::Resolve as i32 => handler.resolved_callback(cx, args.get(0)), - v if v == NativeHandlerTask::Reject as i32 => handler.rejected_callback(cx, args.get(0)), + v if v == NativeHandlerTask::Resolve as i32 => + handler.resolved_callback(cx, HandleValue::from_raw(args.get(0))), + v if v == NativeHandlerTask::Reject as i32 => + handler.rejected_callback(cx, HandleValue::from_raw(args.get(0))), _ => panic!("unexpected native handler task value"), }; diff --git a/components/script/timers.rs b/components/script/timers.rs index 202a8edc8ae..2bcf2b478e9 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -522,6 +522,6 @@ impl JsTimerTask { // always done via rooted JsTimers, which is safe. #[allow(unsafe_code)] fn collect_heap_args<'b>(&self, args: &'b [Heap<JSVal>]) -> Vec<HandleValue<'b>> { - args.iter().map(|arg| unsafe { arg.handle() }).collect() + args.iter().map(|arg| unsafe { HandleValue::from_raw(arg.handle()) }).collect() } } |