tor-browser

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

navigate-anchor-with-target.html (1261B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <iframe id="iframe" name="i" src="/common/blank.html"></iframe>
      5 <a id="a" href="foo.html" target="i"></a>
      6 <script>
      7 async_test(t => {
      8  window.onload = t.step_func(() => {
      9    navigation.onnavigate = t.step_func_done(() => {
     10      assert_unreached("onnavigate should not have fired in source window");
     11    });
     12    iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => {
     13      assert_equals(e.navigationType, "push");
     14      assert_true(e.cancelable);
     15      assert_true(e.canIntercept);
     16      assert_false(e.userInitiated);
     17      assert_false(e.hashChange);
     18      assert_equals(e.formData, null);
     19      assert_equals(e.downloadRequest, null);
     20      assert_equals(new URL(e.destination.url).pathname,
     21                    "/navigation-api/navigate-event/foo.html");
     22      assert_false(e.destination.sameDocument);
     23      assert_equals(e.destination.key, "");
     24      assert_equals(e.destination.id, "");
     25      assert_equals(e.destination.index, -1);
     26      assert_equals(e.sourceElement, a);
     27      e.preventDefault();
     28    });
     29    a.click();
     30  });
     31 }, "<a> with a target fires navigate event in target window but not source");
     32 </script>