| <html> |
| <head> |
| <script> |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setCanOpenWindows(); |
| testRunner.waitUntilDone(); |
| } |
| |
| addEventListener('message', function(e) { |
| simulateClick('button2'); |
| }, false); |
| |
| function runTest() |
| { |
| if (!eventSender) |
| return; |
| |
| simulateClick('button1'); |
| } |
| |
| function simulateClick(id) |
| { |
| var rect = document.getElementById(id).getBoundingClientRect(); |
| eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| |
| function submitTo(target) |
| { |
| document.test.target = target; |
| document.test.submit(); |
| } |
| |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <p>This test ensures that multiple form submission protection is correctly reset on mouse events. To test manually: |
| <ol> |
| <li>Click on "Click 1" to submit form to a new window. The window will close immediately. |
| <li>Click on "Click 2" to submit form to this window. Single word "SUCCESS" should replace the contents of this document. |
| </ol> |
| <p>If either event doesn't occur, the test has failed. |
| <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>"> |
| <input type="button" id="button1" value="Click 1" onclick="submitTo('_new')"> |
| <input type="button" id="button2" value="Click 2" onclick="submitTo('_self')"> |
| </form> |
| </body> |
| </html> |