tor-browser

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

click-crossdocument-crossorigin.html (1069B)


      1 <!doctype html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="/resources/testharnessreport.js"></script>
      4 <script src="/common/get-host-info.sub.js"></script>
      5 <body>
      6 
      7 <script>
      8 async_test(t => {
      9  const url = new URL("resources/cross-origin-iframe-helper.html", location.href);
     10  url.hostname = get_host_info().REMOTE_HOST;
     11  const iframe = document.createElement("iframe");
     12  iframe.src = url;
     13  iframe.name = "windowname";
     14  document.body.append(iframe);
     15 
     16  url.search = "?postMessage-top-when-done";
     17  const link = document.createElement("a");
     18  link.href = url;
     19  link.target = iframe.name;
     20  document.body.append(link);
     21 
     22  window.onmessage = t.step_func_done(e => {
     23    // If we hit onnavigate in the target window, we'll get a different message, and fail.
     24    assert_equals(e.data, "DONE");
     25  });
     26 
     27  navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window");
     28  window.onload = t.step_func(() => link.click());
     29 }, "clicking on an <a> element that navigates cross-document targeting a cross-origin window");
     30 </script>