Title: [131282] trunk/Source/WebKit2
Revision
131282
Author
[email protected]
Date
2012-10-14 17:24:10 -0700 (Sun, 14 Oct 2012)

Log Message

WebPage::PostInjectedBundleMessage should be a variadic message
https://bugs.webkit.org/show_bug.cgi?id=99277

Reviewed by Sam Weinig.

Don't use a data reference for messages posted to the injected bundle; they could contain data that requires attachments
(such as shared memory).

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::postMessageToInjectedBundle):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::postInjectedBundleMessage):
* WebProcess/WebPage/WebPage.h:
(WebPage):
* WebProcess/WebPage/WebPage.messages.in:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (131281 => 131282)


--- trunk/Source/WebKit2/ChangeLog	2012-10-14 23:55:23 UTC (rev 131281)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-15 00:24:10 UTC (rev 131282)
@@ -1,3 +1,21 @@
+2012-10-14  Anders Carlsson  <[email protected]>
+
+        WebPage::PostInjectedBundleMessage should be a variadic message
+        https://bugs.webkit.org/show_bug.cgi?id=99277
+
+        Reviewed by Sam Weinig.
+
+        Don't use a data reference for messages posted to the injected bundle; they could contain data that requires attachments
+        (such as shared memory).
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::postMessageToInjectedBundle):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::postInjectedBundleMessage):
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2012-10-14  Sam Weinig  <[email protected]>
 
         Simplify user content in WebKit2 by using WebCore::UserStyleSheet and WebCore::UserScript directly

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (131281 => 131282)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-10-14 23:55:23 UTC (rev 131281)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-10-15 00:24:10 UTC (rev 131282)
@@ -2964,13 +2964,7 @@
 
 void WebPageProxy::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
 {
-    OwnPtr<CoreIPC::ArgumentEncoder> messageData = CoreIPC::ArgumentEncoder::create(0);
-
-    messageData->encode(messageName);
-    messageData->encode(WebContextUserMessageEncoder(messageBody));
-
-    // FIXME: We should consider returning false from this function if the messageBody cannot be encoded.
-    process()->send(Messages::WebPage::PostInjectedBundleMessage(CoreIPC::DataReference(messageData->buffer(), messageData->bufferSize())), m_pageID);
+    process()->send(Messages::WebPage::PostInjectedBundleMessage(messageName, WebContextUserMessageEncoder(messageBody)), m_pageID);
 }
 
 #if PLATFORM(GTK)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (131281 => 131282)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-10-14 23:55:23 UTC (rev 131281)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2012-10-15 00:24:10 UTC (rev 131282)
@@ -1215,20 +1215,14 @@
     m_page->setPagination(pagination);
 }
 
-void WebPage::postInjectedBundleMessage(const CoreIPC::DataReference& messageData)
+void WebPage::postInjectedBundleMessage(const String& messageName, CoreIPC::ArgumentDecoder* argumentDecoder)
 {
     InjectedBundle* injectedBundle = WebProcess::shared().injectedBundle();
     if (!injectedBundle)
         return;
 
-    CoreIPC::ArgumentDecoder messageDecoder(messageData.data(), messageData.size());
-
-    String messageName;
-    if (!messageDecoder.decode(messageName))
-        return;
-
     RefPtr<APIObject> messageBody;
-    if (!messageDecoder.decode(InjectedBundleUserMessageDecoder(messageBody)))
+    if (argumentDecoder->decode(InjectedBundleUserMessageDecoder(messageBody)))
         return;
 
     injectedBundle->didReceiveMessageToPage(this, messageName, messageBody.get());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (131281 => 131282)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-10-14 23:55:23 UTC (rev 131281)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2012-10-15 00:24:10 UTC (rev 131282)
@@ -320,7 +320,7 @@
     void setPageLength(double);
     void setGapBetweenPages(double);
 
-    void postInjectedBundleMessage(const CoreIPC::DataReference& message);
+    void postInjectedBundleMessage(const String& messageName, CoreIPC::ArgumentDecoder*);
 
     bool drawsBackground() const { return m_drawsBackground; }
     bool drawsTransparentBackground() const { return m_drawsTransparentBackground; }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (131281 => 131282)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2012-10-14 23:55:23 UTC (rev 131281)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2012-10-15 00:24:10 UTC (rev 131282)
@@ -46,8 +46,8 @@
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    DidEndColorChooser();
-    DidChooseColor(WebCore::Color color);
+    DidEndColorChooser()
+    DidChooseColor(WebCore::Color color)
 #endif
 
 #if ENABLE(CONTEXT_MENUS)
@@ -62,7 +62,7 @@
     GoToBackForwardItem(uint64_t backForwardItemID)
     TryRestoreScrollPosition()
     LoadHTMLString(WTF::String htmlString, WTF::String baseURL)
-    LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL); 
+    LoadAlternateHTMLString(WTF::String htmlString, WTF::String baseURL, WTF::String unreachableURL)
     LoadPlainTextString(WTF::String string)
     LoadWebArchiveData(CoreIPC::DataReference webArchiveData)
     LoadURL(WTF::String url, WebKit::SandboxExtension::Handle sandboxExtensionHandle)
