Bug 1256688 - Continue using getPropertyDescriptor for has in Sandbox. r=peterv
authorTom Schuster <evilpies@gmail.com>
Sat, 19 Mar 2016 01:30:03 +0100
changeset 289496 94f67b8f05834f1ed2ee28d7253b8885c649441d
parent 289495 3f5ac8a1b9561e5a00b1efe80484d9c776a8dd11
child 289497 01d79567d75985ce46bd1af60139b9b9feefe175
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1256688
milestone48.0a1
Bug 1256688 - Continue using getPropertyDescriptor for has in Sandbox. r=peterv
js/xpconnect/src/Sandbox.cpp
--- a/js/xpconnect/src/Sandbox.cpp
+++ b/js/xpconnect/src/Sandbox.cpp
@@ -799,17 +799,24 @@ xpc::SandboxProxyHandler::getOwnProperty
  * Reuse the BaseProxyHandler versions of the derived traps that are implemented
  * in terms of the fundamental traps.
  */
 
 bool
 xpc::SandboxProxyHandler::has(JSContext* cx, JS::Handle<JSObject*> proxy,
                               JS::Handle<jsid> id, bool* bp) const
 {
-    return BaseProxyHandler::has(cx, proxy, id, bp);
+    // This uses getPropertyDescriptor for backward compatibility with
+    // the old BaseProxyHandler::has implementation.
+    Rooted<PropertyDescriptor> desc(cx);
+    if (!getPropertyDescriptor(cx, proxy, id, &desc))
+        return false;
+
+    *bp = !!desc.object();
+    return true;
 }
 bool
 xpc::SandboxProxyHandler::hasOwn(JSContext* cx, JS::Handle<JSObject*> proxy,
                                  JS::Handle<jsid> id, bool* bp) const
 {
     return BaseProxyHandler::hasOwn(cx, proxy, id, bp);
 }