From 6dab37c88c2b5aa05ba2cec7710bbfa29d23bba6 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Mon, 14 Sep 2015 17:28:23 +0200 Subject: [PATCH] Implement a global_object_for_reflector method. --- components/script/dom/bindings/global.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index ae68290166c..3ff081521cc 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -229,6 +229,11 @@ impl GlobalField { } } +/// Returns the global object of the realm that the given DOM object's reflector was created in. +pub fn global_object_for_reflector(reflector: &T) -> GlobalRoot { + global_object_for_js_object(*reflector.reflector().get_jsobject()) +} + /// Returns the global object of the realm that the given JS object was created in. #[allow(unrooted_must_root)] pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalRoot {