5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.setCanOpenWindows();
8 testRunner
.waitUntilDone();
11 addEventListener('message', function(e
) {
12 simulateClick('button2');
20 simulateClick('button1');
23 function simulateClick(id
)
25 var rect
= document
.getElementById(id
).getBoundingClientRect();
26 eventSender
.mouseMoveTo(rect
.left
+ rect
.width
/ 2, rect
.top
+ rect
.height
/ 2);
27 eventSender
.mouseDown();
28 eventSender
.mouseUp();
31 function submitTo(target
)
33 document
.test
.target
= target
;
34 document
.test
.submit();
39 <body onload=
"runTest()">
40 <p>This test ensures that multiple form submission protection is correctly reset on mouse events. To test manually:
42 <li>Click on
"Click 1" to submit form to a new window. The window will close immediately.
43 <li>Click on
"Click 2" to submit form to this window. Single word
"SUCCESS" should replace the contents of this document.
45 <p>If either event doesn't occur, the test has failed.
46 <form method=
"post" name=
"test" action=
"data:text/html,<script>if (opener) { opener.postMessage('trololo', '*'); window.close(); } else { document.write('SUCCESS'); window.testRunner && testRunner.notifyDone(); }</script>">
47 <input type
="button" id
="button1" value
="Click 1" onclick
="submitTo('_new')">
48 <input type
="button" id
="button2" value
="Click 2" onclick
="submitTo('_self')">