summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-names-03.js
blob: cffc7cb461fd16e85806b12aa323345f9c9bf862 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Optimized out scopes should have working names().

var g = newGlobal({newCompartment: true});
var dbg = new Debugger;
dbg.addDebuggee(g);

g.eval("" + function f() {
  var x = 42;
  function g() { }
  g();
});

dbg.onEnterFrame = function (f) {
  if (f.callee && (f.callee.name === "g")) {
    var names = f.environment.parent.names();
    assertEq(names.indexOf("x") !== -1, true);
    assertEq(names.indexOf("g") !== -1, true);
    assertEq(names.length, 3); // x,g,arguments
  }
}

g.f();