ConstructorEnabled now takes a SafeJSContext instead of a JSContext

a first argument. The function cannot be made safe because of call
to unsafe function is_exposed_in.
This commit is contained in:
marmeladema 2019-07-20 15:34:26 +01:00
parent dbcd8d7af2
commit cd0eb88a3e

View file

@ -2586,7 +2586,7 @@ class CGConstructorEnabled(CGAbstractMethod):
def __init__(self, descriptor): def __init__(self, descriptor):
CGAbstractMethod.__init__(self, descriptor, CGAbstractMethod.__init__(self, descriptor,
'ConstructorEnabled', 'bool', 'ConstructorEnabled', 'bool',
[Argument("*mut JSContext", "aCx"), [Argument("SafeJSContext", "aCx"),
Argument("HandleObject", "aObj")], Argument("HandleObject", "aObj")],
unsafe=True) unsafe=True)
@ -3285,7 +3285,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
return CGGeneric("""\ return CGGeneric("""\
assert!(!global.get().is_null()); assert!(!global.get().is_null());
if !ConstructorEnabled(cx, global) { if !ConstructorEnabled(SafeJSContext::from_ptr(cx), global) {
return; return;
} }
@ -6006,6 +6006,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'crate::mem::malloc_size_of_including_raw_self', 'crate::mem::malloc_size_of_including_raw_self',
'crate::compartments::InCompartment', 'crate::compartments::InCompartment',
'crate::compartments::AlreadyInCompartment', 'crate::compartments::AlreadyInCompartment',
'crate::script_runtime::JSContext as SafeJSContext',
'libc', 'libc',
'servo_config::pref', 'servo_config::pref',
'servo_config::prefs', 'servo_config::prefs',