mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Add a static from_rooted method to JS<T> #2309
This commit is contained in:
parent
59cef940e8
commit
7910eb1399
1 changed files with 8 additions and 0 deletions
|
@ -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> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue