summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyGet11.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/jit-test/tests/proxy/testDirectProxyGet11.js')
-rw-r--r--js/src/jit-test/tests/proxy/testDirectProxyGet11.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGet11.js b/js/src/jit-test/tests/proxy/testDirectProxyGet11.js
new file mode 100644
index 0000000000..1f0f0e0b0b
--- /dev/null
+++ b/js/src/jit-test/tests/proxy/testDirectProxyGet11.js
@@ -0,0 +1,28 @@
+load(libdir + "asserts.js");
+
+var target = {x:5};
+var returnValue = 42;
+var handler = {
+ get(t, p) {
+ if (returnValue != 42) {
+ gc(testGet, "shrinking");
+ }
+ return returnValue;
+ }
+};
+var proxy = new Proxy(target, handler);
+
+function testGet(p) {
+ return p.x;
+}
+
+for (i = 0; i < 200; i++) {
+ assertEq(testGet(proxy), returnValue);
+}
+
+Object.defineProperty(target, 'x', {
+ set(v) {},
+ configurable: false
+});
+
+assertThrowsInstanceOf(function () { testGet(proxy) }, TypeError);