aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/js.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/bindings/js.rs')
-rw-r--r--components/script/dom/bindings/js.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index 72f4c16e832..f390a6444ee 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -91,6 +91,12 @@ impl<T: Reflectable> Unrooted<T> {
}
}
+ /// Create a new unrooted value from a `Temporary<T>`.
+ #[allow(unrooted_must_root)]
+ pub fn from_temporary(ptr: Temporary<T>) -> Unrooted<T> {
+ Unrooted::from_js(ptr.inner)
+ }
+
/// Get the `Reflector` for this pointer.
pub fn reflector<'a>(&'a self) -> &'a Reflector {
unsafe {