Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / before-unload-forbidden-navigation.html
blobcdbf9b70cdfe406f6531bb535c67da355eb6f7d4
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>This test ensures navigation is forbidden while beforeunload event is being fired. You should see PASS 1/2 and PASS 2/2 below:</p>
5 <pre id="log">FAIL</pre>
6 <script>
8 if (window.testRunner) {
9 testRunner.dumpAsText();
10 testRunner.dumpChildFramesAsText();
11 testRunner.waitUntilDone();
14 var log = document.getElementById('log');
16 function test(iframe) {
17 if (iframe.done) {
18 if (iframe.halfPassed) {
19 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-destination.html';
20 iframe.halfPassed = false;
22 return;
24 iframe.done = true;
25 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
28 function fired(contentWindow) {
29 location.href = 'resources/before-unload-in-subframe-fail.html';
30 contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html';
31 log.innerHTML = 'PASS 1/2';
32 contentWindow.frameElement.halfPassed = true;
35 </script>
36 <iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html"></iframe>
37 </body>
38 </html>