2008-01-29 17:31:29 -08: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-12 13:53:36 -08:00
|
|
|
if (evt.origin !== "http://mochi.test:8888")
|
2008-02-26 19:48:54 -08:00
|
|
|
response += " wrong-sender-origin(" + evt.origin + ")";
|
2008-01-29 17:31:29 -08:00
|
|
|
if (evt.data !== "idn-message")
|
|
|
|
response += " wrong-data(" + evt.data + ")";
|
2008-05-02 12:26:47 -07:00
|
|
|
if (evt.lastEventId !== "")
|
|
|
|
response += " wrong-lastEventId(" + evt.lastEventId + ")";
|
2008-01-29 17:31:29 -08:00
|
|
|
if (evt.source !== window.parent)
|
|
|
|
response += " wrong-source";
|
2008-05-02 12:26:47 -07:00
|
|
|
if (evt.target !== window)
|
2008-01-29 17:31:29 -08:00
|
|
|
response += " wrong-target";
|
|
|
|
if (evt.type !== "message")
|
|
|
|
response += " wrong-type(" + evt.type + ")";
|
|
|
|
|
2008-05-02 12:26:47 -07:00
|
|
|
evt.source.postMessage(response, evt.origin);
|
2008-01-29 17:31:29 -08:00
|
|
|
}
|
2008-05-02 12:26:47 -07:00
|
|
|
window.addEventListener("message", receiveMessage, false);
|
2008-01-29 17:31:29 -08:00
|
|
|
|
|
|
|
function setup()
|
|
|
|
{
|
|
|
|
var target = document.getElementById("location");
|
2008-05-02 12:26:47 -07:00
|
|
|
target.textContent = location.hostname + ":" + (location.port || 80);
|
2008-01-29 17:31:29 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener("load", setup, false);
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h1 id="location">No location!</h1>
|
|
|
|
</body>
|
|
|
|
</html>
|