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 {