tor-browser

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

location-samedocument-crossorigin-sameorigindomain.sub.html (1467B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <body>
      5 
      6 <script>
      7 document.domain = "{{host}}";
      8 async_test(t => {
      9  const url = new URL("resources/document-domain-setter.sub.html", location.href);
     10  url.hostname = "{{domains[www1]}}";
     11  const iframe = document.createElement("iframe");
     12  iframe.src = url;
     13  document.body.append(iframe);
     14 
     15  navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window");
     16  window.onload = t.step_func(() => {
     17    iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => {
     18      assert_equals(e.navigationType, "push", "navigationType");
     19      assert_true(e.cancelable, "cancelable");
     20      assert_true(e.canIntercept, "canIntercept");
     21      assert_false(e.userInitiated, "userInitiated");
     22      assert_true(e.hashChange, "hashChange");
     23      assert_equals(e.formData, null, "formData");
     24      assert_equals(e.destination.url, iframe.src + "#foo", "destination.url");
     25      assert_true(e.destination.sameDocument, "destination.sameDocument");
     26      assert_equals(e.destination.key, "", "destination.key");
     27      assert_equals(e.destination.id, "", "destination.id");
     28      assert_equals(e.destination.index, -1, "destination.index");
     29    });
     30 
     31    iframe.contentWindow.location.href = url + "#foo";
     32  });
     33 }, "using location.href to navigate same-document targeting a same-origin-domain (but cross-origin) window");
     34 </script>