test_bug1126851.html (1544B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1126851 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1126851</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1126851 */ 14 15 SimpleTest.waitForExplicitFinish(); 16 17 let gotUnload = false; 18 19 function runTest() { 20 win = window.open("file_bug1126851_post_unload.html", ""); 21 // Reload replaces the inner window so we cannot wait for win.onunload 22 // and instead must rely on messages from the popup. 23 window.onmessage = function() { 24 if (gotUnload) { 25 SimpleTest.finish(); 26 } else { 27 gotUnload = true; 28 ok(true, "got unload"); 29 win.close(); 30 } 31 } 32 // Bug 543435 caused there to be a resize event after `window.open` which 33 // is also there in other browsers. But now we must ensure to get the right 34 // resize event to avoid races. 35 let evt; 36 win.onresize = function(e) { 37 if (e == evt) { 38 win.location.reload(); 39 } 40 } 41 win.onload = function() { 42 evt = new win.Event("resize", { bubbles: true }); 43 win.document.dispatchEvent(evt); 44 } 45 } 46 47 48 </script> 49 </head> 50 <body onload="runTest()"> 51 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1126851">Mozilla Bug 1126851</a> 52 <p id="display"></p> 53 <div id="content" style="display: none"> 54 55 </div> 56 <pre id="test"> 57 </pre> 58 </body> 59 </html>