2008-02-11 12:27:32 -08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>postMessage's interaction with hash URIs</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="browserFu.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
<base href="http://example.com/" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<p>(no bug; this is a preemptive test)</p>
|
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none"></div>
|
|
|
|
|
|
|
|
<iframe src="http://localhost:8888/tests/dom/tests/mochitest/whatwg/postMessage_hash.html#hash"
|
|
|
|
name="kid"></iframe>
|
|
|
|
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
function receiveMessage(evt)
|
|
|
|
{
|
2008-02-26 19:48:54 -08:00
|
|
|
is(evt.origin, "http://localhost:8888", "wrong origin");
|
2008-02-11 12:27:32 -08:00
|
|
|
ok(evt.source === window.frames.kid, "wrong source");
|
2008-05-02 12:26:47 -07:00
|
|
|
is(evt.lastEventId, "", "postMessage creates events with empty lastEventId");
|
2008-02-11 12:27:32 -08:00
|
|
|
|
|
|
|
is(evt.data, "response-message", "wrong data");
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
2008-05-02 12:26:47 -07:00
|
|
|
window.addEventListener("message", receiveMessage, false);
|
2008-02-11 12:27:32 -08:00
|
|
|
|
|
|
|
function run()
|
|
|
|
{
|
2008-05-02 12:26:47 -07:00
|
|
|
window.frames.kid.postMessage("from-parent", "http://localhost:8888");
|
2008-02-11 12:27:32 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
window.addEventListener("load", run, false);
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|