diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index b798d6c1e27..4f953d6bb61 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -174,10 +174,6 @@ impl Temporary { pub fn from_rooted<'a>(root: JSRef<'a, T>) -> Temporary { Temporary::new(JS::from_rooted(root)) } - - unsafe fn inner(&self) -> JS { - self.inner.clone() - } } impl Rootable for Temporary { @@ -406,7 +402,7 @@ impl JS { /// are reachable in the GC graph, so this unrooted value becomes /// transitively rooted for the lifetime of its new owner. pub fn assign(&mut self, val: Temporary) { - *self = unsafe { val.inner() }; + *self = val.inner.clone(); } } @@ -461,13 +457,15 @@ impl Assignable for JS { impl<'a, T: Reflectable> Assignable for JSRef<'a, T> { unsafe fn get_js(&self) -> JS { - self.unrooted() + JS { + ptr: self.ptr + } } } impl Assignable for Temporary { unsafe fn get_js(&self) -> JS { - self.inner() + self.inner.clone() } } @@ -484,18 +482,6 @@ impl> OptionalRootable for Option { } } -/// Return an unrooted type for storing in optional DOM fields -pub trait OptionalUnrootable { - /// Returns a `JS` for the inner value, if it exists. - fn unrooted(&self) -> Option>; -} - -impl<'a, T: Reflectable> OptionalUnrootable for Option> { - fn unrooted(&self) -> Option> { - self.as_ref().map(|inner| JS::from_rooted(*inner)) - } -} - /// Root a rootable `Option