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.rs21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs
index 8c33333e3cf..38fafe757a1 100644
--- a/src/components/script/dom/bindings/js.rs
+++ b/src/components/script/dom/bindings/js.rs
@@ -49,7 +49,6 @@ use script_task::StackRoots;
use std::cast;
use std::cell::RefCell;
use std::kinds::marker::ContravariantLifetime;
-use std::local_data;
/// A type that represents a JS-owned value that is rooted for the lifetime of this value.
/// Importantly, it requires explicit rooting in order to interact with the inner value.
@@ -94,12 +93,10 @@ impl<T: Reflectable> Temporary<T> {
/// Create a stack-bounded root for this value.
pub fn root<'a, 'b>(self) -> Root<'a, 'b, T> {
- local_data::get(StackRoots, |opt| {
- let collection = opt.unwrap();
- unsafe {
- (**collection).new_root(&self.inner)
- }
- })
+ let collection = StackRoots.get().unwrap();
+ unsafe {
+ (**collection).new_root(&self.inner)
+ }
}
unsafe fn inner(&self) -> JS<T> {
@@ -162,12 +159,10 @@ impl<T: Reflectable> JS<T> {
/// Root this JS-owned value to prevent its collection as garbage.
pub fn root<'a, 'b>(&self) -> Root<'a, 'b, T> {
- local_data::get(StackRoots, |opt| {
- let collection = opt.unwrap();
- unsafe {
- (**collection).new_root(self)
- }
- })
+ let collection = StackRoots.get().unwrap();
+ unsafe {
+ (**collection).new_root(self)
+ }
}
}