| <!DOCTYPE html> |
| <html> |
| <body> |
| <p> |
| Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=28633">Bug 28633 - Submitting a form with target=_blank works only once</a> |
| </p> |
| <p> |
| This test will click the first submit button twice, then press the space bar on the second submit button twice. Both should popup two blank windows. |
| </p> |
| <form action="resources/submit-to-blank-multiple-times-form-action.html" target="_blank"> |
| <input name="nextOp" id="nextOp" type="hidden"> |
| <input name="submit" id="submit" type="submit"> |
| </form> |
| <form action="resources/submit-to-blank-multiple-times-form-action.html" target="_blank"> |
| <input name="nextOp" id="nextOpKey" type="hidden"> |
| <input name="submit" id="submitKey" type="submit"> |
| </form> |
| <div id="console"></div> |
| <script type="text/javascript"> |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setCanOpenWindows(); |
| testRunner.setCloseRemainingWindowsWhenComplete(); |
| testRunner.waitUntilDone(); |
| } |
| var numberTimesToClick = 2; |
| var numberTimesToSpace = 2; |
| window.onload = function() { |
| if (!window.testRunner || !window.eventSender) |
| return; |
| |
| click(); |
| }; |
| function log(message) { |
| var span = document.createElement("span"); |
| span.innerHTML = message + "<br>"; |
| document.getElementById("console").appendChild(span); |
| } |
| function click() { |
| log("Clicking first button, should open new window"); |
| var button = document.getElementById("submit"); |
| var x = button.offsetLeft + button.offsetWidth/2; |
| var y = button.offsetTop + button.offsetHeight/2; |
| |
| numberTimesToClick--; |
| if (numberTimesToClick > 0) |
| document.getElementById("nextOp").value = "click"; |
| else |
| document.getElementById("nextOp").value = "space"; |
| eventSender.mouseMoveTo(x, y); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| function pressSpace() { |
| log("Pressing space on second button, should open new window"); |
| var button = document.getElementById("submitKey"); |
| |
| numberTimesToSpace--; |
| if (numberTimesToSpace > 0) |
| document.getElementById("nextOpKey").value = "space"; |
| else |
| document.getElementById("nextOpKey").value = "notifyDone"; |
| button.focus(); |
| eventSender.keyDown(' '); |
| } |
| function notifyDone() { |
| testRunner.notifyDone(); |
| } |
| </script> |
| </body> |
| </html> |