From 26455b8a67771ff82ce70f21b131d452518e0c50 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 5 Oct 2016 01:01:22 +0200 Subject: [PATCH] Remove global_root_from_reflector --- components/script/dom/bindings/callback.rs | 6 +++--- components/script/dom/bindings/codegen/CodegenRust.py | 1 - components/script/dom/bindings/global.rs | 5 ----- components/script/dom/bindings/reflector.rs | 4 ++-- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 7e6bb3534fb..c9fb9fd8a53 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -5,7 +5,7 @@ //! Base classes to work with IDL callbacks. use dom::bindings::error::{Error, Fallible, report_pending_exception}; -use dom::bindings::global::global_root_from_object; +use dom::bindings::global::global_scope_from_object; use dom::bindings::reflector::Reflectable; use js::jsapi::{Heap, MutableHandleObject, RootedObject}; use js::jsapi::{IsCallable, JSContext, JSObject, JS_WrapObject}; @@ -165,8 +165,8 @@ impl<'a> CallSetup<'a> { callback: &T, handling: ExceptionHandling) -> CallSetup<'a> { - let global = unsafe { global_root_from_object(callback.callback()) }; - let cx = global.r().get_cx(); + let global = unsafe { global_scope_from_object(callback.callback()) }; + let cx = global.get_cx(); exception_compartment.ptr = unsafe { GetGlobalForObjectCrossCompartment(callback.callback()) diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 8a2ea4ed2c3..e85865ed143 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -5502,7 +5502,6 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries 'dom::bindings::global::GlobalRef', 'dom::bindings::global::global_root_from_object', 'dom::bindings::global::global_root_from_object_maybe_wrapped', - 'dom::bindings::global::global_root_from_reflector', 'dom::bindings::global::global_scope_from_reflector', 'dom::bindings::interface::ConstructorClassHook', 'dom::bindings::interface::InterfaceConstructorBehavior', diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 0cbb3ec302b..2c4fa189ce6 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -111,11 +111,6 @@ pub fn global_scope_from_reflector(reflector: &T) -> Root(reflector: &T) -> GlobalRoot { - unsafe { global_root_from_object(*reflector.reflector().get_jsobject()) } -} - /// Returns the Rust global scope from a JS global object. unsafe fn global_scope_from_global(global: *mut JSObject) -> Root { assert!(!global.is_null()); diff --git a/components/script/dom/bindings/reflector.rs b/components/script/dom/bindings/reflector.rs index bb48cee0b1a..946c31ca290 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, global_scope_from_reflector}; +use dom::bindings::global::{GlobalRoot, global_root_from_object, global_scope_from_reflector}; use dom::bindings::js::Root; use dom::globalscope::GlobalScope; use js::jsapi::{HandleObject, JSContext, JSObject}; @@ -87,7 +87,7 @@ pub trait Reflectable { /// 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) + unsafe { global_root_from_object(*self.reflector().get_jsobject()) } } }