tor-browser

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

test_postMessage_hash.html (1157B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4  <title>postMessage's interaction with hash URIs</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>        
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7  <base href="http://example.com/" />
      8 </head>
      9 <body>
     10 <p>(no bug; this is a preemptive test)</p>
     11 <p id="display"></p>
     12 <div id="content" style="display: none"></div>
     13 
     14 <iframe src="http://mochi.test:8888/tests/dom/tests/mochitest/whatwg/postMessage_hash.html#hash"
     15        name="kid"></iframe>
     16 
     17 <pre id="test">
     18 <script class="testbody" type="application/javascript">
     19 
     20 SimpleTest.waitForExplicitFinish();
     21 
     22 function receiveMessage(evt)
     23 {
     24  is(evt.origin, "http://mochi.test:8888", "wrong origin");
     25  ok(evt.source === window.frames.kid, "wrong source");
     26  is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
     27 
     28  is(evt.data, "response-message", "wrong data");
     29 
     30  SimpleTest.finish();
     31 }
     32 
     33 window.addEventListener("message", receiveMessage);
     34 
     35 function run()
     36 {
     37  window.frames.kid.postMessage("from-parent", "http://mochi.test:8888");
     38 }
     39 
     40 window.addEventListener("load", run);
     41 </script>
     42 </pre>
     43 </body>
     44 </html>