Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>postMessage IDN test page</title> |
michael@0 | 5 | <script type="application/javascript"> |
michael@0 | 6 | function receiveMessage(evt) |
michael@0 | 7 | { |
michael@0 | 8 | var response = "idn-response"; |
michael@0 | 9 | |
michael@0 | 10 | if (!(evt instanceof MessageEvent)) |
michael@0 | 11 | response += " not-a-MessageEvent"; |
michael@0 | 12 | if (evt.origin !== "http://mochi.test:8888") |
michael@0 | 13 | response += " wrong-sender-origin(" + evt.origin + ")"; |
michael@0 | 14 | if (evt.data !== "idn-message") |
michael@0 | 15 | response += " wrong-data(" + evt.data + ")"; |
michael@0 | 16 | if (evt.lastEventId !== "") |
michael@0 | 17 | response += " wrong-lastEventId(" + evt.lastEventId + ")"; |
michael@0 | 18 | if (evt.source !== window.parent) |
michael@0 | 19 | response += " wrong-source"; |
michael@0 | 20 | if (evt.target !== window) |
michael@0 | 21 | response += " wrong-target"; |
michael@0 | 22 | if (evt.type !== "message") |
michael@0 | 23 | response += " wrong-type(" + evt.type + ")"; |
michael@0 | 24 | |
michael@0 | 25 | evt.source.postMessage(response, evt.origin); |
michael@0 | 26 | } |
michael@0 | 27 | window.addEventListener("message", receiveMessage, false); |
michael@0 | 28 | |
michael@0 | 29 | function setup() |
michael@0 | 30 | { |
michael@0 | 31 | var target = document.getElementById("location"); |
michael@0 | 32 | target.textContent = location.hostname + ":" + (location.port || 80); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | window.addEventListener("load", setup, false); |
michael@0 | 36 | </script> |
michael@0 | 37 | </head> |
michael@0 | 38 | <body> |
michael@0 | 39 | <h1 id="location">No location!</h1> |
michael@0 | 40 | </body> |
michael@0 | 41 | </html> |