2 var waitingForClose
= true;
3 window
.addEventListener('beforeunload', function() {
8 window
.onload = function() {
9 // There's no real way to know whether the iframe's attempt to close us
10 // actually failed because it would succeed asynchronously and there is no
11 // failure event. The best we can do is wait around for a while. The one
12 // saving grace is that this test is deterministic when it passes.
13 window
.setTimeout(function() {
14 waitingForClose
= false;
19 <iframe sandbox=
"allow-scripts" src=
"close-top.html"></iframe>