tor-browser

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

browser_replace_state_during_navigation_from_first_page.js (935B)


      1 "use strict";
      2 
      3 const TEST_URI =
      4  getRootDirectory(gTestPath).replace(
      5    "chrome://mochitests/content",
      6    "https://example.com"
      7  ) + "file_replace_state_during_navigation.html";
      8 
      9 add_setup(async function () {
     10  await SpecialPowers.pushPrefEnv({
     11    set: [
     12      ["test.wait300msAfterTabSwitch", true],
     13      ["browser.navigation.requireUserInteraction", true],
     14    ],
     15  });
     16 });
     17 
     18 add_task(async () => {
     19  await BrowserTestUtils.withNewTab(TEST_URI, async browser => {
     20    // Add user interaction to the first page.
     21    await BrowserTestUtils.synthesizeMouseAtCenter("body", {}, browser);
     22 
     23    // Navigate, causing a hashchange event to fire and call history.replaceState
     24    let loaded = BrowserTestUtils.waitForLocationChange(
     25      gBrowser,
     26      TEST_URI + "#1"
     27    );
     28    await BrowserTestUtils.synthesizeMouseAtCenter("#link", {}, browser);
     29    await loaded;
     30 
     31    await assertMenulist([TEST_URI + "#1", TEST_URI]);
     32  });
     33 });