[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

weinig at apple.com weinig at apple.com
Wed Dec 22 13:01:11 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 40af0ea53dcce28fa6d4dcdb05d1b43cbc6433d9
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 4 03:24:18 2010 +0000

    Add ability to send UserData to willSubmitForm
    https://bugs.webkit.org/show_bug.cgi?id=45222
    
    Reviewed by Adam Barth.
    
    - Adds a willSubmitForm callback to the BundlePageFormClient with an out
      parameter WKTypeRef* parameter.
    - That out parameter gets serialized and then passed to the PageFormClient's
      willSubmitForm, which now has WKTypeRef parameter.
    
    - Temporarily adds a new WillSubmitFormWithUserData message kind. This will
      be replaced by the ability to explicitly serialize null as a UserMessage.
    
    * Platform/CoreIPC/Arguments.h:
    (CoreIPC::Arguments6::Arguments6):
    (CoreIPC::Arguments6::encode):
    (CoreIPC::Arguments6::decode):
    (CoreIPC::In):
    (CoreIPC::Out):
    * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
    * UIProcess/API/C/WKPage.h:
    * UIProcess/WebFormClient.cpp:
    (WebKit::WebFormClient::willSubmitForm):
    * UIProcess/WebFormClient.h:
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didReceiveMessage):
    (WebKit::WebPageProxy::willSubmitForm):
    * UIProcess/WebPageProxy.h:
    * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
    (WebKit::InjectedBundlePageFormClient::textFieldDidBeginEditing):
    (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing):
    (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField):
    (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea):
    (WebKit::InjectedBundlePageFormClient::willSubmitForm):
    * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66789 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 71adfff..e454851 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,5 +1,46 @@
 2010-09-03  Sam Weinig  <sam at webkit.org>
 
+        Reviewed by Adam Barth.
+
+        Add ability to send UserData to willSubmitForm
+        https://bugs.webkit.org/show_bug.cgi?id=45222
+
+        - Adds a willSubmitForm callback to the BundlePageFormClient with an out
+          parameter WKTypeRef* parameter.
+        - That out parameter gets serialized and then passed to the PageFormClient's
+          willSubmitForm, which now has WKTypeRef parameter.
+
+        - Temporarily adds a new WillSubmitFormWithUserData message kind. This will
+          be replaced by the ability to explicitly serialize null as a UserMessage.
+
+        * Platform/CoreIPC/Arguments.h:
+        (CoreIPC::Arguments6::Arguments6):
+        (CoreIPC::Arguments6::encode):
+        (CoreIPC::Arguments6::decode):
+        (CoreIPC::In):
+        (CoreIPC::Out):
+        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h:
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebFormClient.cpp:
+        (WebKit::WebFormClient::willSubmitForm):
+        * UIProcess/WebFormClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        (WebKit::WebPageProxy::willSubmitForm):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp:
+        (WebKit::InjectedBundlePageFormClient::textFieldDidBeginEditing):
+        (WebKit::InjectedBundlePageFormClient::textFieldDidEndEditing):
+        (WebKit::InjectedBundlePageFormClient::textDidChangeInTextField):
+        (WebKit::InjectedBundlePageFormClient::textDidChangeInTextArea):
+        (WebKit::InjectedBundlePageFormClient::willSubmitForm):
+        * WebProcess/InjectedBundle/InjectedBundlePageFormClient.h:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
+
+2010-09-03  Sam Weinig  <sam at webkit.org>
+
         Reviewed by Gavin Barraclough.
 
         Change WKDictionaryIsMutable to take a WKDictionaryRef instead of a WKMutableDictionaryRef.
