mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Return a JS<T> from *Binding::Wrap rather than a JSObject.
This lets us avoid the sketchy tricks in JS::new and Window::new, where we kept an unsafe pointer to the native object across the Wrap call that consumed the owned pointer.
This commit is contained in:
parent
71f4fd0478
commit
4ad3b6ccd1
6 changed files with 30 additions and 43 deletions
|
@ -766,7 +766,7 @@ impl Node {
|
|||
pub fn reflect_node<N: Reflectable+NodeBase>
|
||||
(node: ~N,
|
||||
document: &JS<Document>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JS<Window>, ~N) -> *JSObject)
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JS<Window>, ~N) -> JS<N>)
|
||||
-> JS<N> {
|
||||
assert!(node.reflector().get_jsobject().is_null());
|
||||
let node = reflect_dom_object(node, &document.get().window, wrap_fn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue