diff options
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r-- | components/script/dom/globalscope.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 7e5f0407e36..29c918d28f0 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -270,6 +270,18 @@ impl GlobalScope { } unreachable!(); } + + /// `ScriptChan` to send messages to the networking task source of + /// this of this global scope. + pub fn networking_task_source(&self) -> Box<ScriptChan + Send> { + if let Some(window) = self.downcast::<Window>() { + return window.networking_task_source(); + } + if let Some(worker) = self.downcast::<WorkerGlobalScope>() { + return worker.script_chan(); + } + unreachable!(); + } } fn timestamp_in_ms(time: Timespec) -> u64 { |