Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
-->
<window title="Mozilla Bug 799348"
<!-- test results are displayed in the html:body -->
target="_blank">Mozilla Bug 799348</a>
</body>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 799348 **/
SimpleTest.waitForExplicitFinish();
var gCalledOnload = false;
var myObserver = {
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
observe(win, topic) {
if (topic == "domwindowopened") {
ok(!gCalledOnload, "domwindowopened notification fired before onload");
win.addEventListener("load", function() {
gCalledOnload = true;
win.close();
});
} else if (topic == "domwindowclosed") {
ok(gCalledOnload, "should have called onload");
Services.ww.unregisterNotification(myObserver);
SimpleTest.finish();
} else {
ok(false, "unknown topic");
}
}
};
Services.ww.registerNotification(myObserver);
]]>
</script>
</window>