Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/browsers/browsing-the-web/unloading-documents/prompt/004.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>salvagable state of document after setting beforeunload listener</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var t = async_test();
var loaded = false;
var beforeunload_fired = false;
var timeout_fired = false;
function start_test() {
step_timeout(
t.step_func(function() {
assert_true(beforeunload_fired);
assert_false(timeout_fired);
t.done()
}), 1000);
}
onload = function() {
var iframe = document.getElementsByTagName("iframe")[0]
onload = null;
iframe.src="004-1.html?" + Math.random();
};
</script>
<iframe></iframe>