From b3dd806a1bdd3101bd82696ed615e8ffe2091a2e Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 28 Sep 2009 13:49:05 +0100 Subject: [PATCH] Fix the multiple form submission bug. (Bug 2098417). Change-Id: I4eb188f6b4826f394a08c72c71f920cc212b2653 --- WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 13 ++++++++++++- WebKit/android/jni/WebCoreFrameBridge.cpp | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 71d504803..c567c665f 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -467,16 +467,21 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForMIMEType(FramePolicyFuncti } void FrameLoaderClientAndroid::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction func, - const NavigationAction&, const ResourceRequest& request, + const NavigationAction& action, const ResourceRequest& request, PassRefPtr formState, const String& frameName) { ASSERT(m_frame); ASSERT(func); if (!func) return; + if (request.isNull()) { (m_frame->loader()->*func)(PolicyIgnore); return; } + + if (action.type() == NavigationTypeFormSubmitted || action.type() == NavigationTypeFormResubmitted) + m_frame->loader()->resetMultipleFormSubmissionProtection(); + // If we get to this point it means that a link has a target that was not // found by the frame tree. Instead of creating a new frame, return the // current frame in dispatchCreatePage. @@ -505,6 +510,12 @@ void FrameLoaderClientAndroid::dispatchDecidePolicyForNavigationAction(FramePoli (m_frame->loader()->*func)(PolicyIgnore); return; } + + // Reset multiple form submission protection. If this is a resubmission, we check with the + // user and reset the protection if they choose to resubmit the form (see WebCoreFrameBridge.cpp) + if (action.type() == NavigationTypeFormSubmitted) + m_frame->loader()->resetMultipleFormSubmissionProtection(); + if (action.type() == NavigationTypeFormResubmitted) { m_webFrame->decidePolicyForFormResubmission(func); return; diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index bb59b736d..6c97acc64 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -738,6 +738,10 @@ static void CallPolicyFunction(JNIEnv* env, jobject obj, jint func, jint decisio PolicyFunctionWrapper* pFunc = (PolicyFunctionWrapper*)func; LOG_ASSERT(pFunc, "nativeCallPolicyFunction must take a valid function pointer!"); + // If we are resending the form then we should reset the multiple submission protection. + if (decision == WebCore::PolicyUse) + pFrame->loader()->resetMultipleFormSubmissionProtection(); + (pFrame->loader()->*(pFunc->func))((WebCore::PolicyAction)decision); } -- 2.11.0