aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/bindings/js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/script/dom/bindings/js.rs')
-rw-r--r--src/components/script/dom/bindings/js.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs
index aa7ba954a48..4aaf3506ae8 100644
--- a/src/components/script/dom/bindings/js.rs
+++ b/src/components/script/dom/bindings/js.rs
@@ -89,6 +89,13 @@ impl<T> JS<T> {
&mut (**borrowed.get())
}
}
+
+ /// Returns an unsafe pointer to the interior of this JS object without touching the borrow
+ /// flags. This is the only method that be safely accessed from layout. (The fact that this
+ /// is unsafe is what necessitates the layout wrappers.)
+ pub unsafe fn unsafe_get(&self) -> *mut T {
+ cast::transmute_copy(&self.ptr)
+ }
}
impl<From, To> JS<From> {
@@ -96,4 +103,8 @@ impl<From, To> JS<From> {
pub unsafe fn transmute(self) -> JS<To> {
cast::transmute(self)
}
+
+ pub unsafe fn transmute_copy(&self) -> JS<To> {
+ cast::transmute_copy(self)
+ }
}