mirror of
https://github.com/servo/servo.git
synced 2025-06-15 20:04:28 +00:00
When calling constructors, retrieve the global object from the callee rather than the JSContext.
This commit is contained in:
parent
4a6077ca4c
commit
c8bd9615f4
3 changed files with 6 additions and 11 deletions
|
@ -4805,13 +4805,8 @@ class CGClassConstructHook(CGAbstractExternMethod):
|
|||
|
||||
def generate_code(self):
|
||||
preamble = """
|
||||
//JSObject* obj = JS_GetGlobalForObject(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
|
||||
//XXXjdm Gecko obtains a GlobalObject from the global (maybe from the private value,
|
||||
// or through unwrapping a slot or something). We'll punt and get the Window
|
||||
// from the context for now.
|
||||
let page = page_from_context(cx);
|
||||
let frame = (*page).frame();
|
||||
let global = frame.get().get_ref().window.clone();
|
||||
let window = global_object_for_js_object(RUST_JSVAL_TO_OBJECT(JS_CALLEE(cx, &*vp)));
|
||||
let global = JS::from_box(window);
|
||||
let obj = global.reflector().get_jsobject();
|
||||
"""
|
||||
nativeName = MakeNativeName(self._ctor.identifier.name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue