diff options
author | bors-servo <release+servo@mozilla.com> | 2014-02-27 14:31:53 -0500 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-02-27 14:31:53 -0500 |
commit | b7fb97cf5a29a018476aada14a477f8605011be2 (patch) | |
tree | 9514038ab79d8725311fded8dd767f00d3f73b76 /src/components/script/dom/bindings/js.rs | |
parent | ab72c473cde0cd69a44dc274d3ecf18207af785c (diff) | |
parent | 3c288a5b80ff53061e44101a746c2ebd2a081fb0 (diff) | |
download | servo-b7fb97cf5a29a018476aada14a477f8605011be2.tar.gz servo-b7fb97cf5a29a018476aada14a477f8605011be2.zip |
auto merge of #1772 : pcwalton/servo/borrow-flags-race, r=jdm
r? @jdm
Diffstat (limited to 'src/components/script/dom/bindings/js.rs')
-rw-r--r-- | src/components/script/dom/bindings/js.rs | 11 |
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) + } } |