mirror of
https://github.com/servo/servo.git
synced 2025-10-06 11:39:23 +01:00
Don't clobber the default wrapping callback.
This commit is contained in:
parent
8ea3cbf18a
commit
1fa3610e2d
1 changed files with 9 additions and 1 deletions
|
@ -616,10 +616,18 @@ impl ScriptTask {
|
||||||
ptr.is_not_null()
|
ptr.is_not_null()
|
||||||
});
|
});
|
||||||
unsafe {
|
unsafe {
|
||||||
JS_SetWrapObjectCallbacks((*js_runtime).ptr,
|
// JS_SetWrapObjectCallbacks clobbers the existing wrap callback,
|
||||||
|
// and JSCompartment::wrap crashes if that happens. The only way
|
||||||
|
// to retrieve the default callback is as the result of
|
||||||
|
// JS_SetWrapObjectCallbacks, which is why we call it twice.
|
||||||
|
let callback = JS_SetWrapObjectCallbacks((*js_runtime).ptr,
|
||||||
ptr::null(),
|
ptr::null(),
|
||||||
wrap_for_same_compartment,
|
wrap_for_same_compartment,
|
||||||
ptr::null());
|
ptr::null());
|
||||||
|
JS_SetWrapObjectCallbacks((*js_runtime).ptr,
|
||||||
|
callback,
|
||||||
|
wrap_for_same_compartment,
|
||||||
|
ptr::null());
|
||||||
}
|
}
|
||||||
|
|
||||||
let js_context = js_runtime.cx();
|
let js_context = js_runtime.cx();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue