Diff
Modified: trunk/Source/WebKit2/CMakeLists.txt (197303 => 197304)
--- trunk/Source/WebKit2/CMakeLists.txt 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/CMakeLists.txt 2016-02-29 00:32:24 UTC (rev 197304)
@@ -716,7 +716,6 @@
WebProcess/WebPage/WebInspector.messages.in
WebProcess/WebPage/WebInspectorUI.messages.in
WebProcess/WebPage/WebPage.messages.in
- WebProcess/WebPage/WebPageGroupProxy.messages.in
)
set(WebProcess_LIBRARIES
Modified: trunk/Source/WebKit2/ChangeLog (197303 => 197304)
--- trunk/Source/WebKit2/ChangeLog 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/ChangeLog 2016-02-29 00:32:24 UTC (rev 197304)
@@ -1,5 +1,109 @@
2016-02-28 Sam Weinig <s...@webkit.org>
+ Reimplement WKPageGroup in terms of WKUserContentController
+ https://bugs.webkit.org/show_bug.cgi?id=154804
+
+ Reviewed by Dan Bernstein.
+
+ Instead of having both WebPageGroup and WebUserContentControllerProxy both keep track
+ of user scripts and user stylesheets, give WebPageGroup a WebUserContentControllerProxy
+ and let it take care of things. This allows us to remove a ton of duplicate code, and
+ provides a convenient way for clients currently using PageGroup based user content insertion
+ to start using UserContentController, since they can now be used at the same time.
+
+ When using WKPageConfigurationRef, the rule is:
+ - If you don't set a WKUserContentControllerRef, the one from the WKPageGroupRef will be used.
+ - If you do set a WKUserContentControllerRef, it will be used, and the one from the WKPageGroupRef
+ will do nothing for that web view.
+
+ * DerivedSources.make:
+ Remove WebPageGroupProxy. It no longer is a MessageReceiver.
+
+ * Shared/WebPageGroupData.cpp:
+ (WebKit::WebPageGroupData::encode):
+ (WebKit::WebPageGroupData::decode):
+ * Shared/WebPageGroupData.h:
+ Stop encoding/decoding user content, instead just encode the identifier to the UserContentController.
+
+ * UIProcess/API/C/WKPageGroup.cpp:
+ (WKPageGroupGetUserContentController):
+ * UIProcess/API/C/WKPageGroup.h:
+ Add getter for the underlying WKUserContentControllerRef.
+
+ * UIProcess/API/cpp/WKRetainPtr.h:
+ (WebKit::retainWK):
+ Add retainWK() helper to match RetainPtr's retainPtr() helper.
+
+ * UIProcess/WebPageGroup.cpp:
+ (WebKit::WebPageGroup::WebPageGroup):
+ (WebKit::WebPageGroup::userContentController):
+ (WebKit::WebPageGroup::addUserStyleSheet):
+ (WebKit::WebPageGroup::addUserScript):
+ (WebKit::WebPageGroup::removeAllUserStyleSheets):
+ (WebKit::WebPageGroup::removeAllUserScripts):
+ (WebKit::WebPageGroup::removeAllUserContent):
+ (WebKit::WebPageGroup::addUserContentExtension):
+ (WebKit::WebPageGroup::removeUserContentExtension):
+ (WebKit::WebPageGroup::removeAllUserContentExtensions):
+ * UIProcess/WebPageGroup.h:
+ Pass through to the WebUserContentControllerProxy.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::WebPageProxy):
+ (WebKit::WebPageProxy::finishInitializingWebPageAfterProcessLaunch):
+ (WebKit::WebPageProxy::creationParameters):
+ * UIProcess/WebPageProxy.h:
+ WebPageProxies always have a WebUserContentControllerProxy now, so it can go in a Ref and
+ a few branches can be removed.
+
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::createWebPage):
+ If a UserContentController is not passed in, use the one from the PageGroup.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Remove files.
+
+ * WebProcess/InjectedBundle/InjectedBundle.cpp:
+ Add some #includes that are now needed.
+
+ * WebProcess/UserContent/WebUserContentController.cpp:
+ (WebKit::WebUserContentController::getOrCreate):
+ * WebProcess/UserContent/WebUserContentController.h:
+ Modernize WebUserContentController::getOrCreate to return a Ref.
+
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::WebPage):
+ (WebKit::m_shouldDispatchFakeMouseMoveEvents):
+ (WebKit::WebPage::addUserScript):
+ (WebKit::WebPage::addUserStyleSheet):
+ (WebKit::WebPage::removeAllUserContent):
+ * WebProcess/WebPage/WebPage.h:
+ Store the WebUserContentController in Ref, remove unnecessary branches/asserts.
+
+ * WebProcess/WebPage/WebPageGroupProxy.cpp:
+ (WebKit::WebPageGroupProxy::WebPageGroupProxy):
+ (WebKit::WebPageGroupProxy::~WebPageGroupProxy):
+ (WebKit::WebPageGroupProxy::userContentController):
+ (WebKit::WebPageGroupProxy::addUserStyleSheet): Deleted.
+ (WebKit::WebPageGroupProxy::addUserScript): Deleted.
+ (WebKit::WebPageGroupProxy::removeAllUserStyleSheets): Deleted.
+ (WebKit::WebPageGroupProxy::removeAllUserScripts): Deleted.
+ (WebKit::WebPageGroupProxy::removeAllUserContent): Deleted.
+ (WebKit::WebPageGroupProxy::addUserContentExtension): Deleted.
+ (WebKit::WebPageGroupProxy::removeUserContentExtension): Deleted.
+ (WebKit::WebPageGroupProxy::removeAllUserContentExtensions): Deleted.
+ * WebProcess/WebPage/WebPageGroupProxy.h:
+ Store a WebUserContentController in a Ref, remove now unnecessary message handling functions.
+
+ * WebProcess/WebPage/WebPageGroupProxy.messages.in:
+ Removed.
+
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::didReceiveMessage):
+ Remove routing to WebPageGroupProxy, which is no longer a MessageReceiver.
+
+2016-02-28 Sam Weinig <s...@webkit.org>
+
Bind _WKUserStyleSheets to _WKUserContentWorlds to allow for grouping of user content by associating to a world
https://bugs.webkit.org/show_bug.cgi?id=154798
Modified: trunk/Source/WebKit2/DerivedSources.make (197303 => 197304)
--- trunk/Source/WebKit2/DerivedSources.make 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/DerivedSources.make 2016-02-29 00:32:24 UTC (rev 197304)
@@ -124,7 +124,6 @@
WebInspectorUI \
WebNotificationManager \
WebPage \
- WebPageGroupProxy \
WebPageProxy \
WebPasteboardProxy \
WebProcess \
Modified: trunk/Source/WebKit2/Shared/WebPageGroupData.cpp (197303 => 197304)
--- trunk/Source/WebKit2/Shared/WebPageGroupData.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/Shared/WebPageGroupData.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -36,11 +36,7 @@
encoder << pageGroupID;
encoder << visibleToInjectedBundle;
encoder << visibleToHistoryClient;
- encoder << userStyleSheets;
- encoder << userScripts;
-#if ENABLE(CONTENT_EXTENSIONS)
- encoder << userContentExtensions;
-#endif
+ encoder << userContentControllerIdentifier;
}
bool WebPageGroupData::decode(IPC::ArgumentDecoder& decoder, WebPageGroupData& data)
@@ -53,14 +49,8 @@
return false;
if (!decoder.decode(data.visibleToHistoryClient))
return false;
- if (!decoder.decode(data.userStyleSheets))
+ if (!decoder.decode(data.userContentControllerIdentifier))
return false;
- if (!decoder.decode(data.userScripts))
- return false;
-#if ENABLE(CONTENT_EXTENSIONS)
- if (!decoder.decode(data.userContentExtensions))
- return false;
-#endif
return true;
}
Modified: trunk/Source/WebKit2/Shared/WebPageGroupData.h (197303 => 197304)
--- trunk/Source/WebKit2/Shared/WebPageGroupData.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/Shared/WebPageGroupData.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -26,11 +26,6 @@
#ifndef WebPageGroupData_h
#define WebPageGroupData_h
-#include "WebCompiledContentExtensionData.h"
-#include <WebCore/UserScript.h>
-#include <WebCore/UserStyleSheet.h>
-#include <wtf/HashMap.h>
-#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace IPC {
@@ -49,12 +44,7 @@
bool visibleToInjectedBundle;
bool visibleToHistoryClient;
- Vector<WebCore::UserStyleSheet> userStyleSheets;
- Vector<WebCore::UserScript> userScripts;
-
-#if ENABLE(CONTENT_EXTENSIONS)
- HashMap<String, WebCompiledContentExtensionData> userContentExtensions;
-#endif
+ uint64_t userContentControllerIdentifier;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -30,6 +30,7 @@
#include "WKAPICast.h"
#include "WebPageGroup.h"
#include "WebPreferences.h"
+#include "WebUserContentControllerProxy.h"
using namespace WebKit;
@@ -59,6 +60,11 @@
return toAPI(&toImpl(pageGroupRef)->preferences());
}
+WKUserContentControllerRef WKPageGroupGetUserContentController(WKPageGroupRef pageGroupRef)
+{
+ return toAPI(&toImpl(pageGroupRef)->userContentController());
+}
+
void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames)
{
toImpl(pageGroupRef)->addUserStyleSheet(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel);
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -42,7 +42,9 @@
WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences);
WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup);
-
+
+WK_EXPORT WKUserContentControllerRef WKPageGroupGetUserContentController(WKPageGroupRef pageGroup);
+
WK_EXPORT void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroup, WKStringRef source, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames);
WK_EXPORT void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup);
Modified: trunk/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/API/cpp/WKRetainPtr.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -248,11 +248,17 @@
return WKRetainPtr<T>(AdoptWK, o);
}
+template<typename T> inline WKRetainPtr<T> retainWK(T ptr)
+{
+ return ptr;
+}
+
} // namespace WebKit
using WebKit::WKRetainPtr;
using WebKit::AdoptWK;
using WebKit::adoptWK;
+using WebKit::retainWK;
namespace WTF {
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -28,10 +28,12 @@
#include "APIArray.h"
#include "APIUserContentExtension.h"
+#include "APIUserScript.h"
+#include "APIUserStyleSheet.h"
#include "WebCompiledContentExtension.h"
-#include "WebPageGroupProxyMessages.h"
#include "WebPageProxy.h"
#include "WebPreferences.h"
+#include "WebUserContentControllerProxy.h"
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/text/StringConcatenate.h>
@@ -89,7 +91,10 @@
WebPageGroup::WebPageGroup(const String& identifier, bool visibleToInjectedBundle, bool visibleToHistoryClient)
: m_data(pageGroupData(identifier, visibleToInjectedBundle, visibleToHistoryClient))
, m_preferences(WebPreferences::createWithLegacyDefaults(m_data.identifier, ".WebKit2", "WebKit2."))
+ , m_userContentController(WebUserContentControllerProxy::create())
{
+ m_data.userContentControllerIdentifier = m_userContentController->identifier();
+
webPageGroupMap().set(m_data.pageGroupID, this);
}
@@ -132,15 +137,18 @@
}
}
+WebUserContentControllerProxy& WebPageGroup::userContentController()
+{
+ return *m_userContentController;
+}
+
void WebPageGroup::addUserStyleSheet(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserStyleLevel level)
{
if (source.isEmpty())
return;
- WebCore::UserStyleSheet userStyleSheet = WebCore::UserStyleSheet(source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames, level);
-
- m_data.userStyleSheets.append(userStyleSheet);
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::AddUserStyleSheet(userStyleSheet), m_data.pageGroupID);
+ Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectedFrames, level }, API::UserContentWorld::normalWorld());
+ m_userContentController->addUserStyleSheet(userStyleSheet.get());
}
void WebPageGroup::addUserScript(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
@@ -148,48 +156,40 @@
if (source.isEmpty())
return;
- WebCore::UserScript userScript = WebCore::UserScript(source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames);
-
- m_data.userScripts.append(userScript);
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::AddUserScript(userScript), m_data.pageGroupID);
+ Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { source, (baseURL.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURL)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), injectionTime, injectedFrames }, API::UserContentWorld::normalWorld());
+ m_userContentController->addUserScript(userScript.get());
}
void WebPageGroup::removeAllUserStyleSheets()
{
- m_data.userStyleSheets.clear();
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserStyleSheets(), m_data.pageGroupID);
+ m_userContentController->removeAllUserStyleSheets();
}
void WebPageGroup::removeAllUserScripts()
{
- m_data.userScripts.clear();
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserScripts(), m_data.pageGroupID);
+ m_userContentController->removeAllUserScripts();
}
void WebPageGroup::removeAllUserContent()
{
- m_data.userStyleSheets.clear();
- m_data.userScripts.clear();
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserContent(), m_data.pageGroupID);
+ m_userContentController->removeAllUserStyleSheets();
+ m_userContentController->removeAllUserScripts();
}
#if ENABLE(CONTENT_EXTENSIONS)
-void WebPageGroup::addUserContentExtension(const API::UserContentExtension& userContentExtension)
+void WebPageGroup::addUserContentExtension(API::UserContentExtension& userContentExtension)
{
- m_data.userContentExtensions.set(userContentExtension.name(), userContentExtension.compiledExtension().data());
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::AddUserContentExtension(userContentExtension.name(), userContentExtension.compiledExtension().data()), m_data.pageGroupID);
+ m_userContentController->addUserContentExtension(userContentExtension);
}
void WebPageGroup::removeUserContentExtension(const String& contentExtensionName)
{
- m_data.userContentExtensions.remove(contentExtensionName);
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveUserContentExtension(contentExtensionName), m_data.pageGroupID);
+ m_userContentController->removeUserContentExtension(contentExtensionName);
}
void WebPageGroup::removeAllUserContentExtensions()
{
- m_data.userContentExtensions.clear();
- sendToAllProcessesInGroup(Messages::WebPageGroupProxy::RemoveAllUserContentExtensions(), m_data.pageGroupID);
+ m_userContentController->removeAllUserContentExtensions();
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -30,6 +30,7 @@
#include "WebPageGroupData.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
+#include <WebCore/UserStyleSheetTypes.h>
#include <wtf/Forward.h>
#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
@@ -38,6 +39,7 @@
class WebPreferences;
class WebPageProxy;
+class WebUserContentControllerProxy;
class WebPageGroup : public API::ObjectImpl<API::Object::Type::PageGroup> {
public:
@@ -59,7 +61,9 @@
void setPreferences(WebPreferences*);
WebPreferences& preferences() const;
void preferencesDidChange();
-
+
+ WebUserContentControllerProxy& userContentController();
+
void addUserStyleSheet(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserStyleLevel);
void addUserScript(const String& source, const String& baseURL, API::Array* whitelist, API::Array* blacklist, WebCore::UserContentInjectedFrames, WebCore::UserScriptInjectionTime);
void removeAllUserStyleSheets();
@@ -67,7 +71,7 @@
void removeAllUserContent();
#if ENABLE(CONTENT_EXTENSIONS)
- void addUserContentExtension(const API::UserContentExtension&);
+ void addUserContentExtension(API::UserContentExtension&);
void removeUserContentExtension(const String&);
void removeAllUserContentExtensions();
#endif
@@ -77,6 +81,7 @@
WebPageGroupData m_data;
RefPtr<WebPreferences> m_preferences;
+ RefPtr<WebUserContentControllerProxy> m_userContentController;
HashSet<WebPageProxy*> m_pages;
};
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -319,7 +319,7 @@
, m_process(process)
, m_pageGroup(*m_configuration->pageGroup())
, m_preferences(*m_configuration->preferences())
- , m_userContentController(m_configuration->userContentController())
+ , m_userContentController(*m_configuration->userContentController())
, m_visitedLinkStore(*m_configuration->visitedLinkStore())
, m_websiteDataStore(m_configuration->websiteDataStore()->websiteDataStore())
, m_mainFrame(nullptr)
@@ -819,8 +819,7 @@
m_needsToFinishInitializingWebPageAfterProcessLaunch = false;
- if (m_userContentController)
- m_process->addWebUserContentControllerProxy(*m_userContentController);
+ m_process->addWebUserContentControllerProxy(m_userContentController);
m_process->addVisitedLinkStore(m_visitedLinkStore);
}
@@ -5154,7 +5153,7 @@
parameters.itemStates = m_backForwardList->itemStates();
parameters.sessionID = m_sessionID;
parameters.highestUsedBackForwardItemID = WebBackForwardListItem::highedUsedItemID();
- parameters.userContentControllerID = m_userContentController ? m_userContentController->identifier() : 0;
+ parameters.userContentControllerID = m_userContentController->identifier();
parameters.visitedLinkTableID = m_visitedLinkStore->identifier();
parameters.websiteDataStoreID = m_websiteDataStore->identifier();
parameters.canRunBeforeUnloadConfirmPanel = m_uiClient->canRunBeforeUnloadConfirmPanel();
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -1511,7 +1511,7 @@
WebProcessLifetimeTracker m_webProcessLifetimeTracker { *this };
- const RefPtr<WebUserContentControllerProxy> m_userContentController;
+ Ref<WebUserContentControllerProxy> m_userContentController;
Ref<VisitedLinkStore> m_visitedLinkStore;
Ref<WebsiteDataStore> m_websiteDataStore;
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (197303 => 197304)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -750,6 +750,8 @@
pageConfiguration->setPageGroup(m_defaultPageGroup.ptr());
if (!pageConfiguration->preferences())
pageConfiguration->setPreferences(&pageConfiguration->pageGroup()->preferences());
+ if (!pageConfiguration->userContentController())
+ pageConfiguration->setUserContentController(&pageConfiguration->pageGroup()->userContentController());
if (!pageConfiguration->visitedLinkStore())
pageConfiguration->setVisitedLinkStore(m_visitedLinkStore.ptr());
if (!pageConfiguration->websiteDataStore()) {
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (197303 => 197304)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2016-02-29 00:32:24 UTC (rev 197304)
@@ -580,8 +580,6 @@
29AD3096164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29AD3095164B4C930072DEA9 /* CustomProtocolManagerProxyMac.mm */; };
29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */; };
29CD55AB128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */; };
- 29D55DF1161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */; };
- 29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */; };
2D125C5E1857EA05003BA3CB /* ViewGestureController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D125C5C1857EA05003BA3CB /* ViewGestureController.h */; };
2D125C5F1857EA05003BA3CB /* ViewGestureControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D125C5D1857EA05003BA3CB /* ViewGestureControllerMac.mm */; };
2D1B5D5D185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D1B5D5B185869C8006C6596 /* ViewGestureControllerMessageReceiver.cpp */; };
@@ -2538,9 +2536,6 @@
29AD3097164B4E210072DEA9 /* CustomProtocolManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = CustomProtocolManagerProxy.messages.in; path = CustomProtocols/CustomProtocolManagerProxy.messages.in; sourceTree = "<group>"; };
29CD55A8128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKAccessibilityWebPageObjectBase.h; sourceTree = "<group>"; };
29CD55A9128E294F00133C85 /* WKAccessibilityWebPageObjectBase.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKAccessibilityWebPageObjectBase.mm; sourceTree = "<group>"; };
- 29D55DEE161BF8780031A2E3 /* WebPageGroupProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = WebPageGroupProxy.messages.in; sourceTree = "<group>"; };
- 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageGroupProxyMessageReceiver.cpp; sourceTree = "<group>"; };
- 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageGroupProxyMessages.h; sourceTree = "<group>"; };
2D0035221BC7414800DA8716 /* DeprecatedPDFPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeprecatedPDFPlugin.h; path = PDF/DeprecatedPDFPlugin.h; sourceTree = "<group>"; };
2D0035231BC7414800DA8716 /* DeprecatedPDFPlugin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DeprecatedPDFPlugin.mm; path = PDF/DeprecatedPDFPlugin.mm; sourceTree = "<group>"; };
2D125C5C1857EA05003BA3CB /* ViewGestureController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewGestureController.h; sourceTree = "<group>"; };
@@ -5753,7 +5748,6 @@
C0CE72581247E4DA00BC0EC4 /* WebPage.messages.in */,
BC7B621412A4219A00D174A4 /* WebPageGroupProxy.cpp */,
BC7B621312A4219A00D174A4 /* WebPageGroupProxy.h */,
- 29D55DEE161BF8780031A2E3 /* WebPageGroupProxy.messages.in */,
2D5C9D0319C81D8F00B3C5C1 /* WebPageOverlay.cpp */,
2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */,
BCA0EF7E12331E78007D3CFB /* WebUndoStep.cpp */,
@@ -6875,8 +6869,6 @@
1CBBE49F19B66C53006B7D81 /* WebInspectorUIMessages.h */,
31BA9248148830810062EDB5 /* WebNotificationManagerMessageReceiver.cpp */,
31BA9249148830810062EDB5 /* WebNotificationManagerMessages.h */,
- 29D55DEF161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp */,
- 29D55DF0161BF9F10031A2E3 /* WebPageGroupProxyMessages.h */,
C0CE729E1247E71D00BC0EC4 /* WebPageMessageReceiver.cpp */,
C0CE729F1247E71D00BC0EC4 /* WebPageMessages.h */,
BCBD3912125BB1A800D2C29F /* WebPageProxyMessageReceiver.cpp */,
@@ -7635,7 +7627,6 @@
5C1427071C23F84C00D41183 /* DownloadManager.h in Headers */,
BC7B625212A43C9600D174A4 /* WebPageGroupData.h in Headers */,
BC7B621512A4219A00D174A4 /* WebPageGroupProxy.h in Headers */,
- 29D55DF2161BF9F10031A2E3 /* WebPageGroupProxyMessages.h in Headers */,
2D9EA30F1A96CBFF002D2807 /* WebPageInjectedBundleClient.h in Headers */,
C0CE72A11247E71D00BC0EC4 /* WebPageMessages.h in Headers */,
2D5C9D0619C81D8F00B3C5C1 /* WebPageOverlay.h in Headers */,
@@ -9114,7 +9105,6 @@
BC7B6207129A0A6700D174A4 /* WebPageGroup.cpp in Sources */,
BC7B625312A43C9600D174A4 /* WebPageGroupData.cpp in Sources */,
BC7B621612A4219A00D174A4 /* WebPageGroupProxy.cpp in Sources */,
- 29D55DF1161BF9F10031A2E3 /* WebPageGroupProxyMessageReceiver.cpp in Sources */,
2D9EA3111A96D9EB002D2807 /* WebPageInjectedBundleClient.cpp in Sources */,
5C1426EC1C23F80900D41183 /* NetworkProcessCreationParameters.cpp in Sources */,
2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -72,6 +72,8 @@
#include <WebCore/Settings.h>
#include <WebCore/UserContentController.h>
#include <WebCore/UserGestureIndicator.h>
+#include <WebCore/UserScript.h>
+#include <WebCore/UserStyleSheet.h>
#if ENABLE(CSS_REGIONS) || ENABLE(CSS_COMPOSITING)
#include <WebCore/RuntimeEnabledFeatures.h>
Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -66,16 +66,16 @@
return map;
}
-PassRefPtr<WebUserContentController> WebUserContentController::getOrCreate(uint64_t identifier)
+Ref<WebUserContentController> WebUserContentController::getOrCreate(uint64_t identifier)
{
auto& userContentControllerPtr = userContentControllers().add(identifier, nullptr).iterator->value;
if (userContentControllerPtr)
- return userContentControllerPtr;
+ return *userContentControllerPtr;
RefPtr<WebUserContentController> userContentController = adoptRef(new WebUserContentController(identifier));
userContentControllerPtr = userContentController.get();
- return userContentController.release();
+ return userContentController.releaseNonNull();
}
WebUserContentController::WebUserContentController(uint64_t identifier)
Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -40,7 +40,7 @@
class WebUserContentController final : public RefCounted<WebUserContentController>, private IPC::MessageReceiver {
public:
- static PassRefPtr<WebUserContentController> getOrCreate(uint64_t identifier);
+ static Ref<WebUserContentController> getOrCreate(uint64_t identifier);
virtual ~WebUserContentController();
WebCore::UserContentController& userContentController() { return m_userContentController; }
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -158,6 +158,8 @@
#include <WebCore/SubstituteData.h>
#include <WebCore/TextIterator.h>
#include <WebCore/UserInputBridge.h>
+#include <WebCore/UserScript.h>
+#include <WebCore/UserStyleSheet.h>
#include <WebCore/VisiblePosition.h>
#include <WebCore/VisibleUnits.h>
#include <WebCore/markup.h>
@@ -307,7 +309,7 @@
#if ENABLE(INPUT_TYPE_COLOR)
, m_activeColorChooser(0)
#endif
- , m_userContentController(parameters.userContentControllerID ? WebUserContentController::getOrCreate(parameters.userContentControllerID) : nullptr)
+ , m_userContentController(WebUserContentController::getOrCreate(parameters.userContentControllerID))
#if ENABLE(GEOLOCATION)
, m_geolocationPermissionRequestManager(this)
#endif
@@ -394,7 +396,7 @@
pageConfiguration.databaseProvider = WebDatabaseProvider::getOrCreate(m_pageGroup->pageGroupID());
pageConfiguration.storageNamespaceProvider = WebStorageNamespaceProvider::getOrCreate(m_pageGroup->pageGroupID());
- pageConfiguration.userContentController = m_userContentController ? &m_userContentController->userContentController() : &m_pageGroup->userContentController();
+ pageConfiguration.userContentController = &m_userContentController->userContentController();
pageConfiguration.visitedLinkStore = VisitedLinkTableController::getOrCreate(parameters.visitedLinkTableID);
#if USE(APPLE_INTERNAL_SDK)
@@ -5182,8 +5184,6 @@
void WebPage::addUserScript(const String& source, WebCore::UserContentInjectedFrames injectedFrames, WebCore::UserScriptInjectionTime injectionTime)
{
- ASSERT(m_userContentController);
-
WebCore::UserScript userScript(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectionTime, injectedFrames);
m_userContentController->userContentController().addUserScript(mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript));
@@ -5191,8 +5191,6 @@
void WebPage::addUserStyleSheet(const String& source, WebCore::UserContentInjectedFrames injectedFrames)
{
- ASSERT(m_userContentController);
-
WebCore::UserStyleSheet userStyleSheet(source, WebCore::blankURL(), Vector<String>(), Vector<String>(), injectedFrames, UserStyleUserLevel);
m_userContentController->userContentController().addUserStyleSheet(mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), InjectInExistingDocuments);
@@ -5200,9 +5198,6 @@
void WebPage::removeAllUserContent()
{
- if (!m_userContentController)
- return;
-
m_userContentController->userContentController().removeAllUserContent();
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -1311,7 +1311,7 @@
RefPtr<WebOpenPanelResultListener> m_activeOpenPanelResultListener;
RefPtr<NotificationPermissionRequestManager> m_notificationPermissionRequestManager;
- RefPtr<WebUserContentController> m_userContentController;
+ Ref<WebUserContentController> m_userContentController;
#if ENABLE(GEOLOCATION)
GeolocationPermissionRequestManager m_geolocationPermissionRequestManager;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -27,8 +27,8 @@
#include "WebPageGroupProxy.h"
#include "InjectedBundle.h"
-#include "WebCompiledContentExtension.h"
#include "WebProcess.h"
+#include "WebUserContentController.h"
#include <WebCore/DOMWrapperWorld.h>
#include <WebCore/PageGroup.h>
#include <WebCore/UserContentController.h>
@@ -48,16 +48,8 @@
WebPageGroupProxy::WebPageGroupProxy(const WebPageGroupData& data)
: m_data(data)
, m_pageGroup(WebCore::PageGroup::pageGroup(m_data.identifier))
+ , m_userContentController(WebUserContentController::getOrCreate(m_data.userContentControllerIdentifier))
{
- for (const auto& userStyleSheet : data.userStyleSheets)
- addUserStyleSheet(userStyleSheet);
- for (const auto& userScript : data.userScripts)
- addUserScript(userScript);
-
-#if ENABLE(CONTENT_EXTENSIONS)
- for (auto& slot : data.userContentExtensions)
- addUserContentExtension(slot.key, slot.value);
-#endif
}
WebPageGroupProxy::~WebPageGroupProxy()
@@ -66,53 +58,7 @@
WebCore::UserContentController& WebPageGroupProxy::userContentController()
{
- if (!m_userContentController)
- m_userContentController = WebCore::UserContentController::create();
-
- return *m_userContentController;
+ return m_userContentController->userContentController();
}
-void WebPageGroupProxy::addUserStyleSheet(const WebCore::UserStyleSheet& userStyleSheet)
-{
- userContentController().addUserStyleSheet(WebCore::mainThreadNormalWorld(), std::make_unique<WebCore::UserStyleSheet>(userStyleSheet), WebCore::InjectInExistingDocuments);
-}
-
-void WebPageGroupProxy::addUserScript(const WebCore::UserScript& userScript)
-{
- userContentController().addUserScript(WebCore::mainThreadNormalWorld(), std::make_unique<WebCore::UserScript>(userScript));
-}
-
-void WebPageGroupProxy::removeAllUserStyleSheets()
-{
- userContentController().removeUserStyleSheets(WebCore::mainThreadNormalWorld());
-}
-
-void WebPageGroupProxy::removeAllUserScripts()
-{
- userContentController().removeUserScripts(WebCore::mainThreadNormalWorld());
-}
-
-void WebPageGroupProxy::removeAllUserContent()
-{
- userContentController().removeAllUserContent();
-}
-
-#if ENABLE(CONTENT_EXTENSIONS)
-void WebPageGroupProxy::addUserContentExtension(const String& name, WebCompiledContentExtensionData contentExtensionData)
-{
- RefPtr<WebCompiledContentExtension> compiledContentExtension = WebCompiledContentExtension::create(WTFMove(contentExtensionData));
- userContentController().addUserContentExtension(name, compiledContentExtension);
-}
-
-void WebPageGroupProxy::removeUserContentExtension(const String& name)
-{
- userContentController().removeUserContentExtension(name);
-}
-
-void WebPageGroupProxy::removeAllUserContentExtensions()
-{
- userContentController().removeAllUserContentExtensions();
-}
-#endif
-
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.h 2016-02-29 00:32:24 UTC (rev 197304)
@@ -30,11 +30,6 @@
#include "WebPageGroupData.h"
#include <wtf/PassRefPtr.h>
-namespace IPC {
-class Connection;
-class MessageDecoder;
-}
-
namespace WebCore {
class PageGroup;
class UserContentController;
@@ -42,7 +37,7 @@
namespace WebKit {
-class WebCompiledContentExtensionData;
+class WebUserContentController;
class WebPageGroupProxy : public API::ObjectImpl<API::Object::Type::BundlePageGroup> {
public:
@@ -57,27 +52,12 @@
WebCore::UserContentController& userContentController();
- void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&);
-
- void addUserStyleSheet(const WebCore::UserStyleSheet&);
- void addUserScript(const WebCore::UserScript&);
- void removeAllUserStyleSheets();
- void removeAllUserScripts();
- void removeAllUserContent();
-
-#if ENABLE(CONTENT_EXTENSIONS)
- void addUserContentExtension(const String& name, WebCompiledContentExtensionData);
- void removeUserContentExtension(const String& name);
- void removeAllUserContentExtensions();
-#endif
-
private:
WebPageGroupProxy(const WebPageGroupData&);
WebPageGroupData m_data;
WebCore::PageGroup* m_pageGroup;
-
- RefPtr<WebCore::UserContentController> m_userContentController;
+ Ref<WebUserContentController> m_userContentController;
};
} // namespace WebKit
Deleted: trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.messages.in (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.messages.in 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageGroupProxy.messages.in 2016-02-29 00:32:24 UTC (rev 197304)
@@ -1,35 +0,0 @@
-# Copyright (C) 2012 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.
-
-messages -> WebPageGroupProxy {
- AddUserStyleSheet(WebCore::UserStyleSheet userStyleSheet);
- AddUserScript(WebCore::UserScript userScript);
- RemoveAllUserStyleSheets();
- RemoveAllUserScripts();
- RemoveAllUserContent();
-
-#if ENABLE(CONTENT_EXTENSIONS)
- AddUserContentExtension(String name, WebKit::WebCompiledContentExtensionData contentExtension);
- RemoveUserContentExtension(String name);
- RemoveAllUserContentExtensions();
-#endif
-}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (197303 => 197304)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -53,7 +53,6 @@
#include "WebMemorySampler.h"
#include "WebPage.h"
#include "WebPageGroupProxy.h"
-#include "WebPageGroupProxyMessages.h"
#include "WebPlatformStrategies.h"
#include "WebProcessCreationParameters.h"
#include "WebProcessMessages.h"
@@ -591,19 +590,6 @@
return;
}
- if (decoder.messageReceiverName() == Messages::WebPageGroupProxy::messageReceiverName()) {
- uint64_t pageGroupID = decoder.destinationID();
- if (!pageGroupID)
- return;
-
- WebPageGroupProxy* pageGroupProxy = webPageGroup(pageGroupID);
- if (!pageGroupProxy)
- return;
-
- pageGroupProxy->didReceiveMessage(connection, decoder);
- return;
- }
-
if (decoder.messageReceiverName() == Messages::ChildProcess::messageReceiverName()) {
ChildProcess::didReceiveMessage(connection, decoder);
return;
Modified: trunk/Tools/ChangeLog (197303 => 197304)
--- trunk/Tools/ChangeLog 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Tools/ChangeLog 2016-02-29 00:32:24 UTC (rev 197304)
@@ -1,5 +1,15 @@
2016-02-28 Sam Weinig <s...@webkit.org>
+ Reimplement WKPageGroup in terms of WKUserContentController
+ https://bugs.webkit.org/show_bug.cgi?id=154804
+
+ Reviewed by Dan Bernstein.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2/PageGroup.cpp: Added.
+
+2016-02-28 Sam Weinig <s...@webkit.org>
+
Bind _WKUserStyleSheets to WKUserContentWorlds to allow for grouping of user content by associating to a world
https://bugs.webkit.org/show_bug.cgi?id=154798
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (197303 => 197304)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-02-28 22:21:54 UTC (rev 197303)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2016-02-29 00:32:24 UTC (rev 197304)
@@ -99,6 +99,7 @@
7C89D2AC1A69B80D003A5FDE /* WKPageConfiguration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2AA1A69B80D003A5FDE /* WKPageConfiguration.cpp */; };
7C9ED98B17A19F4B00E4DC33 /* attributedStringStrikethrough.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 7C9ED98A17A19D0600E4DC33 /* attributedStringStrikethrough.html */; };
7CB184C61AA3F2100066EDFD /* ContentExtensions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CB184C41AA3F2100066EDFD /* ContentExtensions.cpp */; };
+ 7CCB4DA91C83AE7300CC6918 /* PageGroup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCB4DA71C83AE7300CC6918 /* PageGroup.cpp */; };
7CCE7EA41A4119F300447C4C /* InstanceMethodSwizzler.mm in Sources */ = {isa = PBXBuildFile; fileRef = C08587FF13FEC3A6001EF4E5 /* InstanceMethodSwizzler.mm */; };
7CCE7EA51A411A0800447C4C /* _javascript_TestMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = C081224013FC172400DC39AE /* _javascript_TestMac.mm */; };
7CCE7EA61A411A0F00447C4C /* PlatformUtilitiesMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */; };
@@ -650,6 +651,7 @@
7CB184C41AA3F2100066EDFD /* ContentExtensions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensions.cpp; sourceTree = "<group>"; };
7CBBA07619BB8A9100BBF025 /* OSObjectPtr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = OSObjectPtr.cpp; sourceTree = "<group>"; };
7CC3E1FA197E234100BE6252 /* UserContentController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UserContentController.mm; sourceTree = "<group>"; };
+ 7CCB4DA71C83AE7300CC6918 /* PageGroup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageGroup.cpp; sourceTree = "<group>"; };
7CCE7E8C1A41144E00447C4C /* libTestWebKitAPI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTestWebKitAPI.a; sourceTree = BUILT_PRODUCTS_DIR; };
7CCE7EA31A4115CB00447C4C /* TestWebKitAPILibrary.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = TestWebKitAPILibrary.xcconfig; sourceTree = "<group>"; };
7CEFA9641AC0B9E200B910FD /* _WKUserContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentExtensionStore.mm; sourceTree = "<group>"; };
@@ -1196,6 +1198,7 @@
93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */,
93F7E86B14DC8E4D00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames.cpp */,
93F7E86E14DC8E5B00C84A99 /* NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp */,
+ 7CCB4DA71C83AE7300CC6918 /* PageGroup.cpp */,
BC909779125571AB00083756 /* PageLoadBasic.cpp */,
BC2D004812A9FDFA00E732A3 /* PageLoadDidChangeLocationWithinPageForFrame.cpp */,
52E5CE4514D21E9D003B2BD8 /* ParentFrame.cpp */,
@@ -1763,6 +1766,7 @@
7CCE7F391A411B8E00447C4C /* MD5.cpp in Sources */,
A14FC5901B8AE36F00D107EB /* TestProtocol.mm in Sources */,
7CCE7F3B1A411B8E00447C4C /* MediaTime.cpp in Sources */,
+ 7CCB4DA91C83AE7300CC6918 /* PageGroup.cpp in Sources */,
7CCE7EB21A411A5100447C4C /* MemoryCacheAddImageToCacheIOS.mm in Sources */,
7CCE7EC51A411A7E00447C4C /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */,
7CCE7EC61A411A7E00447C4C /* MemoryCachePruneWithinResourceLoadDelegate.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageGroup.cpp (0 => 197304)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageGroup.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/PageGroup.cpp 2016-02-29 00:32:24 UTC (rev 197304)
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+#import "config.h"
+#import <WebKit/WKFoundation.h>
+
+#if WK_HAVE_C_SPI
+
+#import "PlatformUtilities.h"
+#import "PlatformWebView.h"
+#import "Test.h"
+#import <WebKit/WKPageGroup.h>
+#import <WebKit/WKUserContentControllerRef.h>
+#import <WebKit/WKPageConfigurationRef.h>
+
+namespace TestWebKitAPI {
+
+TEST(PageGroup, DefaultUserContentController)
+{
+ auto pageConfiguration = adoptWK(WKPageConfigurationCreate());
+ auto context = adoptWK(WKContextCreate());
+ WKPageConfigurationSetContext(pageConfiguration.get(), context.get());
+ auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("TestPageGroup").get()));
+ WKPageConfigurationSetPageGroup(pageConfiguration.get(), pageGroup.get());
+
+ auto pageGroupUserContentController = retainWK(WKPageGroupGetUserContentController(pageGroup.get()));
+
+ EXPECT_NULL(WKPageConfigurationGetUserContentController(pageConfiguration.get()));
+
+ PlatformWebView webView(pageConfiguration.get());
+ auto copiedPageConfiguration = adoptWK(WKPageCopyPageConfiguration(webView.page()));
+
+ ASSERT_EQ(pageGroupUserContentController.get(), WKPageConfigurationGetUserContentController(copiedPageConfiguration.get()));
+}
+
+TEST(PageGroup, CustomUserContentController)
+{
+ auto pageConfiguration = adoptWK(WKPageConfigurationCreate());
+ auto context = adoptWK(WKContextCreate());
+ WKPageConfigurationSetContext(pageConfiguration.get(), context.get());
+ auto pageGroup = adoptWK(WKPageGroupCreateWithIdentifier(Util::toWK("TestPageGroup").get()));
+ WKPageConfigurationSetPageGroup(pageConfiguration.get(), pageGroup.get());
+ auto userContentController = adoptWK(WKUserContentControllerCreate());
+ WKPageConfigurationSetUserContentController(pageConfiguration.get(), userContentController.get());
+
+ auto pageGroupUserContentController = retainWK(WKPageGroupGetUserContentController(pageGroup.get()));
+
+ EXPECT_EQ(userContentController.get(), WKPageConfigurationGetUserContentController(pageConfiguration.get()));
+
+ PlatformWebView webView(pageConfiguration.get());
+ auto copiedPageConfiguration = adoptWK(WKPageCopyPageConfiguration(webView.page()));
+
+ EXPECT_EQ(userContentController.get(), WKPageConfigurationGetUserContentController(copiedPageConfiguration.get()));
+}
+
+} // namespace TestWebKitAPI
+
+#endif