Bug 842940 - Don't squelch exceptions in Proxy::get. r=jorendorff
authorBobby Holley <bobbyholley@gmail.com>
Thu, 21 Feb 2013 13:32:13 -0800
changeset 122582 41dea0da21db4b0f743d5d100c2367d2fb47a704
parent 122581 ac4a74c8e510388b922f6397e4bd4006126c3bcc
child 122583 81290fcf5990d7bfec5c4c6d438bdfdff3a987f2
push id24349
push userryanvm@gmail.com
push dateFri, 22 Feb 2013 17:43:12 +0000
treeherdermozilla-central@e36f42046452 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs842940
milestone22.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 842940 - Don't squelch exceptions in Proxy::get. r=jorendorff
js/src/jit-test/tests/basic/bug842940.js
js/src/jsproxy.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug842940.js
@@ -0,0 +1,1 @@
+try { for (let v of wrapWithProto(Proxy.create({}), [])) { } } catch (e) {}
--- a/js/src/jsproxy.cpp
+++ b/js/src/jsproxy.cpp
@@ -2337,18 +2337,24 @@ Proxy::hasOwn(JSContext *cx, JSObject *p
 }
 
 bool
 Proxy::get(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id,
            MutableHandleValue vp)
 {
     JS_CHECK_RECURSION(cx, return false);
     BaseProxyHandler *handler = GetProxyHandler(proxy);
-    bool own = false;
-    if (!handler->hasPrototype() || (handler->hasOwn(cx, proxy, id, &own) && own))
+    bool own;
+    if (!handler->hasPrototype()) {
+        own = true;
+    } else {
+        if (!handler->hasOwn(cx, proxy, id, &own))
+            return false;
+    }
+    if (own)
         return handler->get(cx, proxy, receiver, id, vp.address());
     INVOKE_ON_PROTOTYPE(cx, handler, proxy, JSObject::getGeneric(cx, proto, receiver, id, vp));
 }
 
 bool
 Proxy::getElementIfPresent(JSContext *cx, HandleObject proxy, HandleObject receiver, uint32_t index,
                            MutableHandleValue vp, bool *present)
 {