tor-browser

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

cross-document-nav-same-document-nav.html (1537B)


      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>
      6 
      7 <!--
      8  According to the spec, the "URL and history update steps" (used by
      9  pushState()) and the fragment navigation steps, do *not* modify the ongoing
     10  navigation, i.e. do not cancel any navigations.
     11 -->
     12 
     13 <body>
     14 <script type="module">
     15 import { createIframe, waitForLoad } from "./resources/helpers.mjs";
     16 
     17 promise_test(async t => {
     18  const iframe = await createIframe(t);
     19 
     20  iframe.contentWindow.location.search = "?1";
     21  iframe.contentWindow.location.hash = "#2";
     22 
     23  assert_equals(iframe.contentWindow.location.search, "");
     24  assert_equals(iframe.contentWindow.location.hash, "#2");
     25 
     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");
     30 
     31 promise_test(async t => {
     32  const iframe = await createIframe(t);
     33 
     34  iframe.contentWindow.location.search = "?1";
     35  iframe.contentWindow.history.pushState(null, "", "/2");
     36 
     37  assert_equals(iframe.contentWindow.location.search, "");
     38  assert_equals(iframe.contentWindow.location.pathname, "/2");
     39 
     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>