test_stepping-with-skip-breakpoints.js (2329B)
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 basic step-over functionality with pause points 8 * for the first statement and end of the last statement. 9 */ 10 11 add_task( 12 threadFrontTest(async ({ threadFront, debuggee }) => { 13 dumpn("Evaluating test code and waiting for first debugger statement"); 14 const dbgStmt = await executeOnNextTickAndWaitForPause( 15 () => evaluateTestCode(debuggee), 16 threadFront 17 ); 18 equal( 19 dbgStmt.frame.where.line, 20 2, 21 "Should be at debugger statement on line 2" 22 ); 23 equal(debuggee.a, undefined); 24 equal(debuggee.b, undefined); 25 26 const source = await getSource( 27 threadFront, 28 "test_stepping-01-test-code.js" 29 ); 30 31 // Add pause points for the first and end of the last statement. 32 // Note: we intentionally ignore the second statement. 33 source.setPausePoints([ 34 { 35 location: { line: 3, column: 8 }, 36 types: { breakpoint: true, stepOver: true }, 37 }, 38 { 39 location: { line: 4, column: 14 }, 40 types: { breakpoint: true, stepOver: true }, 41 }, 42 ]); 43 44 dumpn("Step Over to line 3"); 45 const step1 = await stepOver(threadFront); 46 equal(step1.why.type, "resumeLimit"); 47 equal(step1.frame.where.line, 3); 48 equal(step1.frame.where.column, 12); 49 50 equal(debuggee.a, undefined); 51 equal(debuggee.b, undefined); 52 53 dumpn("Step Over to line 4"); 54 const step2 = await stepOver(threadFront); 55 equal(step2.why.type, "resumeLimit"); 56 equal(step2.frame.where.line, 4); 57 equal(step2.frame.where.column, 12); 58 59 equal(debuggee.a, 1); 60 equal(debuggee.b, undefined); 61 62 dumpn("Step Over to the end of line 4"); 63 const step3 = await stepOver(threadFront); 64 equal(step3.why.type, "resumeLimit"); 65 equal(step3.frame.where.line, 4); 66 equal(step3.frame.where.column, 14); 67 equal(debuggee.a, 1); 68 equal(debuggee.b, 2); 69 }) 70 ); 71 72 function evaluateTestCode(debuggee) { 73 // prettier-ignore 74 Cu.evalInSandbox( 75 ` // 1 76 debugger; // 2 77 var a = 1; // 3 78 var b = 2;`, // 4 79 debuggee, 80 "1.8", 81 "test_stepping-01-test-code.js", 82 1 83 ); 84 }