aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/components/script/dom/bindings/js.rs8
1 files changed, 8 insertions, 0 deletions
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<T: Reflectable> JS<T> {
}
}
+impl<T: Assignable<U>, U: Reflectable> JS<U> {
+ pub fn from_rooted(root: T) -> JS<U> {
+ 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<T: Reflectable> Reflectable for JS<T> {