beforeunload.window.js (854B)
1 // In an earlier version of the HTML Standard, document open steps had "prompt 2 // to unload document" as a step. Test that this no longer happens. 3 4 async_test(t => { 5 const frame = document.body.appendChild(document.createElement("iframe")); 6 t.add_cleanup(() => frame.remove()); 7 frame.src = "/common/blank.html"; 8 frame.onload = t.step_func(() => { 9 frame.contentWindow.onbeforeunload = t.unreached_func("beforeunload should not be fired"); 10 frame.contentDocument.open(); 11 t.step_timeout(t.step_func_done(() => { 12 // If the beforeunload event has still not fired by this point, we 13 // consider the test a success. `frame.remove()` above will allow the 14 // `load` event to be fired on the top-level Window, thus unblocking 15 // testharness. 16 }), 500); 17 }); 18 }, "document.open() should not fire a beforeunload event");