test_stepping-10.js (1339B)
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 step out stops at the parent and the parent's parent. 8 * This checks for the failure found in bug 1530549. 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 3, 21 "Should be at debugger statement on line 3" 22 ); 23 24 dumpn("Step out of inner and into var statement IIFE"); 25 const step2 = await stepOut(threadFront); 26 equal(step2.frame.where.line, 4); 27 deepEqual(step2.why.frameFinished.return, { type: "undefined" }); 28 29 dumpn("Step out of vars and into script body"); 30 const step3 = await stepOut(threadFront); 31 equal(step3.frame.where.line, 9); 32 deepEqual(step3.why.frameFinished.return, { type: "undefined" }); 33 }) 34 ); 35 36 function evaluateTestCode(debuggee) { 37 Cu.evalInSandbox( 38 ` 39 (function() { 40 (function(){debugger;})(); 41 var a = 1; 42 a = 2; 43 a = 3; 44 a = 4; 45 })(); 46 `, 47 debuggee, 48 "1.8", 49 "test_stepping-10-test-code.js", 50 1 51 ); 52 }