mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 14:20:14 +02:00
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
26 lines
1 KiB
JavaScript
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.");
|
|
});
|
|
});
|