Frame-onStep-11.js (1174B)
1 // Stepping out of a finally should not appear to 2 // step backward to some earlier statement. 3 4 var g = newGlobal({newCompartment: true}); 5 g.eval(`function f() { 6 debugger; // +0 7 var x = 0; // +1 8 try { // +2 9 x = 1; // +3 10 throw 'something'; // +4 11 } catch (e) { // +5 12 x = 2; // +6 13 } finally { // +7 14 x = 3; // +8 15 } // +9 16 x = 4; // +10 17 }`); // +11 18 19 var dbg = Debugger(g); 20 21 let foundLines = ''; 22 23 dbg.onDebuggerStatement = function(frame) { 24 let debugLine = frame.script.getOffsetLocation(frame.offset).lineNumber; 25 frame.onStep = function() { 26 // Only record a stop when the offset is an entry point. 27 let foundLine = this.script.getOffsetLocation(this.offset).lineNumber; 28 if (foundLine != debugLine && this.script.getLineOffsets(foundLine).indexOf(this.offset) >= 0) { 29 foundLines += "," + (foundLine - debugLine); 30 } 31 }; 32 }; 33 34 g.f(); 35 36 assertEq(foundLines, ",1,2,3,4,5,6,7,8,10,11");