OLD | NEW |
1 <script> | 1 <script> |
2 if (window.testRunner) { | 2 if (window.testRunner) { |
3 testRunner.waitUntilDone(); | 3 testRunner.waitUntilDone(); |
4 testRunner.dumpAsText(); | 4 testRunner.dumpAsText(); |
5 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); | 5 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true); |
6 } | 6 } |
7 | 7 |
| 8 // JavaScript onbeforeunload dialogs require a user gesture. |
| 9 if (window.eventSender) { |
| 10 eventSender.mouseMoveTo(5, 5); |
| 11 eventSender.mouseDown(); |
| 12 eventSender.mouseUp(); |
| 13 } |
| 14 |
8 _confirmationDialogDisplayedOnce = false; | 15 _confirmationDialogDisplayedOnce = false; |
9 | 16 |
10 window.onbeforeunload = function() { | 17 window.onbeforeunload = function() { |
11 | 18 |
12 if (window._confirmationDialogDisplayedOnce) | 19 if (window._confirmationDialogDisplayedOnce) |
13 return "Click 'Leave Page'"; | 20 return "Click 'Leave Page'"; |
14 | 21 |
15 window.setTimeout(function() { | 22 window.setTimeout(function() { |
16 if (window.testRunner) | 23 if (window.testRunner) |
17 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false); | 24 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false); |
(...skipping 16 matching lines...) Expand all Loading... |
34 <p>This tests that submitting a form a second time after canceling the first sub
mission in a onbeforeunload handler is allowed. To test manually, follow the ins
tructions in the JavaScript confirmation dialogs.</p> | 41 <p>This tests that submitting a form a second time after canceling the first sub
mission in a onbeforeunload handler is allowed. To test manually, follow the ins
tructions in the JavaScript confirmation dialogs.</p> |
35 | 42 |
36 <div id="console"></div> | 43 <div id="console"></div> |
37 | 44 |
38 <form action="resources/pass-and-notify-done.html" method="POST"> | 45 <form action="resources/pass-and-notify-done.html" method="POST"> |
39 </form> | 46 </form> |
40 | 47 |
41 <script> | 48 <script> |
42 document.forms[0].submit(); | 49 document.forms[0].submit(); |
43 </script> | 50 </script> |
OLD | NEW |