Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/loader/form-submission-after-beforeunload-cancel.html

Issue 2801813005: Only show a beforeunload dialog if a frame has had a user gesture since its load. (Closed)
Patch Set: one last bit Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698