tor-browser

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

click-crossdocument-sameorigin.html (1285B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 
      5 <a id="link" href="/common/blank.html?foo" target="windowname">Click me</a>
      6 <iframe id="i" name="windowname" src="/common/blank.html"></iframe>
      7 
      8 <script>
      9 async_test(t => {
     10  navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window");
     11  window.onload = t.step_func(() => {
     12    i.contentWindow.navigation.onnavigate = t.step_func_done(e => {
     13      assert_equals(e.navigationType, "push", "navigationType");
     14      assert_true(e.cancelable, "cancelable");
     15      assert_true(e.canIntercept, "canIntercept");
     16      assert_false(e.userInitiated, "userInitiated");
     17      assert_false(e.hashChange, "hashChange");
     18      assert_equals(e.formData, null, "formData");
     19      assert_equals(e.destination.url, link.href, "destination.url");
     20      assert_false(e.destination.sameDocument, "destination.sameDocument");
     21      assert_equals(e.destination.key, "", "destination.key");
     22      assert_equals(e.destination.id, "", "destination.id");
     23      assert_equals(e.destination.index, -1, "destination.index");
     24    });
     25 
     26    link.click();
     27  });
     28 }, "clicking on an <a> element that navigates cross-document targeting a same-origin window");
     29 </script>