Bug 1794567 [wpt PR 36396] - CSS highlight painting: no OffsetInContainerNode for...
[gecko.git] / testing / web-platform / tests / html / browsers / browsing-the-web / overlapping-navigations-and-traversals / tentative / cross-document-nav-same-document-nav.html
blob1b2aeaecfcc6f238e058cbe31fe9f0ce2acfa23d
1 <!DOCTYPE html>
2 <meta charset="utf-8">
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>
7 <!--
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.
11 -->
13 <body>
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()");
44 </script>