tor-browser

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

broadcastchannel-incumbent.sub.html (1159B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>The incumbent page being cross-origin must not prevent the BroadcastChannel message from being seen</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 
      7 <!-- This is the entry global -->
      8 
      9 <iframe src="http://{{hosts[][www]}}:{{ports[http][0]}}/webmessaging/multi-globals/support/incumbent-document-domain.sub.html" id="incumbent"></iframe>
     10 <iframe src="support/current-document-domain.sub.html" id="current"></iframe>
     11 
     12 <script>
     13 "use strict";
     14 document.domain = "{{hosts[][]}}";
     15 
     16 setup({ explicit_done: true });
     17 
     18 const incumbentIframe = document.querySelector("#incumbent");
     19 const currentIframe = document.querySelector("#current");
     20 
     21 window.onload = () => {
     22  async_test(t => {
     23    const createdThroughCrossOrigin = frames[0].createBroadcastChannel("incumbent");
     24    const createdSameOrigin = new BroadcastChannel("incumbent");
     25 
     26    createdSameOrigin.onmessage = () => t.done();
     27    createdSameOrigin.onmessageerror = t.unreached_func("messageerror event fired");
     28 
     29    createdThroughCrossOrigin.postMessage("the message");
     30  });
     31 
     32  done();
     33 };
     34 </script>