no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / docshell / test / browser / browser_bug1769189.js
blob08cb4f90025e4c61af54a5c6db60c23b3a7fa921
1 /* Any copyright is dedicated to the Public Domain.
2    http://creativecommons.org/publicdomain/zero/1.0/ */
4 "use strict";
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       });
17       is(initialState, null, "history.state should be initially null.");
19       let awaitPageShow = BrowserTestUtils.waitForContentEvent(
20         browser,
21         "pageshow"
22       );
23       BrowserReload();
24       await awaitPageShow;
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 });