diff --git a/WebKit2/Platform/CoreIPC/Arguments.h b/WebKit2/Platform/CoreIPC/Arguments.h
index 11061f1..0533dc5 100644
--- a/WebKit2/Platform/CoreIPC/Arguments.h
+++ b/WebKit2/Platform/CoreIPC/Arguments.h
@@ -228,6 +228,42 @@ template<typename T1, typename T2, typename T3, typename T4, typename T5> Argume
     return Arguments5<T1&, T2&, T3&, T4&, T5&>(t1, t2, t3, t4, t5);
 }
 
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> class Arguments6 : Arguments5<T1, T2, T3, T4, T5> {
+public:
+    Arguments6(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6)
+        : Arguments5<T1, T2, T3, T4, T5>(t1, t2, t3, t4, t5)
+        , m_value(t6)
+    {
+    }
+
+    void encode(ArgumentEncoder* encoder) const
+    {
+        Arguments5<T1, T2, T3, T4, T5>::encode(encoder);
+        encoder->encode(m_value);
+    }
+    
+    static bool decode(ArgumentDecoder* decoder, Arguments6<T1, T2, T3, T4, T5, T6>& result)
+    {
+        if (!Arguments5<T1, T2, T3, T4, T5>::decode(decoder, result))
+            return false;
+        
+        return decoder->decode(result.m_value);
+    }
+
+private:
+    T6 m_value;
+};
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&> In(const T1& t1, const T2& t2, const T3 &t3, const T4& t4, const T5& t5, const T6& t6)
+{
+    return Arguments6<const T1&, const T2&, const T3&, const T4&, const T5&, const T6&>(t1, t2, t3, t4, t5, t6);
+}
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> Arguments6<T1&, T2&, T3&, T4&, T5&, T6&> Out(T1& t1, T2& t2, T3& t3, T4& t4, T5& t5, T6& t6)
+{
+    return Arguments6<T1&, T2&, T3&, T4&, T5&, T6&>(t1, t2, t3, t4, t5, t6);
+}
+
 } // namespace CoreIPC
 
 #endif // Arguments_h
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
index 2a1f1f3..323a944 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
@@ -67,6 +67,7 @@ enum Kind {
     SetToolTip,
     TakeFocus,
     WillSubmitForm,
+    WillSubmitFormWithUserData,
     
     BackForwardAddItem,
     BackForwardGoToItem,
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 29f9686..f58c9f3 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -124,7 +124,7 @@ struct WKPagePolicyClient {
 typedef struct WKPagePolicyClient WKPagePolicyClient;
 
 // Form Client.
-typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKFormSubmissionListenerRef listener, const void* clientInfo);
+typedef void (*WKPageWillSubmitFormCallback)(WKPageRef page, WKFrameRef frame, WKFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef userData, WKFormSubmissionListenerRef listener, const void* clientInfo);
 
 struct WKPageFormClient {
     int                                                                 version;
diff --git a/WebKit2/UIProcess/WebFormClient.cpp b/WebKit2/UIProcess/WebFormClient.cpp
index 7c65fd2..523887c 100644
--- a/WebKit2/UIProcess/WebFormClient.cpp
+++ b/WebKit2/UIProcess/WebFormClient.cpp
@@ -45,7 +45,7 @@ void WebFormClient::initialize(const WKPageFormClient* client)
         memset(&m_pageFormClient, 0, sizeof(m_pageFormClient));
 }
 
-bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, WebFormSubmissionListenerProxy* listener)
+bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy* listener)
 {
     if (!m_pageFormClient.willSubmitForm)
         return false;
@@ -53,9 +53,9 @@ bool WebFormClient::willSubmitForm(WebPageProxy* page, WebFrameProxy* frame, Web
     ImmutableDictionary::MapType map;
     for (size_t i = 0; i < textFieldValues.size(); ++i)
         map.set(textFieldValues[i].first, WebString::create(textFieldValues[i].second));
-
     RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map);
-    m_pageFormClient.willSubmitForm(toRef(page), toRef(frame), toRef(sourceFrame), toRef(textFieldsMap.get()), toRef(listener), m_pageFormClient.clientInfo);
+
+    m_pageFormClient.willSubmitForm(toRef(page), toRef(frame), toRef(sourceFrame), toRef(textFieldsMap.get()), toRef(userData), toRef(listener), m_pageFormClient.clientInfo);
     return true;
 }
 
