test_breakpoint-19.js (1140B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Make sure that setting a breakpoint in a not-yet-existing script doesn't throw 8 * an error (see bug 897567). Also make sure that this breakpoint works. 9 */ 10 11 const URL = "test.js"; 12 13 function setUpCode(debuggee) { 14 /* eslint-disable mozilla/var-only-at-top-level, no-unused-vars */ 15 // prettier-ignore 16 Cu.evalInSandbox( 17 "" + function test() { // 1 18 var a = 1; // 2 19 debugger; // 3 20 } + // 4 21 "\ndebugger;", // 5 22 debuggee, 23 "1.8", 24 URL 25 ); 26 /* eslint-enable mozilla/var-only-at-top-level, no-unused-vars */ 27 } 28 29 add_task( 30 threadFrontTest(async ({ threadFront, debuggee }) => { 31 setBreakpoint(threadFront, { sourceUrl: URL, line: 2 }); 32 33 await executeOnNextTickAndWaitForPause( 34 () => setUpCode(debuggee), 35 threadFront 36 ); 37 await resume(threadFront); 38 39 const packet = await executeOnNextTickAndWaitForPause( 40 debuggee.test, 41 threadFront 42 ); 43 equal(packet.why.type, "breakpoint"); 44 }) 45 );