mirror of
https://github.com/servo/servo.git
synced 2025-10-05 19:19:25 +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,8 +616,16 @@ impl ScriptTask {
|
|||
ptr.is_not_null()
|
||||
});
|
||||
unsafe {
|
||||
// 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(),
|
||||
wrap_for_same_compartment,
|
||||
ptr::null());
|
||||
JS_SetWrapObjectCallbacks((*js_runtime).ptr,
|
||||
ptr::null(),
|
||||
callback,
|
||||
wrap_for_same_compartment,
|
||||
ptr::null());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue