mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Switch to using the new rooted!/RootedGuard API for rooting.
This commit is contained in:
parent
a77cc9950f
commit
0db1faf876
28 changed files with 238 additions and 237 deletions
|
@ -13,7 +13,7 @@ use js::glue::InvokeGetOwnPropertyDescriptor;
|
|||
use js::glue::{GetProxyHandler, SetProxyExtra};
|
||||
use js::jsapi::GetObjectProto;
|
||||
use js::jsapi::JS_GetPropertyDescriptorById;
|
||||
use js::jsapi::{Handle, HandleId, HandleObject, MutableHandle, ObjectOpResult, RootedObject};
|
||||
use js::jsapi::{Handle, HandleId, HandleObject, MutableHandle, ObjectOpResult};
|
||||
use js::jsapi::{JSContext, JSObject, JSPROP_GETTER, PropertyDescriptor};
|
||||
use js::jsapi::{JSErrNum, JS_StrictPropertyStub};
|
||||
use js::jsapi::{JS_DefinePropertyById, JS_NewObjectWithGivenProto};
|
||||
|
@ -36,12 +36,13 @@ pub unsafe extern "C" fn get_property_descriptor(cx: *mut JSContext,
|
|||
if !InvokeGetOwnPropertyDescriptor(handler, cx, proxy, id, desc) {
|
||||
return false;
|
||||
}
|
||||
if !desc.get().obj.is_null() {
|
||||
if !desc.obj.is_null() {
|
||||
return true;
|
||||
}
|
||||
|
||||
let mut proto = RootedObject::new(cx, ptr::null_mut());
|
||||
rooted!(in(cx) let mut proto = ptr::null_mut());
|
||||
if !GetObjectProto(cx, proxy, proto.handle_mut()) {
|
||||
// FIXME(#11868) Should assign to desc.obj, desc.get() is a copy.
|
||||
desc.get().obj = ptr::null_mut();
|
||||
return true;
|
||||
}
|
||||
|
@ -65,7 +66,7 @@ pub unsafe extern "C" fn define_property(cx: *mut JSContext,
|
|||
return true;
|
||||
}
|
||||
|
||||
let expando = RootedObject::new(cx, ensure_expando_object(cx, proxy));
|
||||
rooted!(in(cx) let expando = ensure_expando_object(cx, proxy));
|
||||
JS_DefinePropertyById(cx, expando.handle(), id, desc, result)
|
||||
}
|
||||
|
||||
|
@ -75,8 +76,8 @@ pub unsafe extern "C" fn delete(cx: *mut JSContext,
|
|||
id: HandleId,
|
||||
bp: *mut ObjectOpResult)
|
||||
-> bool {
|
||||
let expando = RootedObject::new(cx, get_expando_object(proxy));
|
||||
if expando.ptr.is_null() {
|
||||
rooted!(in(cx) let expando = get_expando_object(proxy));
|
||||
if expando.is_null() {
|
||||
(*bp).code_ = 0 /* OkCode */;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue