LayoutTests:
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Mar 2007 07:59:15 +0000 (07:59 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Mar 2007 07:59:15 +0000 (07:59 +0000)
        Reviewed by Maciej.

        HTTP layout test for http://bugs.webkit.org/show_bug.cgi?id=12690
        REGRESSION: can not log in to bank of america with TOT webkit
        <rdar://problem/4990044>

        also for
        http://bugs.webkit.org/show_bug.cgi?id=12604
        http://bugs.webkit.org/show_bug.cgi?id=12020

        * http/tests/misc/multiple-submit-expected.txt: Added.
        * http/tests/misc/multiple-submit.html: Added.
        * http/tests/misc/resources/post-echo-and-notify-done.cgi: Added.

WebCore:

        Reviewed by Maciej.

        Fix http://bugs.webkit.org/show_bug.cgi?id=12690
        REGRESSION: can not log in to bank of america with TOT webkit
        <rdar://problem/4990044>

        and http://bugs.webkit.org/show_bug.cgi?id=12604
        REGRESSION: After closing the "Would you like to save password" sheet, the form fails
        to submit automatically at http://www.mac.com/WebObjects/HomePage.woa
        <rdar://problem/4871752>

        and http://bugs.webkit.org/show_bug.cgi?id=12020
        REGRESSION: Flickr uploading broken
        <rdar://problem/4928662>

        Turn protection against multiple forms submission back on. This approach is buggy
        but it is way better than not having it at all. Not protecting against this
        breaks number of major sites.

        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject accessibilityPerformAction:]):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::resetMultipleFormSubmissionProtection):
        (WebCore::FrameLoader::submitForm):
        (WebCore::FrameLoader::receivedMainResourceError):
        * loader/FrameLoader.h:
        * page/EventHandler.cpp:
        (WebCore::EventHandler::keyEvent):
        * page/Frame.cpp:
        (WebCore::Frame::setView):
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::mouseDown):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19940 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/misc/multiple-submit-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/misc/multiple-submit.html [new file with mode: 0644]
LayoutTests/http/tests/misc/resources/post-echo-and-notify-done.cgi [new file with mode: 0755]
WebCore/ChangeLog
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/loader/FrameLoader.cpp
WebCore/loader/FrameLoader.h
WebCore/page/EventHandler.cpp
WebCore/page/Frame.cpp
WebCore/page/mac/EventHandlerMac.mm

index 0cd4ed2c9a3c98627b0a59bc3d9fb38098368c5d..99266e1541197b55af6d2e8459b60d34f1041040 100644 (file)
@@ -1,3 +1,19 @@
+2007-03-01  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        HTTP layout test for http://bugs.webkit.org/show_bug.cgi?id=12690
+        REGRESSION: can not log in to bank of america with TOT webkit
+        <rdar://problem/4990044>
+
+        also for
+        http://bugs.webkit.org/show_bug.cgi?id=12604
+        http://bugs.webkit.org/show_bug.cgi?id=12020
+        
+        * http/tests/misc/multiple-submit-expected.txt: Added.
+        * http/tests/misc/multiple-submit.html: Added.
+        * http/tests/misc/resources/post-echo-and-notify-done.cgi: Added.
+
 2007-03-01  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Adam.
diff --git a/LayoutTests/http/tests/misc/multiple-submit-expected.txt b/LayoutTests/http/tests/misc/multiple-submit-expected.txt
new file mode 100644 (file)
index 0000000..3c8412e
--- /dev/null
@@ -0,0 +1 @@
+submitted=form2
diff --git a/LayoutTests/http/tests/misc/multiple-submit.html b/LayoutTests/http/tests/misc/multiple-submit.html
new file mode 100644 (file)
index 0000000..003babf
--- /dev/null
@@ -0,0 +1,23 @@
+<form name=f action='resources/post-echo-and-notify-done.cgi' method=post>
+<input id=sub type=submit onclick='return clickf();'>
+<input id=val type=hidden name=submitted value='form1'>
+</form>
+
+<form name=f2 action='resources/post-echo-and-notify-done.cgi' method=post>
+<input id=val type=hidden name=submitted value='form2'>
+</form>
+
+<script>
+function clickf()
+{
+    document.f2.submit();
+    return true;
+}
+
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+}
+
+setTimeout(function() { document.getElementById('sub').click(); }, 0);
+</script>
diff --git a/LayoutTests/http/tests/misc/resources/post-echo-and-notify-done.cgi b/LayoutTests/http/tests/misc/resources/post-echo-and-notify-done.cgi
new file mode 100755 (executable)
index 0000000..3d77182
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/perl -w
+
+print "Content-type: text/html\n\n"; 
+
+if ($ENV{'REQUEST_METHOD'} eq "POST") {
+    read(STDIN, $request, $ENV{'CONTENT_LENGTH'})
+                || die "Could not get query\n";
+    print $request;
+    print "<script>if (window.layoutTestController) layoutTestController.notifyDone();</script>";
+} else {
+    print "Wrong method: " . $ENV{'REQUEST_METHOD'} . "\n";
+} 
index ca4934ea2484128c1b0a6092c21cfa34213e389b..c165e14af3a8b560735d85cd748ef8e8db65ba2f 100644 (file)
@@ -1,3 +1,38 @@
+2007-03-01  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Maciej.
+        
+        Fix http://bugs.webkit.org/show_bug.cgi?id=12690
+        REGRESSION: can not log in to bank of america with TOT webkit
+        <rdar://problem/4990044>
+        
+        and http://bugs.webkit.org/show_bug.cgi?id=12604
+        REGRESSION: After closing the "Would you like to save password" sheet, the form fails 
+        to submit automatically at http://www.mac.com/WebObjects/HomePage.woa
+        <rdar://problem/4871752>
+        
+        and http://bugs.webkit.org/show_bug.cgi?id=12020
+        REGRESSION: Flickr uploading broken
+        <rdar://problem/4928662>
+        
+        Turn protection against multiple forms submission back on. This approach is buggy 
+        but it is way better than not having it at all. Not protecting against this
+        breaks number of major sites.
+        
+        * bridge/mac/WebCoreAXObject.mm:
+        (-[WebCoreAXObject accessibilityPerformAction:]):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::resetMultipleFormSubmissionProtection):
+        (WebCore::FrameLoader::submitForm):
+        (WebCore::FrameLoader::receivedMainResourceError):
+        * loader/FrameLoader.h:
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::keyEvent):
+        * page/Frame.cpp:
+        (WebCore::Frame::setView):
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::mouseDown):
+
 2007-03-01  Kevin McCullough  <kmccullough@apple.com>
 
         Reviewed by Adam.
index d02a0a313b81aca8187b9bdd727b1d30fe8fc6aa..f11d98529e4831d2c08c623af0e088d94863fa99 100644 (file)
@@ -887,10 +887,8 @@ static IntRect boundingBoxRect(RenderObject* obj)
         Element* actionElement = [self actionElement];
         if (!actionElement)
             return;
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
         if (Frame* f = actionElement->document()->frame())
             f->loader()->resetMultipleFormSubmissionProtection();
-#endif
         actionElement->accessKeyAction(true);
     }
 }
index 17f385c1c067d92e3f30823d35f20656b2dff1d2..7a74d783e4984df1ed81f389ec0a9b7dc0bd5944 100644 (file)
@@ -1464,7 +1464,6 @@ bool FrameLoader::userGestureHint()
     return true; // If JavaScript is disabled, a user gesture must have initiated the navigation
 }
 
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
 void FrameLoader::didNotOpenURL(const KURL& URL)
 {
     if (m_submittedFormURL == URL)
@@ -1475,7 +1474,6 @@ void FrameLoader::resetMultipleFormSubmissionProtection()
 {
     m_submittedFormURL = KURL();
 }
-#endif
 
 void FrameLoader::setEncoding(const String& name, bool userChosen)
 {
@@ -2729,7 +2727,6 @@ FrameLoaderClient* FrameLoader::client() const
 
 void FrameLoader::submitForm(const FrameLoadRequest& request, Event* event)
 {
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
     // FIXME: We'd like to remove this altogether and fix the multiple form submission issue another way.
     // We do not want to submit more than one form from the same page,
     // nor do we want to submit a single form more than once.
@@ -2746,7 +2743,6 @@ void FrameLoader::submitForm(const FrameLoadRequest& request, Event* event)
             return;
         m_submittedFormURL = request.resourceRequest().url();
     }
-#endif
 
     // FIXME: Why do we always pass true for userGesture?
     load(request, true, event, m_formAboutToBeSubmitted.get(), m_formValuesAboutToBeSubmitted);
@@ -3038,10 +3034,9 @@ void FrameLoader::receivedMainResourceError(const ResourceError& error, bool isC
     }
     
     if (m_state == FrameStateProvisional) {
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
         KURL failedURL = m_provisionalDocumentLoader->originalRequestCopy().url();
         didNotOpenURL(failedURL);
-#endif
+            
         // We might have made a page cache item, but now we're bailing out due to an error before we ever
         // transitioned to the new page (before WebFrameState == commit).  The goal here is to restore any state
         // so that the existing view (that wenever got far enough to replace) can continue being used.
index 49969f8ccc5e5b0993db5a9d9a394196acc92b5d..d67c6e33cbdf1581d969c585fe8fe8f595d4d108 100644 (file)
@@ -338,10 +338,8 @@ namespace WebCore {
 
         bool userGestureHint();
 
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
         void resetMultipleFormSubmissionProtection();
         void didNotOpenURL(const KURL&);
-#endif
 
         void addData(const char* bytes, int length);
 
@@ -579,9 +577,7 @@ namespace WebCore {
 
         RefPtr<HTMLFormElement> m_formAboutToBeSubmitted;
         HashMap<String, String> m_formValuesAboutToBeSubmitted;
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
         KURL m_submittedFormURL;
-#endif
     
         Timer<FrameLoader> m_redirectionTimer;
 
index f5145ef68bc1271037446d493c98680ec8d1c021..48c19f8a7597e3ca020bf18f53034f038fc30239 100644 (file)
@@ -37,6 +37,7 @@
 #include "FloatPoint.h"
 #include "FocusController.h"
 #include "Frame.h"
+#include "FrameLoader.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "HitTestRequest.h"
@@ -1257,10 +1258,8 @@ bool EventHandler::keyEvent(const PlatformKeyboardEvent& keyEvent)
     if (!node)
         return false;
     
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
     if (!keyEvent.isKeyUp())
-        loader()->resetMultipleFormSubmissionProtection();
-#endif
+        m_frame->loader()->resetMultipleFormSubmissionProtection();
 
     result = !node->dispatchKeyEvent(keyEvent);
 
index 1e3234cbae63ba11a788296eebe45d0709412a42..43f9d68967a9cdb99b2aca2591ccbcae3c479851 100644 (file)
@@ -275,12 +275,10 @@ void Frame::setView(FrameView* view)
 
     d->m_view = view;
 
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
     // Only one form submission is allowed per view of a part.
     // Since this part may be getting reused as a result of being
     // pulled from the back/forward cache, reset this flag.
     loader()->resetMultipleFormSubmissionProtection();
-#endif
 }
 
 KJSProxy *Frame::scriptProxy()
index bf4bee744da7dbe5a84c0dfcbb173be34e4af594..7b3cf068bebd1fbd488e8cf673c10a07a4b0b7ae 100644 (file)
@@ -455,9 +455,9 @@ void EventHandler::mouseDown(NSEvent *event)
         return;
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-#ifdef MULTIPLE_FORM_SUBMISSION_PROTECTION
+    
     m_frame->loader()->resetMultipleFormSubmissionProtection();
-#endif
+
     m_mouseDownView = nil;
     dragState().m_dragSrc = 0;