fune/browser/base/content/test/favicons/browser_missing_favicon.js
Victor Porof f9f5914039 Bug 1561435 - Format browser/base/, a=automatic-formatting
# ignore-this-changeset

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

--HG--
extra : source : 96b3895a3b2aa2fcb064c85ec5857b7216884556
2019-07-05 09:48:57 +02:00

33 lines
1.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."
);
}
);
});