Title: [95226] trunk
Revision
95226
Author
jon...@apple.com
Date
2011-09-15 14:04:09 -0700 (Thu, 15 Sep 2011)

Log Message

Submitting a form with target=_blank works only once
https://bugs.webkit.org/show_bug.cgi?id=28633
<rdar://problem/7357787>

Reviewed by Andy Estes.

Source/WebCore:

Test: fast/forms/submit-to-blank-multiple-times.html

The call to reset the multiple form submission bool is pushed down from the mouseDown handler to
handleMousePressEvent(), to include WK2 coverage, similar to keyEvent.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleMousePressEvent):
(WebCore::EventHandler::keyEvent): clarified old FIXME comment. Both key events and mouse events
may submit a form multiple times, but the call to reset the handler should probably be in another
abstraction layer.
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::mouseDown):

Source/WebKit/chromium:

* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::mouseDown): Remove call to resetMultipleFormSubmissionProtection() since
it will be made in platform-independent function EventHandler::handleMousePressEvent().

LayoutTests:

New test that simulates mouse clicking submit button twice (which didn't work), as well as using the keyboard twice (which did work).

* fast/forms/resources/submit-to-blank-multiple-times-form-action.html: Added.
* fast/forms/submit-to-blank-multiple-times-expected.txt: Added.
* fast/forms/submit-to-blank-multiple-times.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95225 => 95226)


--- trunk/LayoutTests/ChangeLog	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/LayoutTests/ChangeLog	2011-09-15 21:04:09 UTC (rev 95226)
@@ -1,3 +1,17 @@
+2011-09-15  Jon Lee  <jon...@apple.com>
+
+        Submitting a form with target=_blank works only once
+        https://bugs.webkit.org/show_bug.cgi?id=28633
+        <rdar://problem/7357787>
+
+        Reviewed by Andy Estes.
+
+        New test that simulates mouse clicking submit button twice (which didn't work), as well as using the keyboard twice (which did work).
+
+        * fast/forms/resources/submit-to-blank-multiple-times-form-action.html: Added.
+        * fast/forms/submit-to-blank-multiple-times-expected.txt: Added.
+        * fast/forms/submit-to-blank-multiple-times.html: Added.
+
 2011-09-15  David Levin  <le...@chromium.org>
 
         [chromium] Add missing GPU-CG to one of the expectations.

Added: trunk/LayoutTests/fast/forms/resources/submit-to-blank-multiple-times-form-action.html (0 => 95226)


--- trunk/LayoutTests/fast/forms/resources/submit-to-blank-multiple-times-form-action.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/resources/submit-to-blank-multiple-times-form-action.html	2011-09-15 21:04:09 UTC (rev 95226)
@@ -0,0 +1,17 @@
+<script>
+if (opener) {
+    opener.log("PASS");
+
+    var result = {}, queryString = location.search.substring(1),
+        re = /([^&=]+)=([^&]*)/g, m;
+    while (m = re.exec(queryString)) {
+      result[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
+    }
+    if (result["nextOp"] == "click" && opener.click)
+        opener.click();
+    else if (result["nextOp"] == "space" && opener.pressSpace)
+        opener.pressSpace();
+    else if (result["nextOp"] == "notifyDone" && opener.notifyDone)
+        opener.notifyDone();
+}
+</script>
\ No newline at end of file

Added: trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times-expected.txt (0 => 95226)


--- trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times-expected.txt	2011-09-15 21:04:09 UTC (rev 95226)
@@ -0,0 +1,15 @@
+Test for Bug 28633 - Submitting a form with target=_blank works only once
+
+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.
+
+
+
+Clicking first button, should open new window
+PASS
+Clicking first button, should open new window
+PASS
+Pressing space on second button, should open new window
+PASS
+Pressing space on second button, should open new window
+PASS
+

Added: trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times.html (0 => 95226)


--- trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/submit-to-blank-multiple-times.html	2011-09-15 21:04:09 UTC (rev 95226)
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+<html>
+    <body>
+        <p>
+            Test for <a href="" 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="" target="_blank">
+            <input name="nextOp" id="nextOp" type="hidden">
+            <input name="submit" id="submit" type="submit">
+        </form>
+        <form action="" 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.layoutTestController) {
+            layoutTestController.dumpAsText();
+            layoutTestController.setCanOpenWindows();
+            layoutTestController.waitUntilDone();
+        }
+        var numberTimesToClick = 2;
+        var numberTimesToSpace = 2;
+        window._onload_ = function() {
+            if (!window.layoutTestController || !window.eventSender)
+                return;
+            
+            click();
+            // Set a timeout to notify done in case the test fails.
+            setTimeout(notifyDone, 2000);
+        };
+        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() {
+            layoutTestController.setCloseRemainingWindowsWhenComplete();
+            layoutTestController.notifyDone();
+        }
+        </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (95225 => 95226)


--- trunk/Source/WebCore/ChangeLog	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/Source/WebCore/ChangeLog	2011-09-15 21:04:09 UTC (rev 95226)
@@ -1,3 +1,24 @@
+2011-09-15  Jon Lee  <jon...@apple.com>
+
+        Submitting a form with target=_blank works only once
+        https://bugs.webkit.org/show_bug.cgi?id=28633
+        <rdar://problem/7357787>
+
+        Reviewed by Andy Estes.
+
+        Test: fast/forms/submit-to-blank-multiple-times.html
+
+        The call to reset the multiple form submission bool is pushed down from the mouseDown handler to
+        handleMousePressEvent(), to include WK2 coverage, similar to keyEvent.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleMousePressEvent):
+        (WebCore::EventHandler::keyEvent): clarified old FIXME comment. Both key events and mouse events
+        may submit a form multiple times, but the call to reset the handler should probably be in another
+        abstraction layer.
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::mouseDown):
+
 2011-09-15  Peter Rybin  <peter.ry...@gmail.com>
 
         XMLDocumentParserQt.cpp incorrectly converts 0-based number into 1-based number

Modified: trunk/Source/WebCore/page/EventHandler.cpp (95225 => 95226)


--- trunk/Source/WebCore/page/EventHandler.cpp	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2011-09-15 21:04:09 UTC (rev 95226)
@@ -1341,6 +1341,9 @@
 
     UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
 
+    // FIXME (bug 68185): this call should be made at another abstraction layer
+    m_frame->loader()->resetMultipleFormSubmissionProtection();
+    
     cancelFakeMouseMoveEvent();
     m_mousePressed = true;
     m_capturesDragging = true;
@@ -2518,7 +2521,7 @@
     if (FrameView* view = m_frame->view())
         view->resetDeferredRepaintDelay();
 
-    // FIXME: what is this doing here, in keyboard event handler?
+    // FIXME (bug 68185): this call should be made at another abstraction layer
     m_frame->loader()->resetMultipleFormSubmissionProtection();
 
     // In IE, access keys are special, they are handled after default keydown processing, but cannot be canceled - this is hard to match.

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (95225 => 95226)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2011-09-15 21:04:09 UTC (rev 95226)
@@ -478,8 +478,6 @@
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
-    m_frame->loader()->resetMultipleFormSubmissionProtection();
-
     m_mouseDownView = nil;
     
     CurrentEventScope scope(event);

Modified: trunk/Source/WebKit/chromium/ChangeLog (95225 => 95226)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-15 21:04:09 UTC (rev 95226)
@@ -1,3 +1,15 @@
+2011-09-15  Jon Lee  <jon...@apple.com>
+
+        Submitting a form with target=_blank works only once
+        https://bugs.webkit.org/show_bug.cgi?id=28633
+        <rdar://problem/7357787>
+
+        Reviewed by Andy Estes.
+
+        * src/WebViewImpl.cpp:
+        (WebKit::WebViewImpl::mouseDown): Remove call to resetMultipleFormSubmissionProtection() since
+        it will be made in platform-independent function EventHandler::handleMousePressEvent().
+
 2011-09-15  Eric Seidel  <e...@webkit.org>
 
         Remove ENABLE_SVG_ANIMATION as all major ports have it on by default

Modified: trunk/Source/WebKit/chromium/src/WebViewImpl.cpp (95225 => 95226)


--- trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-09-15 21:00:40 UTC (rev 95225)
+++ trunk/Source/WebKit/chromium/src/WebViewImpl.cpp	2011-09-15 21:04:09 UTC (rev 95226)
@@ -475,8 +475,6 @@
             m_mouseCaptureNode = hitNode;
     }
 
-    mainFrameImpl()->frame()->loader()->resetMultipleFormSubmissionProtection();
-
     mainFrameImpl()->frame()->eventHandler()->handleMousePressEvent(
         PlatformMouseEventBuilder(mainFrameImpl()->frameView(), event));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to