mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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:
commit
7f188500a1
6 changed files with 30 additions and 43 deletions
|
@ -40,7 +40,7 @@ use servo_util::str::DOMString;
|
|||
|
||||
use collections::hashmap::HashMap;
|
||||
use extra::url::{Url, from_str};
|
||||
use js::jsapi::{JSObject, JSContext};
|
||||
use js::jsapi::JSContext;
|
||||
use std::ascii::StrAsciiExt;
|
||||
|
||||
use serialize::{Encoder, Encodable};
|
||||
|
@ -87,7 +87,7 @@ impl Document {
|
|||
pub fn reflect_document<D: Reflectable+DocumentBase>
|
||||
(document: ~D,
|
||||
window: &JS<Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JS<Window>, ~D) -> *JSObject)
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JS<Window>, ~D) -> JS<D>)
|
||||
-> JS<D> {
|
||||
assert!(document.reflector().get_jsobject().is_null());
|
||||
let raw_doc = reflect_dom_object(document, window, wrap_fn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue