Debian Codegraph @

js/src/jit-test/tests/debug/Environment-gc-03.js

raw
1 // Test that block scopes cannot be resurrected by onStep.
2
3 var g = newGlobal({newCompartment: true});
4 var dbg = new Debugger(g);
5 dbg.onDebuggerStatement = function(frame) {
6 frame.onStep = (function() {
7 frame.environment;
8 });
9 };
10
11 g.eval("debugger; for (let i = 0; i < 1; i++) (function(){});");
12
13 // If the last freshened block scope was incorrectly resurrected by onStep
14 // above, GCing will assert.
15 gc();
16
17 g.eval("debugger; { let i = 0; (function(){ i = 42; }); }");
18 gc();
19
20 g.eval("debugger; try { throw 42; } catch (e) { };");
21 gc();