[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:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 770e26bd832aa50f68b9085210acc38471952050
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Sep 5 00:19:55 2010 +0000

    Allow passing null to postMessage API functions
    https://bugs.webkit.org/show_bug.cgi?id=45234
    
    Reviewed by Anders Carlsson.
    
    * Shared/APIObject.h: Add TypeNull to enum. This is only used
    for serialization purposes, and does not represent a concrete subclass
    of APIObject.
    
    * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Remove WillSubmitFormWithUserData
    now that it is not needed.
    
    * Shared/UserMessageCoders.h:
    (WebKit::UserMessageEncoder::baseEncode):
    (WebKit::UserMessageDecoder::baseDecode):
    Add explicit encoding/decoding of null for user messages.
    
    * UIProcess/WebContextUserMessageCoders.h:
    (WebKit::WebContextUserMessageEncoder::encode):
    (WebKit::WebContextUserMessageDecoder::decode):
    * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
    (WebKit::InjectedBundleUserMessageEncoder::encode):
    (WebKit::InjectedBundleUserMessageDecoder::decode):
    Update UserMessageCoders subclasses to call the base class in the correct
    way to work with null messages. This means moving the encoding/decoding
    of the type down to the base class, which is a nice cleanup.
    
    * UIProcess/WebPageProxy.cpp:
    (WebKit::WebPageProxy::didReceiveMessage):
    Remove now redundant WillSubmitFormWithUserData implementation.
    
    * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
    (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
    Ditto.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66799 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 5b57297..2938b54 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,40 @@
+2010-09-04  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        Allow passing null to postMessage API functions
+        https://bugs.webkit.org/show_bug.cgi?id=45234
+
+        * Shared/APIObject.h: Add TypeNull to enum. This is only used
+        for serialization purposes, and does not represent a concrete subclass
+        of APIObject.
+
+        * Shared/CoreIPCSupport/WebPageProxyMessageKinds.h: Remove WillSubmitFormWithUserData
+        now that it is not needed.
+
+        * Shared/UserMessageCoders.h:
+        (WebKit::UserMessageEncoder::baseEncode):
+        (WebKit::UserMessageDecoder::baseDecode):
+        Add explicit encoding/decoding of null for user messages.
+
+        * UIProcess/WebContextUserMessageCoders.h:
+        (WebKit::WebContextUserMessageEncoder::encode):
+        (WebKit::WebContextUserMessageDecoder::decode):
+        * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
+        (WebKit::InjectedBundleUserMessageEncoder::encode):
+        (WebKit::InjectedBundleUserMessageDecoder::decode):
+        Update UserMessageCoders subclasses to call the base class in the correct
+        way to work with null messages. This means moving the encoding/decoding
+        of the type down to the base class, which is a nice cleanup.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::didReceiveMessage):
+        Remove now redundant WillSubmitFormWithUserData implementation.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
+        Ditto.
+
 2010-09-03  Jesus Sanchez-Palencia  <jesus.palencia at openbossa.org>
 
         Reviewed by Darin Adler.
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index 66b6792..8acb1ef 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -34,6 +34,7 @@ class APIObject : public RefCounted<APIObject> {
 public:
     enum Type {
         // Base types
+        TypeNull,
         TypeArray,
         TypeData,
         TypeDictionary,
diff --git a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
index 323a944..2a1f1f3 100644
--- a/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
+++ b/WebKit2/Shared/CoreIPCSupport/WebPageProxyMessageKinds.h
@@ -67,7 +67,6 @@ enum Kind {
     SetToolTip,
     TakeFocus,
     WillSubmitForm,
-    WillSubmitFormWithUserData,
     
     BackForwardAddItem,
     BackForwardGoToItem,
diff --git a/WebKit2/Shared/UserMessageCoders.h b/WebKit2/Shared/UserMessageCoders.h
index 6c97872..51a1dcd 100644
--- a/WebKit2/Shared/UserMessageCoders.h
+++ b/WebKit2/Shared/UserMessageCoders.h
@@ -32,6 +32,7 @@
 
 namespace WebKit {
 
+//   - Null -> Null
 //   - Array -> Array
 //   - Dictionary -> Dictionary
 //   - String -> String
@@ -39,8 +40,16 @@ namespace WebKit {
 template<typename Owner>
 class UserMessageEncoder {
 public:
-    bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type type) const 
+    bool baseEncode(CoreIPC::ArgumentEncoder* encoder, APIObject::Type& type) const 
     {
+        if (!m_root) {
+            encoder->encodeUInt32(APIObject::TypeNull);
+            return true;
+        }
+
+        type = m_root->type();
+        encoder->encodeUInt32(type);
+
         switch (type) {
         case APIObject::TypeArray: {
             ImmutableArray* array = static_cast<ImmutableArray*>(m_root);
@@ -85,6 +94,7 @@ protected:
 
 
 // Handles
+//   - Null -> Null
 //   - Array -> Array
 //   - Dictionary -> Dictionary
 //   - String -> String
@@ -92,8 +102,14 @@ protected:
 template<typename Owner>
 class UserMessageDecoder {
 public:
-    static bool baseDecode(CoreIPC::ArgumentDecoder* decoder, Owner& coder, APIObject::Type type)
+    static bool baseDecode(CoreIPC::ArgumentDecoder* decoder, Owner& coder, APIObject::Type& type)
     {
+        uint32_t typeAsUInt32;
+        if (!decoder->decode(typeAsUInt32))
+            return false;
+
+        type = static_cast<APIObject::Type>(typeAsUInt32);
+
         switch (type) {
         case APIObject::TypeArray: {
             uint64_t size;
diff --git a/WebKit2/UIProcess/WebContextUserMessageCoders.h b/WebKit2/UIProcess/WebContextUserMessageCoders.h
index 178ea0e..2c26b07 100644
--- a/WebKit2/UIProcess/WebContextUserMessageCoders.h
+++ b/WebKit2/UIProcess/WebContextUserMessageCoders.h
@@ -43,9 +43,7 @@ public:
 
     void encode(CoreIPC::ArgumentEncoder* encoder) const 
     {
-        APIObject::Type type = m_root->type();
-        encoder->encode(static_cast<uint32_t>(type));
-
+        APIObject::Type type = APIObject::TypeNull;
         if (baseEncode(encoder, type))
             return;
 
@@ -83,15 +81,11 @@ public:
 
     static bool decode(CoreIPC::ArgumentDecoder* decoder, WebContextUserMessageDecoder& coder)
     {
-        uint32_t type;
-        if (!decoder->decode(type))
-            return false;
-
-        if (!Base::baseDecode(decoder, coder, static_cast<APIObject::Type>(type)))
+        APIObject::Type type = APIObject::TypeNull;
+        if (!Base::baseDecode(decoder, coder, type))
             return false;
 
-        // If the base decoded something into root, we are done.
-        if (coder.m_root)
+        if (coder.m_root || type == APIObject::TypeNull)
             return true;
 
         switch (type) {
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index bc4675b..5995f05 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -576,19 +576,7 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             uint64_t sourceFrameID;
             Vector<std::pair<String, String> > textFieldValues;
             uint64_t listenerID;
-            if (!arguments->decode(CoreIPC::Out(frameID, sourceFrameID, textFieldValues, listenerID)))
-                return;
 
-            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());
 
@@ -598,7 +586,6 @@ void WebPageProxy::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::M
             willSubmitForm(process()->webFrame(frameID), process()->webFrame(sourceFrameID), textFieldValues, userData.get(), listenerID);
             break;
         }
-        
         case WebPageProxyMessage::DidRunJavaScriptInMainFrame: {
             String resultString;
             uint64_t callbackID;
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
index 0ec4c3a..cee2e2e 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
@@ -43,9 +43,7 @@ public:
 
     void encode(CoreIPC::ArgumentEncoder* encoder) const 
     {
-        APIObject::Type type = m_root->type();
-        encoder->encode(static_cast<uint32_t>(type));
-        
+        APIObject::Type type = APIObject::TypeNull;
         if (baseEncode(encoder, type))
             return;
 
@@ -81,15 +79,11 @@ public:
 
     static bool decode(CoreIPC::ArgumentDecoder* decoder, InjectedBundleUserMessageDecoder& coder)
     {
-        uint32_t type;
-        if (!decoder->decode(type))
+        APIObject::Type type = APIObject::TypeNull;
+        if (!Base::baseDecode(decoder, coder, type))
             return false;
 
-        if (!Base::baseDecode(decoder, coder, static_cast<APIObject::Type>(type)))
-            return false;
-
-        // If the base created something in root, we are done.
-        if (coder.m_root)
+        if (coder.m_root || type == APIObject::TypeNull)
             return true;
 
         switch (type) {
diff --git a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
index 515d877..55793aa 100644
--- a/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
+++ b/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
@@ -523,13 +523,8 @@ void WebFrameLoaderClient::dispatchWillSubmitForm(FramePolicyFunction function,
 
     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));
-    }
+    WebProcess::shared().connection()->send(WebPageProxyMessage::WillSubmitForm, webPage->pageID(),
+                                            CoreIPC::In(m_frame->frameID(), sourceFrame->frameID(), values, listenerID, InjectedBundleUserMessageEncoder(userData.get())));
 }
 
 void WebFrameLoaderClient::dispatchDidLoadMainResource(DocumentLoader*)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list