summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html
blob: 06aba08af61f573270f02fb36fb4575b5ce7375f (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
<!DOCTYPE HTML>
<script>
 var t = opener.t;
 var do_test = t.step_func(function() {
   localStorage.test6564729 += 'B';
   var d = document;
   var e = document.open(); // unload triggered here - beforeunload C, D in 004b; pagehide E, unload F, pagehide G in 004b, unload HIJK in 004b
   localStorage.test6564729 += (e == d) ? 'L' : 'Y';
   var s = 'FAIL if you see this | ' + localStorage.test6564729;
   document.write(s);
   localStorage.test6564729 += document.body.textContent == s ? 'M' : 'y';
   document.close();
   localStorage.test6564729 += 'N';
   location = '004a.html'; // unload triggers again here, but they're not registered event listeners any more
 })
onload = t.step_func(function() {
  localStorage.test6564729 = 'A';
  setTimeout(t.step_func(function() {document.getElementsByTagName("input")[0].click()}), 100);
})
</script>
<body onbeforeunload="localStorage.test6564729 += 'C'"
      onpagehide="localStorage.test6564729 += 'E'"
      onunload="localStorage.test6564729 += 'F'">
<input type=button value="Activate this button to run the test" onclick="do_test()">
<p><iframe src="004b.html"></iframe>