tor-browser

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

open-crossdocument-crossorigin.html (964B)


      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 iframeURL = new URL("resources/cross-origin-iframe-helper.html", location.href);
     10  iframeURL.hostname = get_host_info().REMOTE_HOST;
     11  const iframe = document.createElement("iframe");
     12  iframe.src = iframeURL;
     13  iframe.name = "windowname";
     14  document.body.append(iframe);
     15 
     16  window.onmessage = t.step_func_done(e => {
     17    // If we hit onnavigate in the target window, we'll get a different message, and fail.
     18    assert_equals(e.data, "DONE");
     19  });
     20 
     21  navigation.onnavigate = t.unreached_func("onnavigate must not fire in the source window");
     22  window.onload = t.step_func(() => window.open(iframeURL + "?postMessage-top-when-done", "windowname"));
     23 }, "using window.open() to navigate cross-document targeting a cross-origin window");
     24 </script>