Implement a global_object_for_reflector method.

This commit is contained in:
Ms2ger 2015-09-14 17:28:23 +02:00
parent 69ed59d78f
commit 6dab37c88c

View file

@ -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 {