mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Return a Temporary from *Binding::Wrap.
Returning a JS<T> is GC-unsafe. This commit also includes some cleanup around Node and Document reflection.
This commit is contained in:
parent
360d5d01d8
commit
439bc78cab
5 changed files with 16 additions and 28 deletions
|
@ -377,9 +377,9 @@ pub trait Reflectable {
|
|||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: Box<T>,
|
||||
window: &JSRef<window::Window>,
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &JSRef<window::Window>, Box<T>) -> JS<T>)
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &JSRef<window::Window>, Box<T>) -> Temporary<T>)
|
||||
-> Temporary<T> {
|
||||
Temporary::new(wrap_fn(window.deref().get_cx(), window, obj))
|
||||
wrap_fn(window.get_cx(), window, obj)
|
||||
}
|
||||
|
||||
#[allow(raw_pointer_deriving)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue