Title: [126311] trunk
Revision
126311
Author
[email protected]
Date
2012-08-22 09:36:47 -0700 (Wed, 22 Aug 2012)

Log Message

        [WK2] Support posting injected bundle messages to a page
        https://bugs.webkit.org/show_bug.cgi?id=94630

        Reviewed by Sam Weinig.

        * Shared/APIClientTraits.cpp:
        * Shared/APIClientTraits.h:
        * Shared/CoreIPCSupport/InjectedBundleMessageKinds.h:
        * UIProcess/API/C/WKPage.cpp:
        (WKPagePostMessageToInjectedBundle):
        * UIProcess/API/C/WKPage.h:
        * UIProcess/WebPageProxy.cpp:
        (WebKit::WebPageProxy::postMessageToInjectedBundle):
        * UIProcess/WebPageProxy.h:
        * WebProcess/InjectedBundle/API/c/WKBundle.h:
        * WebProcess/InjectedBundle/InjectedBundle.cpp:
        (WebKit::InjectedBundle::didReceiveMessageToPage):
        (WebKit::InjectedBundle::didReceiveMessage):
        * WebProcess/InjectedBundle/InjectedBundle.h:
        * WebProcess/InjectedBundle/InjectedBundleClient.cpp:
        (WebKit::InjectedBundleClient::didReceiveMessageToPage):
        * WebProcess/InjectedBundle/InjectedBundleClient.h:
        (InjectedBundleClient):
        Added a PostMessageToPage injected bundle message type, with all associated
        machinery. API is WKPagePostMessageToInjectedBundle(), and an associated
        didReceiveMessageToPage() injected bundle client function.

        * WebProcess/qt/QtBuiltinBundle.cpp: (WebKit::QtBuiltinBundle::initialize):
        Updated for new client API.

        * UIProcess/WebContext.cpp: (WebKit::WebContext::postMessageToInjectedBundle):
        Implemented multiple process model case.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (126310 => 126311)


--- trunk/Source/WebKit2/ChangeLog	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/ChangeLog	2012-08-22 16:36:47 UTC (rev 126311)
@@ -1,3 +1,38 @@
+2012-08-22  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] Support posting injected bundle messages to a page
+        https://bugs.webkit.org/show_bug.cgi?id=94630
+
+        Reviewed by Sam Weinig.
+
+        * Shared/APIClientTraits.cpp:
+        * Shared/APIClientTraits.h:
+        * Shared/CoreIPCSupport/InjectedBundleMessageKinds.h:
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPagePostMessageToInjectedBundle):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::postMessageToInjectedBundle):
+        * UIProcess/WebPageProxy.h:
+        * WebProcess/InjectedBundle/API/c/WKBundle.h:
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::didReceiveMessageToPage):
+        (WebKit::InjectedBundle::didReceiveMessage):
+        * WebProcess/InjectedBundle/InjectedBundle.h:
+        * WebProcess/InjectedBundle/InjectedBundleClient.cpp:
+        (WebKit::InjectedBundleClient::didReceiveMessageToPage):
+        * WebProcess/InjectedBundle/InjectedBundleClient.h:
+        (InjectedBundleClient):
+        Added a PostMessageToPage injected bundle message type, with all associated
+        machinery. API is WKPagePostMessageToInjectedBundle(), and an associated
+        didReceiveMessageToPage() injected bundle client function.
+
+        * WebProcess/qt/QtBuiltinBundle.cpp: (WebKit::QtBuiltinBundle::initialize):
+        Updated for new client API.
+
+        * UIProcess/WebContext.cpp: (WebKit::WebContext::postMessageToInjectedBundle):
+        Implemented multiple process model case.
+
 2012-08-22  Gustavo Noronha Silva  <[email protected]>
 
         [GTK] Split WebCore/platform into a separate library

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.cpp (126310 => 126311)


--- trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -31,6 +31,11 @@
 
 namespace WebKit {
 
+const size_t APIClientTraits<WKBundleClient>::interfaceSizesByVersion[] = {
+    offsetof(WKBundleClient, didReceiveMessageToPage),
+    sizeof(WKBundleClient)
+};
+
 const size_t APIClientTraits<WKBundlePageLoaderClient>::interfaceSizesByVersion[] = {
     offsetof(WKBundlePageLoaderClient, didLayoutForFrame),
     offsetof(WKBundlePageLoaderClient, didFinishProgress),

Modified: trunk/Source/WebKit2/Shared/APIClientTraits.h (126310 => 126311)


--- trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/Shared/APIClientTraits.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -26,6 +26,7 @@
 #ifndef APIClientTraits_h
 #define APIClientTraits_h
 
+#include "WKBundle.h"
 #include "WKBundlePage.h"
 #include "WKContext.h"
 #include "WKPage.h"
@@ -37,6 +38,10 @@
 };
 template <typename ClientInterface> const size_t APIClientTraits<ClientInterface>::interfaceSizesByVersion[] = { sizeof(ClientInterface) };
 
+template<> struct APIClientTraits<WKBundleClient> {
+    static const size_t interfaceSizesByVersion[2];
+};
+
 template<> struct APIClientTraits<WKBundlePageLoaderClient> {
     static const size_t interfaceSizesByVersion[4];
 };

Modified: trunk/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h (126310 => 126311)


--- trunk/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/Shared/CoreIPCSupport/InjectedBundleMessageKinds.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -33,7 +33,8 @@
 namespace InjectedBundleMessage {
 
 enum Kind {
-    PostMessage
+    PostMessage,
+    PostMessageToPage
 };
 
 }

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (126310 => 126311)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -712,3 +712,9 @@
 {
     toImpl(page)->setMediaVolume(volume);    
 }
+
+void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
+{
+    toImpl(pageRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef));
+}
+

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (126310 => 126311)


--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -489,6 +489,8 @@
 WK_EXPORT void WKPageValidateCommand(WKPageRef page, WKStringRef command, void* context, WKPageValidateCommandCallback callback);
 WK_EXPORT void WKPageExecuteCommand(WKPageRef page, WKStringRef command);
 
+WK_EXPORT void WKPagePostMessageToInjectedBundle(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody);
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/WebContext.cpp (126310 => 126311)


--- trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/UIProcess/WebContext.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -514,17 +514,19 @@
 
 void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
 {
-    if (m_processModel == ProcessModelSharedSecondaryProcess) {
-        if (m_processes.isEmpty() || !m_processes[0]->canSendMessage()) {
+    if (m_processes.isEmpty()) {
+        m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody));
+        return;
+    }
+
+    for (size_t i = 0; i < m_processes.size(); ++i) {
+        // FIXME (Multi-WebProcess): Evolve m_pendingMessagesToPostToInjectedBundle to work with multiple secondary processes.
+        if (!m_processes[i]->canSendMessage()) {
             m_pendingMessagesToPostToInjectedBundle.append(std::make_pair(messageName, messageBody));
-            return;
+            continue;
         }
-
-        // FIXME: We should consider returning false from this function if the messageBody cannot
-        // be encoded.
-        m_processes[0]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
-    } else {
-        // FIXME (Multi-WebProcess): Implement.
+        // FIXME: We should consider returning false from this function if the messageBody cannot be encoded.
+        m_processes[i]->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
     }
 }
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (126310 => 126311)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -34,6 +34,7 @@
 #include "DrawingAreaProxy.h"
 #include "EventDispatcherMessages.h"
 #include "FindIndicator.h"
+#include "InjectedBundleMessageKinds.h"
 #include "Logging.h"
 #include "MessageID.h"
 #include "NativeWebKeyboardEvent.h"
@@ -2887,6 +2888,12 @@
     return m_currentlyProcessedMouseDownEvent.get();
 }
 
+void WebPageProxy::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
+{
+    // FIXME: We should consider returning false from this function if the messageBody cannot be encoded.
+    process()->deprecatedSend(InjectedBundleMessage::PostMessageToPage, m_pageID, CoreIPC::In(messageName, WebContextUserMessageEncoder(messageBody)));
+}
+
 #if PLATFORM(GTK)
 void WebPageProxy::failedToShowPopupMenu()
 {

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (126310 => 126311)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -715,6 +715,8 @@
     void setSuppressVisibilityUpdates(bool flag) { m_suppressVisibilityUpdates = flag; }
     bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
 
+    void postMessageToInjectedBundle(const String& messageName, APIObject* messageBody);
+
 private:
     WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -38,6 +38,7 @@
 typedef void (*WKBundleWillDestroyPageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
 typedef void (*WKBundleDidInitializePageGroupCallback)(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, const void* clientInfo);
 typedef void (*WKBundleDidReceiveMessageCallback)(WKBundleRef bundle, WKStringRef name, WKTypeRef messageBody, const void* clientInfo);
+typedef void (*WKBundleDidReceiveMessageToPageCallback)(WKBundleRef bundle, WKBundlePageRef page, WKStringRef name, WKTypeRef messageBody, const void* clientInfo);
 
 struct WKBundleClient {
     int                                                                 version;
@@ -46,14 +47,17 @@
     WKBundleWillDestroyPageCallback                                     willDestroyPage;
     WKBundleDidInitializePageGroupCallback                              didInitializePageGroup;
     WKBundleDidReceiveMessageCallback                                   didReceiveMessage;
+
+    // Version 1.
+    WKBundleDidReceiveMessageToPageCallback                             didReceiveMessageToPage;
 };
 typedef struct WKBundleClient WKBundleClient;
 
-enum { kWKBundleClientCurrentVersion = 0 };
+enum { kWKBundleClientCurrentVersion = 1 };
 
 WK_EXPORT WKTypeID WKBundleGetTypeID();
 
-WK_EXPORT void WKBundleSetClient(WKBundleRef bundle, WKBundleClient * client);
+WK_EXPORT void WKBundleSetClient(WKBundleRef bundle, WKBundleClient* client);
 
 WK_EXPORT void WKBundlePostMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody);
 WK_EXPORT void WKBundlePostSynchronousMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -478,6 +478,11 @@
     m_client.didReceiveMessage(this, messageName, messageBody);
 }
 
