[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / LayoutTests / fast / events / onbeforeunload-focused-iframe.html
1 <html>
2 <body>
3     New window with beforeUnload handler.<br>
4     You should see an alert with "beforeUnload" if you try to close the window.<br>
5     <iframe src="resources/onbeforeunload-focused-iframe-frame.html" id="focusedFrame"></iframe>
6     <script>
7         if (window.layoutTestController) {
8             layoutTestController.dumpAsText();
9             layoutTestController.dumpChildFramesAsText();
10             layoutTestController.waitUntilDone();
11         }
12
13         window.onbeforeunload = beforeUnload;
14         function beforeUnload()
15         {
16             alert("beforeUnload");
17             window.onbeforeunload = null;
18         }
19
20
21         function simulateCloseWindow()
22         {
23             if (window.layoutTestController) {
24                 // Simulate an attempt to close the window
25                 if (!layoutTestController.callShouldCloseOnWebView())
26                     alert("Should have run the beforeUnload handler.");
27                 layoutTestController.notifyDone();
28             }
29         }
30     </script>
31 </body>
32 </html>