test_ignore_no_interface_exceptions.js (1562B)
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 the debugger automatically ignores NS_ERROR_NO_INTERFACE 8 * exceptions, but not normal ones. 9 */ 10 11 add_task( 12 threadFrontTest( 13 async ({ threadFront, debuggee }) => { 14 await threadFront.pauseOnExceptions(true, false); 15 const paused = await executeOnNextTickAndWaitForPause( 16 () => evaluateTestCode(debuggee), 17 threadFront 18 ); 19 equal(paused.frame.where.line, 6, "paused at throw"); 20 21 await resume(threadFront); 22 }, 23 { 24 // Bug 1508289, exception tests fails in worker scope 25 doNotRunWorker: true, 26 } 27 ) 28 ); 29 30 function evaluateTestCode(debuggee) { 31 // debuggee isn't privileged and doesn't have access to 'Cr' 32 debuggee.NS_ERROR_NO_INTERFACE = Cr.NS_ERROR_NO_INTERFACE; 33 34 // prettier-ignore 35 Cu.evalInSandbox(` // 1 36 function QueryInterface() { // 2 37 throw NS_ERROR_NO_INTERFACE; // 3 38 } // 4 39 function stopMe() { // 5 40 throw 42; // 6 41 } // 7 42 try { // 8 43 QueryInterface(); // 9 44 } catch (e) {} // 10 45 try { // 11 46 stopMe(); // 12 47 } catch (e) {}`, // 13 48 debuggee, 49 "1.8", 50 "test_ignore_no_interface_exceptions.js", 51 1 52 ); 53 }