2 if (window.testRunner) {
3 testRunner.waitUntilDone();
4 testRunner.dumpAsText();
5 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
8 _confirmationDialogDisplayedOnce = false;
10 window.onbeforeunload = function() {
12 if (window._confirmationDialogDisplayedOnce)
13 return "Click 'Leave Page'";
15 window.setTimeout(function() {
16 if (window.testRunner)
17 testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false);
19 window.setTimeout(function() {
20 document.getElementById("console").innerHTML = "FAIL";
21 if (window.testRunner)
22 testRunner.notifyDone();
25 document.forms[0].submit();
28 window._confirmationDialogDisplayedOnce = true;
30 return "Click 'Stay on Page'";
34 <p>This tests that submitting a form a second time after canceling the first submission in a onbeforeunload handler is allowed. To test manually, follow the instructions in the JavaScript confirmation dialogs.</p>
36 <div id="console"></div>
38 <form action="resources/pass-and-notify-done.html" method="POST">
42 document.forms[0].submit();