dom/tests/mochitest/whatwg/postMessage_idn_helper.html

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>
     3 <head>
     4   <title>postMessage IDN test page</title>
     5   <script type="application/javascript">
     6     function receiveMessage(evt)
     7     {
     8       var response = "idn-response";
    10       if (!(evt instanceof MessageEvent))
    11         response += " not-a-MessageEvent";
    12       if (evt.origin !== "http://mochi.test:8888")
    13         response += " wrong-sender-origin(" + evt.origin + ")";
    14       if (evt.data !== "idn-message")
    15         response += " wrong-data(" + evt.data + ")";
    16       if (evt.lastEventId !== "")
    17         response += " wrong-lastEventId(" + evt.lastEventId + ")";
    18       if (evt.source !== window.parent)
    19         response += " wrong-source";
    20       if (evt.target !== window)
    21         response += " wrong-target";
    22       if (evt.type !== "message")
    23         response += " wrong-type(" + evt.type + ")";
    25       evt.source.postMessage(response, evt.origin);
    26     }
    27     window.addEventListener("message", receiveMessage, false);
    29     function setup()
    30     {
    31       var target = document.getElementById("location");
    32       target.textContent = location.hostname + ":" + (location.port || 80);
    33     }
    35     window.addEventListener("load", setup, false);
    36   </script>
    37 </head>
    38 <body>
    39 <h1 id="location">No location!</h1>
    40 </body>
    41 </html>

mercurial