mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Add global default method for Reflectable trait
This commit is contained in:
parent
2703568227
commit
ce6075825d
17 changed files with 88 additions and 83 deletions
|
@ -4,7 +4,7 @@
|
|||
|
||||
//! The `Reflector` struct.
|
||||
|
||||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::global::{GlobalRef, GlobalRoot, global_root_from_reflector};
|
||||
use dom::bindings::js::Root;
|
||||
use js::jsapi::{HandleObject, JSContext, JSObject};
|
||||
use std::cell::UnsafeCell;
|
||||
|
@ -75,4 +75,9 @@ pub trait Reflectable {
|
|||
fn reflector(&self) -> &Reflector;
|
||||
/// Initializes the Reflector
|
||||
fn init_reflector(&mut self, obj: *mut JSObject);
|
||||
|
||||
/// 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