diff --git a/WebKit2/UIProcess/WebFormClient.h b/WebKit2/UIProcess/WebFormClient.h
index a42f9fc..1f074a6 100644
--- a/WebKit2/UIProcess/WebFormClient.h
+++ b/WebKit2/UIProcess/WebFormClient.h
@@ -33,6 +33,7 @@
 
 namespace WebKit {
 
+class APIObject;
 class WebPageProxy;
 class WebFrameProxy;
 class WebFormSubmissionListenerProxy;
@@ -42,8 +43,7 @@ public:
     WebFormClient();
     void initialize(const WKPageFormClient*);
 
-    // FIXME: Add some type of form element reference or anotated user data.
-    bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, Vector<std::pair<String, String> >& textFieldValues, WebFormSubmissionListenerProxy*); 
+    bool willSubmitForm(WebPageProxy*, WebFrameProxy*, WebFrameProxy*, Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, WebFormSubmissionListenerProxy*); 
 
 private:
     WKPageFormClient m_pageFormClient;
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index 129aa3e..bc4675b 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -31,6 +31,7 @@
 #include "WebBackForwardList.h"
 #include "WebBackForwardListItem.h"
 #include "WebContext.h"
+#include "WebContextUserMessageCoders.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebData.h"
 #include "WebEvent.h"
@@ -577,7 +578,24 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t listenerID;
             if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID)))
                 return;
-            willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, listenerID);
+
+            APIObject* noUserData = 0;
+            willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, noUserData, listenerID);
+            break;
+        }
+        case WebPageProxyMessage::WillSubmitFormWithUserData: {
+            uint64_t frameID;
+            uint64_t sourceFrameID;
+            Vector<std::pair<String, String> > textFieldValues;
+            uint64_t listenerID;
+            
+            RefPtr<APIObject> userData;
+            WebContextUserMessageDecoder messageDecoder(userData, pageNamespace()->context());
+
+            if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID, messageDecoder)))
+                return;
+
+            willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, userData.get(), listenerID);
             break;
         }
         
@@ -876,10 +894,10 @@ void WebPageProxy::decidePolicyForMIMEType(WebFrameProxy* frame, const String& M
 
 // FormClient
 
-void WebPageProxy::willSubmitForm(WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, uint64_t listenerID)
+void WebPageProxy::willSubmitForm(WebFrameProxy* frame, WebFrameProxy* sourceFrame, Vector<std::pair<String, String> >& textFieldValues, APIObject* userData, uint64_t listenerID)
 {
     RefPtr<WebFormSubmissionListenerProxy> listener = frame->setUpFormSubmissionListenerProxy(listenerID);
-    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues, listener.get()))
+    if (!m_formClient.willSubmitForm(this, frame, sourceFrame, textFieldValues, userData, listener.get()))
         listener->continueSubmission();
 }
 
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 082c69c..baf2d75 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -200,7 +200,7 @@ private:
     void decidePolicyForNewWindowAction(WebFrameProxy*, WebCore::NavigationType navigationType, WebEvent::Modifiers modifiers, const WTF::String& url, uint64_t listenerID);
     void decidePolicyForMIMEType(WebFrameProxy*, const WTF::String& MIMEType, const WTF::String& url, uint64_t listenerID);
 
