mirror of
https://github.com/servo/servo.git
synced 2025-06-24 17:14:33 +01:00
Stop calling wrap_object_shared in WrapNewBindingObject and WrapNativeParent. Fixes #1083.
This commit is contained in:
parent
4910a23803
commit
c693cb185c
1 changed files with 4 additions and 19 deletions
|
@ -584,39 +584,24 @@ impl Reflector {
|
|||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
|
||||
pub fn WrapNewBindingObject(cx: *JSContext, _scope: *JSObject,
|
||||
value: @mut Reflectable,
|
||||
vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let reflector = value.mut_reflector();
|
||||
let obj = reflector.get_jsobject();
|
||||
if obj.is_not_null() /*&& js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)*/ {
|
||||
*vp = RUST_OBJECT_TO_JSVAL(obj);
|
||||
return 1; // JS_TRUE
|
||||
}
|
||||
|
||||
let obj = value.wrap_object_shared(cx, scope);
|
||||
if obj.is_null() {
|
||||
return 0; // JS_FALSE
|
||||
}
|
||||
|
||||
// MOZ_ASSERT(js::IsObjectInContextCompartment(scope, cx));
|
||||
reflector.set_jsobject(obj);
|
||||
assert!(obj.is_not_null());
|
||||
*vp = RUST_OBJECT_TO_JSVAL(obj);
|
||||
return JS_WrapValue(cx, cast::transmute(vp));
|
||||
}
|
||||
}
|
||||
|
||||
#[fixed_stack_segment]
|
||||
pub fn WrapNativeParent(cx: *JSContext, scope: *JSObject, mut p: Option<@mut Reflectable>) -> *JSObject {
|
||||
pub fn WrapNativeParent(cx: *JSContext, _scope: *JSObject, mut p: Option<@mut Reflectable>) -> *JSObject {
|
||||
match p {
|
||||
Some(ref mut p) => {
|
||||
let obj = p.reflector().get_jsobject();
|
||||
if obj.is_not_null() {
|
||||
return obj;
|
||||
}
|
||||
let obj = p.wrap_object_shared(cx, scope);
|
||||
p.mut_reflector().set_jsobject(obj);
|
||||
assert!(obj.is_not_null());
|
||||
obj
|
||||
}
|
||||
None => unsafe { JS_GetGlobalObject(cx) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue