diff options
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 16 | ||||
-rw-r--r-- | components/script/dom/bindings/htmlconstructor.rs | 5 |
2 files changed, 11 insertions, 10 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 12f6b61a533..e656a7ab3ce 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2726,7 +2726,7 @@ assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0); rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>()); let _ac = JSAutoRealm::new(*cx, scope.get()); -GetProtoObject(*cx, scope, proto.handle_mut()); +GetProtoObject(cx, scope, proto.handle_mut()); assert!(!proto.is_null()); %(createObject)s @@ -2782,7 +2782,7 @@ assert!(!obj.is_null()); let _ac = JSAutoRealm::new(*cx, obj.get()); rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>()); -GetProtoObject(*cx, obj.handle(), proto.handle_mut()); +GetProtoObject(cx, obj.handle(), proto.handle_mut()); assert!(JS_SplicePrototype(*cx, obj.handle(), proto.handle())); let mut immutable = false; assert!(JS_SetImmutablePrototype(*cx, obj.handle(), &mut immutable)); @@ -2942,7 +2942,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null()); protoGetter = "GetRealmObjectPrototype" getPrototypeProto = "prototype_proto.set(%s(*cx))" % protoGetter else: - getPrototypeProto = ("%s::GetProtoObject(*cx, global, prototype_proto.handle_mut())" % + getPrototypeProto = ("%s::GetProtoObject(cx, global, prototype_proto.handle_mut())" % toBindingNamespace(parentName)) code = [CGGeneric("""\ @@ -3003,7 +3003,7 @@ assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null()); if parentName: parentName = toBindingNamespace(parentName) code.append(CGGeneric(""" -%s::GetConstructorObject(*cx, global, interface_proto.handle_mut());""" % parentName)) +%s::GetConstructorObject(cx, global, interface_proto.handle_mut());""" % parentName)) else: code.append(CGGeneric("interface_proto.set(GetRealmFunctionPrototype(*cx));")) code.append(CGGeneric("""\ @@ -3131,7 +3131,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod): constructor object). """ def __init__(self, descriptor, name, idPrefix="", pub=False): - args = [Argument('*mut JSContext', 'cx'), + args = [Argument('SafeJSContext', 'cx'), Argument('HandleObject', 'global'), Argument('MutableHandleObject', 'mut rval')] CGAbstractMethod.__init__(self, descriptor, name, @@ -3149,7 +3149,7 @@ if !rval.get().is_null() { return; } -CreateInterfaceObjects(SafeJSContext::from_ptr(cx), global, proto_or_iface_array); +CreateInterfaceObjects(cx, global, proto_or_iface_array); rval.set((*proto_or_iface_array)[%(id)s as usize]); assert!(!rval.get().is_null()); """ % {"id": self.id}) @@ -3290,7 +3290,7 @@ if !ConstructorEnabled(SafeJSContext::from_ptr(cx), global) { } rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>()); -%s(cx, global, proto.handle_mut()); +%s(SafeJSContext::from_ptr(cx), global, proto.handle_mut()); assert!(!proto.is_null());""" % (function,)) @@ -5574,7 +5574,7 @@ rooted!(in(cx) let mut prototype = ptr::null_mut::<JSObject>()); // https://bugzilla.mozilla.org/show_bug.cgi?id=1317658 rooted!(in(cx) let global_object = CurrentGlobalOrNull(cx)); - GetProtoObject(cx, global_object.handle(), prototype.handle_mut()); + GetProtoObject(SafeJSContext::from_ptr(cx), global_object.handle(), prototype.handle_mut()); } else { // Step 6 prototype.set(proto_val.to_object()); diff --git a/components/script/dom/bindings/htmlconstructor.rs b/components/script/dom/bindings/htmlconstructor.rs index 7e122ef6e29..f976a09ee91 100644 --- a/components/script/dom/bindings/htmlconstructor.rs +++ b/components/script/dom/bindings/htmlconstructor.rs @@ -76,6 +76,7 @@ use crate::dom::customelementregistry::{ConstructionStackEntry, CustomElementSta use crate::dom::element::{Element, ElementCreator}; use crate::dom::htmlelement::HTMLElement; use crate::dom::window::Window; +use crate::script_runtime::JSContext as SafeJSContext; use crate::script_thread::ScriptThread; use html5ever::interface::QualName; use html5ever::LocalName; @@ -125,7 +126,7 @@ where // Retrieve the constructor object for HTMLElement HTMLElementBinding::GetConstructorObject( - window.get_cx(), + SafeJSContext::from_ptr(window.get_cx()), global_object.handle(), constructor.handle_mut(), ); @@ -201,7 +202,7 @@ pub fn get_constructor_object_from_local_name( ) -> bool { macro_rules! get_constructor( ($binding:ident) => ({ - unsafe { $binding::GetConstructorObject(cx, global, rval); } + unsafe { $binding::GetConstructorObject(SafeJSContext::from_ptr(cx), global, rval); } true }) ); |