Debian Codegraph @

js/src/jit-test/tests/debug/Frame-onStep-13.js

raw
1 // Stepping over a not-taken "if" that is at the end of the function
2 // should move to the end of the function, not somewhere in the body
3 // of the "if".
4
5 var g = newGlobal({newCompartment: true});
6 g.eval(`function f() { // 1
7 var a,c; // 2
8 debugger; // 3
9 if(false) { // 4
10 for(var b=0; b<0; b++) { // 5
11 c = 2; // 6
12 } // 7
13 } // 8
14 } // 9
15 `);
16
17 var dbg = Debugger(g);
18 var badStep = false;
19
20 dbg.onDebuggerStatement = function(frame) {
21 let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber;
22 assertEq(debugLine, 3);
23 frame.onStep = function() {
24 let foundLine = this.script.getOffsetLocation(this.offset).lineNumber;
25 assertEq(foundLine <= 4 || foundLine >= 8, true);
26 };
27 };
28
29 g.eval("f();\n");