@@ -142,12 +142,12 @@
     ListenForLayoutMilestones(uint32_t milestones)
     SetSuppressScrollbarAnimations(bool suppressAnimations)
 
-    SetPaginationMode(uint32_t mode);
-    SetPaginationBehavesLikeColumns(bool behavesLikeColumns);
-    SetPageLength(double pageLength);
-    SetGapBetweenPages(double gap);
+    SetPaginationMode(uint32_t mode)
+    SetPaginationBehavesLikeColumns(bool behavesLikeColumns)
+    SetPageLength(double pageLength)
+    SetGapBetweenPages(double gap)
 
-    PostInjectedBundleMessage(CoreIPC::DataReference messageData);
+    PostInjectedBundleMessage(WTF::String messageName, WebKit::WebContextUserMessageEncoder messageBody) Variadic
 
     # Find.
     FindString(WTF::String string, uint32_t findOptions, unsigned maxMatchCount)
@@ -169,19 +169,19 @@
 #endif
 
     # Popup menu.
-    DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex);
-    SetTextForActivePopupMenu(int32_t index);
-#if PLATFORM(GTK)    
-    FailedToShowPopupMenu();
+    DidChangeSelectedIndexForActivePopupMenu(int32_t newIndex)
+    SetTextForActivePopupMenu(int32_t index)
+#if PLATFORM(GTK)
+    FailedToShowPopupMenu()
 #endif
 #if PLATFORM(QT)
-    HidePopupMenu();
-    SelectedIndex(int32_t newIndex);
+    HidePopupMenu()
+    SelectedIndex(int32_t newIndex)
 #endif
     
 #if ENABLE(CONTEXT_MENUS)
     # Context menu.
-    DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItemData menuItem);
+    DidSelectItemFromActiveContextMenu(WebKit::WebContextMenuItemData menuItem)
 #endif
 
     # Open panel.
@@ -195,11 +195,11 @@
     AdvanceToNextMisspelling(bool startBeforeSelection)
     ChangeSpellingToWord(WTF::String word)
 #if USE(APPKIT)
-    UppercaseWord();
-    LowercaseWord();
-    CapitalizeWord();
+    UppercaseWord()
+    LowercaseWord()
+    CapitalizeWord()
 
-    SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled);
+    SetSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled)
 #endif
 
 #if ENABLE(GEOLOCATION)
@@ -214,7 +214,7 @@
 
     # Printing.
     BeginPrinting(uint64_t frameID, WebKit::PrintInfo printInfo)
-    EndPrinting();
+    EndPrinting()
     ComputePagesForPrinting(uint64_t frameID, WebKit::PrintInfo printInfo, uint64_t callbackID)
 #if PLATFORM(MAC) || PLATFORM(WIN)
     DrawRectToPDF(uint64_t frameID, WebKit::PrintInfo printInfo, WebCore::IntRect rect, uint64_t callbackID)
@@ -238,7 +238,7 @@
 
     # Web Intents
 #if ENABLE(WEB_INTENTS)
-    DeliverIntentToFrame(uint64_t frameID, WebKit::IntentData intentData);
+    DeliverIntentToFrame(uint64_t frameID, WebKit::IntentData intentData)
 #endif
 
 #if PLATFORM(EFL)
@@ -301,7 +301,7 @@
 #endif
 
 #if ENABLE(PAGE_VISIBILITY_API) || ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
-    SetVisibilityState(int visibilityState, bool isInitialState);
+    SetVisibilityState(int visibilityState, bool isInitialState)
 #endif
 
 #if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to