Debian Codegraph @

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

raw
1 var target = {x: 5};
2 var returnValue = 42;
3 var handlerProto = {};
4 var handler = {};
5 handlerProto.get = function(t, p) {
6 return returnValue;
7 }
8 handler.foo = handlerProto.get;
9 handler.__proto__ = handlerProto;
10
11 var proxy = new Proxy(target, handler);
12
13 function testGet(p) {
14 return p.x;
15 }
16
17 for (i = 0; i < 500; i++) {
18 assertEq(testGet(proxy), returnValue);
19 }
20
21 handlerProto.get = function() {
22 return returnValue - 1;
23 }
24
25 assertEq(testGet(proxy), returnValue - 1);