[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / before-unload-forbidden-navigation.html
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>
7
8 if (window.layoutTestController) {
9     layoutTestController.dumpAsText();
10     layoutTestController.dumpChildFramesAsText();
11     layoutTestController.waitUntilDone();
12 }
13
14 var log = document.getElementById('log');
15
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;
21         }
22         return;
23     }
24     iframe.done = true;
25     iframe.contentWindow.location.href = 'resources/before-unload-in-subframe-child.html';
26 }
27
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;
33 }
34
35 </script>
36 <iframe onload="test(this);" src="resources/before-unload-in-subframe-child.html"></iframe>
37 </body>
38 </html>