Bug 1256688 - Continue using getPropertyDescriptor for has in XrayWrapper. r=peterv
authorTom Schuster <evilpies@gmail.com>
Sat, 19 Mar 2016 01:30:03 +0100
changeset 289431 3f5ac8a1b9561e5a00b1efe80484d9c776a8dd11
parent 289430 7db58032977aaafc2bd70e035c1b6ae37aab207a
child 289432 94f67b8f05834f1ed2ee28d7253b8885c649441d
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 XrayWrapper. r=peterv
js/xpconnect/wrappers/XrayWrapper.cpp
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -2212,18 +2212,24 @@ XrayWrapper<Base, Traits>::set(JSContext
     return js::BaseProxyHandler::set(cx, wrapper, id, v, wrapperValue, result);
 }
 
 template <typename Base, typename Traits>
 bool
 XrayWrapper<Base, Traits>::has(JSContext* cx, HandleObject wrapper,
                                HandleId id, bool* bp) const
 {
-    // Skip our Base if it isn't already ProxyHandler.
-    return js::BaseProxyHandler::has(cx, wrapper, id, bp);
+    // This uses getPropertyDescriptor for backward compatibility with
+    // the old BaseProxyHandler::has implementation.
+    Rooted<PropertyDescriptor> desc(cx);
+    if (!getPropertyDescriptor(cx, wrapper, id, &desc))
+        return false;
+
+    *bp = !!desc.object();
+    return true;
 }
 
 template <typename Base, typename Traits>
 bool
 XrayWrapper<Base, Traits>::hasOwn(JSContext* cx, HandleObject wrapper,
                                   HandleId id, bool* bp) const
 {
     // Skip our Base if it isn't already ProxyHandler.