2008-01-30 04:31:29 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>postMessage IDN test page</title>
|
|
|
|
<script type="application/javascript">
|
|
|
|
function receiveMessage(evt)
|
|
|
|
{
|
|
|
|
var response = "idn-response";
|
|
|
|
|
|
|
|
if (!(evt instanceof MessageEvent))
|
|
|
|
response += " not-a-MessageEvent";
|
2010-03-13 00:53:36 +03:00
|
|
|
if (evt.origin !== "http://mochi.test:8888")
|
2008-02-27 06:48:54 +03:00
|
|
|
response += " wrong-sender-origin(" + evt.origin + ")";
|
2008-01-30 04:31:29 +03:00
|
|
|
if (evt.data !== "idn-message")
|
|
|
|
response += " wrong-data(" + evt.data + ")";
|
2008-05-02 23:26:47 +04:00
|
|
|
if (evt.lastEventId !== "")
|
|
|
|
response += " wrong-lastEventId(" + evt.lastEventId + ")";
|
2008-01-30 04:31:29 +03:00
|
|
|
if (evt.source !== window.parent)
|
|
|
|
response += " wrong-source";
|
2008-05-02 23:26:47 +04:00
|
|
|
if (evt.target !== window)
|
2008-01-30 04:31:29 +03:00
|
|
|
response += " wrong-target";
|
|
|
|
if (evt.type !== "message")
|
|
|
|
response += " wrong-type(" + evt.type + ")";
|
|
|
|
|
2008-05-02 23:26:47 +04:00
|
|
|
evt.source.postMessage(response, evt.origin);
|
2008-01-30 04:31:29 +03:00
|
|
|
}
|
2008-05-02 23:26:47 +04:00
|
|
|
window.addEventListener("message", receiveMessage, false);
|
2008-01-30 04:31:29 +03:00
|
|
|
|
|
|
|
function setup()
|
|
|
|
{
|
|
|
|
var target = document.getElementById("location");
|
2008-05-02 23:26:47 +04:00
|
|
|
target.textContent = location.hostname + ":" + (location.port || 80);
|
2008-01-30 04:31:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener("load", setup, false);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1 id="location">No location!</h1>
|
|
|
|
</body>
|
|
|
|
</html>
|