From 7910eb13997ef1e8fc9ef27c9b0795c30fe6924a Mon Sep 17 00:00:00 2001 From: Edit Balint Date: Mon, 2 Jun 2014 15:48:19 +0200 Subject: [PATCH] Add a static from_rooted method to JS #2309 --- src/components/script/dom/bindings/js.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/script/dom/bindings/js.rs b/src/components/script/dom/bindings/js.rs index 805adcf1ff3..89898a35ba0 100644 --- a/src/components/script/dom/bindings/js.rs +++ b/src/components/script/dom/bindings/js.rs @@ -166,6 +166,14 @@ impl JS { } } +impl, U: Reflectable> JS { + pub fn from_rooted(root: T) -> JS { + unsafe { + root.get_js() + } + } +} + //XXXjdm This is disappointing. This only gets called from trace hooks, in theory, // so it's safe to assume that self is rooted and thereby safe to access. impl Reflectable for JS {