diff options
author | Eduard Burtescu <edy.burt@gmail.com> | 2016-07-04 20:59:01 +0300 |
---|---|---|
committer | Eduard Burtescu <edy.burt@gmail.com> | 2016-07-04 20:59:01 +0300 |
commit | 0db1faf87651c99223683faafc836353f016ffb3 (patch) | |
tree | dec7ee5366fdb60a47f495d32c11a9ed2b8a4eb2 /components/script/dom/bindings/proxyhandler.rs | |
parent | a77cc9950fb13ccd674a10e46c2327bfa0735dab (diff) | |
download | servo-0db1faf87651c99223683faafc836353f016ffb3.tar.gz servo-0db1faf87651c99223683faafc836353f016ffb3.zip |
Switch to using the new rooted!/RootedGuard API for rooting.
Diffstat (limited to 'components/script/dom/bindings/proxyhandler.rs')
-rw-r--r-- | components/script/dom/bindings/proxyhandler.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/components/script/dom/bindings/proxyhandler.rs b/components/script/dom/bindings/proxyhandler.rs index f7505b77fc7..9db30d8835c 100644 --- a/components/script/dom/bindings/proxyhandler.rs +++ b/components/script/dom/bindings/proxyhandler.rs @@ -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; } |