mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Pass a JSContext and a reflector to RegisterBindings::Register.
This makes the generated code less dependent on the fact that all global objects are Windows.
This commit is contained in:
parent
2191a578c6
commit
5baff0cc2c
2 changed files with 8 additions and 8 deletions
|
@ -2098,7 +2098,8 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
def __init__(self, descriptor):
|
||||
assert descriptor.interface.hasInterfaceObject()
|
||||
args = [
|
||||
Argument('&JSRef<Window>', 'window'),
|
||||
Argument('*mut JSContext', 'cx'),
|
||||
Argument('*mut JSObject', 'global'),
|
||||
]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'DefineDOMInterface', 'void', args, pub=True)
|
||||
|
||||
|
@ -2107,8 +2108,6 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
|
||||
def definition_body(self):
|
||||
return CGGeneric("""\
|
||||
let cx = window.get_cx();
|
||||
let global = window.reflector().get_jsobject();
|
||||
assert!(global.is_not_null());
|
||||
assert!(GetProtoObject(cx, global, global).is_not_null());""")
|
||||
|
||||
|
@ -4267,7 +4266,8 @@ class CGDictionary(CGThing):
|
|||
class CGRegisterProtos(CGAbstractMethod):
|
||||
def __init__(self, config):
|
||||
arguments = [
|
||||
Argument('&JSRef<Window>', 'window'),
|
||||
Argument('*mut JSContext', 'cx'),
|
||||
Argument('*mut JSObject', 'global'),
|
||||
]
|
||||
CGAbstractMethod.__init__(self, None, 'Register', 'void', arguments,
|
||||
unsafe=False, pub=True)
|
||||
|
@ -4275,7 +4275,7 @@ class CGRegisterProtos(CGAbstractMethod):
|
|||
|
||||
def definition_body(self):
|
||||
return CGList([
|
||||
CGGeneric("codegen::Bindings::%sBinding::DefineDOMInterface(window);" % desc.name)
|
||||
CGGeneric("codegen::Bindings::%sBinding::DefineDOMInterface(cx, global);" % desc.name)
|
||||
for desc in self.config.getDescriptors(hasInterfaceObject=True, register=True)
|
||||
], "\n")
|
||||
|
||||
|
@ -5303,8 +5303,8 @@ class GlobalGenRoots():
|
|||
return CGImports(code, [], [
|
||||
'dom::bindings::codegen',
|
||||
'dom::bindings::codegen::PrototypeList::proxies',
|
||||
'dom::bindings::js::{JS, JSRef}',
|
||||
'dom::window::Window',
|
||||
'js::jsapi::JSContext',
|
||||
'js::jsapi::JSObject',
|
||||
'libc',
|
||||
])
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue