gecko/content/base/test/chrome/file_bug549682.xul

46 lines
1.5 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=549682
-->
<window title="Mozilla Bug 549682"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="run()">
<label value="Mozilla Bug 549682"/>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
var didRunAsync = false;
function asyncL(m) {
didRunAsync = true;
opener.wrappedJSObject.is(m.name, "async", "Wrong message!");
opener.wrappedJSObject.is(m.json.data, 1234, "Wrong data!");
}
function syncL(m) {
opener.wrappedJSObject.is(m.name, "sync", "Wrong message!");
opener.wrappedJSObject.is(m.json.data, 1234, "Wrong data!");
opener.wrappedJSObject.ok(didRunAsync, "Should have run async!");
opener.setTimeout("done()", 0);
var i = document.getElementById("ifr");
i.parentNode.removeChild(i); // This is a crash test!
window.close();
}
function loadScript() {
// Async should be prosessed first!
messageManager.loadFrameScript("data:,sendAsyncMessage('async', { data: 1234 }); sendSyncMessage('sync', { data: 1234 });", true);
}
function run() {
messageManager.addMessageListener("async", asyncL);
messageManager.addMessageListener("sync", syncL);
setTimeout(loadScript, 0);
}
]]></script>
<browser type="content" src="about:blank" id="ifr"/>
</window>