mirror of
https://github.com/servo/servo.git
synced 2025-07-23 23:33:43 +01:00
GetPerInterfaceObject methods now takes a SafeJSContext instead of a JSContext
as first argument.
This commit is contained in:
parent
0a5a9bc7bc
commit
aa0e4f5c76
2 changed files with 11 additions and 10 deletions
|
@ -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>());
|
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
||||||
let _ac = JSAutoRealm::new(*cx, scope.get());
|
let _ac = JSAutoRealm::new(*cx, scope.get());
|
||||||
GetProtoObject(*cx, scope, proto.handle_mut());
|
GetProtoObject(cx, scope, proto.handle_mut());
|
||||||
assert!(!proto.is_null());
|
assert!(!proto.is_null());
|
||||||
|
|
||||||
%(createObject)s
|
%(createObject)s
|
||||||
|
@ -2782,7 +2782,7 @@ assert!(!obj.is_null());
|
||||||
|
|
||||||
let _ac = JSAutoRealm::new(*cx, obj.get());
|
let _ac = JSAutoRealm::new(*cx, obj.get());
|
||||||
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
|
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()));
|
assert!(JS_SplicePrototype(*cx, obj.handle(), proto.handle()));
|
||||||
let mut immutable = false;
|
let mut immutable = false;
|
||||||
assert!(JS_SetImmutablePrototype(*cx, obj.handle(), &mut immutable));
|
assert!(JS_SetImmutablePrototype(*cx, obj.handle(), &mut immutable));
|
||||||
|
@ -2942,7 +2942,7 @@ assert!((*cache)[PrototypeList::Constructor::%(id)s as usize].is_null());
|
||||||
protoGetter = "GetRealmObjectPrototype"
|
protoGetter = "GetRealmObjectPrototype"
|
||||||
getPrototypeProto = "prototype_proto.set(%s(*cx))" % protoGetter
|
getPrototypeProto = "prototype_proto.set(%s(*cx))" % protoGetter
|
||||||
else:
|
else:
|
||||||
getPrototypeProto = ("%s::GetProtoObject(*cx, global, prototype_proto.handle_mut())" %
|
getPrototypeProto = ("%s::GetProtoObject(cx, global, prototype_proto.handle_mut())" %
|
||||||
toBindingNamespace(parentName))
|
toBindingNamespace(parentName))
|
||||||
|
|
||||||
code = [CGGeneric("""\
|
code = [CGGeneric("""\
|
||||||
|
@ -3003,7 +3003,7 @@ assert!((*cache)[PrototypeList::ID::%(id)s as usize].is_null());
|
||||||
if parentName:
|
if parentName:
|
||||||
parentName = toBindingNamespace(parentName)
|
parentName = toBindingNamespace(parentName)
|
||||||
code.append(CGGeneric("""
|
code.append(CGGeneric("""
|
||||||
%s::GetConstructorObject(*cx, global, interface_proto.handle_mut());""" % parentName))
|
%s::GetConstructorObject(cx, global, interface_proto.handle_mut());""" % parentName))
|
||||||
else:
|
else:
|
||||||
code.append(CGGeneric("interface_proto.set(GetRealmFunctionPrototype(*cx));"))
|
code.append(CGGeneric("interface_proto.set(GetRealmFunctionPrototype(*cx));"))
|
||||||
code.append(CGGeneric("""\
|
code.append(CGGeneric("""\
|
||||||
|
@ -3131,7 +3131,7 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
|
||||||
constructor object).
|
constructor object).
|
||||||
"""
|
"""
|
||||||
def __init__(self, descriptor, name, idPrefix="", pub=False):
|
def __init__(self, descriptor, name, idPrefix="", pub=False):
|
||||||
args = [Argument('*mut JSContext', 'cx'),
|
args = [Argument('SafeJSContext', 'cx'),
|
||||||
Argument('HandleObject', 'global'),
|
Argument('HandleObject', 'global'),
|
||||||
Argument('MutableHandleObject', 'mut rval')]
|
Argument('MutableHandleObject', 'mut rval')]
|
||||||
CGAbstractMethod.__init__(self, descriptor, name,
|
CGAbstractMethod.__init__(self, descriptor, name,
|
||||||
|
@ -3149,7 +3149,7 @@ if !rval.get().is_null() {
|
||||||
return;
|
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]);
|
rval.set((*proto_or_iface_array)[%(id)s as usize]);
|
||||||
assert!(!rval.get().is_null());
|
assert!(!rval.get().is_null());
|
||||||
""" % {"id": self.id})
|
""" % {"id": self.id})
|
||||||
|
@ -3290,7 +3290,7 @@ if !ConstructorEnabled(SafeJSContext::from_ptr(cx), global) {
|
||||||
}
|
}
|
||||||
|
|
||||||
rooted!(in(cx) let mut proto = ptr::null_mut::<JSObject>());
|
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,))
|
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
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=1317658
|
||||||
|
|
||||||
rooted!(in(cx) let global_object = CurrentGlobalOrNull(cx));
|
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 {
|
} else {
|
||||||
// Step 6
|
// Step 6
|
||||||
prototype.set(proto_val.to_object());
|
prototype.set(proto_val.to_object());
|
||||||
|
|
|
@ -76,6 +76,7 @@ use crate::dom::customelementregistry::{ConstructionStackEntry, CustomElementSta
|
||||||
use crate::dom::element::{Element, ElementCreator};
|
use crate::dom::element::{Element, ElementCreator};
|
||||||
use crate::dom::htmlelement::HTMLElement;
|
use crate::dom::htmlelement::HTMLElement;
|
||||||
use crate::dom::window::Window;
|
use crate::dom::window::Window;
|
||||||
|
use crate::script_runtime::JSContext as SafeJSContext;
|
||||||
use crate::script_thread::ScriptThread;
|
use crate::script_thread::ScriptThread;
|
||||||
use html5ever::interface::QualName;
|
use html5ever::interface::QualName;
|
||||||
use html5ever::LocalName;
|
use html5ever::LocalName;
|
||||||
|
@ -125,7 +126,7 @@ where
|
||||||
|
|
||||||
// Retrieve the constructor object for HTMLElement
|
// Retrieve the constructor object for HTMLElement
|
||||||
HTMLElementBinding::GetConstructorObject(
|
HTMLElementBinding::GetConstructorObject(
|
||||||
window.get_cx(),
|
SafeJSContext::from_ptr(window.get_cx()),
|
||||||
global_object.handle(),
|
global_object.handle(),
|
||||||
constructor.handle_mut(),
|
constructor.handle_mut(),
|
||||||
);
|
);
|
||||||
|
@ -201,7 +202,7 @@ pub fn get_constructor_object_from_local_name(
|
||||||
) -> bool {
|
) -> bool {
|
||||||
macro_rules! get_constructor(
|
macro_rules! get_constructor(
|
||||||
($binding:ident) => ({
|
($binding:ident) => ({
|
||||||
unsafe { $binding::GetConstructorObject(cx, global, rval); }
|
unsafe { $binding::GetConstructorObject(SafeJSContext::from_ptr(cx), global, rval); }
|
||||||
true
|
true
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue