summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/004.html
blob: 7076a4dd18e5250e677a6ba6eaaf8e85cc061c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!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>