dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE html>
     2 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <head>
     4   <title>postMessage origin-testing helper page</title>
     5   <script type="application/javascript"><![CDATA[
     6 function receiveMessage(evt)
     7 {
     8   var response = "PASS";
    10   if (evt.origin !== "http://mochi.test:8888")
    11     response += " wrong-origin(" + evt.origin + ")";
    12   if (evt.source !== window.parent)
    13     response += " wrong-source";
    14   if (evt.data !== "PASS")
    15     response += " wrong-data(" + evt.data + ")";
    17   window.parent.postMessage(response, "http://mochi.test:8888");
    18 }
    20 window.addEventListener("message", receiveMessage, false);
    23 // Aids for identifying origins
    25 function setup()
    26 {
    27   var target = document.getElementById("location");
    28   target.textContent = location.hostname + ":" + (location.port || 80);
    29 }
    31 window.addEventListener("load", setup, false);
    32   ]]></script>
    33 </head>
    34 <body>
    35 <h1 id="location">No location!</h1>
    36 </body>
    37 </html>

mercurial