Bug 1163423 - Use JS_HasOwnProperty in WrapperAnswer::RecvHasOwn. r=billm
authorTom Schuster <evilpies@gmail.com>
Tue, 12 May 2015 21:05:50 +0200
changeset 243542 efef07486ddeeb8fe3fca5c1259a393ebf2062fb
parent 243541 e7886e8be8fb5f541c26a1dfeb8f52c06d5205ab
child 243543 2db3491d59e4035b2fb0e951d4b40299a8d6c4eb
push id59692
push userevilpies@gmail.com
push dateTue, 12 May 2015 19:37:45 +0000
treeherdermozilla-inbound@efef07486dde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1163423
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1163423 - Use JS_HasOwnProperty in WrapperAnswer::RecvHasOwn. r=billm
js/ipc/WrapperAnswer.cpp
js/ipc/WrapperAnswer.h
--- a/js/ipc/WrapperAnswer.cpp
+++ b/js/ipc/WrapperAnswer.cpp
@@ -215,69 +215,64 @@ WrapperAnswer::RecvDelete(const ObjectId
 
     ObjectOpResult success;
     if (!JS_DeletePropertyById(cx, obj, id, success))
         return fail(jsapi, rs);
     return ok(rs, success);
 }
 
 bool
-WrapperAnswer::RecvHas(const ObjectId& objId, const JSIDVariant& idVar, ReturnStatus* rs, bool* bp)
+WrapperAnswer::RecvHas(const ObjectId& objId, const JSIDVariant& idVar, ReturnStatus* rs,
+                       bool* foundp)
 {
     AutoJSAPI jsapi;
     if (NS_WARN_IF(!jsapi.Init(scopeForTargetObjects())))
         return false;
     jsapi.TakeOwnershipOfErrorReporting();
     JSContext* cx = jsapi.cx();
-    *bp = false;
+    *foundp = false;
 
     RootedObject obj(cx, findObjectById(cx, objId));
     if (!obj)
         return fail(jsapi, rs);
 
     LOG("%s.has(%s)", ReceiverObj(objId), Identifier(idVar));
 
     RootedId id(cx);
     if (!fromJSIDVariant(cx, idVar, &id))
         return fail(jsapi, rs);
 
-    bool found;
-    if (!JS_HasPropertyById(cx, obj, id, &found))
+    if (!JS_HasPropertyById(cx, obj, id, foundp))
         return fail(jsapi, rs);
-    *bp = !!found;
-
     return ok(rs);
 }
 
 bool
 WrapperAnswer::RecvHasOwn(const ObjectId& objId, const JSIDVariant& idVar, ReturnStatus* rs,
-                          bool* bp)
+                          bool* foundp)
 {
     AutoJSAPI jsapi;
     if (NS_WARN_IF(!jsapi.Init(scopeForTargetObjects())))
         return false;
     jsapi.TakeOwnershipOfErrorReporting();
     JSContext* cx = jsapi.cx();
-    *bp = false;
+    *foundp = false;
 
     RootedObject obj(cx, findObjectById(cx, objId));
     if (!obj)
         return fail(jsapi, rs);
 
     LOG("%s.hasOwn(%s)", ReceiverObj(objId), Identifier(idVar));
 
     RootedId id(cx);
     if (!fromJSIDVariant(cx, idVar, &id))
         return fail(jsapi, rs);
 
-    Rooted<JSPropertyDescriptor> desc(cx);
-    if (!JS_GetPropertyDescriptorById(cx, obj, id, &desc))
+    if (!JS_HasOwnPropertyById(cx, obj, id, foundp))
         return fail(jsapi, rs);
-    *bp = (desc.object() == obj);
-
     return ok(rs);
 }
 
 bool
 WrapperAnswer::RecvGet(const ObjectId& objId, const ObjectVariant& receiverVar,
                        const JSIDVariant& idVar, ReturnStatus* rs, JSVariant* result)
 {
     // We may run scripted getters.
--- a/js/ipc/WrapperAnswer.h
+++ b/js/ipc/WrapperAnswer.h
@@ -31,19 +31,19 @@ class WrapperAnswer : public virtual Jav
                                       const JSIDVariant& id,
                                       ReturnStatus* rs,
                                       PPropertyDescriptor* out);
     bool RecvDefineProperty(const ObjectId& objId, const JSIDVariant& id,
                             const PPropertyDescriptor& flags, ReturnStatus* rs);
     bool RecvDelete(const ObjectId& objId, const JSIDVariant& id, ReturnStatus* rs);
 
     bool RecvHas(const ObjectId& objId, const JSIDVariant& id,
-                 ReturnStatus* rs, bool* bp);
+                 ReturnStatus* rs, bool* foundp);
     bool RecvHasOwn(const ObjectId& objId, const JSIDVariant& id,
-                    ReturnStatus* rs, bool* bp);
+                    ReturnStatus* rs, bool* foundp);
     bool RecvGet(const ObjectId& objId, const ObjectVariant& receiverVar,
                  const JSIDVariant& id,
                  ReturnStatus* rs, JSVariant* result);
     bool RecvSet(const ObjectId& objId, const JSIDVariant& id, const JSVariant& value,
                  const JSVariant& receiverVar, ReturnStatus* rs);
 
     bool RecvIsExtensible(const ObjectId& objId, ReturnStatus* rs,
                           bool* result);