mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +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]
|
#[fixed_stack_segment]
|
||||||
pub fn WrapNewBindingObject(cx: *JSContext, scope: *JSObject,
|
pub fn WrapNewBindingObject(cx: *JSContext, _scope: *JSObject,
|
||||||
value: @mut Reflectable,
|
value: @mut Reflectable,
|
||||||
vp: *mut JSVal) -> JSBool {
|
vp: *mut JSVal) -> JSBool {
|
||||||
unsafe {
|
unsafe {
|
||||||
let reflector = value.mut_reflector();
|
let reflector = value.mut_reflector();
|
||||||
let obj = reflector.get_jsobject();
|
let obj = reflector.get_jsobject();
|
||||||
if obj.is_not_null() /*&& js::GetObjectCompartment(obj) == js::GetObjectCompartment(scope)*/ {
|
assert!(obj.is_not_null());
|
||||||
*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);
|
|
||||||
*vp = RUST_OBJECT_TO_JSVAL(obj);
|
*vp = RUST_OBJECT_TO_JSVAL(obj);
|
||||||
return JS_WrapValue(cx, cast::transmute(vp));
|
return JS_WrapValue(cx, cast::transmute(vp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[fixed_stack_segment]
|
#[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 {
|
match p {
|
||||||
Some(ref mut p) => {
|
Some(ref mut p) => {
|
||||||
let obj = p.reflector().get_jsobject();
|
let obj = p.reflector().get_jsobject();
|
||||||
if obj.is_not_null() {
|
assert!(obj.is_not_null());
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
let obj = p.wrap_object_shared(cx, scope);
|
|
||||||
p.mut_reflector().set_jsobject(obj);
|
|
||||||
obj
|
obj
|
||||||
}
|
}
|
||||||
None => unsafe { JS_GetGlobalObject(cx) }
|
None => unsafe { JS_GetGlobalObject(cx) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue