tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_missing_favicon.js (1156B)


      1 add_task(async () => {
      2  let testPath = getRootDirectory(gTestPath);
      3 
      4  // The default favicon would interfere with this test.
      5  Services.prefs.setBoolPref("browser.chrome.guess_favicon", false);
      6  registerCleanupFunction(() => {
      7    Services.prefs.setBoolPref("browser.chrome.guess_favicon", true);
      8  });
      9 
     10  await BrowserTestUtils.withNewTab(
     11    { gBrowser, url: "about:blank" },
     12    async browser => {
     13      const expectedIcon = testPath + "file_generic_favicon.ico";
     14      let faviconPromise = waitForLinkAvailable(browser);
     15 
     16      BrowserTestUtils.startLoadingURIString(
     17        browser,
     18        testPath + "file_with_favicon.html"
     19      );
     20      await BrowserTestUtils.browserLoaded(browser);
     21 
     22      let iconURI = await faviconPromise;
     23      is(iconURI, expectedIcon, "Got correct icon.");
     24 
     25      BrowserTestUtils.startLoadingURIString(browser, testPath + "blank.html");
     26      await BrowserTestUtils.browserLoaded(browser);
     27 
     28      is(browser.mIconURL, null, "Should have blanked the icon.");
     29      is(
     30        gBrowser.getTabForBrowser(browser).getAttribute("image"),
     31        null,
     32        "Should have blanked the tab icon."
     33      );
     34    }
     35  );
     36 });