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, 10 insertions, 0 deletions
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index 0b65fabfec0..94a9fdf0cd4 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -7,6 +7,8 @@
//! This module contains smart pointers to global scopes, to simplify writing
//! code that works in workers as well as window scopes.
+#[deny(missing_docs)]
+
use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::js::{JS, JSRef, Root};
use dom::bindings::utils::{Reflectable, Reflector};
@@ -28,13 +30,17 @@ use std::ptr;
/// A freely-copyable reference to a rooted global object.
#[deriving(Copy)]
pub enum GlobalRef<'a> {
+ /// A reference to a `Window` object.
Window(JSRef<'a, window::Window>),
+ /// A reference to a `WorkerGlobalScope` object.
Worker(JSRef<'a, WorkerGlobalScope>),
}
/// A stack-based rooted reference to a global object.
pub enum GlobalRoot {
+ /// A root for a `Window` object.
Window(Root<window::Window>),
+ /// A root for a `WorkerGlobalScope` object.
Worker(Root<WorkerGlobalScope>),
}
@@ -43,7 +49,9 @@ pub enum GlobalRoot {
#[jstraceable]
#[must_root]
pub enum GlobalField {
+ /// A field for a `Window` object.
Window(JS<window::Window>),
+ /// A field for a `WorkerGlobalScope` object.
Worker(JS<WorkerGlobalScope>),
}
@@ -66,6 +74,7 @@ impl<'a> GlobalRef<'a> {
}
}
+ /// Get the `ResourceTask` for this global scope.
pub fn resource_task(&self) -> ResourceTask {
match *self {
GlobalRef::Window(ref window) => window.page().resource_task.clone(),
@@ -73,6 +82,7 @@ impl<'a> GlobalRef<'a> {
}
}
+ /// Get the URL for this global scope.
pub fn get_url(&self) -> Url {
match *self {
GlobalRef::Window(ref window) => window.get_url(),