fune/browser/base/content/test/favicons/browser_missing_favicon.js
Dave Townsend 606d7bff5c Bug 1478823: Start loading the default favicon as soon as the head element is complete. r=mak
We have to potentially add the root favicon both after the head element completes and when the page finishes loading in the case that there was no head element.

Differential Revision: https://phabricator.services.mozilla.com/D2803

--HG--
extra : moz-landing-system : lando
2018-08-07 12:42:15 +00:00

26 lines
1 KiB
JavaScript

add_task(async () => {
let testPath = getRootDirectory(gTestPath);
// The default favicon would interfere with this test.
Services.prefs.setBoolPref("browser.chrome.guess_favicon", false);
registerCleanupFunction(() => {
Services.prefs.setBoolPref("browser.chrome.guess_favicon", true);
});
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, async (browser) => {
const expectedIcon = testPath + "file_generic_favicon.ico";
let faviconPromise = waitForLinkAvailable(browser);
BrowserTestUtils.loadURI(browser, testPath + "file_with_favicon.html");
await BrowserTestUtils.browserLoaded(browser);
let iconURI = await faviconPromise;
is(iconURI, expectedIcon, "Got correct icon.");
BrowserTestUtils.loadURI(browser, testPath + "blank.html");
await BrowserTestUtils.browserLoaded(browser);
is(browser.mIconURL, null, "Should have blanked the icon.");
is(gBrowser.getTabForBrowser(browser).getAttribute("image"), "", "Should have blanked the tab icon.");
});
});