tor-browser

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

browser_bug1769189.js (993B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 add_task(async function test_beforeUnload_and_replaceState() {
      7  await BrowserTestUtils.withNewTab(
      8    {
      9      gBrowser,
     10      url: "data:text/html,<script>window.addEventListener('beforeunload', () => { window.history.replaceState(true, ''); });</script>",
     11    },
     12    async function (browser) {
     13      let initialState = await SpecialPowers.spawn(browser, [], () => {
     14        return content.history.state;
     15      });
     16 
     17      is(initialState, null, "history.state should be initially null.");
     18 
     19      let awaitPageShow = BrowserTestUtils.waitForContentEvent(
     20        browser,
     21        "pageshow"
     22      );
     23      BrowserCommands.reload();
     24      await awaitPageShow;
     25 
     26      let updatedState = await SpecialPowers.spawn(browser, [], () => {
     27        return content.history.state;
     28      });
     29      is(updatedState, true, "history.state should have been updated.");
     30    }
     31  );
     32 });