Debian Codegraph @

js/src/jit-test/tests/proxy/testDirectProxyGet14.js

raw
1 load(libdir + "asserts.js");
2
3 var target = {x: 5};
4 var returnValue = 42;
5 var handler = {
6 get(t, p) {
7 return returnValue;
8 }
9 };
10 var {proxy, revoke} = Proxy.revocable(target, handler);
11
12 function testGet(p) {
13 return p.x;
14 }
15
16 for (i = 0; i < 200; i++) {
17 assertEq(testGet(proxy), returnValue);
18 }
19
20 assertEq(testGet(proxy), returnValue);
21 revoke();
22 assertThrowsInstanceOf(function () { testGet(proxy) }, TypeError);