aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2015-09-14 17:28:23 +0200
committerMs2ger <Ms2ger@gmail.com>2015-09-16 16:29:00 +0200
commit6dab37c88c2b5aa05ba2cec7710bbfa29d23bba6 (patch)
treee6d79e69c4b4828174068e85b31bd4071d606330 /components/script/dom/bindings
parent69ed59d78fb50b2d5a7bdf9f13b42874888f1ce5 (diff)
downloadservo-6dab37c88c2b5aa05ba2cec7710bbfa29d23bba6.tar.gz
servo-6dab37c88c2b5aa05ba2cec7710bbfa29d23bba6.zip
Implement a global_object_for_reflector method.
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/global.rs5
1 files changed, 5 insertions, 0 deletions
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<T: Reflectable>(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 {