diff options
Diffstat (limited to 'components/script/dom/bindings/js.rs')
-rw-r--r-- | components/script/dom/bindings/js.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index 970281c2977..ea4a8af2f56 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -83,6 +83,14 @@ impl<T: Reflectable> Unrooted<T> { } } + /// Create a new unrooted value from a `JS<T>`. + #[allow(unrooted_must_root)] + pub fn from_js(ptr: JS<T>) -> Unrooted<T> { + Unrooted { + ptr: ptr.ptr + } + } + /// Get the `Reflector` for this pointer. pub fn reflector<'a>(&'a self) -> &'a Reflector { unsafe { |