Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that disables it given conditions:
- This WPT test may be referenced by the following Test IDs:
- /html/browsers/browsing-the-web/unloading-documents/prompt-and-unload-script-closeable.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>beforeunload and unload events fire after window.close() in script-closeable browsing context</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
beforeunload_fired = false;
var t = async_test();
onload = t.step_func(function() {
window.close();
});
onbeforeunload = t.step_func(function() {
beforeunload_fired = true;
});
onunload = t.step_func(function() {
assert_true(beforeunload_fired);
t.done()
});
</script>