summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-identity-05.js
blob: d72b5e76f3698a91904cb7a5dba0a5dfae303cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Tests that freshened blocks behave correctly in Debugger.

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var log = '';
var oldEnv = null;
dbg.onDebuggerStatement = function (frame) {
  if (!oldEnv) {
    oldEnv = frame.environment;
  } else {
    // Block has been freshened by |for (let ...)|, should be different
    // identity.
    log += (oldEnv === frame.environment);
  }
  log += frame.environment.getVariable("x");
};
g.eval("for (let x = 0; x < 2; x++) { eval(\"\"); debugger; }");
gc();
assertEq(log, "0false1");