dom/tests/mochitest/whatwg/postMessage_idn_helper.html

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     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