dom/tests/mochitest/whatwg/postMessage_origin_helper.xhtml

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.

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

mercurial