aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/js.rs')
-rw-r--r--components/script/dom/bindings/js.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index 1fd127b3b28..fc881fee3b7 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -444,6 +444,14 @@ impl<T: Reflectable> LayoutJS<T> {
debug_assert!(thread_state::get().is_layout());
*self.ptr
}
+
+ /// Returns a reference to the interior of this JS object. This method is
+ /// safe to call because it originates from the layout thread, and it cannot
+ /// mutate DOM nodes.
+ pub fn get_for_script(&self) -> &T {
+ debug_assert!(thread_state::get().is_script());
+ unsafe { &**self.ptr }
+ }
}
/// Get an `&T` out of a `Rc<T>`