mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Move the worker script evaluation into a method on WorkerGlobalScope.
This commit is contained in:
parent
11ea299105
commit
95763a87b0
2 changed files with 19 additions and 16 deletions
|
@ -10,7 +10,7 @@ use dom::bindings::codegen::Bindings::ErrorEventBinding::ErrorEventMethods;
|
|||
use dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
|
||||
use dom::bindings::codegen::InheritTypes::DedicatedWorkerGlobalScopeDerived;
|
||||
use dom::bindings::codegen::InheritTypes::{EventTargetCast, WorkerGlobalScopeCast};
|
||||
use dom::bindings::error::{ErrorResult, report_pending_exception};
|
||||
use dom::bindings::error::ErrorResult;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::js::{RootCollection, Root};
|
||||
use dom::bindings::refcounted::LiveDOMReferences;
|
||||
|
@ -176,7 +176,6 @@ impl DedicatedWorkerGlobalScope {
|
|||
};
|
||||
|
||||
let runtime = Rc::new(ScriptTask::new_rt_and_cx());
|
||||
let serialized_url = url.serialize();
|
||||
|
||||
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
|
||||
ROUTER.route_ipc_receiver_to_mpsc_sender(devtools_ipc_port, devtools_mpsc_chan);
|
||||
|
@ -190,18 +189,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
|
||||
{
|
||||
let _ar = AutoWorkerReset::new(global.r(), worker);
|
||||
|
||||
match runtime.evaluate_script(
|
||||
global.r().reflector().get_jsobject(), source, serialized_url, 1) {
|
||||
Ok(_) => (),
|
||||
Err(_) => {
|
||||
// TODO: An error needs to be dispatched to the parent.
|
||||
// https://github.com/servo/servo/issues/6422
|
||||
println!("evaluate_script failed");
|
||||
let _ar = JSAutoRequest::new(runtime.cx());
|
||||
report_pending_exception(runtime.cx(), global.r().reflector().get_jsobject().get());
|
||||
}
|
||||
}
|
||||
scope.execute_script(source);
|
||||
}
|
||||
|
||||
// Register this task as a memory reporter.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue