tor-browser

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

browser_bug408415.js (1009B)


      1 add_task(async function test() {
      2  let testPath = getRootDirectory(gTestPath);
      3 
      4  await BrowserTestUtils.withNewTab(
      5    { gBrowser, url: "about:blank" },
      6    async function (tabBrowser) {
      7      const URI = testPath + "file_with_favicon.html";
      8      const expectedIcon = testPath + "file_generic_favicon.ico";
      9      let faviconPromise = waitForLinkAvailable(tabBrowser);
     10 
     11      BrowserTestUtils.startLoadingURIString(tabBrowser, URI);
     12 
     13      let iconURI = await faviconPromise;
     14      is(iconURI, expectedIcon, "Correct icon before pushState.");
     15 
     16      faviconPromise = waitForLinkAvailable(tabBrowser);
     17 
     18      await SpecialPowers.spawn(tabBrowser, [], function () {
     19        content.location.href += "#foo";
     20      });
     21 
     22      TestUtils.executeSoon(() => {
     23        faviconPromise.cancel();
     24      });
     25 
     26      try {
     27        await faviconPromise;
     28        ok(false, "Should not have seen a new icon load.");
     29      } catch (e) {
     30        ok(true, "Should have been able to cancel the promise.");
     31      }
     32    }
     33  );
     34 });