blob: 48d56e10922c3a6d7ce3daf2638c6225ecb7aedb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(true);
}
_confirmationDialogDisplayedOnce = false;
window.addEventListener("beforeunload", function() {
if (window._confirmationDialogDisplayedOnce)
return "Click 'Leave Page'";
window.setTimeout(function() {
if (window.testRunner)
testRunner.setShouldStayOnPageAfterHandlingBeforeUnload(false);
window.setTimeout(function() {
document.getElementById("console").innerHTML = "FAIL";
if (window.testRunner)
testRunner.notifyDone();
}, 1000);
document.forms[0].submit();
}, 0);
window._confirmationDialogDisplayedOnce = true;
return "Click 'Stay on Page'";
});
</script>
<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>
<div id="console"></div>
<form action="resources/pass-and-notify-done.html" method="POST">
</form>
<script>
document.forms[0].submit();
</script>
|