-    void willSubmitForm(WebFrameProxy* frame, WebFrameProxy* frameSource, Vector<std::pair<WTF::String, WTF::String> >& textFieldValues, uint64_t listenerID);
+    void willSubmitForm(WebFrameProxy* frame, WebFrameProxy* frameSource, Vector<std::pair<WTF::String, WTF::String> >& textFieldValues, APIObject* userData, uint64_t listenerID);
 
     PassRefPtr<WebPageProxy> createNewPage();
     void showPage();
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index a23f8cd..ea43049 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -138,6 +138,7 @@ typedef void (*WKBundlePageTextFieldDidBeginEditingCallback)(WKBundlePageRef pag
 typedef void (*WKBundlePageTextFieldDidEndEditingCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageTextDidChangeInTextFieldCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlInputElementHandle, WKBundleFrameRef frame, const void* clientInfo);
 typedef void (*WKBundlePageTextDidChangeInTextAreaCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlTextAreaElementHandle, WKBundleFrameRef frame, const void* clientInfo);
+typedef void (*WKBundlePageWillSubmitFormCallback)(WKBundlePageRef page, WKBundleNodeHandleRef htmlFormElementHandle, WKBundleFrameRef frame, WKBundleFrameRef sourceFrame, WKDictionaryRef values, WKTypeRef* userData, const void* clientInfo);
 
 struct WKBundlePageFormClient {
     int                                                                 version;
@@ -146,6 +147,7 @@ struct WKBundlePageFormClient {
     WKBundlePageTextFieldDidEndEditingCallback                          textFieldDidEndEditing;
     WKBundlePageTextDidChangeInTextFieldCallback                        textDidChangeInTextField;
     WKBundlePageTextDidChangeInTextAreaCallback                         textDidChangeInTextArea;
+    WKBundlePageWillSubmitFormCallback                                  willSubmitForm;
 };
 typedef struct WKBundlePageFormClient WKBundlePageFormClient;
 
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
index 71a95c9..563edc6 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.cpp
@@ -25,9 +25,11 @@
 
 #include "InjectedBundlePageFormClient.h"
 
+#include "ImmutableDictionary.h"
 #include "InjectedBundleNodeHandle.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
+#include <WebCore/HTMLFormElement.h>
 #include <WebCore/HTMLInputElement.h>
 #include <WebCore/HTMLTextAreaElement.h>
 
@@ -48,7 +50,7 @@ void InjectedBundlePageFormClient::initialize(WKBundlePageFormClient* client)
         memset(&m_client, 0, sizeof(m_client));
 }
 
-void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, WebCore::HTMLInputElement* inputElement, WebFrame* frame)
+void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
 {
     if (!m_client.textFieldDidBeginEditing)
         return;
@@ -57,7 +59,7 @@ void InjectedBundlePageFormClient::textFieldDidBeginEditing(WebPage* page, WebCo
     m_client.textFieldDidBeginEditing(toRef(page), toRef(nodeHandle.get()), toRef(frame), m_client.clientInfo);
 }
 
-void InjectedBundlePageFormClient::textFieldDidEndEditing(WebPage* page, WebCore::HTMLInputElement* inputElement, WebFrame* frame)
+void InjectedBundlePageFormClient::textFieldDidEndEditing(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
 {
     if (!m_client.textFieldDidEndEditing)
         return;
@@ -66,7 +68,7 @@ void InjectedBundlePageFormClient::textFieldDidEndEditing(WebPage* page, WebCore
     m_client.textFieldDidEndEditing(toRef(page), toRef(nodeHandle.get()), toRef(frame), m_client.clientInfo);
 }
 
-void InjectedBundlePageFormClient::textDidChangeInTextField(WebPage* page, WebCore::HTMLInputElement* inputElement, WebFrame* frame)
+void InjectedBundlePageFormClient::textDidChangeInTextField(WebPage* page, HTMLInputElement* inputElement, WebFrame* frame)
 {
     if (!m_client.textDidChangeInTextField)
         return;
@@ -75,7 +77,7 @@ void InjectedBundlePageFormClient::textDidChangeInTextField(WebPage* page, WebCo
     m_client.textDidChangeInTextField(toRef(page), toRef(nodeHandle.get()), toRef(frame), m_client.clientInfo);
 }
 
-void InjectedBundlePageFormClient::textDidChangeInTextArea(WebPage* page, WebCore::HTMLTextAreaElement* textAreaElement, WebFrame* frame)
+void InjectedBundlePageFormClient::textDidChangeInTextArea(WebPage* page, HTMLTextAreaElement* textAreaElement, WebFrame* frame)
 {
     if (!m_client.textDidChangeInTextArea)
         return;
@@ -84,4 +86,21 @@ void InjectedBundlePageFormClient::textDidChangeInTextArea(WebPage* page, WebCor
     m_client.textDidChangeInTextArea(toRef(page), toRef(nodeHandle.get()), toRef(frame), m_client.clientInfo);
 }
 
+void InjectedBundlePageFormClient::willSubmitForm(WebPage* page, HTMLFormElement* formElement, WebFrame* frame, WebFrame* sourceFrame, const Vector<std::pair<String, String> >& values, RefPtr<APIObject>& userData)
+{
+    if (!m_client.willSubmitForm)
+        return;
+
+    RefPtr<InjectedBundleNodeHandle> nodeHandle = InjectedBundleNodeHandle::getOrCreate(formElement);
+
+    ImmutableDictionary::MapType map;
+    for (size_t i = 0; i < values.size(); ++i)
+        map.set(values[i].first, WebString::create(values[i].second));
+    RefPtr<ImmutableDictionary> textFieldsMap = ImmutableDictionary::adopt(map);
+
+    WKTypeRef userDataToPass = 0;
+    m_client.willSubmitForm(toRef(page), toRef(nodeHandle.get()), toRef(frame), toRef(sourceFrame), toRef(textFieldsMap.get()), &userDataToPass, m_client.clientInfo);
+    userData = adoptRef(toWK(userDataToPass));
+}
+
 } // namespace WebKit
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
index 9c40698..909a45e 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundlePageFormClient.h
@@ -27,14 +27,20 @@
 #define InjectedBundlePageFormClient_h
 
 #include "WKBundlePage.h"
+#include <algorithm>
+#include <wtf/Forward.h>
+#include <wtf/Vector.h>
 
 namespace WebCore {
+    class HTMLFormElement;
     class HTMLInputElement;
     class HTMLTextAreaElement;
 }
 
 namespace WebKit {
 
+class APIObject;
+class ImmutableDictionary;
 class WebFrame;
 class WebPage;
 
@@ -48,6 +54,8 @@ public:
     void textDidChangeInTextField(WebPage*, WebCore::HTMLInputElement*, WebFrame*);
     void textDidChangeInTextArea(WebPage*, WebCore::HTMLTextAreaElement*, WebFrame*);
 
+    void willSubmitForm(WebPage*, WebCore::HTMLFormElement*, WebFrame*, WebFrame* sourceFrame, const Vector<std::pair<String, String> >&, RefPtr<APIObject>& userData);
+
 private:
     WKBundlePageFormClient m_client;
 };
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 8b6f357..45acf97 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -28,6 +28,7 @@
 #define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
 #include "NotImplemented.h"
 
+#include "InjectedBundleUserMessageCoders.h"
 #include "NetscapePlugin.h"
 #include "PluginView.h"
 #include "WebCoreArgumentCoders.h"
@@ -502,20 +503,32 @@ void WebFrameLoaderClient::dispatchUnableToImplementPolicy(const ResourceError&)
     notImplemented();
 }
 
-void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> formState)
+void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function, PassRefPtr<FormState> prpFormState)
 {
     WebPage* webPage = m_frame->page();
     if (!webPage)
         return;
 
     // FIXME: Pass more of the form state.
+    RefPtr<FormState> formState = prpFormState;
+    
+    HTMLFormElement* form = formState->form();
+    WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame();    
+    const Vector<std::pair<String, String> >& values = formState->textFieldValues();
 
-    uint64_t listenerID = m_frame->setUpPolicyListener(function);
+    RefPtr<APIObject> userData;
+    webPage->injectedBundleFormClient().willSubmitForm(webPage, form, m_frame, sourceFrame, values, userData);
 
-    WebFrame* sourceFrame = static_cast<WebFrameLoaderClient*>(formState->sourceFrame()->loader()->client())->webFrame();    
 
-    WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
-                                            CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), formState->textFieldValues(), listenerID));
+    uint64_t listenerID = m_frame->setUpPolicyListener(function);
+
+    if (userData) {
+        WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitFormWithUserData, webPage->pageID(),
+                                                CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
+    } else {
+        WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
+                                                CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID));
+    }
 }
 
 void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list