+void InjectedBundle::didReceiveMessageToPage(WebPage* page, const String& messageName, APIObject* messageBody)
+{
+    m_client.didReceiveMessageToPage(this, page, messageName, messageBody);
+}
+
 void InjectedBundle::didReceiveMessage(CoreIPC::Connection* connection, CoreIPC::MessageID messageID, CoreIPC::ArgumentDecoder* arguments)
 {
     switch (messageID.get<InjectedBundleMessage::Kind>()) {
@@ -491,6 +496,25 @@
             didReceiveMessage(messageName, messageBody.get());
             return;
         }
+
+        case InjectedBundleMessage::PostMessageToPage: {
+            uint64_t pageID = arguments->destinationID();
+            if (!pageID)
+                return;
+            
+            WebPage* page = WebProcess::shared().webPage(pageID);
+            if (!page)
+                return;
+
+            String messageName;
+            RefPtr<APIObject> messageBody;
+            InjectedBundleUserMessageDecoder messageDecoder(messageBody);
+            if (!arguments->decode(CoreIPC::Out(messageName, messageDecoder)))
+                return;
+
+            didReceiveMessageToPage(page, messageName, messageBody.get());
+            return;
+        }
     }
 
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -152,6 +152,7 @@
     void willDestroyPage(WebPage*);
     void didInitializePageGroup(WebPageGroupProxy*);
     void didReceiveMessage(const String&, APIObject*);
+    void didReceiveMessageToPage(WebPage*, const String&, APIObject*);
 
     void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
 

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -62,4 +62,12 @@
     m_client.didReceiveMessage(toAPI(bundle), toAPI(messageName.impl()), toAPI(messageBody), m_client.clientInfo);
 }
 
+void InjectedBundleClient::didReceiveMessageToPage(InjectedBundle* bundle, WebPage* page, const String& messageName, APIObject* messageBody)
+{
+    if (!m_client.didReceiveMessageToPage)
+        return;
+
+    m_client.didReceiveMessageToPage(toAPI(bundle), toAPI(page), toAPI(messageName.impl()), toAPI(messageBody), m_client.clientInfo);
+}
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -43,6 +43,7 @@
     void willDestroyPage(InjectedBundle*, WebPage*);
     void didInitializePageGroup(InjectedBundle*, WebPageGroupProxy*);
     void didReceiveMessage(InjectedBundle*, const String& messageName, APIObject* messageBody);
+    void didReceiveMessageToPage(InjectedBundle*, WebPage*, const String& messageName, APIObject* messageBody);
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp (126310 => 126311)


--- trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Source/WebKit2/WebProcess/qt/QtBuiltinBundle.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -58,7 +58,8 @@
         didCreatePage,
         willDestroyPage,
         0, // didInitializePageGroup
-        didReceiveMessage
+        didReceiveMessage,
+        0 // didReceiveMessageToPage
     };
     WKBundleSetClient(m_bundle, &client);
 }

Modified: trunk/Tools/ChangeLog (126310 => 126311)


--- trunk/Tools/ChangeLog	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/ChangeLog	2012-08-22 16:36:47 UTC (rev 126311)
@@ -1,3 +1,24 @@
+2012-08-22  Alexey Proskuryakov  <[email protected]>
+
+        [WK2] Support posting injected bundle messages to a page
+        https://bugs.webkit.org/show_bug.cgi?id=94630
+
+        Reviewed by Sam Weinig.
+
+        * MiniBrowser/mac/WebBundle/WebBundleMain.m:
+        * TestWebKitAPI/InjectedBundleController.cpp:
+        (TestWebKitAPI::InjectedBundleController::initialize):
+        (TestWebKitAPI::InjectedBundleController::didReceiveMessageToPage):
+        * TestWebKitAPI/InjectedBundleController.h:
+        * TestWebKitAPI/InjectedBundleTest.h:
+        (TestWebKitAPI::InjectedBundleTest::didReceiveMessageToPage):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::didReceiveMessage):
+        (WTR::InjectedBundle::didReceiveMessageToPage):
+        (WTR::InjectedBundle::initialize):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        Updated for new client API call.
+
 2012-08-22  Dominic Mazzoni  <[email protected]>
 
         REGRESSION (r125710): accessibility/accessibility-node-reparent.html, accessibility/accessibility-node-memory-management.html failing on GTK Linux

