test_pause_exceptions-03.js (1455B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Test that setting pauseOnExceptions to true will cause the debuggee to pause 8 * when an exception is thrown. 9 */ 10 11 add_task( 12 threadFrontTest( 13 async ({ threadFront, debuggee, commands }) => { 14 await executeOnNextTickAndWaitForPause( 15 () => evaluateTestCode(debuggee), 16 threadFront 17 ); 18 19 await commands.threadConfigurationCommand.updateConfiguration({ 20 pauseOnExceptions: true, 21 ignoreCaughtExceptions: false, 22 }); 23 await resume(threadFront); 24 const paused = await waitForPause(threadFront); 25 Assert.equal(paused.why.type, "exception"); 26 equal(paused.frame.where.line, 4, "paused at throw"); 27 28 await resume(threadFront); 29 }, 30 { 31 // Bug 1508289, exception tests fails in worker scope 32 doNotRunWorker: true, 33 } 34 ) 35 ); 36 37 function evaluateTestCode(debuggee) { 38 // prettier-ignore 39 Cu.evalInSandbox( 40 ` // 1 41 function stopMe() { // 2 42 debugger; // 3 43 throw 42; // 4 44 } // 5 45 try { // 6 46 stopMe(); // 7 47 } catch (e) {}`, // 8 48 debuggee, 49 "1.8", 50 "test_pause_exceptions-03.js", 51 1 52 ); 53 }