diff options
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r-- | components/script/dom/globalscope.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 759216df27a..08e7b2d3d62 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -56,6 +56,7 @@ use task_source::TaskSourceName; use task_source::file_reading::FileReadingTaskSource; use task_source::networking::NetworkingTaskSource; use task_source::performance_timeline::PerformanceTimelineTaskSource; +use task_source::remote_event::RemoteEventTaskSource; use time::{Timespec, get_time}; use timers::{IsInterval, OneshotTimerCallback, OneshotTimerHandle}; use timers::{OneshotTimers, TimerCallback}; @@ -390,7 +391,7 @@ impl GlobalScope { } /// `ScriptChan` to send messages to the networking task source of - /// this of this global scope. + /// this global scope. pub fn networking_task_source(&self) -> NetworkingTaskSource { if let Some(window) = self.downcast::<Window>() { return window.networking_task_source(); @@ -401,6 +402,18 @@ impl GlobalScope { unreachable!(); } + /// `ScriptChan` to send messages to the remote-event task source of + /// this global scope. + pub fn remote_event_task_source(&self) -> RemoteEventTaskSource { + if let Some(window) = self.downcast::<Window>() { + return window.remote_event_task_source(); + } + if let Some(worker) = self.downcast::<WorkerGlobalScope>() { + return worker.remote_event_task_source(); + } + unreachable!(); + } + /// Evaluate JS code on this global scope. pub fn evaluate_js_on_global_with_result( &self, code: &str, rval: MutableHandleValue) -> bool { |