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 289432 94f67b8f05834f1ed2ee28d7253b8885c649441d
parent 289431 3f5ac8a1b9561e5a00b1efe80484d9c776a8dd11
child 289433 01d79567d75985ce46bd1af60139b9b9feefe175
push id73840
push userevilpies@gmail.com
push dateSat, 19 Mar 2016 00:30:35 +0000
treeherdermozilla-inbound@94f67b8f0583 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspeterv
bugs1256688
milestone48.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 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);
 }