aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/global.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/global.rs')
-rw-r--r--components/script/dom/bindings/global.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index 85dd955628b..5335db1d928 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -17,7 +17,7 @@ use dom::window::{self, WindowHelpers};
use devtools_traits::DevtoolsControlChan;
use script_task::{ScriptChan, ScriptPort, ScriptMsg, ScriptTask};
-use msg::constellation_msg::{PipelineId, WorkerId};
+use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use net_traits::ResourceTask;
use profile_traits::mem;
@@ -91,6 +91,14 @@ impl<'a> GlobalRef<'a> {
}
}
+ /// Get a `ConstellationChan` to send messages to the constellation channel when available.
+ pub fn constellation_chan(&self) -> ConstellationChan {
+ match *self {
+ GlobalRef::Window(window) => window.constellation_chan(),
+ GlobalRef::Worker(worker) => worker.constellation_chan(),
+ }
+ }
+
/// Get a `DevtoolsControlChan` to send messages to Devtools
/// task when available.
pub fn devtools_chan(&self) -> Option<DevtoolsControlChan> {