diff options
author | Edit Balint <edbalint@inf.u-szeged.hu> | 2014-06-02 15:48:19 +0200 |
---|---|---|
committer | Edit Balint <edbalint@inf.u-szeged.hu> | 2014-06-02 15:48:19 +0200 |
commit | 7910eb13997ef1e8fc9ef27c9b0795c30fe6924a (patch) | |
tree | 5c64de809e7bf7d30c5837afdc6e0e58b034fc40 /src/components/script/dom/bindings/js.rs | |
parent | 59cef940e899a900b4601dbbc9b4d4bd96a96687 (diff) | |
download | servo-7910eb13997ef1e8fc9ef27c9b0795c30fe6924a.tar.gz servo-7910eb13997ef1e8fc9ef27c9b0795c30fe6924a.zip |
Add a static from_rooted method to JS<T> #2309
Diffstat (limited to 'src/components/script/dom/bindings/js.rs')
-rw-r--r-- | src/components/script/dom/bindings/js.rs | 8 |
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> { |