mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Implement Reflectable for GlobalRef.
This commit is contained in:
parent
8653450b6e
commit
61fcc72d35
2 changed files with 10 additions and 8 deletions
|
@ -16,6 +16,7 @@ use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstrin
|
|||
use dom::bindings::global::GlobalRef;
|
||||
use dom::bindings::inheritance::Castable;
|
||||
use dom::bindings::js::Root;
|
||||
use dom::bindings::reflector::Reflectable;
|
||||
use dom::bindings::str::DOMString;
|
||||
use dom::browsingcontext::BrowsingContext;
|
||||
use dom::element::Element;
|
||||
|
|
|
@ -271,14 +271,6 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the receiver's reflector.
|
||||
pub fn reflector(&self) -> &Reflector {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.reflector(),
|
||||
GlobalRef::Worker(ref worker) => worker.reflector(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns a wrapper for runnables to ensure they are cancelled if the global
|
||||
/// is being destroyed.
|
||||
pub fn get_runnable_wrapper(&self) -> RunnableWrapper {
|
||||
|
@ -297,6 +289,15 @@ impl<'a> GlobalRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Reflectable for GlobalRef<'a> {
|
||||
fn reflector(&self) -> &Reflector {
|
||||
match *self {
|
||||
GlobalRef::Window(ref window) => window.reflector(),
|
||||
GlobalRef::Worker(ref worker) => worker.reflector(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl GlobalRoot {
|
||||
/// Obtain a safe reference to the global object that cannot outlive the
|
||||
/// lifetime of this root.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue