tor-browser

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

navigate-window-open.html (1187B)


      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 <script>
      6 async_test(t => {
      7  window.onload = t.step_func(() => {
      8    navigation.onnavigate = t.step_func_done(() => {
      9      assert_unreached("onnavigate should not have fired in source window");
     10    });
     11    iframe.contentWindow.navigation.onnavigate = t.step_func_done(e => {
     12      assert_equals(e.navigationType, "push");
     13      assert_true(e.cancelable);
     14      assert_true(e.canIntercept);
     15      assert_false(e.userInitiated);
     16      assert_true(e.hashChange);
     17      assert_equals(e.downloadRequest, null);
     18      assert_equals(new URL(e.destination.url).hash, "#1");
     19      assert_true(e.destination.sameDocument);
     20      assert_equals(e.destination.key, "");
     21      assert_equals(e.destination.id, "");
     22      assert_equals(e.destination.index, -1);
     23      assert_equals(e.formData, null);
     24      assert_equals(e.sourceElement, null);
     25      e.preventDefault();
     26    });
     27 
     28    window.open("/common/blank.html#1", "i");
     29  });
     30 }, "window.open() fires navigate event in target window but not source");
     31 </script>