Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Errors

<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1126851</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 1126851 */
SimpleTest.waitForExplicitFinish();
let gotUnload = false;
function runTest() {
win = window.open("file_bug1126851_post_unload.html", "");
// Reload replaces the inner window so we cannot wait for win.onunload
// and instead must rely on messages from the popup.
window.onmessage = function() {
if (gotUnload) {
SimpleTest.finish();
} else {
gotUnload = true;
ok(true, "got unload");
win.close();
}
}
// Bug 543435 caused there to be a resize event after `window.open` which
// is also there in other browsers. But now we must ensure to get the right
// resize event to avoid races.
let evt;
win.onresize = function(e) {
if (e == evt) {
win.location.reload();
}
}
win.onload = function() {
evt = new win.Event("resize", { bubbles: true });
win.document.dispatchEvent(evt);
}
}
</script>
</head>
<body onload="runTest()">
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>