mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Create a helper API for entering a DOM object's compartment
Revert some unnecessary changes Fix fmt errors
This commit is contained in:
parent
84786add22
commit
adb402487e
14 changed files with 45 additions and 50 deletions
|
@ -2,6 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::compartments::enter_realm;
|
||||
use crate::dom::abstractworker::SimpleWorkerErrorHandler;
|
||||
use crate::dom::abstractworker::WorkerScriptMsg;
|
||||
use crate::dom::bindings::codegen::Bindings::WorkerBinding;
|
||||
|
@ -25,7 +26,7 @@ use crossbeam_channel::{unbounded, Sender};
|
|||
use devtools_traits::{DevtoolsPageInfo, ScriptToDevtoolsControlMsg};
|
||||
use dom_struct::dom_struct;
|
||||
use ipc_channel::ipc;
|
||||
use js::jsapi::{JSAutoRealm, JSContext, JS_RequestInterruptCallback};
|
||||
use js::jsapi::{JSContext, JS_RequestInterruptCallback};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::HandleValue;
|
||||
use script_traits::WorkerScriptLoadOrigin;
|
||||
|
@ -144,7 +145,7 @@ impl Worker {
|
|||
|
||||
let global = worker.global();
|
||||
let target = worker.upcast();
|
||||
let _ac = JSAutoRealm::new(global.get_cx(), target.reflector().get_jsobject().get());
|
||||
let _ac = enter_realm(target);
|
||||
rooted!(in(global.get_cx()) let mut message = UndefinedValue());
|
||||
data.read(&global, message.handle_mut());
|
||||
MessageEvent::dispatch_jsval(target, &global, message.handle(), None, None);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue