blob: 5e2136b9d78ce8eafbcdf7af7e20d609f5b6bd87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// getVariable works on ancestors of frame.environment.
var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var log = '';
dbg.onDebuggerStatement = function (frame) {
for (var env = frame.environment; env; env = env.parent) {
if (env.find("x") === env)
log += env.getVariable("x");
}
};
g.eval("var x = 1; { let x = 2; with (Object.create({x: 3})) { debugger; } }");
assertEq(log, "321");
|