summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/favicons/browser_rooticon.js
blob: 6e642070c7cad3e210b5c5ee7f08d86fcb727ce5 (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.loadURIString(browser, testPath);
  await BrowserTestUtils.browserLoaded(browser);
  iconURI = await faviconPromise;
  is(iconURI, expectedIcon, "Got correct icon on second load.");

  BrowserTestUtils.removeTab(tab);
});