diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 3eb911e7be3..f7208237cc1 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -514,7 +514,10 @@ impl Root { /// Obtain a safe reference to the wrapped JS owned-value that cannot outlive /// the lifetime of this root. pub fn r<'b>(&'b self) -> JSRef<'b, T> { - self.jsref.clone() + JSRef { + ptr: self.jsref.ptr, + chain: ContravariantLifetime, + } } }