Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <p>This test ensures navigation is forbidden while beforeunload event is being f ired. You should see PASS 1/2 and PASS 2/2 below:</p> | 4 <p>This test ensures navigation is forbidden while beforeunload event is being f ired. You should see PASS 1/2 and PASS 2/2 below:</p> |
| 5 <pre id="log">FAIL</pre> | 5 <pre id="log">FAIL</pre> |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 if (window.testRunner) { | 8 if (window.testRunner) { |
| 9 testRunner.dumpAsText(); | 9 testRunner.dumpAsText(); |
| 10 testRunner.dumpChildFramesAsText(); | 10 testRunner.dumpChildFramesAsText(); |
| 11 testRunner.waitUntilDone(); | 11 testRunner.waitUntilDone(); |
| 12 } | 12 } |
| 13 | 13 |
| 14 var log = document.getElementById('log'); | 14 var log = document.getElementById('log'); |
| 15 | 15 |
| 16 function test(iframe) { | 16 function test(iframe) { |
| 17 if (iframe.done) { | 17 if (iframe.done) { |
| 18 if (iframe.halfPassed) { | 18 if (iframe.halfPassed) { |
| 19 iframe.contentWindow.location.href = 'resources/before-unload-in-sub frame-destination.html'; | 19 iframe.contentWindow.location.href = 'resources/before-unload-in-sub frame-destination.html'; |
| 20 iframe.halfPassed = false; | 20 iframe.halfPassed = false; |
| 21 } | 21 } |
| 22 return; | 22 return; |
| 23 } | 23 } |
| 24 iframe.done = true; | 24 iframe.done = true; |
| 25 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-ch ild.html'; | 25 iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-ch ild.html'; |
| 26 } | 26 } |
| 27 | 27 |
| 28 function fired(contentWindow) { | 28 function fired(contentWindow) { |
| 29 location.href = 'resources/before-unload-in-subframe-fail.html'; | |
|
lfg
2016/11/10 00:15:04
This test was navigating the top-level frame in th
| |
| 30 contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html '; | 29 contentWindow.location.href = 'resources/before-unload-in-subframe-fail.html '; |
| 31 log.innerHTML = 'PASS 1/2'; | 30 log.innerHTML = 'PASS 1/2'; |
| 32 contentWindow.frameElement.halfPassed = true; | 31 contentWindow.frameElement.halfPassed = true; |
| 33 } | 32 } |
| 34 | 33 |
| 35 </script> | 34 </script> |
| 36 <iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html "></iframe> | 35 <iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html "></iframe> |
| 37 </body> | 36 </body> |
| 38 </html> | 37 </html> |
| OLD | NEW |