summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js b/js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js
new file mode 100644
index 0000000000..d9f34e60e8
--- /dev/null
+++ b/js/src/jit-test/tests/proxy/testDirectProxyGetInherited3.js
@@ -0,0 +1,21 @@
+// Recursion through the get hook works; runaway recursion is checked.
+
+load(libdir + "asserts.js");
+
+var hits = 0, limit = 10;
+var proto = new Proxy({}, {
+ get(t, id, r) {
+ assertEq(r, obj);
+ if (hits++ >= limit)
+ return "ding";
+ return obj[id];
+ }
+});
+
+var obj = Object.create(proto);
+assertEq(obj.prop, "ding");
+
+hits = 0;
+limit = Infinity;
+assertThrowsInstanceOf(() => obj.prop, InternalError);
+assertEq(hits > 10, true);