mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Introduce Reflectable::global_scope
This commit is contained in:
parent
27f100b1d4
commit
ae6af5172b
30 changed files with 116 additions and 120 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue