diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index bff4c66f89b..3c3df454ca1 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -130,8 +130,9 @@ impl<'a> GlobalRef<'a> { } } - /// `ScriptChan` used to send messages to the event loop of this global's - /// thread. + /// Create a new sender/receiver pair that can be used to implement an on-demand + /// event loop. Used for implementing web APIs that require blocking semantics + /// without resorting to nested event loops. pub fn new_script_pair(&self) -> (Box, Box) { match *self { GlobalRef::Window(ref window) => window.new_script_pair(), diff --git a/components/script/script_task.rs b/components/script/script_task.rs index e43ca69a981..31116307b3c 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -201,6 +201,9 @@ pub trait ScriptChan { fn clone(&self) -> Box; } +/// An interface for receiving ScriptMsg values in an event loop. Used for synchronous DOM +/// APIs that need to abstract over multiple kinds of event loops (worker/main thread) with +/// different Receiver interfaces. pub trait ScriptPort { fn recv(&self) -> ScriptMsg; }