summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/arguments/redefine-callee.js
blob: c200f5326d0eb75644de594782d7761cc731ada3 (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
26
27
28
29
30
31
function test() {
  let count = 0;
  for (var i = 0; i < 30; i++) {
    assertEq(arguments.callee, i > 20 ? 3 : test);
    if (i === 20) {
      Object.defineProperty(arguments, "callee", {get: function() { count++; return 3; }});
    }
  }
  assertEq(count, 9);
}
test();

function testUnusedResult() {
  let count = 0;
  for (var i = 0; i < 30; i++) {
    arguments.callee;
    if (i === 20) {
      Object.defineProperty(arguments, "callee", {get: function() { count++; return 3; }});
    }
  }
  assertEq(count, 9);
}
testUnusedResult();

function testSetter() {
  Object.defineProperty(arguments, "callee", {set: function() {}});
  for (var i = 0; i < 15; i++) {
    assertEq(arguments.callee, undefined);
  }
}
testSetter();