Debian Codegraph @

js/src/jit-test/tests/debug/execution-observability-01.js

raw
1 // For perf reasons we don't recompile all a debuggee global's scripts when
2 // Debugger no longer needs to observe all execution for that global. Test that
3 // things don't crash if we try to run a script with a BaselineScript that was
4 // compiled with debug instrumentation when the global is no longer a debuggee.
5
6 var g = newGlobal({newCompartment: true});
7 var dbg = new Debugger(g);
8 var counter = 0;
9 dbg.onDebuggerStatement = function (frame) {
10 counter++;
11 if (counter == 15)
12 dbg.onDebuggerStatement = undefined;
13 };
14
15 g.eval("" + function f() {
16 {
17 let inner = 42;
18 debugger;
19 inner++;
20 }
21 });
22 g.eval("for (var i = 0; i < 20; i++) f()");