test_breakpoint-13.js (2322B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Check that execution doesn't pause twice while stepping, when encountering 8 * either a breakpoint or a debugger statement. 9 */ 10 11 add_task( 12 threadFrontTest(async ({ threadFront, debuggee }) => { 13 const packet = await executeOnNextTickAndWaitForPause( 14 () => evaluateTestCode(debuggee), 15 threadFront 16 ); 17 18 const source = await getSourceById(threadFront, packet.frame.where.actor); 19 await threadFront.setBreakpoint( 20 { sourceUrl: source.url, line: 3, column: 6 }, 21 {} 22 ); 23 24 info("Check that the stepping worked."); 25 const packet1 = await stepIn(threadFront); 26 Assert.equal(packet1.frame.where.line, 6); 27 Assert.equal(packet1.why.type, "resumeLimit"); 28 29 info("Entered the foo function call frame."); 30 const packet2 = await stepIn(threadFront); 31 Assert.equal(packet2.frame.where.line, 3); 32 Assert.equal(packet2.why.type, "resumeLimit"); 33 34 info("Check that the breakpoint wasn't the reason for this pause"); 35 const packet3 = await stepIn(threadFront); 36 Assert.equal(packet3.frame.where.line, 4); 37 Assert.equal(packet3.why.type, "resumeLimit"); 38 Assert.equal(packet3.why.frameFinished.return.type, "undefined"); 39 40 info("Check that the debugger statement wasn't the reason for this pause."); 41 const packet4 = await stepIn(threadFront); 42 Assert.equal(debuggee.a, 1); 43 Assert.equal(debuggee.b, undefined); 44 Assert.equal(packet4.frame.where.line, 7); 45 Assert.equal(packet4.why.type, "resumeLimit"); 46 47 info("Check that the debugger statement wasn't the reason for this pause."); 48 const packet5 = await stepIn(threadFront); 49 Assert.equal(packet5.frame.where.line, 8); 50 Assert.equal(packet5.why.type, "resumeLimit"); 51 52 info("Remove the breakpoint and finish."); 53 await stepIn(threadFront); 54 threadFront.removeBreakpoint({ sourceUrl: source.url, line: 3 }); 55 56 await resume(threadFront); 57 }) 58 ); 59 60 function evaluateTestCode(debuggee) { 61 /* eslint-disable */ 62 Cu.evalInSandbox( 63 ` 64 function foo() { 65 this.a = 1; // <-- breakpoint set here 66 } 67 debugger; 68 foo(); 69 debugger; 70 var b = 2; 71 `, 72 debuggee, 73 "1.8", 74 "test_breakpoint-13.js", 75 1 76 ); 77 /* eslint-enable */ 78 }