Modified: trunk/Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m (126310 => 126311)


--- trunk/Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/MiniBrowser/mac/WebBundle/WebBundleMain.m	2012-08-22 16:36:47 UTC (rev 126311)
@@ -99,7 +99,8 @@
         didCreatePage,
         willDestroyPage,
         0, // didInitializePageGroup
-        didReceiveMessage
+        didReceiveMessage,
+        0 // didReceiveMessageToPage
     };
     WKBundleSetClient(bundle, &client);
 }

Modified: trunk/Tools/TestWebKitAPI/InjectedBundleController.cpp (126310 => 126311)


--- trunk/Tools/TestWebKitAPI/InjectedBundleController.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/TestWebKitAPI/InjectedBundleController.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -60,7 +60,8 @@
         didCreatePage,
         willDestroyPage,
         didInitializePageGroup,
-        didReceiveMessage
+        didReceiveMessage,
+        didReceiveMessageToPage
     };
     WKBundleSetClient(m_bundle, &client);
 
@@ -103,6 +104,13 @@
     self->m_currentTest->didReceiveMessage(bundle, messageName, messageBody);
 }
 
+void InjectedBundleController::didReceiveMessageToPage(WKBundleRef bundle, WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+    InjectedBundleController* self = static_cast<InjectedBundleController*>(const_cast<void*>(clientInfo));
+    assert(self->m_currentTest);
+    self->m_currentTest->didReceiveMessageToPage(bundle, page, messageName, messageBody);
+}
+
 void InjectedBundleController::dumpTestNames()
 {
     std::map<std::string, CreateInjectedBundleTestFunction>::const_iterator it = m_createInjectedBundleTestFunctions.begin();

Modified: trunk/Tools/TestWebKitAPI/InjectedBundleController.h (126310 => 126311)


--- trunk/Tools/TestWebKitAPI/InjectedBundleController.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/TestWebKitAPI/InjectedBundleController.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -58,6 +58,7 @@
     static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
     static void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef, const void* clientInfo);
     static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
+    static void didReceiveMessageToPage(WKBundleRef, WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
 
     std::map<std::string, CreateInjectedBundleTestFunction> m_createInjectedBundleTestFunctions;
     WKBundleRef m_bundle;

Modified: trunk/Tools/TestWebKitAPI/InjectedBundleTest.h (126310 => 126311)


--- trunk/Tools/TestWebKitAPI/InjectedBundleTest.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/TestWebKitAPI/InjectedBundleTest.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -40,6 +40,7 @@
     virtual void willDestroyPage(WKBundleRef, WKBundlePageRef) { }
     virtual void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef) { }
     virtual void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody) { }
+    virtual void didReceiveMessageToPage(WKBundleRef, WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody) { }
 
     std::string name() const { return m_identifier; }
     

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (126310 => 126311)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2012-08-22 16:36:47 UTC (rev 126311)
@@ -72,11 +72,16 @@
     static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didInitializePageGroup(pageGroup);
 }
 
-void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
+void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
 {
     static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody);
 }
 
+void InjectedBundle::didReceiveMessageToPage(WKBundleRef bundle, WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+    static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessageToPage(page, messageName, messageBody);
+}
+
 void InjectedBundle::initialize(WKBundleRef bundle, WKTypeRef initializationUserData)
 {
     m_bundle = bundle;
@@ -88,7 +93,8 @@
         didCreatePage,
         willDestroyPage,
         didInitializePageGroup,
-        didReceiveMessage
+        didReceiveMessage,
+        didReceiveMessageToPage
     };
     WKBundleSetClient(m_bundle, &client);
 
@@ -190,6 +196,13 @@
     WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
 }
 
+void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody)
+{
+    WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
+    WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
+    WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
+}
+
 bool InjectedBundle::booleanForKey(WKDictionaryRef dictionary, const char* key)
 {
     WKRetainPtr<WKStringRef> wkKey(AdoptWK, WKStringCreateWithUTF8CString(key));

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (126310 => 126311)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2012-08-22 16:07:44 UTC (rev 126310)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2012-08-22 16:36:47 UTC (rev 126311)
@@ -97,11 +97,13 @@
     static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
     static void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef, const void* clientInfo);
     static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
+    static void didReceiveMessageToPage(WKBundleRef, WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
 
     void didCreatePage(WKBundlePageRef);
     void willDestroyPage(WKBundlePageRef);
     void didInitializePageGroup(WKBundlePageGroupRef);
     void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody);
+    void didReceiveMessageToPage(WKBundlePageRef, WKStringRef messageName, WKTypeRef messageBody);
 
     void platformInitialize(WKTypeRef initializationUserData);
     void resetLocalSettings();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to