browser_launchFail.js (1854B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Tests that if the content process fails to launch in the 8 * foreground tab, that we show about:tabcrashed, but do not 9 * attempt to wait for a crash dump for it (which will never come). 10 */ 11 add_task(async function test_launchfail_foreground() { 12 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 13 await BrowserTestUtils.withNewTab("http://example.com", async browser => { 14 let tabcrashed = BrowserTestUtils.waitForEvent( 15 browser, 16 "AboutTabCrashedReady", 17 false, 18 null, 19 true 20 ); 21 await BrowserTestUtils.simulateProcessLaunchFail(browser); 22 Assert.equal( 23 0, 24 TabCrashHandler.queuedCrashedBrowsers, 25 "No crashed browsers should be queued." 26 ); 27 await tabcrashed; 28 }); 29 }); 30 31 /** 32 * Tests that if the content process fails to launch in a background 33 * tab, that upon choosing that tab, we show about:tabcrashed, but do 34 * not attempt to wait for a crash dump for it (which will never come). 35 */ 36 add_task(async function test_launchfail_background() { 37 let originalTab = gBrowser.selectedTab; 38 // eslint-disable-next-line @microsoft/sdl/no-insecure-url 39 await BrowserTestUtils.withNewTab("http://example.com", async browser => { 40 let tab = gBrowser.getTabForBrowser(browser); 41 await BrowserTestUtils.switchTab(gBrowser, originalTab); 42 43 let tabcrashed = BrowserTestUtils.waitForEvent( 44 browser, 45 "AboutTabCrashedReady", 46 false, 47 null, 48 true 49 ); 50 await BrowserTestUtils.simulateProcessLaunchFail(browser); 51 Assert.equal( 52 0, 53 TabCrashHandler.queuedCrashedBrowsers, 54 "No crashed browsers should be queued." 55 ); 56 await BrowserTestUtils.switchTab(gBrowser, tab); 57 await tabcrashed; 58 }); 59 });