3 <title>Cross-document navigation after a same-document navigation
</title>
4 <script src=
"/resources/testharness.js"></script>
5 <script src=
"/resources/testharnessreport.js"></script>
8 According to the spec, the "URL and history update steps" (used by
9 pushState()) and the fragment navigation steps, both cancel any ongoing
10 history traversals, but do *not* cancel any ongoing navigations.
14 <script type=
"module">
15 import { createIframe, waitForLoad } from
"./resources/helpers.mjs";
17 promise_test(async t =
> {
18 const iframe = await createIframe(t);
20 iframe.contentWindow.location.search =
"?1";
21 iframe.contentWindow.location.hash =
"#2";
23 assert_equals(iframe.contentWindow.location.search,
"");
24 assert_equals(iframe.contentWindow.location.hash,
"#2");
26 await waitForLoad(iframe);
27 assert_equals(iframe.contentWindow.location.search,
"?1");
28 assert_equals(iframe.contentWindow.location.hash,
"");
29 },
"cross-document navigation then fragment navigation");
31 promise_test(async t =
> {
32 const iframe = await createIframe(t);
34 iframe.contentWindow.location.search =
"?1";
35 iframe.contentWindow.history.pushState(null,
"",
"/2");
37 assert_equals(iframe.contentWindow.location.search,
"");
38 assert_equals(iframe.contentWindow.location.pathname,
"/2");
40 await waitForLoad(iframe);
41 assert_equals(iframe.contentWindow.location.search,
"?1");
42 assert_equals(iframe.contentWindow.location.pathname,
"/common/blank.html");
43 },
"cross-document navigation then pushState()");