summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/testDirectProxyGet15.js
blob: 60b86feacf95f7827119dd84b504c9043ed2f32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var target = {x: 5};
var returnValue = 42;
var handlerProto = {};
var handler = {};
handlerProto.get = function(t, p) {
  return returnValue;
}
handler.foo = handlerProto.get;
handler.__proto__ = handlerProto;

var proxy = new Proxy(target, handler);

function testGet(p) {
  return p.x;
}

for (i = 0; i < 500; i++) {
  assertEq(testGet(proxy), returnValue);
}

handlerProto.get = function() {
  return returnValue - 1;
}

assertEq(testGet(proxy), returnValue - 1);