diff options
Diffstat (limited to 'components/script/dom/bindings/reflector.rs')
-rw-r--r-- | components/script/dom/bindings/reflector.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index 74c039688f7..bb48cee0b1a 100644 --- a/components/script/dom/bindings/reflector.rs +++ b/components/script/dom/bindings/reflector.rs @@ -5,7 +5,7 @@ //! The `Reflector` struct. use dom::bindings::conversions::DerivedFrom; -use dom::bindings::global::{GlobalRoot, global_root_from_reflector}; +use dom::bindings::global::{GlobalRoot, global_root_from_reflector, global_scope_from_reflector}; use dom::bindings::js::Root; use dom::globalscope::GlobalScope; use js::jsapi::{HandleObject, JSContext, JSObject}; @@ -80,6 +80,11 @@ pub trait Reflectable { /// Returns the receiver's reflector. fn reflector(&self) -> &Reflector; + /// Returns the global scope of the realm that the Reflectable was created in. + fn global_scope(&self) -> Root<GlobalScope> where Self: Sized { + global_scope_from_reflector(self) + } + /// Returns the global object of the realm that the Reflectable was created in. fn global(&self) -> GlobalRoot where Self: Sized { global_root_from_reflector(self) |