auto merge of #1915 : Ms2ger/servo/wrap-return-js, r=jdm

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:
bors-servo 2014-03-19 19:01:48 -04:00
commit 7f188500a1
6 changed files with 30 additions and 43 deletions

View file

@ -424,7 +424,7 @@ pub trait Reflectable {
pub fn reflect_dom_object<T: Reflectable>
(obj: ~T,
window: &JS<window::Window>,
wrap_fn: extern "Rust" fn(*JSContext, &JS<window::Window>, ~T) -> *JSObject)
wrap_fn: extern "Rust" fn(*JSContext, &JS<window::Window>, ~T) -> JS<T>)
-> JS<T> {
JS::new(obj, window, wrap_fn)
}