diff --git a/components/script/dom/serviceworkerregistration.rs b/components/script/dom/serviceworkerregistration.rs index 87226207266..e274e5a6e51 100644 --- a/components/script/dom/serviceworkerregistration.rs +++ b/components/script/dom/serviceworkerregistration.rs @@ -60,7 +60,7 @@ impl ServiceWorkerRegistration { let worker_id = global_scope.get_next_worker_id(); let devtools_chan = global_scope.devtools_chan().cloned(); - let init = prepare_workerscope_init(global, None); + let init = prepare_workerscope_init(global_scope, None); ScopeThings { script_url: script_url, init: init, diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index 9e590b0f7da..1ef6242720d 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -105,7 +105,7 @@ impl Worker { page_info)); } - let init = prepare_workerscope_init(global, Some(devtools_sender)); + let init = prepare_workerscope_init(global_scope, Some(devtools_sender)); DedicatedWorkerGlobalScope::run_worker_scope( init, worker_url, devtools_receiver, worker.runtime.clone(), worker_ref, diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs index 59478818cfa..93361d8e620 100644 --- a/components/script/dom/workerglobalscope.rs +++ b/components/script/dom/workerglobalscope.rs @@ -46,27 +46,18 @@ use task_source::file_reading::FileReadingTaskSource; use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle, OneshotTimers, TimerCallback}; use url::Url; -pub fn prepare_workerscope_init(global: GlobalRef, +pub fn prepare_workerscope_init(global: &GlobalScope, devtools_sender: Option>) -> WorkerGlobalScopeInit { - let global_scope = global.as_global_scope(); - let worker_id = global_scope.get_next_worker_id(); - let to_devtools_sender = global_scope.devtools_chan().cloned(); - let mem_profiler_chan = global_scope.mem_profiler_chan().clone(); - let time_profiler_chan = global_scope.time_profiler_chan().clone(); - let constellation_chan = global_scope.constellation_chan().clone(); - let scheduler_chan = global_scope.scheduler_chan().clone(); - let pipeline_id = global_scope.pipeline_id(); - let resource_threads = global_scope.resource_threads().clone(); let init = WorkerGlobalScopeInit { - resource_threads: resource_threads, - mem_profiler_chan: mem_profiler_chan, - to_devtools_sender: to_devtools_sender, - time_profiler_chan: time_profiler_chan, + resource_threads: global.resource_threads().clone(), + mem_profiler_chan: global.mem_profiler_chan().clone(), + to_devtools_sender: global.devtools_chan().cloned(), + time_profiler_chan: global.time_profiler_chan().clone(), from_devtools_sender: devtools_sender, - constellation_chan: constellation_chan, - scheduler_chan: scheduler_chan, - worker_id: worker_id, - pipeline_id: pipeline_id, + constellation_chan: global.constellation_chan().clone(), + scheduler_chan: global.scheduler_chan().clone(), + worker_id: global.get_next_worker_id(), + pipeline_id: global.pipeline_id(), }; init