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 289495 3f5ac8a1b9561e5a00b1efe80484d9c776a8dd11
parent 289494 7db58032977aaafc2bd70e035c1b6ae37aab207a
child 289496 94f67b8f05834f1ed2ee28d7253b8885c649441d
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 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.