summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/favicons/browser_rooticon.js
blob: b574f5a86a35005184b8a7d64bb099659a5b49a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
add_task(async () => {
  const testPath =
    // eslint-disable-next-line @microsoft/sdl/no-insecure-url
    "http://example.com/browser/browser/base/content/test/favicons/blank.html";
  // eslint-disable-next-line @microsoft/sdl/no-insecure-url
  const expectedIcon = "http://example.com/favicon.ico";

  let tab = BrowserTestUtils.addTab(gBrowser, testPath);
  gBrowser.selectedTab = tab;
  let browser = tab.linkedBrowser;

  let faviconPromise = waitForLinkAvailable(browser);
  await BrowserTestUtils.browserLoaded(browser);
  let iconURI = await faviconPromise;
  is(iconURI, expectedIcon, "Got correct initial icon.");

  faviconPromise = waitForLinkAvailable(browser);
  BrowserTestUtils.startLoadingURIString(browser, testPath);
  await BrowserTestUtils.browserLoaded(browser);
  iconURI = await faviconPromise;
  is(iconURI, expectedIcon, "Got correct icon on second load.");

  BrowserTestUtils.removeTab(tab);
});