summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-identity-05.js
blob: c1d06b7e78c44a86ef1b89366aff97dd2b916bad (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();
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++) debugger;");
gc();
assertEq(log, "0false1");