summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt-and-unload-script-uncloseable.html
blob: f6a17d740b5cc25af1acfeb7d50d223e96ee35d8 (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
<!doctype html>
<title>beforeunload and unload events do not fire after window.close() in script-uncloseable browsing context</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
var beforeunload_fired = false;
var unload_fired = false;
var t = async_test();

onload = t.step_func(function() {
  var iframe = document.getElementsByTagName("iframe")[0]
  iframe.onload = t.step_func(function() {
    iframe.contentWindow.close()
    t.step_timeout(function() {
      assert_false(beforeunload_fired);
      assert_false(unload_fired);
      t.done();
    }, 1000);
  });
  iframe.src = "prompt-and-unload-script-uncloseable-1.html";
});
</script>
<iframe></iframe>