1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
6 add_task(async function test_beforeUnload_and_replaceState() {
7 await BrowserTestUtils.withNewTab(
10 url: "data:text/html,<script>window.addEventListener('beforeunload', () => { window.history.replaceState(true, ''); });</script>",
12 async function (browser) {
13 let initialState = await SpecialPowers.spawn(browser, [], () => {
14 return content.history.state;
17 is(initialState, null, "history.state should be initially null.");
19 let awaitPageShow = BrowserTestUtils.waitForContentEvent(
26 let updatedState = await SpecialPowers.spawn(browser, [], () => {
27 return content.history.state;
29 is(updatedState, true, "history.state should have been updated.");