1
0
Fork 0
firefox/browser/base/content/test/favicons/browser_missing_favicon.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

36 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.startLoadingURIString(
browser,
testPath + "file_with_favicon.html"
);
await BrowserTestUtils.browserLoaded(browser);
let iconURI = await faviconPromise;
is(iconURI, expectedIcon, "Got correct icon.");
BrowserTestUtils.startLoadingURIString(browser, testPath + "blank.html");
await BrowserTestUtils.browserLoaded(browser);
is(browser.mIconURL, null, "Should have blanked the icon.");
is(
gBrowser.getTabForBrowser(browser).getAttribute("image"),
null,
"Should have blanked the tab icon."
);
}
);
});