Diff
Modified: trunk/Source/WebKit2/CMakeLists.txt (182259 => 182260)
--- trunk/Source/WebKit2/CMakeLists.txt 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/CMakeLists.txt 2015-04-01 23:22:19 UTC (rev 182260)
@@ -374,6 +374,7 @@
UIProcess/WebOriginDataManagerProxy.cpp
UIProcess/WebPageDiagnosticLoggingClient.cpp
UIProcess/WebPageGroup.cpp
+ UIProcess/WebPageInjectedBundleClient.cpp
UIProcess/WebPageProxy.cpp
UIProcess/WebPasteboardProxy.cpp
UIProcess/WebPreferences.cpp
Modified: trunk/Source/WebKit2/ChangeLog (182259 => 182260)
--- trunk/Source/WebKit2/ChangeLog 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/ChangeLog 2015-04-01 23:22:19 UTC (rev 182260)
@@ -1,3 +1,45 @@
+2015-04-01 Enrica Casucci <enr...@apple.com>
+
+ Injected bundle messages should be at the page level.
+ https://bugs.webkit.org/show_bug.cgi?id=143283
+
+ Reviewed by Alexey Proskuryakov.
+
+ All the messages between the injected bundle and the UI
+ process should be page level messages instead of context.
+ The author of this patch is Tim Horton, I just finished it.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageInjectedBundleClient):
+ * UIProcess/API/C/WKPage.h:
+ * UIProcess/API/C/WKPageInjectedBundleClient.h: Added.
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _pageForTesting]):
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/WebPageInjectedBundleClient.cpp: Added.
+ (WebKit::WebPageInjectedBundleClient::didReceiveMessageFromInjectedBundle):
+ (WebKit::WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle):
+ * UIProcess/WebPageInjectedBundleClient.h: Added.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::setInjectedBundleClient):
+ (WebKit::WebPageProxy::handleMessage):
+ (WebKit::WebPageProxy::handleSynchronousMessage):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::injectedBundleClient):
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::handleMessage):
+ * WebKit2.xcodeproj/project.pbxproj:
+ * CMakeLists.txt:
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePagePostMessage):
+ (WKBundlePagePostSynchronousMessage):
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::postMessage):
+ (WebKit::WebPage::postSynchronousMessage):
+ * WebProcess/WebPage/WebPage.h:
+
2015-04-01 Alexey Proskuryakov <a...@apple.com>
[iOS] WebContent should have access to the entirety of its caches directory
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -881,6 +881,11 @@
toImpl(pageRef)->initializeFindMatchesClient(wkClient);
}
+void WKPageSetPageInjectedBundleClient(WKPageRef pageRef, const WKPageInjectedBundleClientBase* wkClient)
+{
+ toImpl(pageRef)->setInjectedBundleClient(wkClient);
+}
+
void WKPageSetPageFormClient(WKPageRef pageRef, const WKPageFormClientBase* wkClient)
{
toImpl(pageRef)->setFormClient(std::make_unique<WebFormClient>(wkClient));
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.h (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -37,6 +37,7 @@
#include <WebKit/WKPageFindClient.h>
#include <WebKit/WKPageFindMatchesClient.h>
#include <WebKit/WKPageFormClient.h>
+#include <WebKit/WKPageInjectedBundleClient.h>
#include <WebKit/WKPageLoadTypes.h>
#include <WebKit/WKPageLoaderClient.h>
#include <WebKit/WKPageNavigationClient.h>
@@ -214,6 +215,7 @@
WK_EXPORT void WKPageSetPageFindMatchesClient(WKPageRef page, const WKPageFindMatchesClientBase* client);
WK_EXPORT void WKPageSetPageFormClient(WKPageRef page, const WKPageFormClientBase* client);
WK_EXPORT void WKPageSetPageUIClient(WKPageRef page, const WKPageUIClientBase* client);
+WK_EXPORT void WKPageSetPageInjectedBundleClient(WKPageRef page, const WKPageInjectedBundleClientBase* client);
// A client can implement either a navigation client or loader and policy clients, but never both.
WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClientBase* client);
Added: trunk/Source/WebKit2/UIProcess/API/C/WKPageInjectedBundleClient.h (0 => 182260)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPageInjectedBundleClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageInjectedBundleClient.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKPageInjectedBundleClient_h
+#define WKPageInjectedBundleClient_h
+
+#include <WebKit/WKBase.h>
+
+typedef void (*WKPageDidReceiveMessageFromInjectedBundleCallback)(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
+typedef void (*WKPageDidReceiveSynchronousMessageFromInjectedBundleCallback)(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void *clientInfo);
+typedef WKTypeRef (*WKPageGetInjectedBundleInitializationUserDataCallback)(WKPageRef page, const void *clientInfo);
+
+typedef struct WKPageInjectedBundleClientBase {
+ int version;
+ const void * clientInfo;
+} WKPageInjectedBundleClientBase;
+
+typedef struct WKPageInjectedBundleClientV0 {
+ WKPageInjectedBundleClientBase base;
+
+ // Version 0.
+ WKPageDidReceiveMessageFromInjectedBundleCallback didReceiveMessageFromInjectedBundle;
+ WKPageDidReceiveSynchronousMessageFromInjectedBundleCallback didReceiveSynchronousMessageFromInjectedBundle;
+} WKPageInjectedBundleClientV0;
+
+#endif // WKPageInjectedBundleClient_h
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2015-04-01 23:22:19 UTC (rev 182260)
@@ -620,6 +620,11 @@
_page->setCustomUserAgent(customUserAgent);
}
+- (WKPageRef)_pageForTesting
+{
+ return toAPI(_page.get());
+}
+
#pragma mark iOS-specific methods
#if PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -46,6 +46,8 @@
#define WK_WEB_VIEW_PROTOCOLS
#endif
+typedef const struct OpaqueWKPage* WKPageRef;
+
namespace WebKit {
class ViewSnapshot;
class WebPageProxy;
@@ -106,6 +108,8 @@
@property (nonatomic, setter=_setIgnoresNonWheelEvents:) BOOL _ignoresNonWheelEvents;
#endif
+- (WKPageRef)_pageForTesting;
+
@end
WKWebView* fromWebPageProxy(WebKit::WebPageProxy&);
Added: trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp (0 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebPageInjectedBundleClient.h"
+
+#include "WKAPICast.h"
+#include "WebProcessPool.h"
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebPageInjectedBundleClient::didReceiveMessageFromInjectedBundle(WebPageProxy* page, const String& messageName, API::Object* messageBody)
+{
+ if (!m_client.didReceiveMessageFromInjectedBundle)
+ return;
+
+ m_client.didReceiveMessageFromInjectedBundle(toAPI(page), toAPI(messageName.impl()), toAPI(messageBody), m_client.base.clientInfo);
+}
+
+void WebPageInjectedBundleClient::didReceiveSynchronousMessageFromInjectedBundle(WebPageProxy* page, const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData)
+{
+ if (!m_client.didReceiveSynchronousMessageFromInjectedBundle)
+ return;
+
+ WKTypeRef returnDataRef = 0;
+ m_client.didReceiveSynchronousMessageFromInjectedBundle(toAPI(page), toAPI(messageName.impl()), toAPI(messageBody), &returnDataRef, m_client.base.clientInfo);
+ returnData = adoptRef(toImpl(returnDataRef));
+}
+
+} // namespace WebKit
Added: trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.h (0 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/WebPageInjectedBundleClient.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebPageInjectedBundleClient_h
+#define WebPageInjectedBundleClient_h
+
+#include "APIClient.h"
+#include "WKPage.h"
+#include <wtf/Forward.h>
+
+namespace API {
+class Object;
+
+template<> struct ClientTraits<WKPageInjectedBundleClientBase> {
+ typedef std::tuple<WKPageInjectedBundleClientV0> Versions;
+};
+}
+
+namespace WebKit {
+
+class WebPageProxy;
+
+class WebPageInjectedBundleClient : public API::Client<WKPageInjectedBundleClientBase> {
+public:
+ void didReceiveMessageFromInjectedBundle(WebPageProxy*, const String&, API::Object*);
+ void didReceiveSynchronousMessageFromInjectedBundle(WebPageProxy*, const String&, API::Object*, RefPtr<API::Object>& returnData);
+};
+
+} // namespace WebKit
+
+#endif // WebPageInjectedBundleClient_h
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -604,6 +604,36 @@
}
#endif
+void WebPageProxy::setInjectedBundleClient(const WKPageInjectedBundleClientBase* client)
+{
+ if (!client) {
+ m_injectedBundleClient = nullptr;
+ return;
+ }
+
+ m_injectedBundleClient = std::make_unique<WebPageInjectedBundleClient>();
+ m_injectedBundleClient->initialize(client);
+}
+
+void WebPageProxy::handleMessage(IPC::Connection& connection, const String& messageName, const WebKit::UserData& messageBody)
+{
+ auto* webProcessProxy = WebProcessProxy::fromConnection(&connection);
+ if (!webProcessProxy || !m_injectedBundleClient)
+ return;
+ m_injectedBundleClient->didReceiveMessageFromInjectedBundle(this, messageName, webProcessProxy->transformHandlesToObjects(messageBody.object()).get());
+}
+
+void WebPageProxy::handleSynchronousMessage(IPC::Connection& connection, const String& messageName, const UserData& messageBody, UserData& returnUserData)
+{
+ if (!WebProcessProxy::fromConnection(&connection) || !m_injectedBundleClient)
+ return;
+
+ RefPtr<API::Object> returnData;
+ m_injectedBundleClient->didReceiveSynchronousMessageFromInjectedBundle(this, messageName, WebProcessProxy::fromConnection(&connection)->transformHandlesToObjects(messageBody.object()).get(), returnData);
+ returnUserData = UserData(WebProcessProxy::fromConnection(&connection)->transformObjectsToHandles(returnData.get()));
+}
+
+
void WebPageProxy::reattachToWebProcess()
{
ASSERT(!m_isClosed);
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -57,6 +57,7 @@
#include "WebFrameProxy.h"
#include "WebPageCreationParameters.h"
#include "WebPageDiagnosticLoggingClient.h"
+#include "WebPageInjectedBundleClient.h"
#include "WebPreferences.h"
#include <WebCore/AlternativeTextClient.h> // FIXME: Needed by WebPageProxyMessages.h for DICTATION_ALTERNATIVES.
#include "WebPageProxyMessages.h"
@@ -330,6 +331,8 @@
void setHistoryClient(std::unique_ptr<API::HistoryClient>);
void setLoaderClient(std::unique_ptr<API::LoaderClient>);
void setPolicyClient(std::unique_ptr<API::PolicyClient>);
+ void setInjectedBundleClient(const WKPageInjectedBundleClientBase*);
+ WebPageInjectedBundleClient* injectedBundleClient() { return m_injectedBundleClient.get(); }
API::UIClient& uiClient() { return *m_uiClient; }
void setUIClient(std::unique_ptr<API::UIClient>);
@@ -1414,6 +1417,9 @@
void handleAutoFillButtonClick(const UserData&);
+ void handleMessage(IPC::Connection&, const String& messageName, const UserData& messageBody);
+ void handleSynchronousMessage(IPC::Connection&, const String& messageName, const UserData& messageBody, UserData& returnUserData);
+
PageClient& m_pageClient;
std::unique_ptr<API::LoaderClient> m_loaderClient;
std::unique_ptr<API::PolicyClient> m_policyClient;
@@ -1430,6 +1436,7 @@
#if ENABLE(CONTEXT_MENUS)
std::unique_ptr<API::ContextMenuClient> m_contextMenuClient;
#endif
+ std::unique_ptr<WebPageInjectedBundleClient> m_injectedBundleClient;
std::unique_ptr<WebNavigationState> m_navigationState;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2015-04-01 23:22:19 UTC (rev 182260)
@@ -426,6 +426,8 @@
#if PLATFORM(MAC)
DidPerformActionMenuHitTest(struct WebKit::ActionMenuHitTestResult result, bool forImmediateAction, WebKit::UserData userData)
#endif
+ HandleMessage(String messageName, WebKit::UserData messageBody) WantsConnection
+ HandleSynchronousMessage(String messageName, WebKit::UserData messageBody) -> (WebKit::UserData returnData) WantsConnection
HandleAutoFillButtonClick(WebKit::UserData userData);
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (182259 => 182260)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -1310,7 +1310,6 @@
auto* webProcessProxy = WebProcessProxy::fromConnection(&connection);
if (!webProcessProxy)
return;
-
m_injectedBundleClient.didReceiveMessageFromInjectedBundle(this, messageName, webProcessProxy->transformHandlesToObjects(messageBody.object()).get());
}
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (182259 => 182260)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-04-01 23:22:19 UTC (rev 182260)
@@ -638,6 +638,9 @@
2D8710171828415D0018FA01 /* PlatformCALayerRemoteCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8710151828415D0018FA01 /* PlatformCALayerRemoteCustom.h */; };
2D8949F0182044F600E898AA /* PlatformCALayerRemoteTiledBacking.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D8949EE182044F600E898AA /* PlatformCALayerRemoteTiledBacking.cpp */; };
2D8949F1182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D8949EF182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h */; };
+ 2D9EA30D1A96CB59002D2807 /* WKPageInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9EA30C1A96CB59002D2807 /* WKPageInjectedBundleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 2D9EA30F1A96CBFF002D2807 /* WebPageInjectedBundleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */; };
+ 2D9EA3111A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9EA3101A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp */; };
2DA049B3180CCCD300AAFA9E /* PlatformCALayerRemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA049B1180CCCD300AAFA9E /* PlatformCALayerRemote.cpp */; };
2DA049B4180CCCD300AAFA9E /* PlatformCALayerRemote.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */; };
2DA049B7180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */; };
@@ -2797,6 +2800,9 @@
2D8710151828415D0018FA01 /* PlatformCALayerRemoteCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemoteCustom.h; sourceTree = "<group>"; };
2D8949EE182044F600E898AA /* PlatformCALayerRemoteTiledBacking.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformCALayerRemoteTiledBacking.cpp; sourceTree = "<group>"; };
2D8949EF182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemoteTiledBacking.h; sourceTree = "<group>"; };
+ 2D9EA30C1A96CB59002D2807 /* WKPageInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageInjectedBundleClient.h; sourceTree = "<group>"; };
+ 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageInjectedBundleClient.h; sourceTree = "<group>"; };
+ 2D9EA3101A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageInjectedBundleClient.cpp; sourceTree = "<group>"; };
2DA049B1180CCCD300AAFA9E /* PlatformCALayerRemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformCALayerRemote.cpp; sourceTree = "<group>"; };
2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemote.h; sourceTree = "<group>"; };
2DA049B5180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsLayerCARemote.cpp; sourceTree = "<group>"; };
@@ -6236,6 +6242,8 @@
8372DB271A67562800C697C5 /* WebPageDiagnosticLoggingClient.h */,
BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */,
BC7B6204129A0A6700D174A4 /* WebPageGroup.h */,
+ 2D9EA3101A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp */,
+ 2D9EA30E1A96CBFF002D2807 /* WebPageInjectedBundleClient.h */,
BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */,
BC032DCB10F4389F0058C15A /* WebPageProxy.h */,
BCBD38FA125BAB9A00D2C29F /* WebPageProxy.messages.in */,
@@ -6405,6 +6413,7 @@
1AB8A1EF18400B0000E9AE69 /* WKPageFormClient.h */,
BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */,
BC7B633512A45ABA00D174A4 /* WKPageGroup.h */,
+ 2D9EA30C1A96CB59002D2807 /* WKPageInjectedBundleClient.h */,
1AB8A1EB1840080900E9AE69 /* WKPageLoaderClient.h */,
2D7303781A7C2B7500F8F487 /* WKPageNavigationClient.h */,
1AB8A1ED18400ACB00E9AE69 /* WKPagePolicyClient.h */,
@@ -7639,6 +7648,7 @@
51BA24441858EE3000EA2811 /* AsyncTask.h in Headers */,
BCEE966D112FAF57006BCC24 /* Attachment.h in Headers */,
E1A31732134CEA6C007C9A4F /* AttributedString.h in Headers */,
+ 2D9EA30F1A96CBFF002D2807 /* WebPageInjectedBundleClient.h in Headers */,
512F589712A8838800629530 /* AuthenticationChallengeProxy.h in Headers */,
512F589912A8838800629530 /* AuthenticationDecisionListener.h in Headers */,
518E8EF916B2091C00E91429 /* AuthenticationManager.h in Headers */,
@@ -8179,6 +8189,7 @@
8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */,
1AB474E4184D44980051B622 /* WKBundlePageContextMenuClient.h in Headers */,
1AB474E8184D44D00051B622 /* WKBundlePageDiagnosticLoggingClient.h in Headers */,
+ 2D9EA30D1A96CB59002D2807 /* WKPageInjectedBundleClient.h in Headers */,
7C89D2BC1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h in Headers */,
1AB474E0184D446A0051B622 /* WKBundlePageEditorClient.h in Headers */,
1AB474E2184D44800051B622 /* WKBundlePageFormClient.h in Headers */,
@@ -9919,6 +9930,7 @@
51FB08FF1639DE1A00EC324A /* WebResourceLoadScheduler.cpp in Sources */,
7C361D721927FA360036A59D /* WebScriptMessageHandler.cpp in Sources */,
D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */,
+ 2D9EA3111A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp in Sources */,
1A53C2A91A32572B004E8C70 /* WebsiteDataStore.cpp in Sources */,
CEDBA84719FDA00A006866A5 /* WebSQLiteDatabaseTracker.cpp in Sources */,
1A52C0F71A38CDC70016160A /* WebStorageNamespaceProvider.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (182259 => 182260)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -572,3 +572,17 @@
toImpl(pageRef)->setUseTestingViewportConfiguration(useTestingViewportConfiguration);
}
#endif
+
+void WKBundlePagePostMessage(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
+{
+ toImpl(pageRef)->postMessage(toWTFString(messageNameRef), toImpl(messageBodyRef));
+}
+
+void WKBundlePagePostSynchronousMessage(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnDataRef)
+{
+ RefPtr<API::Object> returnData;
+ toImpl(pageRef)->postSynchronousMessage(toWTFString(messageNameRef), toImpl(messageBodyRef), returnData);
+ if (returnDataRef)
+ *returnDataRef = toAPI(returnData.release().leakRef());
+}
+
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h (182259 => 182260)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -109,6 +109,9 @@
WK_EXPORT bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef page);
+WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody);
+WK_EXPORT void WKBundlePagePostSynchronousMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (182259 => 182260)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -4832,4 +4832,20 @@
updateMainFrameScrollOffsetPinning();
}
+void WebPage::postMessage(const String& messageName, API::Object* messageBody)
+{
+ send(Messages::WebPageProxy::HandleMessage(messageName, UserData(WebProcess::singleton().transformObjectsToHandles(messageBody))));
+}
+
+void WebPage::postSynchronousMessage(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData)
+{
+ UserData returnUserData;
+
+ auto& webProcess = WebProcess::singleton();
+ if (!sendSync(Messages::WebPageProxy::HandleSynchronousMessage(messageName, UserData(webProcess.transformObjectsToHandles(messageBody))), Messages::WebPageProxy::HandleSynchronousMessage::Reply(returnUserData)))
+ returnData = nullptr;
+ else
+ returnData = webProcess.transformHandlesToObjects(returnUserData.object());
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (182259 => 182260)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -865,6 +865,9 @@
void setPageActivityState(WebCore::PageActivityState::Flags);
+ void postMessage(const String& messageName, API::Object* messageBody);
+ void postSynchronousMessage(const String& messageName, API::Object* messageBody, RefPtr<API::Object>& returnData);
+
private:
WebPage(uint64_t pageID, const WebPageCreationParameters&);
Modified: trunk/Tools/ChangeLog (182259 => 182260)
--- trunk/Tools/ChangeLog 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/ChangeLog 2015-04-01 23:22:19 UTC (rev 182260)
@@ -1,3 +1,80 @@
+2015-04-01 Enrica Casucci <enr...@apple.com>
+
+ Injected bundle messages should be at the page level.
+ https://bugs.webkit.org/show_bug.cgi?id=143283
+
+ Reviewed by Alexey Proskuryakov.
+
+ Updating WebKitTestRunner to use the new page level messaging.
+ The author of this patch is Tim Horton, I just finished it.
+
+ * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
+ (WTR::EventSendingController::mouseDown):
+ (WTR::EventSendingController::mouseUp):
+ (WTR::EventSendingController::mouseMoveTo):
+ (WTR::EventSendingController::leapForward):
+ (WTR::EventSendingController::scheduleAsynchronousClick):
+ (WTR::EventSendingController::keyDown):
+ (WTR::EventSendingController::scheduleAsynchronousKeyDown):
+ (WTR::EventSendingController::mouseScrollBy):
+ (WTR::EventSendingController::mouseScrollByWithWheelAndMomentumPhases):
+ (WTR::EventSendingController::continuousMouseScrollBy):
+ (WTR::EventSendingController::addTouchPoint):
+ (WTR::EventSendingController::updateTouchPoint):
+ (WTR::EventSendingController::setTouchModifier):
+ (WTR::EventSendingController::setTouchPointRadius):
+ (WTR::EventSendingController::touchStart):
+ (WTR::EventSendingController::touchMove):
+ (WTR::EventSendingController::touchEnd):
+ (WTR::EventSendingController::touchCancel):
+ (WTR::EventSendingController::clearTouchPoints):
+ (WTR::EventSendingController::releaseTouchPoint):
+ (WTR::EventSendingController::cancelTouchPoint):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didReceiveMessage):
+ (WTR::InjectedBundle::didReceiveMessageToPage):
+ (WTR::InjectedBundle::done):
+ (WTR::InjectedBundle::outputText):
+ (WTR::InjectedBundle::postNewBeforeUnloadReturnValue):
+ (WTR::InjectedBundle::postAddChromeInputField):
+ (WTR::InjectedBundle::postRemoveChromeInputField):
+ (WTR::InjectedBundle::postFocusWebView):
+ (WTR::InjectedBundle::postSetBackingScaleFactor):
+ (WTR::InjectedBundle::postSetWindowIsKey):
+ (WTR::InjectedBundle::postSimulateWebNotificationClick):
+ (WTR::InjectedBundle::postSetAddsVisitedLinks):
+ (WTR::InjectedBundle::setGeolocationPermission):
+ (WTR::InjectedBundle::setMockGeolocationPosition):
+ (WTR::InjectedBundle::setMockGeolocationPositionUnavailableError):
+ (WTR::InjectedBundle::setUserMediaPermission):
+ (WTR::InjectedBundle::setCustomPolicyDelegate):
+ (WTR::InjectedBundle::setHidden):
+ (WTR::InjectedBundle::setCacheModel):
+ (WTR::InjectedBundle::shouldProcessWorkQueue):
+ (WTR::InjectedBundle::processWorkQueue):
+ (WTR::InjectedBundle::queueBackNavigation):
+ (WTR::InjectedBundle::queueForwardNavigation):
+ (WTR::InjectedBundle::queueLoad):
+ (WTR::InjectedBundle::queueLoadHTMLString):
+ (WTR::InjectedBundle::queueReload):
+ (WTR::InjectedBundle::queueLoadingScript):
+ (WTR::InjectedBundle::queueNonLoadingScript):
+ * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+ (WTR::TestRunner::setHandlesAuthenticationChallenges):
+ (WTR::TestRunner::setAuthenticationUsername):
+ (WTR::TestRunner::setAuthenticationPassword):
+ (WTR::TestRunner::secureEventInputIsEnabled):
+ (WTR::TestRunner::setBlockAllPlugins):
+ * WebKitTestRunner/TestController.cpp:
+ (WTR::TestController::createWebViewWithOptions):
+ (WTR::TestController::resetStateToConsistentValues):
+ (WTR::TestController::didReceivePageMessageFromInjectedBundle):
+ (WTR::TestController::didReceiveSynchronousPageMessageFromInjectedBundle):
+ * WebKitTestRunner/TestController.h:
+ * WebKitTestRunner/TestInvocation.cpp:
+ (WTR::TestInvocation::invoke):
+ (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
2015-04-01 Commit Queue <commit-qu...@webkit.org>
Unreviewed, rolling out r182174 and r182177.
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -208,8 +208,8 @@
void EventSendingController::mouseDown(int button, JSValueRef modifierArray)
{
- auto& injectedBungle = InjectedBundle::singleton();
- WKBundlePageRef page = injectedBungle.page()->page();
+ auto& injectedBundle = InjectedBundle::singleton();
+ WKBundlePageRef page = injectedBundle.page()->page();
WKBundleFrameRef frame = WKBundlePageGetMainFrame(page);
JSContextRef context = WKBundleFrameGetJavaScriptContext(frame);
WKEventModifiers modifiers = parseModifierArray(context, modifierArray);
@@ -217,7 +217,7 @@
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
- WKBundlePostSynchronousMessage(injectedBungle.bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(page, EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::mouseUp(int button, JSValueRef modifierArray)
@@ -230,7 +230,7 @@
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> EventSenderMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::mouseMoveTo(int x, int y)
@@ -250,7 +250,7 @@
WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::leapForward(int milliseconds)
@@ -266,7 +266,7 @@
WKRetainPtr<WKUInt64Ref> timeRef(AdoptWK, WKUInt64Create(milliseconds));
WKDictionarySetItem(EventSenderMessageBody.get(), timeKey.get(), timeRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::scheduleAsynchronousClick()
@@ -278,11 +278,11 @@
// Asynchronous mouse down.
WKRetainPtr<WKMutableDictionaryRef> mouseDownMessageBody(AdoptWK, createMouseMessageBody(MouseDown, button, modifiers));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), mouseDownMessageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), mouseDownMessageBody.get());
// Asynchronous mouse up.
WKRetainPtr<WKMutableDictionaryRef> mouseUpMessageBody(AdoptWK, createMouseMessageBody(MouseUp, button, modifiers));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), mouseUpMessageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), mouseUpMessageBody.get());
}
static WKRetainPtr<WKMutableDictionaryRef> createKeyDownMessageBody(JSStringRef key, WKEventModifiers modifiers, int location)
@@ -317,7 +317,7 @@
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, modifiers, location);
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), keyDownMessageBody.get(), 0);
}
void EventSendingController::scheduleAsynchronousKeyDown(JSStringRef key)
@@ -325,7 +325,7 @@
WKRetainPtr<WKStringRef> EventSenderMessageName(AdoptWK, WKStringCreateWithUTF8CString("EventSender"));
WKRetainPtr<WKMutableDictionaryRef> keyDownMessageBody = createKeyDownMessageBody(key, 0 /* modifiers */, 0 /* location */);
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), keyDownMessageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), keyDownMessageBody.get());
}
void EventSendingController::mouseScrollBy(int x, int y)
@@ -345,7 +345,7 @@
WKRetainPtr<WKDoubleRef> yRef(AdoptWK, WKDoubleCreate(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::mouseScrollByWithWheelAndMomentumPhases(int x, int y, JSStringRef phaseStr, JSStringRef momentumStr, bool asyncScrolling)
@@ -398,9 +398,9 @@
WKDictionarySetItem(EventSenderMessageBody.get(), momentumKey.get(), momentumRef.get());
if (asyncScrolling)
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get());
else
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::continuousMouseScrollBy(int x, int y, bool paged)
@@ -424,7 +424,7 @@
WKRetainPtr<WKUInt64Ref> pagedRef(AdoptWK, WKUInt64Create(paged));
WKDictionarySetItem(EventSenderMessageBody.get(), pagedKey.get(), pagedRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
JSValueRef EventSendingController::contextClick()
@@ -519,7 +519,7 @@
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::updateTouchPoint(int index, int x, int y)
@@ -543,7 +543,7 @@
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(y));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::setTouchModifier(const JSStringRef &modifier, bool enable)
@@ -573,7 +573,7 @@
WKRetainPtr<WKUInt64Ref> enableRef(AdoptWK, WKUInt64Create(enable));
WKDictionarySetItem(EventSenderMessageBody.get(), enableKey.get(), enableRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
@@ -594,7 +594,7 @@
WKRetainPtr<WKUInt64Ref> yRef(AdoptWK, WKUInt64Create(radiusY));
WKDictionarySetItem(EventSenderMessageBody.get(), yKey.get(), yRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchStart()
@@ -606,7 +606,7 @@
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchStart"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchMove()
@@ -618,7 +618,7 @@
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchMove"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchEnd()
@@ -630,7 +630,7 @@
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchEnd"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::touchCancel()
@@ -642,7 +642,7 @@
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("TouchCancel"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::clearTouchPoints()
@@ -654,7 +654,7 @@
WKRetainPtr<WKStringRef> subMessageName(AdoptWK, WKStringCreateWithUTF8CString("ClearTouchPoints"));
WKDictionarySetItem(EventSenderMessageBody.get(), subMessageKey.get(), subMessageName.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::releaseTouchPoint(int index)
@@ -670,7 +670,7 @@
WKRetainPtr<WKUInt64Ref> indexRef(AdoptWK, WKUInt64Create(index));
WKDictionarySetItem(EventSenderMessageBody.get(), indexKey.get(), indexRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
void EventSendingController::cancelTouchPoint(int index)
@@ -686,7 +686,7 @@
WKRetainPtr<WKUInt64Ref> indexRef(AdoptWK, WKUInt64Create(index));
WKDictionarySetItem(EventSenderMessageBody.get(), indexKey.get(), indexRef.get());
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), EventSenderMessageName.get(), EventSenderMessageBody.get(), 0);
}
#endif
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -133,6 +133,13 @@
void InjectedBundle::didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody)
{
+ WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
+ WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
+ WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
+}
+
+void InjectedBundle::didReceiveMessageToPage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody)
+{
if (WKStringIsEqualToUTF8CString(messageName, "BeginTest")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
@@ -149,12 +156,12 @@
WKRetainPtr<WKStringRef> ackMessageName(AdoptWK, WKStringCreateWithUTF8CString("Ack"));
WKRetainPtr<WKStringRef> ackMessageBody(AdoptWK, WKStringCreateWithUTF8CString("BeginTest"));
- WKBundlePostMessage(m_bundle, ackMessageName.get(), ackMessageBody.get());
+ WKBundlePagePostMessage(page, ackMessageName.get(), ackMessageBody.get());
beginTesting(messageBodyDictionary);
return;
}
-
+
if (WKStringIsEqualToUTF8CString(messageName, "Reset")) {
ASSERT(messageBody);
ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID());
@@ -183,7 +190,7 @@
resetLocalSettings();
m_testRunner->removeAllWebNotificationPermissions();
- page()->resetAfterTest();
+ InjectedBundle::page()->resetAfterTest();
return;
}
@@ -206,26 +213,19 @@
if (WKStringIsEqualToUTF8CString(messageName, "CallSetBackingScaleFactorCallback")) {
m_testRunner->callSetBackingScaleFactorCallback();
return;
- }
+ }
if (WKStringIsEqualToUTF8CString(messageName, "WorkQueueProcessedCallback")) {
if (!topLoadingFrame() && !m_testRunner->waitToDump())
- page()->dump();
+ InjectedBundle::page()->dump();
return;
}
WKRetainPtr<WKStringRef> errorMessageName(AdoptWK, WKStringCreateWithUTF8CString("Error"));
WKRetainPtr<WKStringRef> errorMessageBody(AdoptWK, WKStringCreateWithUTF8CString("Unknown"));
- WKBundlePostMessage(m_bundle, errorMessageName.get(), errorMessageBody.get());
+ WKBundlePagePostMessage(page, 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));
@@ -310,7 +310,7 @@
WKRetainPtr<WKStringRef> audioResultKey = adoptWK(WKStringCreateWithUTF8CString("AudioResult"));
WKDictionarySetItem(doneMessageBody.get(), audioResultKey.get(), m_audioResult.get());
- WKBundlePostMessage(m_bundle, doneMessageName.get(), doneMessageBody.get());
+ WKBundlePagePostMessage(page()->page(), doneMessageName.get(), doneMessageBody.get());
closeOtherPages();
@@ -343,67 +343,67 @@
return;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("TextOutput"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithUTF8CString(output.utf8().data()));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::postNewBeforeUnloadReturnValue(bool value)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("BeforeUnloadReturnValue"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(value));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::postAddChromeInputField()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("AddChromeInputField"));
- WKBundlePostMessage(m_bundle, messageName.get(), 0);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
}
void InjectedBundle::postRemoveChromeInputField()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("RemoveChromeInputField"));
- WKBundlePostMessage(m_bundle, messageName.get(), 0);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
}
void InjectedBundle::postFocusWebView()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("FocusWebView"));
- WKBundlePostMessage(m_bundle, messageName.get(), 0);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
}
void InjectedBundle::postSetBackingScaleFactor(double backingScaleFactor)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBackingScaleFactor"));
WKRetainPtr<WKDoubleRef> messageBody(AdoptWK, WKDoubleCreate(backingScaleFactor));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::postSetWindowIsKey(bool isKey)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetWindowIsKey"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(isKey));
- WKBundlePostSynchronousMessage(m_bundle, messageName.get(), messageBody.get(), 0);
+ WKBundlePagePostSynchronousMessage(page()->page(), messageName.get(), messageBody.get(), 0);
}
void InjectedBundle::postSimulateWebNotificationClick(uint64_t notificationID)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SimulateWebNotificationClick"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(notificationID));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::postSetAddsVisitedLinks(bool addsVisitedLinks)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAddsVisitedLinks"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(addsVisitedLinks));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setGeolocationPermission(bool enabled)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetGeolocationPermission"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(enabled));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
@@ -456,20 +456,20 @@
WKRetainPtr<WKDoubleRef> speedWK(AdoptWK, WKDoubleCreate(speed));
WKDictionarySetItem(messageBody.get(), speedKeyWK.get(), speedWK.get());
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPositionUnavailableError"));
- WKBundlePostMessage(m_bundle, messageName.get(), errorMessage);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), errorMessage);
}
void InjectedBundle::setUserMediaPermission(bool enabled)
{
auto messageName = adoptWK(WKStringCreateWithUTF8CString("SetUserMediaPermission"));
auto messageBody = adoptWK(WKBooleanCreate(enabled));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setCustomPolicyDelegate(bool enabled, bool permissive)
@@ -486,7 +486,7 @@
WKRetainPtr<WKBooleanRef> permissiveWK(AdoptWK, WKBooleanCreate(permissive));
WKDictionarySetItem(messageBody.get(), permissiveKeyWK.get(), permissiveWK.get());
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setHidden(bool hidden)
@@ -498,14 +498,14 @@
WKRetainPtr<WKBooleanRef> isInitialWK(AdoptWK, WKBooleanCreate(hidden));
WKDictionarySetItem(messageBody.get(), isInitialKeyWK.get(), isInitialWK.get());
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::setCacheModel(int model)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetCacheModel"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(model));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
bool InjectedBundle::shouldProcessWorkQueue() const
@@ -515,7 +515,7 @@
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("IsWorkQueueEmpty"));
WKTypeRef resultToPass = 0;
- WKBundlePostSynchronousMessage(m_bundle, messageName.get(), 0, &resultToPass);
+ WKBundlePagePostSynchronousMessage(page()->page(), messageName.get(), 0, &resultToPass);
WKRetainPtr<WKBooleanRef> isEmpty(AdoptWK, static_cast<WKBooleanRef>(resultToPass));
return !WKBooleanGetValue(isEmpty.get());
@@ -524,7 +524,7 @@
void InjectedBundle::processWorkQueue()
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("ProcessWorkQueue"));
- WKBundlePostMessage(m_bundle, messageName.get(), 0);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
}
void InjectedBundle::queueBackNavigation(unsigned howFarBackward)
@@ -533,7 +533,7 @@
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueBackNavigation"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarBackward));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::queueForwardNavigation(unsigned howFarForward)
@@ -542,7 +542,7 @@
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueForwardNavigation"));
WKRetainPtr<WKUInt64Ref> messageBody(AdoptWK, WKUInt64Create(howFarForward));
- WKBundlePostMessage(m_bundle, messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
}
void InjectedBundle::queueLoad(WKStringRef url, WKStringRef target)
@@ -559,7 +559,7 @@
WKRetainPtr<WKStringRef> targetKey(AdoptWK, WKStringCreateWithUTF8CString("target"));
WKDictionarySetItem(loadData.get(), targetKey.get(), target);
- WKBundlePostMessage(m_bundle, messageName.get(), loadData.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), loadData.get());
}
void InjectedBundle::queueLoadHTMLString(WKStringRef content, WKStringRef baseURL, WKStringRef unreachableURL)
@@ -583,7 +583,7 @@
WKDictionarySetItem(loadData.get(), unreachableURLKey.get(), unreachableURL);
}
- WKBundlePostMessage(m_bundle, messageName.get(), loadData.get());
+ WKBundlePagePostMessage(page()->page(), messageName.get(), loadData.get());
}
void InjectedBundle::queueReload()
@@ -591,7 +591,7 @@
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueReload"));
- WKBundlePostMessage(m_bundle, messageName.get(), 0);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), 0);
}
void InjectedBundle::queueLoadingScript(WKStringRef script)
@@ -599,7 +599,7 @@
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueLoadingScript"));
- WKBundlePostMessage(m_bundle, messageName.get(), script);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), script);
}
void InjectedBundle::queueNonLoadingScript(WKStringRef script)
@@ -607,7 +607,7 @@
m_useWorkQueue = true;
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("QueueNonLoadingScript"));
- WKBundlePostMessage(m_bundle, messageName.get(), script);
+ WKBundlePagePostMessage(page()->page(), messageName.get(), script);
}
bool InjectedBundle::isAllowedHost(WKStringRef host)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -804,21 +804,21 @@
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetHandlesAuthenticationChallenge"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(handlesAuthenticationChallenges));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
void TestRunner::setAuthenticationUsername(JSStringRef username)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationUsername"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(username));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
void TestRunner::setAuthenticationPassword(JSStringRef password)
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetAuthenticationPassword"));
WKRetainPtr<WKStringRef> messageBody(AdoptWK, WKStringCreateWithJSString(password));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
bool TestRunner::secureEventInputIsEnabled() const
@@ -826,7 +826,7 @@
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SecureEventInputIsEnabled"));
WKTypeRef returnData = 0;
- WKBundlePostSynchronousMessage(InjectedBundle::singleton().bundle(), messageName.get(), 0, &returnData);
+ WKBundlePagePostSynchronousMessage(InjectedBundle::singleton().page()->page(), messageName.get(), 0, &returnData);
return WKBooleanGetValue(static_cast<WKBooleanRef>(returnData));
}
@@ -834,7 +834,7 @@
{
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetBlockAllPlugins"));
WKRetainPtr<WKBooleanRef> messageBody(AdoptWK, WKBooleanCreate(shouldBlock));
- WKBundlePostMessage(InjectedBundle::singleton().bundle(), messageName.get(), messageBody.get());
+ WKBundlePagePostMessage(InjectedBundle::singleton().page()->page(), messageName.get(), messageBody.get());
}
JSValueRef TestRunner::numberOfDFGCompiles(JSValueRef theFunction)
Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/TestController.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -44,6 +44,7 @@
#include <WebKit/WKNotificationPermissionRequest.h>
#include <WebKit/WKNumber.h>
#include <WebKit/WKPageGroup.h>
+#include <WebKit/WKPageInjectedBundleClient.h>
#include <WebKit/WKPagePrivate.h>
#include <WebKit/WKPreferencesRefPrivate.h>
#include <WebKit/WKProtectionSpace.h>
@@ -521,6 +522,15 @@
};
WKPageSetPageNavigationClient(m_mainWebView->page(), &pageNavigationClient.base);
+
+ // this should just be done on the page?
+ WKPageInjectedBundleClientV0 injectedBundleClient = {
+ { 0, this },
+ didReceivePageMessageFromInjectedBundle,
+ didReceiveSynchronousPageMessageFromInjectedBundle
+ };
+ WKPageSetPageInjectedBundleClient(m_mainWebView->page(), &injectedBundleClient.base);
+
m_mainWebView->didInitializeClients();
// Generally, the tests should default to running at 1x. updateWindowScaleForTest() will adjust the scale to
@@ -621,7 +631,7 @@
}
WKDictionarySetItem(resetMessageBody.get(), allowedHostsKey.get(), allowedHostsValue.get());
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), resetMessageBody.get());
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), resetMessageBody.get());
WKContextSetShouldUseFontSmoothing(TestController::singleton().context(), false);
@@ -947,6 +957,18 @@
*returnData = static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody).leakRef();
}
+// WKPageInjectedBundleClient
+
+void TestController::didReceivePageMessageFromInjectedBundle(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
+{
+ static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveMessageFromInjectedBundle(messageName, messageBody);
+}
+
+void TestController::didReceiveSynchronousPageMessageFromInjectedBundle(WKPageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void* clientInfo)
+{
+ *returnData = static_cast<TestController*>(const_cast<void*>(clientInfo))->didReceiveSynchronousMessageFromInjectedBundle(messageName, messageBody).leakRef();
+}
+
void TestController::networkProcessDidCrash(WKContextRef context, const void *clientInfo)
{
static_cast<TestController*>(const_cast<void*>(clientInfo))->networkProcessDidCrash();
Modified: trunk/Tools/WebKitTestRunner/TestController.h (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/TestController.h 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/TestController.h 2015-04-01 23:22:19 UTC (rev 182260)
@@ -146,6 +146,10 @@
// WKContextInjectedBundleClient
static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
static void didReceiveSynchronousMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void*);
+
+ // WKPageInjectedBundleClient
+ static void didReceivePageMessageFromInjectedBundle(WKPageRef, WKStringRef messageName, WKTypeRef messageBody, const void*);
+ static void didReceiveSynchronousPageMessageFromInjectedBundle(WKPageRef, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData, const void*);
void didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
WKRetainPtr<WKTypeRef> didReceiveSynchronousMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody);
Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (182259 => 182260)
--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-04-01 22:50:53 UTC (rev 182259)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp 2015-04-01 23:22:19 UTC (rev 182260)
@@ -175,7 +175,7 @@
WKRetainPtr<WKUInt64Ref> timeoutValue = adoptWK(WKUInt64Create(m_timeout));
WKDictionarySetItem(beginTestMessageBody.get(), timeoutKey.get(), timeoutValue.get());
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), beginTestMessageBody.get());
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), beginTestMessageBody.get());
TestController::singleton().runUntil(m_gotInitialResponse, TestController::shortTimeout);
if (!m_gotInitialResponse) {
@@ -369,21 +369,21 @@
if (WKStringIsEqualToUTF8CString(messageName, "AddChromeInputField")) {
TestController::singleton().mainWebView()->addChromeInputField();
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallAddChromeInputFieldCallback"));
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), 0);
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "RemoveChromeInputField")) {
TestController::singleton().mainWebView()->removeChromeInputField();
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallRemoveChromeInputFieldCallback"));
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), 0);
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
return;
}
if (WKStringIsEqualToUTF8CString(messageName, "FocusWebView")) {
TestController::singleton().mainWebView()->makeWebViewFirstResponder();
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallFocusWebViewCallback"));
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), 0);
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
return;
}
@@ -393,7 +393,7 @@
WKPageSetCustomBackingScaleFactor(TestController::singleton().mainWebView()->page(), backingScaleFactor);
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("CallSetBackingScaleFactorCallback"));
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), 0);
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
return;
}
@@ -522,7 +522,7 @@
if (WKStringIsEqualToUTF8CString(messageName, "ProcessWorkQueue")) {
if (TestController::singleton().workQueueManager().processWorkQueue()) {
WKRetainPtr<WKStringRef> messageName = adoptWK(WKStringCreateWithUTF8CString("WorkQueueProcessedCallback"));
- WKContextPostMessageToInjectedBundle(TestController::singleton().context(), messageName.get(), 0);
+ WKPagePostMessageToInjectedBundle(TestController::singleton().mainWebView()->page(), messageName.get(), 0);
}
return;
}