browser_bug550565.js (1104B)
1 add_task(async function test() { 2 let testPath = getRootDirectory(gTestPath); 3 4 await BrowserTestUtils.withNewTab( 5 { gBrowser, url: "about:blank" }, 6 async function (tabBrowser) { 7 const URI = testPath + "file_with_favicon.html"; 8 const expectedIcon = testPath + "file_generic_favicon.ico"; 9 let faviconPromise = waitForLinkAvailable(tabBrowser); 10 11 BrowserTestUtils.startLoadingURIString(tabBrowser, URI); 12 13 let iconURI = await faviconPromise; 14 is(iconURI, expectedIcon, "Correct icon before pushState."); 15 16 faviconPromise = waitForLinkAvailable(tabBrowser); 17 18 await SpecialPowers.spawn(tabBrowser, [], function () { 19 content.history.pushState("page2", "page2", "page2"); 20 }); 21 22 // We've navigated and shouldn't get a call to onLinkIconAvailable. 23 TestUtils.executeSoon(() => { 24 faviconPromise.cancel(); 25 }); 26 27 try { 28 await faviconPromise; 29 ok(false, "Should not have seen a new icon load."); 30 } catch (e) { 31 ok(true, "Should have been able to cancel the promise."); 32 } 33 } 34 ); 35 });