summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/proxy/bug1885774.js
blob: fa88cbf823a4cffbcebf662d076b01ecfa6cee19 (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
// |jit-test| --no-threads; --fast-warmup

var {proxy, revoke} = Proxy.revocable({x:1}, {});

function foo(o) {
  var res = 0;
  for (var i = 0; i < 2; i++) {
    res += o.x;
  }
  return res;
}

with ({}) {}
for (var i = 0; i < 100; i++) {
  assertEq(foo(proxy), 2);
}

revoke();
var caught = false;
try {
  foo(proxy);
} catch {
  caught = true;
}
assertEq(caught, true);