[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
weinig at apple.com
weinig at apple.com
Wed Dec 22 17:52:14 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 40a04ca9a16d77a5710050bfd084ff4ca8a6eeb3
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 1 22:00:01 2010 +0000
Add PageGrouping to WebKit2 API
https://bugs.webkit.org/show_bug.cgi?id=50332
Reviewed by Anders Carlsson.
WebKit2:
- Adds WKPageGroupRef and WKBundlePageGroupRef API objects
(backed by WebPageGroup and WebPageGroupProxy respectively).
- Moves visibleToInjectedBundle from page to PageGroup.
- Make userScript/userStyleSheet functions take a page group parameter.
* Shared/API/c/WKBase.h:
* Shared/APIObject.h:
* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):
* Shared/WebPageCreationParameters.h:
* Shared/WebPageGroupData.cpp: Added.
(WebKit::WebPageGroupData::encode):
(WebKit::WebPageGroupData::decode):
* Shared/WebPageGroupData.h: Added.
* UIProcess/API/C/WKAPICast.h:
* UIProcess/API/C/WKPage.cpp:
(WKPageGetPageGroup):
* UIProcess/API/C/WKPage.h:
* UIProcess/API/C/WKPageGroup.cpp: Added.
(WKPageGroupGetTypeID):
(WKPageGroupCreateWithIdentifier):
(WKPageGroupCopyIdentifier):
* UIProcess/API/C/WKPageGroup.h: Added.
* UIProcess/API/C/WebKit2.h:
* UIProcess/API/C/win/WKView.cpp:
(WKViewCreate):
* UIProcess/API/C/win/WKView.h:
* UIProcess/API/mac/WKView.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView initWithFrame:pageNamespaceRef:pageGroupRef:]):
(-[WKView initWithFrame:pageNamespaceRef:]):
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/API/qt/qwkpage.cpp:
(QWKPagePrivate::QWKPagePrivate):
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
(WebKit::WebContext::createWebPage):
* UIProcess/WebContext.h:
* UIProcess/WebContextUserMessageCoders.h:
(WebKit::WebContextUserMessageEncoder::encode):
(WebKit::WebContextUserMessageDecoder::decode):
* UIProcess/WebInspectorProxy.cpp:
(WebKit::WebInspectorProxy::inspectorPageGroup):
* UIProcess/WebInspectorProxy.h:
* UIProcess/WebPageGroup.cpp: Added.
(WebKit::generatePageGroupID):
(WebKit::webPageGroupMap):
(WebKit::WebPageGroup::create):
(WebKit::WebPageGroup::get):
(WebKit::WebPageGroup::WebPageGroup):
(WebKit::WebPageGroup::~WebPageGroup):
* UIProcess/WebPageGroup.h: Added.
(WebKit::WebPageGroup::identifier):
(WebKit::WebPageGroup::pageGroupID):
(WebKit::WebPageGroup::data):
(WebKit::WebPageGroup::type):
* UIProcess/WebPageNamespace.cpp:
(WebKit::WebPageNamespace::createWebPage):
* UIProcess/WebPageNamespace.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::create):
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::creationParameters):
* UIProcess/WebPageProxy.h:
(WebKit::WebPageProxy::pageGroup):
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::createWebPage):
* UIProcess/WebProcessProxy.h:
* UIProcess/mac/WebInspectorProxyMac.mm:
(WebKit::WebInspectorProxy::platformCreateInspectorPage):
* UIProcess/win/WebView.cpp:
(WebKit::WebView::WebView):
* UIProcess/win/WebView.h:
(WebKit::WebView::create):
* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleAddUserScript):
(WKBundleAddUserStyleSheet):
(WKBundleRemoveUserScript):
(WKBundleRemoveUserStyleSheet):
(WKBundleRemoveUserScripts):
(WKBundleRemoveUserStyleSheets):
(WKBundleRemoveAllUserContent):
(WKBundleOverrideXSSAuditorEnabledForTestRunner):
* WebProcess/InjectedBundle/API/c/WKBundle.h:
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageGetPageGroup):
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:
* WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp: Added.
(WKBundlePageGroupGetTypeID):
(WKBundlePageGroupCopyIdentifier):
* WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h: Added.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner):
(WebKit::InjectedBundle::addUserScript):
(WebKit::InjectedBundle::addUserStyleSheet):
(WebKit::InjectedBundle::removeUserScript):
(WebKit::InjectedBundle::removeUserStyleSheet):
(WebKit::InjectedBundle::removeUserScripts):
(WebKit::InjectedBundle::removeUserStyleSheets):
(WebKit::InjectedBundle::removeAllUserContent):
(WebKit::InjectedBundle::didInitializePageGroup):
* WebProcess/InjectedBundle/InjectedBundle.h:
* WebProcess/InjectedBundle/InjectedBundleClient.cpp:
(WebKit::InjectedBundleClient::didInitializePageGroup):
* WebProcess/InjectedBundle/InjectedBundleClient.h:
* WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
(WebKit::InjectedBundleUserMessageEncoder::encode):
(WebKit::InjectedBundleUserMessageDecoder::decode):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::create):
(WebKit::WebPage::WebPage):
(WebKit::WebPage::close):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::pageGroup):
* WebProcess/WebPage/WebPageGroupProxy.cpp: Added.
(WebKit::WebPageGroupProxy::create):
(WebKit::WebPageGroupProxy::~WebPageGroupProxy):
* WebProcess/WebPage/WebPageGroupProxy.h: Added.
(WebKit::WebPageGroupProxy::identifier):
(WebKit::WebPageGroupProxy::pageGroupID):
(WebKit::WebPageGroupProxy::isVisibleToInjectedBundle):
(WebKit::WebPageGroupProxy::WebPageGroupProxy):
(WebKit::WebPageGroupProxy::type):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::webPageGroup):
* WebProcess/WebProcess.h:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:
WebKitTools:
- Update testing harnesses to deal with new PageGroup API.
* MiniBrowser/mac/WebBundle/WebBundleMain.m:
(WKBundleInitialize):
* TestWebKitAPI/InjectedBundleController.cpp:
(TestWebKitAPI::InjectedBundleController::initialize):
(TestWebKitAPI::InjectedBundleController::didInitializePageGroup):
(TestWebKitAPI::InjectedBundleController::initializeTestNamed):
* TestWebKitAPI/InjectedBundleController.h:
* TestWebKitAPI/InjectedBundleTest.h:
(TestWebKitAPI::InjectedBundleTest::initialize):
(TestWebKitAPI::InjectedBundleTest::didInitializePageGroup):
* TestWebKitAPI/PlatformUtilities.cpp:
(TestWebKitAPI::Util::createContextForInjectedBundleTest):
* TestWebKitAPI/PlatformUtilities.h:
* TestWebKitAPI/PlatformWebView.h:
* TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp:
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp:
(TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize):
* TestWebKitAPI/mac/PlatformWebViewMac.mm:
(TestWebKitAPI::PlatformWebView::PlatformWebView):
* TestWebKitAPI/win/PlatformWebViewWin.cpp:
(TestWebKitAPI::PlatformWebView::PlatformWebView):
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::didInitializePageGroup):
(WTR::InjectedBundle::initialize):
(WTR::InjectedBundle::beginTesting):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(WTR::InjectedBundle::pageGroup):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::addUserScript):
(WTR::LayoutTestController::addUserStyleSheet):
(WTR::LayoutTestController::setXSSAuditorEnabled):
* WebKitTestRunner/TestController.cpp:
* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::PlatformWebView):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73066 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index e53dc45..1a6e639 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,144 @@
+2010-12-01 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add PageGrouping to WebKit2 API
+ https://bugs.webkit.org/show_bug.cgi?id=50332
+
+ - Adds WKPageGroupRef and WKBundlePageGroupRef API objects
+ (backed by WebPageGroup and WebPageGroupProxy respectively).
+ - Moves visibleToInjectedBundle from page to PageGroup.
+ - Make userScript/userStyleSheet functions take a page group parameter.
+
+ * Shared/API/c/WKBase.h:
+ * Shared/APIObject.h:
+ * Shared/WebPageCreationParameters.cpp:
+ (WebKit::WebPageCreationParameters::encode):
+ (WebKit::WebPageCreationParameters::decode):
+ * Shared/WebPageCreationParameters.h:
+ * Shared/WebPageGroupData.cpp: Added.
+ (WebKit::WebPageGroupData::encode):
+ (WebKit::WebPageGroupData::decode):
+ * Shared/WebPageGroupData.h: Added.
+ * UIProcess/API/C/WKAPICast.h:
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageGetPageGroup):
+ * UIProcess/API/C/WKPage.h:
+ * UIProcess/API/C/WKPageGroup.cpp: Added.
+ (WKPageGroupGetTypeID):
+ (WKPageGroupCreateWithIdentifier):
+ (WKPageGroupCopyIdentifier):
+ * UIProcess/API/C/WKPageGroup.h: Added.
+ * UIProcess/API/C/WebKit2.h:
+ * UIProcess/API/C/win/WKView.cpp:
+ (WKViewCreate):
+ * UIProcess/API/C/win/WKView.h:
+ * UIProcess/API/mac/WKView.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView initWithFrame:pageNamespaceRef:pageGroupRef:]):
+ (-[WKView initWithFrame:pageNamespaceRef:]):
+ * UIProcess/API/mac/WKViewInternal.h:
+ * UIProcess/API/qt/qwkpage.cpp:
+ (QWKPagePrivate::QWKPagePrivate):
+ * UIProcess/WebContext.cpp:
+ (WebKit::WebContext::WebContext):
+ (WebKit::WebContext::createWebPage):
+ * UIProcess/WebContext.h:
+ * UIProcess/WebContextUserMessageCoders.h:
+ (WebKit::WebContextUserMessageEncoder::encode):
+ (WebKit::WebContextUserMessageDecoder::decode):
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::inspectorPageGroup):
+ * UIProcess/WebInspectorProxy.h:
+ * UIProcess/WebPageGroup.cpp: Added.
+ (WebKit::generatePageGroupID):
+ (WebKit::webPageGroupMap):
+ (WebKit::WebPageGroup::create):
+ (WebKit::WebPageGroup::get):
+ (WebKit::WebPageGroup::WebPageGroup):
+ (WebKit::WebPageGroup::~WebPageGroup):
+ * UIProcess/WebPageGroup.h: Added.
+ (WebKit::WebPageGroup::identifier):
+ (WebKit::WebPageGroup::pageGroupID):
+ (WebKit::WebPageGroup::data):
+ (WebKit::WebPageGroup::type):
+ * UIProcess/WebPageNamespace.cpp:
+ (WebKit::WebPageNamespace::createWebPage):
+ * UIProcess/WebPageNamespace.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::create):
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::creationParameters):
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::pageGroup):
+ * UIProcess/WebProcessProxy.cpp:
+ (WebKit::WebProcessProxy::createWebPage):
+ * UIProcess/WebProcessProxy.h:
+ * UIProcess/mac/WebInspectorProxyMac.mm:
+ (WebKit::WebInspectorProxy::platformCreateInspectorPage):
+ * UIProcess/win/WebView.cpp:
+ (WebKit::WebView::WebView):
+ * UIProcess/win/WebView.h:
+ (WebKit::WebView::create):
+ * WebKit2.pro:
+ * WebKit2.xcodeproj/project.pbxproj:
+ * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+ (WKBundleAddUserScript):
+ (WKBundleAddUserStyleSheet):
+ (WKBundleRemoveUserScript):
+ (WKBundleRemoveUserStyleSheet):
+ (WKBundleRemoveUserScripts):
+ (WKBundleRemoveUserStyleSheets):
+ (WKBundleRemoveAllUserContent):
+ (WKBundleOverrideXSSAuditorEnabledForTestRunner):
+ * WebProcess/InjectedBundle/API/c/WKBundle.h:
+ * WebProcess/InjectedBundle/API/c/WKBundleAPICast.h:
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+ (WKBundlePageGetPageGroup):
+ * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+ * WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp: Added.
+ (WKBundlePageGroupGetTypeID):
+ (WKBundlePageGroupCopyIdentifier):
+ * WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h: Added.
+ * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h:
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ (WebKit::InjectedBundle::overrideXSSAuditorEnabledForTestRunner):
+ (WebKit::InjectedBundle::addUserScript):
+ (WebKit::InjectedBundle::addUserStyleSheet):
+ (WebKit::InjectedBundle::removeUserScript):
+ (WebKit::InjectedBundle::removeUserStyleSheet):
+ (WebKit::InjectedBundle::removeUserScripts):
+ (WebKit::InjectedBundle::removeUserStyleSheets):
+ (WebKit::InjectedBundle::removeAllUserContent):
+ (WebKit::InjectedBundle::didInitializePageGroup):
+ * WebProcess/InjectedBundle/InjectedBundle.h:
+ * WebProcess/InjectedBundle/InjectedBundleClient.cpp:
+ (WebKit::InjectedBundleClient::didInitializePageGroup):
+ * WebProcess/InjectedBundle/InjectedBundleClient.h:
+ * WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h:
+ (WebKit::InjectedBundleUserMessageEncoder::encode):
+ (WebKit::InjectedBundleUserMessageDecoder::decode):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::create):
+ (WebKit::WebPage::WebPage):
+ (WebKit::WebPage::close):
+ * WebProcess/WebPage/WebPage.h:
+ (WebKit::WebPage::pageGroup):
+ * WebProcess/WebPage/WebPageGroupProxy.cpp: Added.
+ (WebKit::WebPageGroupProxy::create):
+ (WebKit::WebPageGroupProxy::~WebPageGroupProxy):
+ * WebProcess/WebPage/WebPageGroupProxy.h: Added.
+ (WebKit::WebPageGroupProxy::identifier):
+ (WebKit::WebPageGroupProxy::pageGroupID):
+ (WebKit::WebPageGroupProxy::isVisibleToInjectedBundle):
+ (WebKit::WebPageGroupProxy::WebPageGroupProxy):
+ (WebKit::WebPageGroupProxy::type):
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::webPageGroup):
+ * WebProcess/WebProcess.h:
+ * win/WebKit2.vcproj:
+ * win/WebKit2Generated.make:
+
2010-12-01 Steve Falkenburg <sfalken at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKit2/Shared/API/c/WKBase.h b/WebKit2/Shared/API/c/WKBase.h
index a9b8093..f2cf12b 100644
--- a/WebKit2/Shared/API/c/WKBase.h
+++ b/WebKit2/Shared/API/c/WKBase.h
@@ -69,6 +69,7 @@ typedef const struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
typedef const struct OpaqueWKInspector* WKInspectorRef;
typedef const struct OpaqueWKNavigationData* WKNavigationDataRef;
typedef const struct OpaqueWKPage* WKPageRef;
+typedef const struct OpaqueWKPageGroup* WKPageGroupRef;
typedef const struct OpaqueWKPageNamespace* WKPageNamespaceRef;
typedef const struct OpaqueWKPreferences* WKPreferencesRef;
@@ -77,14 +78,15 @@ typedef const struct OpaqueWKPreferences* WKPreferencesRef;
typedef const struct OpaqueWKBundle* WKBundleRef;
typedef const struct OpaqueWKBundleBackForwardList* WKBundleBackForwardListRef;
typedef const struct OpaqueWKBundleBackForwardListItem* WKBundleBackForwardListItemRef;
+typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
typedef const struct OpaqueWKBundleFrame* WKBundleFrameRef;
typedef const struct OpaqueWKBundleHitTestResult* WKBundleHitTestResultRef;
typedef const struct OpaqueWKBundleNodeHandle* WKBundleNodeHandleRef;
typedef const struct OpaqueWKBundlePage* WKBundlePageRef;
+typedef const struct OpaqueWKBundlePageGroup* WKBundlePageGroupRef;
typedef const struct OpaqueWKBundlePageOverlay* WKBundlePageOverlayRef;
typedef const struct OpaqueWKBundleRangeHandle* WKBundleRangeHandleRef;
typedef const struct OpaqueWKBundleScriptWorld* WKBundleScriptWorldRef;
-typedef const struct OpaqueWKBundleDOMCSSStyleDeclaration* WKBundleCSSStyleDeclarationRef;
#undef WK_EXPORT
#if defined(WK_NO_EXPORT)
diff --git a/WebKit2/Shared/APIObject.h b/WebKit2/Shared/APIObject.h
index b53c9d5..85ccba9 100644
--- a/WebKit2/Shared/APIObject.h
+++ b/WebKit2/Shared/APIObject.h
@@ -64,6 +64,7 @@ public:
TypeInspector,
TypeNavigationData,
TypePage,
+ TypePageGroup,
TypePageNamespace,
TypePreferences,
@@ -75,6 +76,7 @@ public:
TypeBundleHitTestResult,
TypeBundleNodeHandle,
TypeBundlePage,
+ TypeBundlePageGroup,
TypeBundlePageOverlay,
TypeBundleRangeHandle,
TypeBundleScriptWorld,
diff --git a/WebKit2/Shared/WebPageCreationParameters.cpp b/WebKit2/Shared/WebPageCreationParameters.cpp
index 28fad62..3c95863 100644
--- a/WebKit2/Shared/WebPageCreationParameters.cpp
+++ b/WebKit2/Shared/WebPageCreationParameters.cpp
@@ -25,7 +25,7 @@
#include "WebPageCreationParameters.h"
-#include "ArgumentEncoder.h"
+#include "ArgumentCoders.h"
namespace WebKit {
@@ -34,7 +34,7 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder* encoder) const
encoder->encode(viewSize);
encoder->encode(store);
encoder->encode(drawingAreaInfo);
- encoder->encode(visibleToInjectedBundle);
+ encoder->encode(pageGroupData);
#if PLATFORM(WIN)
encoder->encode(reinterpret_cast<uint64_t>(nativeWindow));
@@ -49,7 +49,7 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder* decoder, WebPag
return false;
if (!decoder->decode(parameters.drawingAreaInfo))
return false;
- if (!decoder->decode(parameters.visibleToInjectedBundle))
+ if (!decoder->decode(parameters.pageGroupData))
return false;
#if PLATFORM(WIN)
diff --git a/WebKit2/Shared/WebPageCreationParameters.h b/WebKit2/Shared/WebPageCreationParameters.h
index b90eb3f..77dcfca 100644
--- a/WebKit2/Shared/WebPageCreationParameters.h
+++ b/WebKit2/Shared/WebPageCreationParameters.h
@@ -27,6 +27,7 @@
#define WebPageCreationParameters_h
#include "DrawingAreaInfo.h"
+#include "WebPageGroupData.h"
#include "WebPreferencesStore.h"
#include <WebCore/IntSize.h>
@@ -44,7 +45,8 @@ struct WebPageCreationParameters {
WebCore::IntSize viewSize;
WebPreferencesStore store;
DrawingAreaInfo drawingAreaInfo;
- bool visibleToInjectedBundle;
+ WebPageGroupData pageGroupData;
+
#if PLATFORM(WIN)
HWND nativeWindow;
#endif
diff --git a/WebKit2/Shared/WebPageGroupData.cpp b/WebKit2/Shared/WebPageGroupData.cpp
new file mode 100644
index 0000000..f01f4a6
--- /dev/null
+++ b/WebKit2/Shared/WebPageGroupData.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 "WebPageGroupData.h"
+
+#include "ArgumentCoders.h"
+#include "Arguments.h"
+
+namespace WebKit {
+
+void WebPageGroupData::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+ return encoder->encode(CoreIPC::In(identifer, pageGroupID, visibleToInjectedBundle));
+}
+
+bool WebPageGroupData::decode(CoreIPC::ArgumentDecoder* decoder, WebPageGroupData& data)
+{
+ return decoder->decode(CoreIPC::Out(data.identifer, data.pageGroupID, data.visibleToInjectedBundle));
+}
+
+} // namespace WebKit
diff --git a/WebKit2/Shared/WebPageGroupData.h b/WebKit2/Shared/WebPageGroupData.h
new file mode 100644
index 0000000..fedb5de
--- /dev/null
+++ b/WebKit2/Shared/WebPageGroupData.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2010 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 WebPageGroupData_h
+#define WebPageGroupData_h
+
+#include <wtf/text/WTFString.h>
+
+namespace CoreIPC {
+ class ArgumentDecoder;
+ class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct WebPageGroupData {
+ void encode(CoreIPC::ArgumentEncoder*) const;
+ static bool decode(CoreIPC::ArgumentDecoder*, WebPageGroupData&);
+
+ String identifer;
+ uint64_t pageGroupID;
+ bool visibleToInjectedBundle;
+};
+
+} // namespace WebKit
+
+
+#endif // WebPageGroupData_h
diff --git a/WebKit2/UIProcess/API/C/WKAPICast.h b/WebKit2/UIProcess/API/C/WKAPICast.h
index 2bb9aa5..6feeb29 100644
--- a/WebKit2/UIProcess/API/C/WKAPICast.h
+++ b/WebKit2/UIProcess/API/C/WKAPICast.h
@@ -45,6 +45,7 @@ class WebFramePolicyListenerProxy;
class WebFrameProxy;
class WebInspectorProxy;
class WebNavigationData;
+class WebPageGroup;
class WebPageNamespace;
class WebPageProxy;
class WebPreferences;
@@ -60,6 +61,7 @@ WK_ADD_API_MAPPING(WKFrameRef, WebFrameProxy)
WK_ADD_API_MAPPING(WKInspectorRef, WebInspectorProxy)
#endif
WK_ADD_API_MAPPING(WKNavigationDataRef, WebNavigationData)
+WK_ADD_API_MAPPING(WKPageGroupRef, WebPageGroup)
WK_ADD_API_MAPPING(WKPageNamespaceRef, WebPageNamespace)
WK_ADD_API_MAPPING(WKPageRef, WebPageProxy)
WK_ADD_API_MAPPING(WKPreferencesRef, WebPreferences)
diff --git a/WebKit2/UIProcess/API/C/WKPage.cpp b/WebKit2/UIProcess/API/C/WKPage.cpp
index 9d4ba91..08ea77e 100644
--- a/WebKit2/UIProcess/API/C/WKPage.cpp
+++ b/WebKit2/UIProcess/API/C/WKPage.cpp
@@ -47,6 +47,11 @@ WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef pageRef)
return toAPI(toImpl(pageRef)->pageNamespace());
}
+WKPageGroupRef WKPageGetPageGroup(WKPageRef pageRef)
+{
+ return toAPI(toImpl(pageRef)->pageGroup());
+}
+
void WKPageLoadURL(WKPageRef pageRef, WKURLRef URLRef)
{
toImpl(pageRef)->loadURL(toImpl(URLRef)->string());
diff --git a/WebKit2/UIProcess/API/C/WKPage.h b/WebKit2/UIProcess/API/C/WKPage.h
index 8bf9ba9..b0013a4 100644
--- a/WebKit2/UIProcess/API/C/WKPage.h
+++ b/WebKit2/UIProcess/API/C/WKPage.h
@@ -219,6 +219,7 @@ typedef struct WKPageContextMenuClient WKPageContextMenuClient;
WK_EXPORT WKTypeID WKPageGetTypeID();
WK_EXPORT WKPageNamespaceRef WKPageGetPageNamespace(WKPageRef page);
+WK_EXPORT WKPageGroupRef WKPageGetPageGroup(WKPageRef page);
WK_EXPORT void WKPageLoadURL(WKPageRef page, WKURLRef url);
WK_EXPORT void WKPageLoadURLRequest(WKPageRef page, WKURLRequestRef urlRequest);
diff --git a/WebKit2/UIProcess/API/C/WKPageGroup.cpp b/WebKit2/UIProcess/API/C/WKPageGroup.cpp
new file mode 100644
index 0000000..305fbc4
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKPageGroup.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 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 "WKPageGroup.h"
+
+#include "WKAPICast.h"
+#include "WebPageGroup.h"
+
+using namespace WebKit;
+
+WKTypeID WKPageGroupGetTypeID()
+{
+ return toAPI(WebPageGroup::APIType);
+}
+
+WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier)
+{
+ RefPtr<WebPageGroup> pageGroup = WebPageGroup::create(toWTFString(identifier));
+ return toAPI(pageGroup.release().leakRef());
+}
+
+WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup)
+{
+ return toCopiedAPI(toImpl(pageGroup)->identifier());
+}
diff --git a/WebKit2/UIProcess/API/C/WKPageGroup.h b/WebKit2/UIProcess/API/C/WKPageGroup.h
new file mode 100644
index 0000000..8433d33
--- /dev/null
+++ b/WebKit2/UIProcess/API/C/WKPageGroup.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 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 WKPageGroup_h
+#define WKPageGroup_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKPageGroupGetTypeID();
+
+WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier);
+
+WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKPageGroup_h */
diff --git a/WebKit2/UIProcess/API/C/WebKit2.h b/WebKit2/UIProcess/API/C/WebKit2.h
index 5bb9bd7..215addb 100644
--- a/WebKit2/UIProcess/API/C/WebKit2.h
+++ b/WebKit2/UIProcess/API/C/WebKit2.h
@@ -34,6 +34,7 @@
#include <WebKit2/WKBackForwardListItem.h>
#include <WebKit2/WKContext.h>
#include <WebKit2/WKData.h>
+#include <WebKit2/WKDictionary.h>
#include <WebKit2/WKError.h>
#include <WebKit2/WKFormSubmissionListener.h>
#include <WebKit2/WKFrame.h>
@@ -43,6 +44,7 @@
#include <WebKit2/WKNavigationData.h>
#include <WebKit2/WKNumber.h>
#include <WebKit2/WKPage.h>
+#include <WebKit2/WKPageGroup.h>
#include <WebKit2/WKPageNamespace.h>
#include <WebKit2/WKPreferences.h>
#include <WebKit2/WKString.h>
diff --git a/WebKit2/UIProcess/API/C/win/WKView.cpp b/WebKit2/UIProcess/API/C/win/WKView.cpp
index 947ea77..c7fd508 100644
--- a/WebKit2/UIProcess/API/C/win/WKView.cpp
+++ b/WebKit2/UIProcess/API/C/win/WKView.cpp
@@ -35,9 +35,9 @@ WKTypeID WKViewGetTypeID()
return toAPI(APIObject::TypeView);
}
-WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespaceRef, HWND parentWindow)
+WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespaceRef, WKPageGroupRef pageGroupRef, HWND parentWindow)
{
- RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), parentWindow, VisibleToInjectedBundle);
+ RefPtr<WebView> view = WebView::create(rect, toImpl(pageNamespaceRef), toImpl(pageGroupRef), parentWindow, VisibleToInjectedBundle);
return toAPI(view.release().releaseRef());
}
diff --git a/WebKit2/UIProcess/API/C/win/WKView.h b/WebKit2/UIProcess/API/C/win/WKView.h
index 043f486..2b7be05 100644
--- a/WebKit2/UIProcess/API/C/win/WKView.h
+++ b/WebKit2/UIProcess/API/C/win/WKView.h
@@ -35,7 +35,7 @@ extern "C" {
WK_EXPORT WKTypeID WKViewGetTypeID();
-WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespace, HWND parentWindow);
+WK_EXPORT WKViewRef WKViewCreate(RECT rect, WKPageNamespaceRef pageNamespace, WKPageGroupRef pageGroup, HWND parentWindow);
WK_EXPORT HWND WKViewGetWindow(WKViewRef view);
diff --git a/WebKit2/UIProcess/API/mac/WKView.h b/WebKit2/UIProcess/API/mac/WKView.h
index 0476fbd..c4629d8 100644
--- a/WebKit2/UIProcess/API/mac/WKView.h
+++ b/WebKit2/UIProcess/API/mac/WKView.h
@@ -34,6 +34,7 @@ WK_EXPORT
}
- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef;
+- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
- (WKPageRef)pageRef;
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index fe0c260..d808056 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -114,7 +114,7 @@ struct EditCommandState {
@implementation WKView
-- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef hiddenFromInjectedBundle:(BOOL)hiddenFromInjectedBundle
+- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef pageGroupRef:(WKPageGroupRef)pageGroupRef
{
self = [super initWithFrame:frame];
if (!self)
@@ -133,10 +133,9 @@ struct EditCommandState {
_data = [[WKViewData alloc] init];
_data->_pageClient = PageClientImpl::create(self);
- _data->_page = toImpl(pageNamespaceRef)->createWebPage();
+ _data->_page = toImpl(pageNamespaceRef)->createWebPage(toImpl(pageGroupRef));
_data->_page->setPageClient(_data->_pageClient.get());
_data->_page->setDrawingArea(ChunkedUpdateDrawingAreaProxy::create(self));
- _data->_page->setVisibleToInjectedBundle(!hiddenFromInjectedBundle);
_data->_page->initializeWebPage(IntSize(frame.size));
_data->_page->setIsInWindow([self window]);
@@ -152,7 +151,7 @@ struct EditCommandState {
- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef
{
- return [self initWithFrame:frame pageNamespaceRef:pageNamespaceRef hiddenFromInjectedBundle:NO];
+ return [self initWithFrame:frame pageNamespaceRef:pageNamespaceRef pageGroupRef:nil];
}
- (id)initWithFrame:(NSRect)frame
diff --git a/WebKit2/UIProcess/API/mac/WKViewInternal.h b/WebKit2/UIProcess/API/mac/WKViewInternal.h
index a331e67..ea70eb7 100644
--- a/WebKit2/UIProcess/API/mac/WKViewInternal.h
+++ b/WebKit2/UIProcess/API/mac/WKViewInternal.h
@@ -31,8 +31,6 @@ namespace WebKit {
}
@interface WKView (Internal)
-- (id)initWithFrame:(NSRect)frame pageNamespaceRef:(WKPageNamespaceRef)pageNamespaceRef hiddenFromInjectedBundle:(BOOL)hiddenFromInjectedBundle;
-
- (void)_processDidCrash;
- (void)_didRelaunchProcess;
- (void)_takeFocus:(BOOL)direction;
diff --git a/WebKit2/UIProcess/API/qt/qwkpage.cpp b/WebKit2/UIProcess/API/qt/qwkpage.cpp
index 18ecea2..bba2cc4 100644
--- a/WebKit2/UIProcess/API/qt/qwkpage.cpp
+++ b/WebKit2/UIProcess/API/qt/qwkpage.cpp
@@ -68,7 +68,7 @@ QWKPagePrivate::QWKPagePrivate(QWKPage* qq, WKPageNamespaceRef namespaceRef)
{
initializePlatformStrategiesIfNeeded();
memset(actions, 0, sizeof(actions));
- page = toImpl(namespaceRef)->createWebPage(); // Page gets a ref to namespace.
+ page = toImpl(namespaceRef)->createWebPage(0); // Page gets a ref to namespace.
page->setPageClient(this);
history = QWKHistoryPrivate::createHistory(page->backForwardList());
}
diff --git a/WebKit2/UIProcess/WebContext.cpp b/WebKit2/UIProcess/WebContext.cpp
index c10999a..69f492a 100644
--- a/WebKit2/UIProcess/WebContext.cpp
+++ b/WebKit2/UIProcess/WebContext.cpp
@@ -33,6 +33,7 @@
#include "WebContextMessageKinds.h"
#include "WebContextUserMessageCoders.h"
#include "WebCoreArgumentCoders.h"
+#include "WebPageGroup.h"
#include "WebPageNamespace.h"
#include "WebPreferences.h"
#include "WebProcessCreationParameters.h"
@@ -41,8 +42,6 @@
#include "WebProcessProxy.h"
#include <WebCore/Language.h>
#include <WebCore/LinkHash.h>
-#include <wtf/OwnArrayPtr.h>
-#include <wtf/PassOwnArrayPtr.h>
#ifndef NDEBUG
#include <wtf/RefCountedLeakCounter.h>
@@ -80,6 +79,7 @@ PassRefPtr<WebContext> WebContext::create(const String& injectedBundlePath)
WebContext::WebContext(ProcessModel processModel, const String& injectedBundlePath)
: m_processModel(processModel)
+ , m_defaultPageGroup(WebPageGroup::create())
, m_injectedBundlePath(injectedBundlePath)
, m_visitedLinkProvider(this)
, m_cacheModel(CacheModelDocumentViewer)
@@ -207,10 +207,14 @@ void WebContext::processDidClose(WebProcessProxy* process)
m_process = 0;
}
-WebPageProxy* WebContext::createWebPage(WebPageNamespace* pageNamespace)
+WebPageProxy* WebContext::createWebPage(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup)
{
ensureWebProcess();
- return m_process->createWebPage(pageNamespace);
+
+ if (!pageGroup)
+ pageGroup = m_defaultPageGroup.get();
+
+ return m_process->createWebPage(pageNamespace, pageGroup);
}
void WebContext::relaunchProcessIfNecessary()
diff --git a/WebKit2/UIProcess/WebContext.h b/WebKit2/UIProcess/WebContext.h
index 20c8fa3..7c7bef0 100644
--- a/WebKit2/UIProcess/WebContext.h
+++ b/WebKit2/UIProcess/WebContext.h
@@ -47,6 +47,7 @@ struct WKContextStatistics;
namespace WebKit {
class DownloadProxy;
+class WebPageGroup;
class WebPageNamespace;
class WebPageProxy;
class WebPreferences;
@@ -72,7 +73,7 @@ public:
void processDidFinishLaunching(WebProcessProxy*);
void processDidClose(WebProcessProxy*);
- WebPageProxy* createWebPage(WebPageNamespace*);
+ WebPageProxy* createWebPage(WebPageNamespace*, WebPageGroup* = 0);
void relaunchProcessIfNecessary();
@@ -160,6 +161,8 @@ private:
HashSet<WebPageNamespace*> m_pageNamespaces;
RefPtr<WebPreferences> m_preferences;
+ RefPtr<WebPageGroup> m_defaultPageGroup;
+
RefPtr<APIObject> m_injectedBundleInitializationUserData;
String m_injectedBundlePath;
WebContextInjectedBundleClient m_injectedBundleClient;
diff --git a/WebKit2/UIProcess/WebContextUserMessageCoders.h b/WebKit2/UIProcess/WebContextUserMessageCoders.h
index 580654d..bb2ba39 100644
--- a/WebKit2/UIProcess/WebContextUserMessageCoders.h
+++ b/WebKit2/UIProcess/WebContextUserMessageCoders.h
@@ -26,6 +26,8 @@
#include "UserMessageCoders.h"
#include "WebContext.h"
#include "WebFrameProxy.h"
+#include "WebPageGroup.h"
+#include "WebPageGroupData.h"
#include "WebPageProxy.h"
namespace WebKit {
@@ -33,6 +35,7 @@ namespace WebKit {
// Adds
// - Page -> BundlePage
// - Frame -> BundleFrame
+// - PageGroup -> BundlePageGroup
class WebContextUserMessageEncoder : public UserMessageEncoder<WebContextUserMessageEncoder> {
public:
@@ -60,6 +63,11 @@ public:
encoder->encode(frame->frameID());
break;
}
+ case APIObject::TypePageGroup: {
+ WebPageGroup* pageGroup = static_cast<WebPageGroup*>(m_root);
+ encoder->encode(pageGroup->data());
+ break;
+ }
default:
ASSERT_NOT_REACHED();
break;
@@ -70,6 +78,7 @@ public:
// Adds
// - Page -> BundlePage
// - Frame -> BundleFrame
+// - PageGroup -> BundlePageGroup
class WebContextUserMessageDecoder : public UserMessageDecoder<WebContextUserMessageDecoder> {
public:
@@ -111,6 +120,13 @@ public:
coder.m_root = coder.m_context->process()->webFrame(frameID);
break;
}
+ case APIObject::TypeBundlePageGroup: {
+ uint64_t pageGroupID;
+ if (!decoder->decode(pageGroupID))
+ return false;
+ coder.m_root = WebPageGroup::get(pageGroupID);
+ break;
+ }
default:
return false;
}
diff --git a/WebKit2/UIProcess/WebInspectorProxy.cpp b/WebKit2/UIProcess/WebInspectorProxy.cpp
index 74aea8c..d9feffe 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.cpp
+++ b/WebKit2/UIProcess/WebInspectorProxy.cpp
@@ -31,6 +31,7 @@
#include "WebPageProxy.h"
#include "WebPageCreationParameters.h"
#include "WebProcessProxy.h"
+#include "WebPageGroup.h"
#define DISABLE_NOT_IMPLEMENTED_WARNINGS 1
#include "NotImplemented.h"
@@ -39,6 +40,12 @@ using namespace WebCore;
namespace WebKit {
+WebPageGroup* WebInspectorProxy::inspectorPageGroup()
+{
+ static WebPageGroup* pageGroup = WebPageGroup::create("__WebInspectorPageGroup__", false).leakRef();
+ return pageGroup;
+}
+
WebInspectorProxy::WebInspectorProxy(WebPageProxy* page)
: m_page(page)
, m_isVisible(false)
diff --git a/WebKit2/UIProcess/WebInspectorProxy.h b/WebKit2/UIProcess/WebInspectorProxy.h
index c6ad655..e0d623e 100644
--- a/WebKit2/UIProcess/WebInspectorProxy.h
+++ b/WebKit2/UIProcess/WebInspectorProxy.h
@@ -44,6 +44,7 @@ class WKView;
namespace WebKit {
+class WebPageGroup;
class WebPageProxy;
struct WebPageCreationParameters;
@@ -102,6 +103,8 @@ private:
void createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters&);
void didLoadInspectorPage();
+ static WebPageGroup* inspectorPageGroup();
+
WebPageProxy* m_page;
bool m_isVisible;
diff --git a/WebKit2/UIProcess/WebPageGroup.cpp b/WebKit2/UIProcess/WebPageGroup.cpp
new file mode 100644
index 0000000..796010d
--- /dev/null
+++ b/WebKit2/UIProcess/WebPageGroup.cpp
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2010 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 "WebPageGroup.h"
+
+#include <wtf/HashMap.h>
+#include <wtf/text/StringConcatenate.h>
+
+namespace WebKit {
+
+static uint64_t generatePageGroupID()
+{
+ static uint64_t uniquePageGroupID = 1;
+ return uniquePageGroupID++;
+}
+
+typedef HashMap<uint64_t, WebPageGroup*> WebPageGroupMap;
+
+static WebPageGroupMap& webPageGroupMap()
+{
+ static WebPageGroupMap map;
+ return map;
+}
+
+
+PassRefPtr<WebPageGroup> WebPageGroup::create(const String& identifier, bool visibleToInjectedBundle)
+{
+ RefPtr<WebPageGroup> pageGroup = adoptRef(new WebPageGroup(identifier, visibleToInjectedBundle));
+
+ webPageGroupMap().set(pageGroup->pageGroupID(), pageGroup.get());
+
+ return pageGroup.release();
+}
+
+WebPageGroup* WebPageGroup::get(uint64_t pageGroupID)
+{
+ return webPageGroupMap().get(pageGroupID);
+}
+
+WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle)
+{
+ m_data.pageGroupID = generatePageGroupID();
+ if (!identifier.isNull())
+ m_data.identifer = identifier;
+ else
+ m_data.identifer = m_data.identifer = makeString("__uniquePageGroupID-", String::number(m_data.pageGroupID));
+ m_data.visibleToInjectedBundle = visibleToInjectedBundle;
+}
+
+WebPageGroup::~WebPageGroup()
+{
+ webPageGroupMap().remove(pageGroupID());
+}
+
+} // namespace WebKit
diff --git a/WebKit2/UIProcess/WebPageGroup.h b/WebKit2/UIProcess/WebPageGroup.h
new file mode 100644
index 0000000..3467cbc
--- /dev/null
+++ b/WebKit2/UIProcess/WebPageGroup.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 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 WebPageGroup_h
+#define WebPageGroup_h
+
+#include "APIObject.h"
+#include "WebPageGroupData.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebPageGroup : public APIObject {
+public:
+ static const Type APIType = TypePageGroup;
+
+ static PassRefPtr<WebPageGroup> create(const String& identifier = String(), bool visibleToInjectedBundle = true);
+ static WebPageGroup* get(uint64_t pageGroupID);
+
+ virtual ~WebPageGroup();
+
+ const String& identifier() const { return m_data.identifer; }
+ uint64_t pageGroupID() const { return m_data.pageGroupID; }
+
+ const WebPageGroupData& data() { return m_data;; }
+
+private:
+ WebPageGroup(const String& identifier, bool visibleToInjectedBundle);
+
+ virtual Type type() const { return APIType; }
+
+ WebPageGroupData m_data;
+};
+
+} // namespace WebKit
+
+#endif // WebPageGroup_h
diff --git a/WebKit2/UIProcess/WebPageNamespace.cpp b/WebKit2/UIProcess/WebPageNamespace.cpp
index 5cbf623..2aade94 100644
--- a/WebKit2/UIProcess/WebPageNamespace.cpp
+++ b/WebKit2/UIProcess/WebPageNamespace.cpp
@@ -58,9 +58,9 @@ WebPageNamespace::~WebPageNamespace()
#endif
}
-WebPageProxy* WebPageNamespace::createWebPage()
+WebPageProxy* WebPageNamespace::createWebPage(WebPageGroup* group)
{
- return m_context->createWebPage(this);
+ return m_context->createWebPage(this, group);
}
void WebPageNamespace::preferencesDidChange()
diff --git a/WebKit2/UIProcess/WebPageNamespace.h b/WebKit2/UIProcess/WebPageNamespace.h
index 8048323..61645be 100644
--- a/WebKit2/UIProcess/WebPageNamespace.h
+++ b/WebKit2/UIProcess/WebPageNamespace.h
@@ -36,6 +36,7 @@ struct WKContextStatistics;
namespace WebKit {
class WebContext;
+class WebPageGroup;
class WebPageNamespace : public APIObject {
public:
@@ -48,7 +49,7 @@ public:
virtual ~WebPageNamespace();
- WebPageProxy* createWebPage();
+ WebPageProxy* createWebPage(WebPageGroup*);
WebContext* context() const { return m_context.get(); }
WebProcessProxy* process() const { return m_context->process(); }
diff --git a/WebKit2/UIProcess/WebPageProxy.cpp b/WebKit2/UIProcess/WebPageProxy.cpp
index c4982bb..f0d5735 100644
--- a/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/WebKit2/UIProcess/WebPageProxy.cpp
@@ -45,6 +45,8 @@
#include "WebFormSubmissionListenerProxy.h"
#include "WebFramePolicyListenerProxy.h"
#include "WebPageCreationParameters.h"
+#include "WebPageGroup.h"
+#include "WebPageGroupData.h"
#include "WebPageMessages.h"
#include "WebPageNamespace.h"
#include "WebPopupItem.h"
@@ -81,14 +83,15 @@ void invalidateCallbackMap(HashMap<uint64_t, T>& map)
map.clear();
}
-PassRefPtr<WebPageProxy> WebPageProxy::create(WebPageNamespace* pageNamespace, uint64_t pageID)
+PassRefPtr<WebPageProxy> WebPageProxy::create(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, uint64_t pageID)
{
- return adoptRef(new WebPageProxy(pageNamespace, pageID));
+ return adoptRef(new WebPageProxy(pageNamespace, pageGroup, pageID));
}
-WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, uint64_t pageID)
+WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, uint64_t pageID)
: m_pageClient(0)
, m_pageNamespace(pageNamespace)
+ , m_pageGroup(pageGroup)
, m_mainFrame(0)
, m_estimatedProgress(0.0)
, m_isInWindow(false)
@@ -96,7 +99,6 @@ WebPageProxy::WebPageProxy(WebPageNamespace* pageNamespace, uint64_t pageID)
, m_textZoomFactor(1)
, m_pageZoomFactor(1)
, m_viewScaleFactor(1)
- , m_visibleToInjectedBundle(true)
, m_isValid(true)
, m_isClosed(false)
, m_inDecidePolicyForMIMEType(false)
@@ -1495,7 +1497,7 @@ WebPageCreationParameters WebPageProxy::creationParameters(const IntSize& size)
parameters.viewSize = size;
parameters.store = pageNamespace()->context()->preferences()->store();
parameters.drawingAreaInfo = m_drawingArea->info();
- parameters.visibleToInjectedBundle = m_visibleToInjectedBundle;
+ parameters.pageGroupData = m_pageGroup->data();
#if PLATFORM(WIN)
parameters.nativeWindow = m_pageClient->nativeWindow();
diff --git a/WebKit2/UIProcess/WebPageProxy.h b/WebKit2/UIProcess/WebPageProxy.h
index 4237ca3..aa49255 100644
--- a/WebKit2/UIProcess/WebPageProxy.h
+++ b/WebKit2/UIProcess/WebPageProxy.h
@@ -84,13 +84,13 @@ class WebData;
class WebEditCommandProxy;
class WebKeyboardEvent;
class WebMouseEvent;
+class WebPageGroup;
class WebPageNamespace;
class WebPopupMenuProxy;
class WebProcessProxy;
class WebURLRequest;
class WebWheelEvent;
struct PlatformPopupMenuData;
-struct WebNavigationDataStore;
struct WebPageCreationParameters;
struct WebPopupItem;
@@ -103,7 +103,7 @@ class WebPageProxy : public APIObject {
public:
static const Type APIType = TypePage;
- static PassRefPtr<WebPageProxy> create(WebPageNamespace*, uint64_t pageID);
+ static PassRefPtr<WebPageProxy> create(WebPageNamespace*, WebPageGroup*, uint64_t pageID);
virtual ~WebPageProxy();
@@ -115,9 +115,6 @@ public:
DrawingAreaProxy* drawingArea() { return m_drawingArea.get(); }
void setDrawingArea(PassOwnPtr<DrawingAreaProxy>);
- bool visibleToInjectedBundle() const { return m_visibleToInjectedBundle; }
- void setVisibleToInjectedBundle(bool visible) { m_visibleToInjectedBundle = visible; }
-
WebBackForwardList* backForwardList() { return m_backForwardList.get(); }
#if ENABLE(INSPECTOR)
@@ -242,6 +239,8 @@ public:
WebProcessProxy* process() const;
WebPageNamespace* pageNamespace() const { return m_pageNamespace.get(); }
+ WebPageGroup* pageGroup() const { return m_pageGroup.get(); }
+
bool isValid();
// REMOVE: For demo purposes only.
@@ -264,7 +263,7 @@ public:
#endif
private:
- WebPageProxy(WebPageNamespace*, uint64_t pageID);
+ WebPageProxy(WebPageNamespace*, WebPageGroup*, uint64_t pageID);
virtual Type type() const { return APIType; }
@@ -388,6 +387,7 @@ private:
OwnPtr<DrawingAreaProxy> m_drawingArea;
RefPtr<WebPageNamespace> m_pageNamespace;
+ RefPtr<WebPageGroup> m_pageGroup;
RefPtr<WebFrameProxy> m_mainFrame;
RefPtr<WebFrameProxy> m_focusedFrame;
String m_pageTitle;
diff --git a/WebKit2/UIProcess/WebProcessProxy.cpp b/WebKit2/UIProcess/WebProcessProxy.cpp
index 0d45c91..75330c2 100644
--- a/WebKit2/UIProcess/WebProcessProxy.cpp
+++ b/WebKit2/UIProcess/WebProcessProxy.cpp
@@ -136,12 +136,12 @@ WebPageProxy* WebProcessProxy::webPage(uint64_t pageID) const
return m_pageMap.get(pageID).get();
}
-WebPageProxy* WebProcessProxy::createWebPage(WebPageNamespace* pageNamespace)
+WebPageProxy* WebProcessProxy::createWebPage(WebPageNamespace* pageNamespace, WebPageGroup* pageGroup)
{
ASSERT(pageNamespace->process() == this);
unsigned pageID = generatePageID();
- RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageNamespace, pageID);
+ RefPtr<WebPageProxy> webPage = WebPageProxy::create(pageNamespace, pageGroup, pageID);
m_pageMap.set(pageID, webPage);
return webPage.get();
}
diff --git a/WebKit2/UIProcess/WebProcessProxy.h b/WebKit2/UIProcess/WebProcessProxy.h
index f28ec14..fe24fb5 100644
--- a/WebKit2/UIProcess/WebProcessProxy.h
+++ b/WebKit2/UIProcess/WebProcessProxy.h
@@ -48,6 +48,7 @@ namespace WebKit {
class WebBackForwardListItem;
class WebContext;
+class WebPageGroup;
class WebPageNamespace;
struct WebNavigationDataStore;
@@ -77,7 +78,7 @@ public:
PlatformProcessIdentifier processIdentifier() const { return m_processLauncher->processIdentifier(); }
WebPageProxy* webPage(uint64_t pageID) const;
- WebPageProxy* createWebPage(WebPageNamespace*);
+ WebPageProxy* createWebPage(WebPageNamespace*, WebPageGroup*);
void addExistingWebPage(WebPageProxy*, uint64_t pageID);
void removeWebPage(uint64_t pageID);
diff --git a/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm b/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
index 98a6d7c..3cec06e 100644
--- a/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
+++ b/WebKit2/UIProcess/mac/WebInspectorProxyMac.mm
@@ -41,7 +41,7 @@ WebPageProxy* WebInspectorProxy::platformCreateInspectorPage()
ASSERT(m_page);
ASSERT(!m_inspectorView);
- m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect pageNamespaceRef:toAPI(m_page->pageNamespace())]);
+ m_inspectorView.adoptNS([[WKView alloc] initWithFrame:NSZeroRect pageNamespaceRef:toAPI(m_page->pageNamespace()) pageGroupRef:toAPI(inspectorPageGroup())]);
ASSERT(m_inspectorView);
return toImpl([m_inspectorView.get() pageRef]);
diff --git a/WebKit2/UIProcess/win/WebView.cpp b/WebKit2/UIProcess/win/WebView.cpp
index d671ab8..58ee9ee 100644
--- a/WebKit2/UIProcess/win/WebView.cpp
+++ b/WebKit2/UIProcess/win/WebView.cpp
@@ -182,7 +182,7 @@ bool WebView::registerWebViewWindowClass()
return !!::RegisterClassEx(&wcex);
}
-WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow, InjectedBundleVisibility injectedBundleVisibility)
+WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, HWND parentWindow)
: m_rect(rect)
, m_topLevelParentWindow(0)
, m_toolTipWindow(0)
@@ -194,10 +194,9 @@ WebView::WebView(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow,
{
registerWebViewWindowClass();
- m_page = pageNamespace->createWebPage();
+ m_page = pageNamespace->createWebPage(pageGroup);
m_page->setPageClient(this);
m_page->setDrawingArea(ChunkedUpdateDrawingAreaProxy::create(this));
- m_page->setVisibleToInjectedBundle(injectedBundleVisibility == VisibleToInjectedBundle);
m_window = ::CreateWindowEx(0, kWebKit2WebViewWindowClassName, 0, WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
rect.top, rect.left, rect.right - rect.left, rect.bottom - rect.top, parentWindow ? parentWindow : HWND_MESSAGE, 0, instanceHandle(), this);
diff --git a/WebKit2/UIProcess/win/WebView.h b/WebKit2/UIProcess/win/WebView.h
index ffd6754..e1946ef 100644
--- a/WebKit2/UIProcess/win/WebView.h
+++ b/WebKit2/UIProcess/win/WebView.h
@@ -39,16 +39,11 @@ namespace WebKit {
class DrawingAreaProxy;
class WebPageNamespace;
-enum InjectedBundleVisibility {
- HiddenFromInjectedBundle,
- VisibleToInjectedBundle
-};
-
class WebView : public APIObject, public PageClient, WebCore::WindowMessageListener {
public:
- static PassRefPtr<WebView> create(RECT rect, WebPageNamespace* pageNamespace, HWND parentWindow, InjectedBundleVisibility visibility)
+ static PassRefPtr<WebView> create(RECT rect, WebPageNamespace* pageNamespace, WebPageGroup* pageGroup, HWND parentWindow)
{
- return adoptRef(new WebView(rect, pageNamespace, parentWindow, visibility));
+ return adoptRef(new WebView(rect, pageNamespace, pageGroup, parentWindow));
}
~WebView();
@@ -63,7 +58,7 @@ public:
WebPageProxy* page() const { return m_page.get(); }
private:
- WebView(RECT, WebPageNamespace*, HWND parentWindow, InjectedBundleVisibility);
+ WebView(RECT, WebPageNamespace*, WebPageGroup*, HWND parentWindow);
virtual Type type() const { return TypeView; }
diff --git a/WebKit2/WebKit2.pro b/WebKit2/WebKit2.pro
index fa7f880..50e88cd 100644
--- a/WebKit2/WebKit2.pro
+++ b/WebKit2/WebKit2.pro
@@ -249,6 +249,7 @@ HEADERS += \
Shared/WebNavigationDataStore.h \
Shared/WebNumber.h \
Shared/WebPageCreationParameters.h \
+ Shared/WebPageGroupData.h \
Shared/WebPopupItem.h \
Shared/WebPreferencesStore.h \
Shared/WebProcessCreationParameters.h \
@@ -270,6 +271,7 @@ HEADERS += \
UIProcess/API/C/WKInspector.h \
UIProcess/API/C/WKNavigationData.h \
UIProcess/API/C/WKPage.h \
+ UIProcess/API/C/WKPageGroup.h \
UIProcess/API/C/WKPageNamespace.h \
UIProcess/API/C/WKPagePrivate.h \
UIProcess/API/C/WKPreferences.h \
@@ -316,6 +318,7 @@ HEADERS += \
UIProcess/WebLoaderClient.h \
UIProcess/WebNavigationData.h \
UIProcess/WebPageContextMenuClient.h \
+ UIProcess/WebPageGroup.h \
UIProcess/WebPageNamespace.h \
UIProcess/WebPageProxy.h \
UIProcess/WebPolicyClient.h \
@@ -333,6 +336,7 @@ HEADERS += \
WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.h \
WebProcess/InjectedBundle/API/c/WKBundleNodeHandlePrivate.h \
WebProcess/InjectedBundle/API/c/WKBundlePage.h \
+ WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h \
WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h \
WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h \
WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h \
@@ -377,6 +381,7 @@ HEADERS += \
WebProcess/WebPage/WebFrame.h \
WebProcess/WebPage/WebInspector.h \
WebProcess/WebPage/WebPage.h \
+ WebProcess/WebPage/WebPageGroupProxy.h \
WebProcess/WebProcess.h \
$$WEBKIT2_GENERATED_HEADERS
@@ -424,6 +429,7 @@ SOURCES += \
Shared/WebKeyboardEvent.cpp \
Shared/WebMouseEvent.cpp \
Shared/WebPageCreationParameters.cpp \
+ Shared/WebPageGroupData.cpp \
Shared/WebPlatformTouchPoint.cpp \
Shared/WebPopupItem.cpp \
Shared/WebPreferencesStore.cpp \
@@ -449,6 +455,7 @@ SOURCES += \
UIProcess/API/C/WKInspector.cpp \
UIProcess/API/C/WKNavigationData.cpp \
UIProcess/API/C/WKPage.cpp \
+ UIProcess/API/C/WKPageGroup.cpp \
UIProcess/API/C/WKPageNamespace.cpp \
UIProcess/API/C/WKPreferences.cpp \
UIProcess/API/cpp/qt/WKStringQt.cpp \
@@ -489,6 +496,7 @@ SOURCES += \
UIProcess/WebLoaderClient.cpp \
UIProcess/WebNavigationData.cpp \
UIProcess/WebPageContextMenuClient.cpp \
+ UIProcess/WebPageGroup.cpp \
UIProcess/WebPageNamespace.cpp \
UIProcess/WebPageProxy.cpp \
UIProcess/WebPolicyClient.cpp \
@@ -513,6 +521,7 @@ SOURCES += \
WebProcess/InjectedBundle/API/c/WKBundleHitTestResult.cpp \
WebProcess/InjectedBundle/API/c/WKBundleNodeHandle.cpp \
WebProcess/InjectedBundle/API/c/WKBundlePage.cpp \
+ WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp \
WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp \
WebProcess/InjectedBundle/API/c/WKBundleScriptWorld.cpp \
WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp \
@@ -566,6 +575,7 @@ SOURCES += \
WebProcess/WebPage/WebInspector.cpp \
WebProcess/WebPage/qt/WebInspectorQt.cpp \
WebProcess/WebPage/WebPage.cpp \
+ WebProcess/WebPage/WebPageGroupProxy.cpp \
WebProcess/WebPage/qt/ChunkedUpdateDrawingAreaQt.cpp \
WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp \
WebProcess/WebPage/qt/WebPageQt.cpp \
diff --git a/WebKit2/WebKit2.xcodeproj/project.pbxproj b/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 6fcd838..9be6f3e 100644
--- a/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -395,6 +395,16 @@
BC72B9FB11E6476B001EB4EA /* WebBackForwardListProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */; };
BC72BA1D11E64907001EB4EA /* WebBackForwardList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */; };
BC72BA1E11E64907001EB4EA /* WebBackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */; };
+ BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B6204129A0A6700D174A4 /* WebPageGroup.h */; };
+ BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */; };
+ BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */; };
+ BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */; };
+ BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B625012A43C9600D174A4 /* WebPageGroupData.h */; };
+ BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */; };
+ BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B633512A45ABA00D174A4 /* WKPageGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC7B633812A45ABA00D174A4 /* WKPageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */; };
+ BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ BC7B633E12A45D1200D174A4 /* WKBundlePageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */; };
BC8452A71162C80900CAB9B5 /* DrawingArea.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC8452A51162C80900CAB9B5 /* DrawingArea.cpp */; };
BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8452A61162C80900CAB9B5 /* DrawingArea.h */; };
BC8699B5116AADAA002A925B /* WKView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC8699B2116AADAA002A925B /* WKView.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -989,6 +999,16 @@
BC72B9F911E6476B001EB4EA /* WebBackForwardListProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardListProxy.h; sourceTree = "<group>"; };
BC72BA1B11E64907001EB4EA /* WebBackForwardList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebBackForwardList.cpp; sourceTree = "<group>"; };
BC72BA1C11E64907001EB4EA /* WebBackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebBackForwardList.h; sourceTree = "<group>"; };
+ BC7B6204129A0A6700D174A4 /* WebPageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroup.h; sourceTree = "<group>"; };
+ BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroup.cpp; sourceTree = "<group>"; };
+ BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxy.h; sourceTree = "<group>"; };
+ BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxy.cpp; sourceTree = "<group>"; };
+ BC7B625012A43C9600D174A4 /* WebPageGroupData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupData.h; sourceTree = "<group>"; };
+ BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupData.cpp; sourceTree = "<group>"; };
+ BC7B633512A45ABA00D174A4 /* WKPageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageGroup.h; sourceTree = "<group>"; };
+ BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageGroup.cpp; sourceTree = "<group>"; };
+ BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundlePageGroup.h; sourceTree = "<group>"; };
+ BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundlePageGroup.cpp; sourceTree = "<group>"; };
BC8452A51162C80900CAB9B5 /* DrawingArea.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DrawingArea.cpp; sourceTree = "<group>"; };
BC8452A61162C80900CAB9B5 /* DrawingArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawingArea.h; sourceTree = "<group>"; };
BC8699B2116AADAA002A925B /* WKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKView.h; sourceTree = "<group>"; };
@@ -1467,6 +1487,8 @@
BC5744EE12638FB3006F0F12 /* WebPopupItem.h */,
C06C6093124C14430001682F /* WebPageCreationParameters.cpp */,
C06C6094124C14430001682F /* WebPageCreationParameters.h */,
+ BC7B625112A43C9600D174A4 /* WebPageGroupData.cpp */,
+ BC7B625012A43C9600D174A4 /* WebPageGroupData.h */,
C0337DDC127A521C008FF4F4 /* WebPlatformTouchPoint.cpp */,
BC306823125A6B9400E71278 /* WebProcessCreationParameters.cpp */,
BC306822125A6B9400E71278 /* WebProcessCreationParameters.h */,
@@ -1666,6 +1688,8 @@
BC963D6A113DD19200574BE2 /* WebPage.cpp */,
BC032D8B10F437A00058C15A /* WebPage.h */,
C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */,
+ BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */,
+ BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */,
);
path = WebPage;
sourceTree = "<group>";
@@ -1733,6 +1757,8 @@
BCF69FA01176D01400471A52 /* WebNavigationData.h */,
5153569A1291B1D2000749DC /* WebPageContextMenuClient.cpp */,
5153569B1291B1D2000749DC /* WebPageContextMenuClient.h */,
+ BC7B6205129A0A6700D174A4 /* WebPageGroup.cpp */,
+ BC7B6204129A0A6700D174A4 /* WebPageGroup.h */,
BCEE98C4113314D7006BCC24 /* WebPageNamespace.cpp */,
BCEE98C5113314D7006BCC24 /* WebPageNamespace.h */,
BC111B0B112F5E4F00337BAB /* WebPageProxy.cpp */,
@@ -1793,6 +1819,8 @@
BCF69FA71176D1CB00471A52 /* WKNavigationData.h */,
BCD597D4112B56DC00EC8C23 /* WKPage.cpp */,
BCD597D5112B56DC00EC8C23 /* WKPage.h */,
+ BC7B633612A45ABA00D174A4 /* WKPageGroup.cpp */,
+ BC7B633512A45ABA00D174A4 /* WKPageGroup.h */,
BCEE98CA1133174C006BCC24 /* WKPageNamespace.cpp */,
BCEE98CB1133174C006BCC24 /* WKPageNamespace.h */,
BC177464118B9FF4007D9E9A /* WKPagePrivate.h */,
@@ -1953,6 +1981,8 @@
BC57450B1263B155006F0F12 /* WKBundleNodeHandlePrivate.h */,
BC20528011C94284008F3375 /* WKBundlePage.cpp */,
BC20527F11C94284008F3375 /* WKBundlePage.h */,
+ BC7B633C12A45D1200D174A4 /* WKBundlePageGroup.cpp */,
+ BC7B633B12A45D1200D174A4 /* WKBundlePageGroup.h */,
1A22F1001289FCD90085E74F /* WKBundlePageOverlay.cpp */,
1A22F0FF1289FCD90085E74F /* WKBundlePageOverlay.h */,
BC1B419711D41D570011E8DD /* WKBundlePagePrivate.h */,
@@ -2477,6 +2507,11 @@
1CA8B946127C882A00576C2B /* WebInspectorProxyMessages.h in Headers */,
5153569D1291B1D2000749DC /* WebPageContextMenuClient.h in Headers */,
1AAB4A8D1296F0A20023952F /* SandboxExtension.h in Headers */,
+ BC7B6206129A0A6700D174A4 /* WebPageGroup.h in Headers */,
+ BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */,
+ BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */,
+ BC7B633712A45ABA00D174A4 /* WKPageGroup.h in Headers */,
+ BC7B633D12A45D1200D174A4 /* WKBundlePageGroup.h in Headers */,
37F623B812A57B6200E3FDF6 /* WKFindOptions.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -2865,6 +2900,11 @@
EDCA71B7128DDA8C00201B26 /* WKBundlePageOverlay.cpp in Sources */,
5153569C1291B1D2000749DC /* WebPageContextMenuClient.cpp in Sources */,
1AAB4AAA1296F1540023952F /* SandboxExtensionMac.mm in Sources */,
+ BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */,
+ BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */,
+ BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */,
+ BC7B633812A45ABA00D174A4 /* WKPageGroup.cpp in Sources */,
+ BC7B633E12A45D1200D174A4 /* WKBundlePageGroup.cpp in Sources */,
1AA4792312A59FD9008236C3 /* PluginProcessMac.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 8ea9209..5c4b6e9 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -87,44 +87,44 @@ size_t WKBundleGetJavaScriptObjectsCount(WKBundleRef bundleRef)
return toImpl(bundleRef)->javaScriptObjectsCount();
}
-void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef)
+void WKBundleAddUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserScriptInjectionTime injectionTimeRef, WKUserContentInjectedFrames injectedFramesRef)
{
- toImpl(bundleRef)->addUserScript(toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef));
+ toImpl(bundleRef)->addUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserScriptInjectionTime(injectionTimeRef), toUserContentInjectedFrames(injectedFramesRef));
}
-void WKBundleAddUserStyleSheet(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserContentInjectedFrames injectedFramesRef)
+void WKBundleAddUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKStringRef sourceRef, WKURLRef urlRef, WKArrayRef whitelistRef, WKArrayRef blacklistRef, WKUserContentInjectedFrames injectedFramesRef)
{
- toImpl(bundleRef)->addUserStyleSheet(toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserContentInjectedFrames(injectedFramesRef));
+ toImpl(bundleRef)->addUserStyleSheet(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(sourceRef), toWTFString(urlRef), toImpl(whitelistRef), toImpl(blacklistRef), toUserContentInjectedFrames(injectedFramesRef));
}
-void WKBundleRemoveUserScript(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
+void WKBundleRemoveUserScript(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
{
- toImpl(bundleRef)->removeUserScript(toImpl(scriptWorldRef), toWTFString(urlRef));
+ toImpl(bundleRef)->removeUserScript(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(urlRef));
}
-void WKBundleRemoveUserStyleSheet(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
+void WKBundleRemoveUserStyleSheet(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef, WKURLRef urlRef)
{
- toImpl(bundleRef)->removeUserStyleSheet(toImpl(scriptWorldRef), toWTFString(urlRef));
+ toImpl(bundleRef)->removeUserStyleSheet(toImpl(pageGroupRef), toImpl(scriptWorldRef), toWTFString(urlRef));
}
-void WKBundleRemoveUserScripts(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef)
+void WKBundleRemoveUserScripts(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef)
{
- toImpl(bundleRef)->removeUserScripts(toImpl(scriptWorldRef));
+ toImpl(bundleRef)->removeUserScripts(toImpl(pageGroupRef), toImpl(scriptWorldRef));
}
-void WKBundleRemoveUserStyleSheets(WKBundleRef bundleRef, WKBundleScriptWorldRef scriptWorldRef)
+void WKBundleRemoveUserStyleSheets(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, WKBundleScriptWorldRef scriptWorldRef)
{
- toImpl(bundleRef)->removeUserStyleSheets(toImpl(scriptWorldRef));
+ toImpl(bundleRef)->removeUserStyleSheets(toImpl(pageGroupRef), toImpl(scriptWorldRef));
}
-void WKBundleRemoveAllUserContent(WKBundleRef bundleRef)
+void WKBundleRemoveAllUserContent(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef)
{
- toImpl(bundleRef)->removeAllUserContent();
+ toImpl(bundleRef)->removeAllUserContent(toImpl(pageGroupRef));
}
-void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, bool enabled)
+void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
{
- toImpl(bundleRef)->overrideXSSAuditorEnabledForTestRunner(enabled);
+ toImpl(bundleRef)->overrideXSSAuditorEnabledForTestRunner(toImpl(pageGroupRef), enabled);
}
void WKBundleReportException(JSContextRef context, JSValueRef exception)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h
index ec2d03d..24c53b4 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h
@@ -34,15 +34,17 @@ extern "C" {
#endif
// Client
-typedef void (*WKBundleDidCreatePageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void *clientInfo);
-typedef void (*WKBundleWillDestroyPageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void *clientInfo);
-typedef void (*WKBundleDidReceiveMessageCallback)(WKBundleRef bundle, WKStringRef name, WKTypeRef messageBody, const void *clientInfo);
+typedef void (*WKBundleDidCreatePageCallback)(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
+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);
struct WKBundleClient {
int version;
const void * clientInfo;
WKBundleDidCreatePageCallback didCreatePage;
WKBundleWillDestroyPageCallback willDestroyPage;
+ WKBundleDidInitializePageGroupCallback didInitializePageGroup;
WKBundleDidReceiveMessageCallback didReceiveMessage;
};
typedef struct WKBundleClient WKBundleClient;
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
index 43c307e..47ac2d6 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h
@@ -51,13 +51,15 @@ class InjectedBundleScriptWorld;
class PageOverlay;
class WebFrame;
class WebPage;
+class WebPageGroupProxy;
-WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList)
WK_ADD_API_MAPPING(WKBundleBackForwardListItemRef, InjectedBundleBackForwardListItem)
+WK_ADD_API_MAPPING(WKBundleBackForwardListRef, InjectedBundleBackForwardList)
WK_ADD_API_MAPPING(WKBundleCSSStyleDeclarationRef, WebCore::CSSStyleDeclaration)
WK_ADD_API_MAPPING(WKBundleFrameRef, WebFrame)
WK_ADD_API_MAPPING(WKBundleHitTestResultRef, InjectedBundleHitTestResult)
WK_ADD_API_MAPPING(WKBundleNodeHandleRef, InjectedBundleNodeHandle)
+WK_ADD_API_MAPPING(WKBundlePageGroupRef, WebPageGroupProxy)
WK_ADD_API_MAPPING(WKBundlePageOverlayRef, PageOverlay)
WK_ADD_API_MAPPING(WKBundlePageRef, WebPage)
WK_ADD_API_MAPPING(WKBundleRangeHandleRef, InjectedBundleRangeHandle)
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
index 57ff028..6a70b33 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
@@ -77,6 +77,11 @@ void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkCl
toImpl(pageRef)->initializeInjectedBundleUIClient(wkClient);
}
+WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef pageRef)
+{
+ return toAPI(toImpl(pageRef)->pageGroup());
+}
+
WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
{
return toAPI(toImpl(pageRef)->mainFrame());
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
index f1f04ae..fb81930 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h
@@ -200,6 +200,7 @@ WK_EXPORT void WKBundlePageSetFormClient(WKBundlePageRef page, WKBundlePageFormC
WK_EXPORT void WKBundlePageSetLoaderClient(WKBundlePageRef page, WKBundlePageLoaderClient* client);
WK_EXPORT void WKBundlePageSetUIClient(WKBundlePageRef page, WKBundlePageUIClient* client);
+WK_EXPORT WKBundlePageGroupRef WKBundlePageGetPageGroup(WKBundlePageRef page);
WK_EXPORT WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef page);
WK_EXPORT WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef page);
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp
new file mode 100644
index 0000000..47d4cf1
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.cpp
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2010 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 "WKBundlePageGroup.h"
+
+#include "WKAPICast.h"
+#include "WKBundleAPICast.h"
+#include "WebPageGroupProxy.h"
+
+using namespace WebKit;
+
+WKTypeID WKBundlePageGroupGetTypeID()
+{
+ return toAPI(WebPageGroupProxy::APIType);
+}
+
+WKStringRef WKBundlePageGroupCopyIdentifier(WKBundlePageGroupRef bundlePageGroup)
+{
+ return toCopiedAPI(toImpl(bundlePageGroup)->identifier());
+}
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h
new file mode 100644
index 0000000..e0bf645
--- /dev/null
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageGroup.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2010 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 WKBundlePageGroup_h
+#define WKBundlePageGroup_h
+
+#include <WebKit2/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKBundlePageGroupGetTypeID();
+
+WK_EXPORT WKStringRef WKBundlePageGroupCopyIdentifier(WKBundlePageGroupRef bundlePageGroup);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKBundlePageGroup_h */
diff --git a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index 3795716..bb0bd9f 100644
--- a/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -55,16 +55,16 @@ enum WKUserContentInjectedFrames {
};
typedef enum WKUserContentInjectedFrames WKUserContentInjectedFrames;
-WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames);
-WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
-WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
-WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld);
-WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundleScriptWorldRef scriptWorld);
-WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle);
+WK_EXPORT void WKBundleAddUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserScriptInjectionTime injectionTime, WKUserContentInjectedFrames injectedFrames);
+WK_EXPORT void WKBundleAddUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKStringRef source, WKURLRef url, WKArrayRef whitelist, WKArrayRef blacklist, WKUserContentInjectedFrames injectedFrames);
+WK_EXPORT void WKBundleRemoveUserScript(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
+WK_EXPORT void WKBundleRemoveUserStyleSheet(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld, WKURLRef url);
+WK_EXPORT void WKBundleRemoveUserScripts(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld);
+WK_EXPORT void WKBundleRemoveUserStyleSheets(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, WKBundleScriptWorldRef scriptWorld);
+WK_EXPORT void WKBundleRemoveAllUserContent(WKBundleRef bundle, WKBundlePageGroupRef pageGroup);
// Will make WebProcess ignore this preference until a preferences change notification, only for WebKitTestRunner use.
-WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, bool enabled);
+WK_EXPORT void WKBundleOverrideXSSAuditorEnabledForTestRunner(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
#ifdef __cplusplus
}
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 50990f1..4dac883 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -96,14 +96,13 @@ void InjectedBundle::removeAllVisitedLinks()
PageGroup::removeAllVisitedLinks();
}
-void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(bool enabled)
+void InjectedBundle::overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled)
{
// Override the preference for all future pages.
WebPreferencesStore::overrideXSSAuditorEnabledForTestRunner(enabled);
// Change the setting for existing ones.
- const HashSet<Page*>& pages = WebProcess::sharedPageGroup()->pages();
-
+ const HashSet<Page*>& pages = PageGroup::pageGroup(pageGroup->identifier())->pages();
for (HashSet<Page*>::iterator iter = pages.begin(); iter != pages.end(); ++iter)
(*iter)->settings()->setXSSAuditorEnabled(enabled);
}
@@ -128,39 +127,39 @@ static PassOwnPtr<Vector<String> > toStringVector(ImmutableArray* patterns)
return patternsVector;
}
-void InjectedBundle::addUserScript(InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames)
+void InjectedBundle::addUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime injectionTime, WebCore::UserContentInjectedFrames injectedFrames)
{
- WebProcess::sharedPageGroup()->addUserScriptToWorld(scriptWorld->coreWorld(), source, KURL(ParsedURLString, url), toStringVector(whitelist), toStringVector(blacklist), injectionTime, injectedFrames);
+ PageGroup::pageGroup(pageGroup->identifier())->addUserScriptToWorld(scriptWorld->coreWorld(), source, KURL(ParsedURLString, url), toStringVector(whitelist), toStringVector(blacklist), injectionTime, injectedFrames);
}
-void InjectedBundle::addUserStyleSheet(InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames injectedFrames)
+void InjectedBundle::addUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames injectedFrames)
{
- WebProcess::sharedPageGroup()->addUserStyleSheetToWorld(scriptWorld->coreWorld(), source, KURL(ParsedURLString, url), toStringVector(whitelist), toStringVector(blacklist), injectedFrames);
+ PageGroup::pageGroup(pageGroup->identifier())->addUserStyleSheetToWorld(scriptWorld->coreWorld(), source, KURL(ParsedURLString, url), toStringVector(whitelist), toStringVector(blacklist), injectedFrames);
}
-void InjectedBundle::removeUserScript(InjectedBundleScriptWorld* scriptWorld, const String& url)
+void InjectedBundle::removeUserScript(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
{
- WebProcess::sharedPageGroup()->removeUserScriptFromWorld(scriptWorld->coreWorld(), KURL(ParsedURLString, url));
+ PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptFromWorld(scriptWorld->coreWorld(), KURL(ParsedURLString, url));
}
-void InjectedBundle::removeUserStyleSheet(InjectedBundleScriptWorld* scriptWorld, const String& url)
+void InjectedBundle::removeUserStyleSheet(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld, const String& url)
{
- WebProcess::sharedPageGroup()->removeUserStyleSheetFromWorld(scriptWorld->coreWorld(), KURL(ParsedURLString, url));
+ PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetFromWorld(scriptWorld->coreWorld(), KURL(ParsedURLString, url));
}
-void InjectedBundle::removeUserScripts(InjectedBundleScriptWorld* scriptWorld)
+void InjectedBundle::removeUserScripts(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
{
- WebProcess::sharedPageGroup()->removeUserScriptsFromWorld(scriptWorld->coreWorld());
+ PageGroup::pageGroup(pageGroup->identifier())->removeUserScriptsFromWorld(scriptWorld->coreWorld());
}
-void InjectedBundle::removeUserStyleSheets(InjectedBundleScriptWorld* scriptWorld)
+void InjectedBundle::removeUserStyleSheets(WebPageGroupProxy* pageGroup, InjectedBundleScriptWorld* scriptWorld)
{
- WebProcess::sharedPageGroup()->removeUserStyleSheetsFromWorld(scriptWorld->coreWorld());
+ PageGroup::pageGroup(pageGroup->identifier())->removeUserStyleSheetsFromWorld(scriptWorld->coreWorld());
}
-void InjectedBundle::removeAllUserContent()
+void InjectedBundle::removeAllUserContent(WebPageGroupProxy* pageGroup)
{
- WebProcess::sharedPageGroup()->removeAllUserContent();
+ PageGroup::pageGroup(pageGroup->identifier())->removeAllUserContent();
}
void InjectedBundle::garbageCollectJavaScriptObjects()
@@ -204,6 +203,11 @@ void InjectedBundle::willDestroyPage(WebPage* page)
m_client.willDestroyPage(this, page);
}
+void InjectedBundle::didInitializePageGroup(WebPageGroupProxy* pageGroup)
+{
+ m_client.didInitializePageGroup(this, pageGroup);
+}
+
void InjectedBundle::didReceiveMessage(const String& messageName, APIObject* messageBody)
{
m_client.didReceiveMessage(this, messageName, messageBody);
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index a074cb5..cf844c9 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -60,6 +60,7 @@ typedef void* PlatformBundle;
class ImmutableArray;
class InjectedBundleScriptWorld;
class WebPage;
+class WebPageGroupProxy;
class InjectedBundle : public APIObject {
public:
@@ -83,16 +84,16 @@ public:
void setShouldTrackVisitedLinks(bool);
void removeAllVisitedLinks();
void activateMacFontAscentHack();
- void overrideXSSAuditorEnabledForTestRunner(bool enabled);
+ void overrideXSSAuditorEnabledForTestRunner(WebPageGroupProxy* pageGroup, bool enabled);
// UserContent API
- void addUserScript(InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
- void addUserStyleSheet(InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames);
- void removeUserScript(InjectedBundleScriptWorld*, const String& url);
- void removeUserStyleSheet(InjectedBundleScriptWorld*, const String& url);
- void removeUserScripts(InjectedBundleScriptWorld*);
- void removeUserStyleSheets(InjectedBundleScriptWorld*);
- void removeAllUserContent();
+ void addUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserScriptInjectionTime, WebCore::UserContentInjectedFrames);
+ void addUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& source, const String& url, ImmutableArray* whitelist, ImmutableArray* blacklist, WebCore::UserContentInjectedFrames);
+ void removeUserScript(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url);
+ void removeUserStyleSheet(WebPageGroupProxy*, InjectedBundleScriptWorld*, const String& url);
+ void removeUserScripts(WebPageGroupProxy*, InjectedBundleScriptWorld*);
+ void removeUserStyleSheets(WebPageGroupProxy*, InjectedBundleScriptWorld*);
+ void removeAllUserContent(WebPageGroupProxy*);
// Garbage collection API
void garbageCollectJavaScriptObjects();
@@ -102,6 +103,7 @@ public:
// Callback hooks
void didCreatePage(WebPage*);
void willDestroyPage(WebPage*);
+ void didInitializePageGroup(WebPageGroupProxy*);
void didReceiveMessage(const String&, APIObject*);
void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp b/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
index 54f3624..de572d0 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.cpp
@@ -45,6 +45,14 @@ void InjectedBundleClient::willDestroyPage(InjectedBundle* bundle, WebPage* page
m_client.willDestroyPage(toAPI(bundle), toAPI(page), m_client.clientInfo);
}
+void InjectedBundleClient::didInitializePageGroup(InjectedBundle* bundle, WebPageGroupProxy* pageGroup)
+{
+ if (!m_client.didInitializePageGroup)
+ return;
+
+ m_client.didInitializePageGroup(toAPI(bundle), toAPI(pageGroup), m_client.clientInfo);
+}
+
void InjectedBundleClient::didReceiveMessage(InjectedBundle* bundle, const String& messageName, APIObject* messageBody)
{
if (!m_client.didReceiveMessage)
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h
index a195832..36bb60a 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundleClient.h
@@ -35,11 +35,13 @@ namespace WebKit {
class APIObject;
class InjectedBundle;
class WebPage;
+class WebPageGroupProxy;
class InjectedBundleClient : public APIClient<WKBundleClient> {
public:
void didCreatePage(InjectedBundle*, WebPage*);
void willDestroyPage(InjectedBundle*, WebPage*);
+ void didInitializePageGroup(InjectedBundle*, WebPageGroupProxy*);
void didReceiveMessage(InjectedBundle*, const String& messageName, APIObject* messageBody);
};
diff --git a/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h b/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
index 518f3df..6e434c7 100644
--- a/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
+++ b/WebKit2/WebProcess/InjectedBundle/InjectedBundleUserMessageCoders.h
@@ -26,6 +26,8 @@
#include "UserMessageCoders.h"
#include "WebFrame.h"
#include "WebPage.h"
+#include "WebPageGroupData.h"
+#include "WebPageGroupProxy.h"
#include "WebProcess.h"
namespace WebKit {
@@ -33,6 +35,7 @@ namespace WebKit {
// Adds
// - BundlePage -> Page
// - BundleFrame -> Frame
+// - BundlePageGroup -> PageGroup
class InjectedBundleUserMessageEncoder : public UserMessageEncoder<InjectedBundleUserMessageEncoder> {
public:
@@ -60,6 +63,11 @@ public:
encoder->encode(frame->frameID());
break;
}
+ case APIObject::TypeBundlePageGroup: {
+ WebPageGroupProxy* pageGroup = static_cast<WebPageGroupProxy*>(m_root);
+ encoder->encode(pageGroup->pageGroupID());
+ break;
+ }
default:
ASSERT_NOT_REACHED();
break;
@@ -70,6 +78,7 @@ public:
// Adds
// - Page -> BundlePage
// - Frame -> BundleFrame
+// - PageGroup -> BundlePageGroup
class InjectedBundleUserMessageDecoder : public UserMessageDecoder<InjectedBundleUserMessageDecoder> {
public:
@@ -109,6 +118,13 @@ public:
coder.m_root = WebProcess::shared().webFrame(frameID);
break;
}
+ case APIObject::TypePageGroup: {
+ WebPageGroupData pageGroupData;
+ if (!decoder->decode(pageGroupData))
+ return false;
+ coder.m_root = WebProcess::shared().webPageGroup(pageGroupData);
+ break;
+ }
default:
return false;
}
diff --git a/WebKit2/WebProcess/WebPage/WebPage.cpp b/WebKit2/WebProcess/WebPage/WebPage.cpp
index 880b85d..39c2767 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.cpp
+++ b/WebKit2/WebProcess/WebPage/WebPage.cpp
@@ -50,12 +50,13 @@
#include "WebInspector.h"
#include "WebInspectorClient.h"
#include "WebPageCreationParameters.h"
+#include "WebPageGroupProxy.h"
#include "WebPageProxyMessages.h"
#include "WebPopupMenu.h"
#include "WebPreferencesStore.h"
#include "WebProcess.h"
-#include "WebProcessProxyMessages.h"
#include "WebProcessProxyMessageKinds.h"
+#include "WebProcessProxyMessages.h"
#include <WebCore/Chrome.h>
#include <WebCore/ContextMenuController.h>
#include <WebCore/EventHandler.h>
@@ -101,7 +102,7 @@ PassRefPtr<WebPage> WebPage::create(uint64_t pageID, const WebPageCreationParame
{
RefPtr<WebPage> page = adoptRef(new WebPage(pageID, parameters));
- if (parameters.visibleToInjectedBundle && WebProcess::shared().injectedBundle())
+ if (page->pageGroup()->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle())
WebProcess::shared().injectedBundle()->didCreatePage(page.get());
return page.release();
@@ -111,7 +112,6 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
: m_viewSize(parameters.viewSize)
, m_isInRedo(false)
, m_isClosed(false)
- , m_isVisibleToInjectedBundle(parameters.visibleToInjectedBundle)
#if PLATFORM(MAC)
, m_windowIsVisible(false)
#elif PLATFORM(WIN)
@@ -143,13 +143,13 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
updatePreferences(parameters.store);
- m_page->setGroupName("WebKit2Group");
+ m_pageGroup = WebProcess::shared().webPageGroup(parameters.pageGroupData);
+ m_page->setGroupName(m_pageGroup->identifier());
platformInitialize();
Settings::setMinDOMTimerInterval(0.004);
m_drawingArea = DrawingArea::create(parameters.drawingAreaInfo.type, parameters.drawingAreaInfo.identifier, this);
-
m_mainFrame = WebFrame::createMainFrame(this);
#ifndef NDEBUG
@@ -305,7 +305,7 @@ void WebPage::close()
m_isClosed = true;
- if (m_isVisibleToInjectedBundle && WebProcess::shared().injectedBundle())
+ if (pageGroup()->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle())
WebProcess::shared().injectedBundle()->willDestroyPage(this);
#if ENABLE(INSPECTOR)
diff --git a/WebKit2/WebProcess/WebPage/WebPage.h b/WebKit2/WebProcess/WebPage/WebPage.h
index 899ed2a..5c0b72d 100644
--- a/WebKit2/WebProcess/WebPage/WebPage.h
+++ b/WebKit2/WebProcess/WebPage/WebPage.h
@@ -77,6 +77,7 @@ class WebFrame;
class WebInspector;
class WebKeyboardEvent;
class WebMouseEvent;
+class WebPageGroupProxy;
class WebPopupMenu;
class WebWheelEvent;
@@ -109,6 +110,8 @@ public:
InjectedBundleBackForwardList* backForwardList();
DrawingArea* drawingArea() const { return m_drawingArea.get(); }
+ WebPageGroupProxy* pageGroup() const { return m_pageGroup.get(); }
+
#if ENABLE(INSPECTOR)
WebInspector* inspector();
#endif
@@ -310,6 +313,8 @@ private:
RefPtr<WebFrame> m_mainFrame;
RefPtr<InjectedBundleBackForwardList> m_backForwardList;
+ RefPtr<WebPageGroupProxy> m_pageGroup;
+
String m_customUserAgent;
WebCore::IntSize m_viewSize;
@@ -317,7 +322,6 @@ private:
bool m_isInRedo;
bool m_isClosed;
- bool m_isVisibleToInjectedBundle;
#if PLATFORM(MAC)
// Whether the containing window is visible or not.
diff --git a/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp b/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
new file mode 100644
index 0000000..67109ec
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2010 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 "WebPageGroupProxy.h"
+
+#include "WebProcess.h"
+#include "InjectedBundle.h"
+
+namespace WebKit {
+
+PassRefPtr<WebPageGroupProxy> WebPageGroupProxy::create(const WebPageGroupData& data)
+{
+ RefPtr<WebPageGroupProxy> pageGroup = adoptRef(new WebPageGroupProxy(data));
+
+ if (pageGroup->isVisibleToInjectedBundle() && WebProcess::shared().injectedBundle())
+ WebProcess::shared().injectedBundle()->didInitializePageGroup(pageGroup.get());
+
+ return pageGroup.release();
+}
+
+WebPageGroupProxy::~WebPageGroupProxy()
+{
+}
+
+} // namespace WebKit
diff --git a/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h b/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h
new file mode 100644
index 0000000..55cf629
--- /dev/null
+++ b/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 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 WebPageGroupProxy_h
+#define WebPageGroupProxy_h
+
+#include "APIObject.h"
+#include "WebPageGroupData.h"
+#include <wtf/PassRefPtr.h>
+
+namespace WebKit {
+
+class WebPageGroupProxy : public APIObject {
+public:
+ static const Type APIType = TypeBundlePageGroup;
+
+ static PassRefPtr<WebPageGroupProxy> create(const WebPageGroupData&);
+ virtual ~WebPageGroupProxy();
+
+ const String& identifier() const { return m_data.identifer; }
+ uint64_t pageGroupID() const { return m_data.pageGroupID; }
+ bool isVisibleToInjectedBundle() const { return m_data.visibleToInjectedBundle; }
+
+private:
+ WebPageGroupProxy(const WebPageGroupData& data)
+ : m_data(data)
+ {
+ }
+
+ virtual Type type() const { return APIType; }
+
+ WebPageGroupData m_data;
+};
+
+} // namespace WebKit
+
+#endif // WebPageGroupProxy_h
diff --git a/WebKit2/WebProcess/WebProcess.cpp b/WebKit2/WebProcess/WebProcess.cpp
index a4bb0bb..33494b9 100644
--- a/WebKit2/WebProcess/WebProcess.cpp
+++ b/WebKit2/WebProcess/WebProcess.cpp
@@ -526,6 +526,22 @@ void WebProcess::removeWebFrame(uint64_t frameID)
m_connection->send(Messages::WebProcessProxy::DidDestroyFrame(frameID), 0);
}
+WebPageGroupProxy* WebProcess::webPageGroup(uint64_t pageGroupID)
+{
+ return m_pageGroupMap.get(pageGroupID).get();
+}
+
+WebPageGroupProxy* WebProcess::webPageGroup(const WebPageGroupData& pageGroupData)
+{
+ std::pair<HashMap<uint64_t, RefPtr<WebPageGroupProxy> >::iterator, bool> result = m_pageGroupMap.add(pageGroupData.pageGroupID, 0);
+ if (result.second) {
+ ASSERT(!result.first->second);
+ result.first->second = WebPageGroupProxy::create(pageGroupData);
+ }
+
+ return result.first->second.get();
+}
+
void WebProcess::clearResourceCaches()
{
platformClearResourceCaches();
diff --git a/WebKit2/WebProcess/WebProcess.h b/WebKit2/WebProcess/WebProcess.h
index cbc8b8f..56ee543 100644
--- a/WebKit2/WebProcess/WebProcess.h
+++ b/WebKit2/WebProcess/WebProcess.h
@@ -31,6 +31,7 @@
#include "DrawingArea.h"
#include "SharedMemory.h"
#include "VisitedLinkTable.h"
+#include "WebPageGroupProxy.h"
#include <WebCore/LinkHash.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
@@ -50,6 +51,7 @@ class InjectedBundle;
class WebFrame;
class WebPage;
struct WebPageCreationParameters;
+struct WebPageGroupData;
struct WebPreferencesStore;
struct WebProcessCreationParameters;
@@ -81,6 +83,8 @@ public:
void addWebFrame(uint64_t, WebFrame*);
void removeWebFrame(uint64_t);
+ WebPageGroupProxy* webPageGroup(uint64_t pageGroupID);
+ WebPageGroupProxy* webPageGroup(const WebPageGroupData&);
static WebCore::PageGroup* sharedPageGroup();
// Will shut down the web process if there are no live pages or downloads.
@@ -124,6 +128,7 @@ private:
RefPtr<CoreIPC::Connection> m_connection;
HashMap<uint64_t, RefPtr<WebPage> > m_pageMap;
+ HashMap<uint64_t, RefPtr<WebPageGroupProxy> > m_pageGroupMap;
RefPtr<InjectedBundle> m_injectedBundle;
bool m_inDidClose;
diff --git a/WebKit2/win/WebKit2.vcproj b/WebKit2/win/WebKit2.vcproj
index 970dc7e..cfcd5fb 100755
--- a/WebKit2/win/WebKit2.vcproj
+++ b/WebKit2/win/WebKit2.vcproj
@@ -576,6 +576,14 @@
>
</File>
<File
+ RelativePath="..\Shared\WebPageGroupData.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Shared\WebPageGroupData.h"
+ >
+ </File>
+ <File
RelativePath="..\Shared\WebPlatformTouchPoint.cpp"
>
</File>
@@ -1286,6 +1294,14 @@
RelativePath="..\WebProcess\WebPage\WebPage.messages.in"
>
</File>
+ <File
+ RelativePath="..\WebProcess\WebPage\WebPageGroupProxy.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebProcess\WebPage\WebPageGroupProxy.h"
+ >
+ </File>
<Filter
Name="win"
>
@@ -1521,6 +1537,14 @@
>
</File>
<File
+ RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.h"
+ >
+ </File>
+ <File
RelativePath="..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.cpp"
>
</File>
@@ -1908,6 +1932,14 @@
>
</File>
<File
+ RelativePath="..\UIProcess\WebPageGroup.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\WebPageGroup.h"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\WebPageNamespace.cpp"
>
</File>
@@ -2082,6 +2114,14 @@
>
</File>
<File
+ RelativePath="..\UIProcess\API\C\WKPageGroup.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\UIProcess\API\C\WKPageGroup.h"
+ >
+ </File>
+ <File
RelativePath="..\UIProcess\API\C\WKPageNamespace.cpp"
>
</File>
diff --git a/WebKit2/win/WebKit2Generated.make b/WebKit2/win/WebKit2Generated.make
index fe1dc35..72a694d 100644
--- a/WebKit2/win/WebKit2Generated.make
+++ b/WebKit2/win/WebKit2Generated.make
@@ -43,6 +43,7 @@ all:
xcopy /y /d "..\UIProcess\API\C\WKNativeEvent.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKNavigationData.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKPage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+ xcopy /y /d "..\UIProcess\API\C\WKPageGroup.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKPageNamespace.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKPreferences.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\UIProcess\API\C\WKPreferencesPrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
@@ -60,6 +61,7 @@ all:
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandle.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundleNodeHandlePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePage.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
+ xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageGroup.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePageOverlay.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePagePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
xcopy /y /d "..\WebProcess\InjectedBundle\API\c\WKBundlePrivate.h" "$(WEBKITOUTPUTDIR)\include\WebKit2"
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 3ac6a36..1aa5425 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,48 @@
+2010-12-01 Sam Weinig <sam at webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add PageGrouping to WebKit2 API
+ https://bugs.webkit.org/show_bug.cgi?id=50332
+
+ - Update testing harnesses to deal with new PageGroup API.
+
+ * MiniBrowser/mac/WebBundle/WebBundleMain.m:
+ (WKBundleInitialize):
+ * TestWebKitAPI/InjectedBundleController.cpp:
+ (TestWebKitAPI::InjectedBundleController::initialize):
+ (TestWebKitAPI::InjectedBundleController::didInitializePageGroup):
+ (TestWebKitAPI::InjectedBundleController::initializeTestNamed):
+ * TestWebKitAPI/InjectedBundleController.h:
+ * TestWebKitAPI/InjectedBundleTest.h:
+ (TestWebKitAPI::InjectedBundleTest::initialize):
+ (TestWebKitAPI::InjectedBundleTest::didInitializePageGroup):
+ * TestWebKitAPI/PlatformUtilities.cpp:
+ (TestWebKitAPI::Util::createContextForInjectedBundleTest):
+ * TestWebKitAPI/PlatformUtilities.h:
+ * TestWebKitAPI/PlatformWebView.h:
+ * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp:
+ (TestWebKitAPI::TEST):
+ * TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp:
+ (TestWebKitAPI::DocumentStartUserScriptAlertCrashTest::initialize):
+ * TestWebKitAPI/mac/PlatformWebViewMac.mm:
+ (TestWebKitAPI::PlatformWebView::PlatformWebView):
+ * TestWebKitAPI/win/PlatformWebViewWin.cpp:
+ (TestWebKitAPI::PlatformWebView::PlatformWebView):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+ (WTR::InjectedBundle::didInitializePageGroup):
+ (WTR::InjectedBundle::initialize):
+ (WTR::InjectedBundle::beginTesting):
+ * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+ (WTR::InjectedBundle::pageGroup):
+ * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+ (WTR::LayoutTestController::addUserScript):
+ (WTR::LayoutTestController::addUserStyleSheet):
+ (WTR::LayoutTestController::setXSSAuditorEnabled):
+ * WebKitTestRunner/TestController.cpp:
+ * WebKitTestRunner/win/PlatformWebViewWin.cpp:
+ (WTR::PlatformWebView::PlatformWebView):
+
2010-12-01 Steve Falkenburg <sfalken at apple.com>
Reviewed by Adam Roben.
diff --git a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
index f3d44a5..90db033 100644
--- a/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
+++ b/WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.m
@@ -97,6 +97,7 @@ void WKBundleInitialize(WKBundleRef bundle, WKTypeRef initializationUserData)
0,
didCreatePage,
willDestroyPage,
+ 0, // didInitializePageGroup
didRecieveMessage
};
WKBundleSetClient(bundle, &client);
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
index 5942ec8..e438afd 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.cpp
@@ -54,15 +54,20 @@ void InjectedBundleController::initialize(WKBundleRef bundle, WKTypeRef initiali
this,
didCreatePage,
willDestroyPage,
+ didInitializePageGroup,
didReceiveMessage
};
WKBundleSetClient(m_bundle, &client);
// Initialize the test from the "initializationUserData".
- assert(WKGetTypeID(initializationUserData) == WKStringGetTypeID());
- WKStringRef testName = static_cast<WKStringRef>(initializationUserData);
- initializeTestNamed(bundle, Util::toSTD(testName));
+ assert(WKGetTypeID(initializationUserData) == WKDictionaryGetTypeID());
+ WKDictionaryRef initializationDictionary = static_cast<WKDictionaryRef>(initializationUserData);
+
+ WKStringRef testName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("TestName")));
+ WKTypeRef userData = WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("UserData"));
+
+ initializeTestNamed(bundle, Util::toSTD(testName), userData);
}
void InjectedBundleController::didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo)
@@ -79,6 +84,13 @@ void InjectedBundleController::willDestroyPage(WKBundleRef bundle, WKBundlePageR
self->m_currentTest->willDestroyPage(bundle, page);
}
+void InjectedBundleController::didInitializePageGroup(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, const void* clientInfo)
+{
+ InjectedBundleController* self = static_cast<InjectedBundleController*>(const_cast<void*>(clientInfo));
+ assert(self->m_currentTest);
+ self->m_currentTest->didInitializePageGroup(bundle, pageGroup);
+}
+
void InjectedBundleController::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo)
{
InjectedBundleController* self = static_cast<InjectedBundleController*>(const_cast<void*>(clientInfo));
@@ -94,7 +106,7 @@ void InjectedBundleController::dumpTestNames()
printf("%s\n", (*it).first.c_str());
}
-void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std::string& identifier)
+void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std::string& identifier, WKTypeRef userData)
{
CreateInjectedBundleTestFunction createTestFunction = m_createInjectedBundleTestFunctions[identifier];
if (!createTestFunction) {
@@ -103,7 +115,7 @@ void InjectedBundleController::initializeTestNamed(WKBundleRef bundle, const std
}
m_currentTest = createTestFunction(identifier);
- m_currentTest->initialize(bundle);
+ m_currentTest->initialize(bundle, userData);
}
void InjectedBundleController::registerCreateInjectedBundleTestFunction(const std::string& identifier, CreateInjectedBundleTestFunction function)
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleController.h b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
index 91c571e..b84be4b 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleController.h
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleController.h
@@ -41,7 +41,7 @@ public:
void initialize(WKBundleRef, WKTypeRef);
void dumpTestNames();
- void initializeTestNamed(WKBundleRef bundle, const std::string&);
+ void initializeTestNamed(WKBundleRef bundle, const std::string&, WKTypeRef userData);
typedef InjectedBundleTest* (*CreateInjectedBundleTestFunction)(const std::string&);
void registerCreateInjectedBundleTestFunction(const std::string&, CreateInjectedBundleTestFunction);
@@ -50,9 +50,10 @@ private:
InjectedBundleController();
~InjectedBundleController();
- static void didCreatePage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
- static void willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, const void* clientInfo);
- static void didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
+ static void didCreatePage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
+ 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);
std::map<std::string, CreateInjectedBundleTestFunction> m_createInjectedBundleTestFunctions;
WKBundleRef m_bundle;
diff --git a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
index b0224f2..5285cdf 100644
--- a/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
+++ b/WebKitTools/TestWebKitAPI/InjectedBundleTest.h
@@ -34,10 +34,11 @@ class InjectedBundleTest {
public:
virtual ~InjectedBundleTest() { }
- virtual void initialize(WKBundleRef) { }
+ virtual void initialize(WKBundleRef, WKTypeRef) { }
virtual void didCreatePage(WKBundleRef, WKBundlePageRef) { }
virtual void willDestroyPage(WKBundleRef, WKBundlePageRef) { }
+ virtual void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef) { }
virtual void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody) { }
std::string name() const { return m_identifier; }
diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
index 281fb13..23678a0 100644
--- a/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
+++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.cpp
@@ -33,13 +33,21 @@
namespace TestWebKitAPI {
namespace Util {
-WKContextRef createContextForInjectedBundleTest(const std::string& testName)
+WKContextRef createContextForInjectedBundleTest(const std::string& testName, WKTypeRef userData)
{
WKRetainPtr<WKStringRef> injectedBundlePath(AdoptWK, createInjectedBundlePath());
WKContextRef context = WKContextCreateWithInjectedBundlePath(injectedBundlePath.get());
+ WKRetainPtr<WKMutableDictionaryRef> initializationDictionary(AdoptWK, WKMutableDictionaryCreate());
+
+ WKRetainPtr<WKStringRef> testNameKey(AdoptWK, WKStringCreateWithUTF8CString("TestName"));
WKRetainPtr<WKStringRef> testNameString(AdoptWK, WKStringCreateWithUTF8CString(testName.c_str()));
- WKContextSetInitializationUserDataForInjectedBundle(context, testNameString.get());
+ WKDictionaryAddItem(initializationDictionary.get(), testNameKey.get(), testNameString.get());
+
+ WKRetainPtr<WKStringRef> userDataKey(AdoptWK, WKStringCreateWithUTF8CString("UserData"));
+ WKDictionaryAddItem(initializationDictionary.get(), userDataKey.get(), userData);
+
+ WKContextSetInitializationUserDataForInjectedBundle(context, initializationDictionary.get());
return context;
}
diff --git a/WebKitTools/TestWebKitAPI/PlatformUtilities.h b/WebKitTools/TestWebKitAPI/PlatformUtilities.h
index 8ae347c..0e67dfd 100644
--- a/WebKitTools/TestWebKitAPI/PlatformUtilities.h
+++ b/WebKitTools/TestWebKitAPI/PlatformUtilities.h
@@ -35,7 +35,7 @@ namespace Util {
// Runs a platform runloop until the 'done' is true.
void run(bool* done);
-WKContextRef createContextForInjectedBundleTest(const std::string&);
+WKContextRef createContextForInjectedBundleTest(const std::string&, WKTypeRef userData = 0);
WKStringRef createInjectedBundlePath();
WKURLRef createURLForResource(const char* resource, const char* extension);
diff --git a/WebKitTools/TestWebKitAPI/PlatformWebView.h b/WebKitTools/TestWebKitAPI/PlatformWebView.h
index 7f4f057..349d855 100644
--- a/WebKitTools/TestWebKitAPI/PlatformWebView.h
+++ b/WebKitTools/TestWebKitAPI/PlatformWebView.h
@@ -51,7 +51,7 @@ class WindowMessageObserver;
class PlatformWebView {
public:
- PlatformWebView(WKPageNamespaceRef);
+ PlatformWebView(WKPageNamespaceRef, WKPageGroupRef = 0);
~PlatformWebView();
WKPageRef page();
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
index 5e0655e..b935b6f 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash.cpp
@@ -45,9 +45,11 @@ static void runJavaScriptAlert(WKPageRef page, WKStringRef alertText, WKFrameRef
TEST(WebKit2, DocumentStartUserScriptAlertCrashTest)
{
- WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest"));
+ WKRetainPtr<WKPageGroupRef> pageGroup(AdoptWK, WKPageGroupCreateWithIdentifier(WKStringCreateWithUTF8CString("DocumentStartUserScriptAlertCrashTestPageGroup")));
+
+ WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextForInjectedBundleTest("DocumentStartUserScriptAlertCrashTest", pageGroup.get()));
WKRetainPtr<WKPageNamespaceRef> pageNamespace(AdoptWK, WKPageNamespaceCreate(context.get()));
- PlatformWebView webView(pageNamespace.get());
+ PlatformWebView webView(pageNamespace.get(), pageGroup.get());
WKPageUIClient uiClient;
memset(&uiClient, 0, sizeof(uiClient));
diff --git a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
index a96bef2..dbd5d21 100644
--- a/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
+++ b/WebKitTools/TestWebKitAPI/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp
@@ -24,10 +24,12 @@
*/
#include "InjectedBundleTest.h"
-#include <WebKit2/WebKit2.h>
+#include <WebKit2/WKBundlePageGroup.h>
#include <WebKit2/WKBundlePrivate.h>
#include <WebKit2/WKBundleScriptWorld.h>
#include <WebKit2/WKRetainPtr.h>
+#include <WebKit2/WebKit2.h>
+#include <assert.h>
namespace TestWebKitAPI {
@@ -38,11 +40,17 @@ public:
{
}
- virtual void initialize(WKBundleRef bundle)
+ virtual void initialize(WKBundleRef bundle, WKTypeRef userData)
{
+ assert(WKGetTypeID(userData) == WKBundlePageGroupGetTypeID());
+ WKBundlePageGroupRef pageGroup = static_cast<WKBundlePageGroupRef>(userData);
+
WKRetainPtr<WKStringRef> source(AdoptWK, WKStringCreateWithUTF8CString("alert('an alert');"));
- WKBundleAddUserScript(bundle, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
+ WKBundleAddUserScript(bundle, pageGroup, WKBundleScriptWorldNormalWorld(), source.get(), 0, 0, 0, kWKInjectAtDocumentStart, kWKInjectInAllFrames);
}
+
+private:
+ WKBundlePageGroupRef m_pageGroup;
};
static InjectedBundleTest::Register<DocumentStartUserScriptAlertCrashTest> registrar("DocumentStartUserScriptAlertCrashTest");
diff --git a/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm b/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm
index d4c31eb..e06e2e6 100644
--- a/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm
+++ b/WebKitTools/TestWebKitAPI/mac/PlatformWebViewMac.mm
@@ -29,10 +29,10 @@
namespace TestWebKitAPI {
-PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
+PlatformWebView::PlatformWebView(WKPageNamespaceRef pageNamespaceRef, WKPageGroupRef pageGroupRef)
{
NSRect rect = NSMakeRect(0, 0, 800, 600);
- m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:namespaceRef];
+ m_view = [[WKView alloc] initWithFrame:rect pageNamespaceRef:pageNamespaceRef pageGroupRef:pageGroupRef];
NSRect windowRect = NSOffsetRect(rect, -10000, [[[NSScreen screens] objectAtIndex:0] frame].size.height - rect.size.height + 10000);
m_window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
diff --git a/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp b/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp
index 65bdbc6..0a4060c 100644
--- a/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp
+++ b/WebKitTools/TestWebKitAPI/win/PlatformWebViewWin.cpp
@@ -56,14 +56,14 @@ void PlatformWebView::registerWindowClass()
::RegisterClassExW(&wndClass);
}
-PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
+PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef, WKPageGroupRef pageGroupRef)
: m_parentWindowMessageObserver(0)
{
registerWindowClass();
RECT viewRect = {0, 0, 800, 600};
m_window = CreateWindowExW(0, hostWindowClassName, L"TestWebKitAPI", WS_OVERLAPPEDWINDOW, viewRect.left, viewRect.top, viewRect.right, viewRect.bottom, 0, 0, 0, this);
- m_view = WKViewCreate(viewRect, namespaceRef, m_window);
+ m_view = WKViewCreate(viewRect, namespaceRef, pageGroupRef, m_window);
}
PlatformWebView::~PlatformWebView()
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
index 6bc1802..49d9db6 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp
@@ -61,6 +61,11 @@ void InjectedBundle::willDestroyPage(WKBundleRef bundle, WKBundlePageRef page, c
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->willDestroyPage(page);
}
+void InjectedBundle::didInitializePageGroup(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, const void* clientInfo)
+{
+ static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didInitializePageGroup(pageGroup);
+}
+
void InjectedBundle::didReceiveMessage(WKBundleRef bundle, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo)
{
static_cast<InjectedBundle*>(const_cast<void*>(clientInfo))->didReceiveMessage(messageName, messageBody);
@@ -75,6 +80,7 @@ void InjectedBundle::initialize(WKBundleRef bundle)
this,
didCreatePage,
willDestroyPage,
+ didInitializePageGroup,
didReceiveMessage
};
WKBundleSetClient(m_bundle, &client);
@@ -99,6 +105,11 @@ void InjectedBundle::willDestroyPage(WKBundlePageRef page)
}
}
+void InjectedBundle::didInitializePageGroup(WKBundlePageGroupRef pageGroup)
+{
+ m_pageGroup = pageGroup;
+}
+
InjectedBundlePage* InjectedBundle::page() const
{
// It might be better to have the UI process send over a reference to the main
@@ -137,7 +148,7 @@ void InjectedBundle::beginTesting()
WKBundleSetShouldTrackVisitedLinks(m_bundle, false);
WKBundleRemoveAllVisitedLinks(m_bundle);
- WKBundleRemoveAllUserContent(m_bundle);
+ WKBundleRemoveAllUserContent(m_bundle, m_pageGroup);
page()->reset();
}
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
index 2c6d14b..c1d8b37 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/InjectedBundle.h
@@ -48,6 +48,7 @@ public:
void initialize(WKBundleRef);
WKBundleRef bundle() const { return m_bundle; }
+ WKBundlePageGroupRef pageGroup() const { return m_pageGroup; }
LayoutTestController* layoutTestController() { return m_layoutTestController.get(); }
GCController* gcController() { return m_gcController.get(); }
@@ -70,15 +71,18 @@ private:
static void didCreatePage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
- static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void *clientInfo);
+ static void didInitializePageGroup(WKBundleRef, WKBundlePageGroupRef, const void* clientInfo);
+ static void didReceiveMessage(WKBundleRef, WKStringRef messageName, WKTypeRef messageBody, const void* clientInfo);
void didCreatePage(WKBundlePageRef);
void willDestroyPage(WKBundlePageRef);
+ void didInitializePageGroup(WKBundlePageGroupRef);
void didReceiveMessage(WKStringRef messageName, WKTypeRef messageBody);
void beginTesting();
WKBundleRef m_bundle;
+ WKBundlePageGroupRef m_pageGroup;
Vector<OwnPtr<InjectedBundlePage> > m_pages;
RefPtr<LayoutTestController> m_layoutTestController;
diff --git a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
index 78b2ae9..60e3130 100644
--- a/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
+++ b/WebKitTools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp
@@ -174,7 +174,7 @@ void LayoutTestController::addUserScript(JSStringRef source, bool runAtStart, bo
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
- WKBundleAddUserScript(InjectedBundle::shared().bundle(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
+ WKBundleAddUserScript(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
(runAtStart ? kWKInjectAtDocumentStart : kWKInjectAtDocumentEnd),
(allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
}
@@ -184,7 +184,7 @@ void LayoutTestController::addUserStyleSheet(JSStringRef source, bool allFrames)
WKRetainPtr<WKStringRef> sourceWK = toWK(source);
WKRetainPtr<WKBundleScriptWorldRef> scriptWorld(AdoptWK, WKBundleScriptWorldCreateWorld());
- WKBundleAddUserStyleSheet(InjectedBundle::shared().bundle(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
+ WKBundleAddUserStyleSheet(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), scriptWorld.get(), sourceWK.get(), 0, 0, 0,
(allFrames ? kWKInjectInAllFrames : kWKInjectInTopFrameOnly));
}
@@ -284,7 +284,7 @@ void LayoutTestController::setCanOpenWindows(bool)
void LayoutTestController::setXSSAuditorEnabled(bool enabled)
{
- WKBundleOverrideXSSAuditorEnabledForTestRunner(InjectedBundle::shared().bundle(), true);
+ WKBundleOverrideXSSAuditorEnabledForTestRunner(InjectedBundle::shared().bundle(), InjectedBundle::shared().pageGroup(), true);
}
unsigned LayoutTestController::windowCount()
diff --git a/WebKitTools/WebKitTestRunner/TestController.cpp b/WebKitTools/WebKitTestRunner/TestController.cpp
index 5e22239..f182377 100644
--- a/WebKitTools/WebKitTestRunner/TestController.cpp
+++ b/WebKitTools/WebKitTestRunner/TestController.cpp
@@ -29,6 +29,7 @@
#include "StringFunctions.h"
#include "TestInvocation.h"
#include <cstdio>
+#include <WebKit2/WKPageGroup.h>
#include <WebKit2/WKContextPrivate.h>
#include <WebKit2/WKPreferencesPrivate.h>
#include <wtf/PassOwnPtr.h>
diff --git a/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp b/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp
index 9acd236..7334d4a 100644
--- a/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp
+++ b/WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp
@@ -53,7 +53,7 @@ PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
RECT viewRect = {0, 0, 800, 600};
m_window = CreateWindowExW(0, hostWindowClassName, L"WebKitTestRunner", WS_OVERLAPPEDWINDOW, 0 /*XOFFSET*/, 0 /*YOFFSET*/, viewRect.right, viewRect.bottom, 0, 0, GetModuleHandle(0), 0);
- m_view = WKViewCreate(viewRect, namespaceRef, m_window);
+ m_view = WKViewCreate(viewRect, namespaceRef, 0 /*pageGroupRef*/, m_window);
}
PlatformWebView::~PlatformWebView()
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list