Bug 783702 - Call through to get() for hasPrototype() path in getElementIfPresent(). r=ejpbruel
authorBobby Holley <bobbyholley@gmail.com>
Mon, 24 Sep 2012 12:05:50 +0200
changeset 107891 3d8bdbcc40f906dfd4edf69c0235ce549528db3f
parent 107890 d678fc7cfbefc491306f05eba987cf3b43b6ac6b
child 107892 46fce5a9890f2fef138ed96b7065aad0a1c67948
push id15262
push userbobbyholley@gmail.com
push dateMon, 24 Sep 2012 10:06:00 +0000
treeherdermozilla-inbound@3d8bdbcc40f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs783702
milestone18.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 783702 - Call through to get() for hasPrototype() path in getElementIfPresent(). r=ejpbruel
js/src/jsproxy.cpp
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -2380,21 +2380,24 @@ Proxy::get(JSContext *cx, HandleObject p
 bool
 Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy_, HandleObject receiver, uint32_t index,
                            MutableHandleValue vp, bool *present)
 {
     JS_CHECK_RECURSION(cx, return false);
     RootedObject proxy(cx, proxy_);
     BaseProxyHandler *handler = GetProxyHandler(proxy);
     bool hasOwn, status = true;
-    if (!handler->hasPrototype() ||
-        ((status = handler->hasOwn(cx, proxy, INT_TO_JSID(index), &hasOwn)) && hasOwn))
+    RootedId id(cx);
+    if (!handler->hasPrototype()) {
+        return GetProxyHandler(proxy)->getElementIfPresent(cx, proxy, receiver, index, vp.address(), present);
+    } else if (status = IndexToId(cx, index, id.address()) &&
+               (status = handler->hasOwn(cx, proxy, id, &hasOwn)) && hasOwn)
     {
-        return GetProxyHandler(proxy)->getElementIfPresent(cx, proxy, receiver,
-                                                           index, vp.address(), present);
+        *present = true;
+        return GetProxyHandler(proxy)->get(cx, proxy, receiver, id, vp.address());
     } else if (!status) {
         return false;
     }
     INVOKE_ON_PROTOTYPE(cx, handler, proxy,
                         JSObject::getElementIfPresent(cx, proto, receiver, index, vp, present));
 }
 
 bool