Diff
Modified: trunk/Source/WebKit2/ChangeLog (207167 => 207168)
--- trunk/Source/WebKit2/ChangeLog 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/ChangeLog 2016-10-11 22:01:45 UTC (rev 207168)
@@ -1,3 +1,43 @@
+2016-10-11 Anders Carlsson <[email protected]>
+
+ Clean up WebPageGroup somewhat
+ https://bugs.webkit.org/show_bug.cgi?id=163299
+
+ Reviewed by Tim Horton.
+
+ * Shared/API/c/WKDeprecatedFunctions.cpp:
+ (WKPageGroupCopyIdentifier):
+ Move this here from WKPageGroup.
+
+ (WKPageGroupAddUserContentFilter):
+ (WKPageGroupRemoveUserContentFilter):
+ (WKPageGroupRemoveAllUserContentFilters):
+ Just call directly into the user content controller.
+
+ * UIProcess/API/C/WKPageGroup.cpp:
+ (WKPageGroupAddUserStyleSheet):
+ (WKPageGroupRemoveAllUserStyleSheets):
+ (WKPageGroupAddUserScript):
+ (WKPageGroupRemoveAllUserScripts):
+ Just call directly into the user content controller.
+
+ * UIProcess/API/C/WKPageGroup.h:
+ * UIProcess/WebPageGroup.cpp:
+ (WebKit::WebPageGroup::addUserStyleSheet): Deleted.
+ (WebKit::WebPageGroup::addUserScript): Deleted.
+ (WebKit::WebPageGroup::removeAllUserStyleSheets): Deleted.
+ (WebKit::WebPageGroup::removeAllUserScripts): Deleted.
+ (WebKit::WebPageGroup::removeAllUserContent): Deleted.
+ (WebKit::WebPageGroup::addUserContentExtension): Deleted.
+ (WebKit::WebPageGroup::removeUserContentExtension): Deleted.
+ (WebKit::WebPageGroup::removeAllUserContentExtensions): Deleted.
+ Get rid of these, all their callers just call into the user content controller now.
+
+ * UIProcess/WebPageGroup.h:
+ (WebKit::WebPageGroup::identifier): Deleted.
+ (WebKit::WebPageGroup::sendToAllProcessesInGroup): Deleted.
+ Remove unused code.
+
2016-10-11 Daniel Bates <[email protected]>
[iOS] REGRESSION (r197953): User gesture required to load video in iOS 9-built apps
Modified: trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp (207167 => 207168)
--- trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/Shared/API/c/WKDeprecatedFunctions.cpp 2016-10-11 22:01:45 UTC (rev 207168)
@@ -33,6 +33,7 @@
#include "WKMutableDictionary.h"
#include "WKPreferencesRefPrivate.h"
#include "WebPageGroup.h"
+#include "WebUserContentControllerProxy.h"
#if PLATFORM(MAC)
#include "WKContextPrivateMac.h"
@@ -41,6 +42,7 @@
// Deprecated functions that should be removed from the framework once nobody uses them.
extern "C" {
+WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup);
WK_EXPORT void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroup, WKUserContentFilterRef userContentFilter);
WK_EXPORT void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroup, WKStringRef userContentFilterName);
WK_EXPORT void WKPageGroupRemoveAllUserContentFilters(WKPageGroupRef pageGroup);
@@ -56,10 +58,15 @@
{
}
+WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef)
+{
+ return nullptr;
+}
+
void WKPageGroupAddUserContentFilter(WKPageGroupRef pageGroupRef, WKUserContentFilterRef userContentFilterRef)
{
#if ENABLE(CONTENT_EXTENSIONS)
- toImpl(pageGroupRef)->addUserContentExtension(*toImpl(userContentFilterRef));
+ toImpl(pageGroupRef)->userContentController().addUserContentExtension(*toImpl(userContentFilterRef));
#else
UNUSED_PARAM(pageGroupRef);
UNUSED_PARAM(userContentFilterRef);
@@ -69,7 +76,7 @@
void WKPageGroupRemoveUserContentFilter(WKPageGroupRef pageGroupRef, WKStringRef userContentFilterNameRef)
{
#if ENABLE(CONTENT_EXTENSIONS)
- toImpl(pageGroupRef)->removeUserContentExtension(toWTFString(userContentFilterNameRef));
+ toImpl(pageGroupRef)->userContentController().removeUserContentExtension(toWTFString(userContentFilterNameRef));
#else
UNUSED_PARAM(pageGroupRef);
UNUSED_PARAM(userContentFilterNameRef);
@@ -76,11 +83,10 @@
#endif
}
-
void WKPageGroupRemoveAllUserContentFilters(WKPageGroupRef pageGroupRef)
{
#if ENABLE(CONTENT_EXTENSIONS)
- toImpl(pageGroupRef)->removeAllUserContentExtensions();
+ toImpl(pageGroupRef)->userContentController().removeAllUserContentExtensions();
#else
UNUSED_PARAM(pageGroupRef);
#endif
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp (207167 => 207168)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.cpp 2016-10-11 22:01:45 UTC (rev 207168)
@@ -27,6 +27,9 @@
#include "WKPageGroup.h"
#include "APIUserContentExtension.h"
+#include "APIUserContentWorld.h"
+#include "APIUserScript.h"
+#include "APIUserStyleSheet.h"
#include "WKAPICast.h"
#include "WebPageGroup.h"
#include "WebPreferences.h"
@@ -45,11 +48,6 @@
return toAPI(pageGroup.leakRef());
}
-WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroupRef)
-{
- return toCopiedAPI(toImpl(pageGroupRef)->identifier());
-}
-
void WKPageGroupSetPreferences(WKPageGroupRef pageGroupRef, WKPreferencesRef preferencesRef)
{
toImpl(pageGroupRef)->setPreferences(toImpl(preferencesRef));
@@ -65,22 +63,43 @@
return toAPI(&toImpl(pageGroupRef)->userContentController());
}
-void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames)
+void WKPageGroupAddUserStyleSheet(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames)
{
- toImpl(pageGroupRef)->addUserStyleSheet(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel);
+ auto source = toWTFString(sourceRef);
+
+ if (source.isEmpty())
+ return;
+
+ auto baseURLString = toWTFString(baseURLRef);
+ auto whitelist = toImpl(whitelistedURLPatterns);
+ auto blacklist = toImpl(blacklistedURLPatterns);
+
+ Ref<API::UserStyleSheet> userStyleSheet = API::UserStyleSheet::create(WebCore::UserStyleSheet { source, (baseURLString.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserContentInjectedFrames(injectedFrames), WebCore::UserStyleUserLevel }, API::UserContentWorld::normalWorld());
+
+ toImpl(pageGroupRef)->userContentController().addUserStyleSheet(userStyleSheet.get());
}
-void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroupRef)
+void WKPageGroupRemoveAllUserStyleSheets(WKPageGroupRef pageGroup)
{
- toImpl(pageGroupRef)->removeAllUserStyleSheets();
+ toImpl(pageGroup)->userContentController().removeAllUserStyleSheets();
}
-void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURL, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime)
+void WKPageGroupAddUserScript(WKPageGroupRef pageGroupRef, WKStringRef sourceRef, WKURLRef baseURLRef, WKArrayRef whitelistedURLPatterns, WKArrayRef blacklistedURLPatterns, WKUserContentInjectedFrames injectedFrames, _WKUserScriptInjectionTime injectionTime)
{
- toImpl(pageGroupRef)->addUserScript(toWTFString(sourceRef), toWTFString(baseURL), toImpl(whitelistedURLPatterns), toImpl(blacklistedURLPatterns), toUserContentInjectedFrames(injectedFrames), toUserScriptInjectionTime(injectionTime));
+ auto source = toWTFString(sourceRef);
+
+ if (source.isEmpty())
+ return;
+
+ auto baseURLString = toWTFString(baseURLRef);
+ auto whitelist = toImpl(whitelistedURLPatterns);
+ auto blacklist = toImpl(blacklistedURLPatterns);
+
+ Ref<API::UserScript> userScript = API::UserScript::create(WebCore::UserScript { source, (baseURLString.isEmpty() ? WebCore::blankURL() : WebCore::URL(WebCore::URL(), baseURLString)), whitelist ? whitelist->toStringVector() : Vector<String>(), blacklist ? blacklist->toStringVector() : Vector<String>(), toUserScriptInjectionTime(injectionTime), toUserContentInjectedFrames(injectedFrames) }, API::UserContentWorld::normalWorld());
+ toImpl(pageGroupRef)->userContentController().addUserScript(userScript.get());
}
void WKPageGroupRemoveAllUserScripts(WKPageGroupRef pageGroupRef)
{
- toImpl(pageGroupRef)->removeAllUserScripts();
+ toImpl(pageGroupRef)->userContentController().removeAllUserScripts();
}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h (207167 => 207168)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPageGroup.h 2016-10-11 22:01:45 UTC (rev 207168)
@@ -38,8 +38,6 @@
WK_EXPORT WKPageGroupRef WKPageGroupCreateWithIdentifier(WKStringRef identifier);
-WK_EXPORT WKStringRef WKPageGroupCopyIdentifier(WKPageGroupRef pageGroup);
-
WK_EXPORT void WKPageGroupSetPreferences(WKPageGroupRef pageGroup, WKPreferencesRef preferences);
WK_EXPORT WKPreferencesRef WKPageGroupGetPreferences(WKPageGroupRef pageGroup);
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp (207167 => 207168)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.cpp 2016-10-11 22:01:45 UTC (rev 207168)
@@ -142,55 +142,4 @@
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;
-
- 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)
-{
- if (source.isEmpty())
- return;
-
- 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_userContentController->removeAllUserStyleSheets();
-}
-
-void WebPageGroup::removeAllUserScripts()
-{
- m_userContentController->removeAllUserScripts();
-}
-
-void WebPageGroup::removeAllUserContent()
-{
- m_userContentController->removeAllUserStyleSheets();
- m_userContentController->removeAllUserScripts();
-}
-
-#if ENABLE(CONTENT_EXTENSIONS)
-void WebPageGroup::addUserContentExtension(API::UserContentExtension& userContentExtension)
-{
- m_userContentController->addUserContentExtension(userContentExtension);
-}
-
-void WebPageGroup::removeUserContentExtension(const String& contentExtensionName)
-{
- m_userContentController->removeUserContentExtension(contentExtensionName);
-}
-
-void WebPageGroup::removeAllUserContentExtensions()
-{
- m_userContentController->removeAllUserContentExtensions();
-}
-#endif
-
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageGroup.h (207167 => 207168)
--- trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2016-10-11 21:58:20 UTC (rev 207167)
+++ trunk/Source/WebKit2/UIProcess/WebPageGroup.h 2016-10-11 22:01:45 UTC (rev 207168)
@@ -53,7 +53,6 @@
void addPage(WebPageProxy*);
void removePage(WebPageProxy*);
- const String& identifier() const { return m_data.identifier; }
uint64_t pageGroupID() const { return m_data.pageGroupID; }
const WebPageGroupData& data() const { return m_data; }
@@ -64,21 +63,7 @@
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();
- void removeAllUserScripts();
- void removeAllUserContent();
-
-#if ENABLE(CONTENT_EXTENSIONS)
- void addUserContentExtension(API::UserContentExtension&);
- void removeUserContentExtension(const String&);
- void removeAllUserContentExtensions();
-#endif
-
private:
- template<typename T> void sendToAllProcessesInGroup(const T&, uint64_t destinationID);
-
WebPageGroupData m_data;
RefPtr<WebPreferences> m_preferences;
RefPtr<WebUserContentControllerProxy> m_userContentController;
@@ -85,21 +70,6 @@
HashSet<WebPageProxy*> m_pages;
};
-template<typename T>
-void WebPageGroup::sendToAllProcessesInGroup(const T& message, uint64_t destinationID)
-{
- HashSet<WebProcessProxy*> processesSeen;
-
- for (WebPageProxy* webPageProxy : m_pages) {
- WebProcessProxy& webProcessProxy = webPageProxy->process();
- if (!processesSeen.add(&webProcessProxy).isNewEntry)
- continue;
-
- if (webProcessProxy.canSendMessage())
- webProcessProxy.send(T(message), destinationID);
- }
-}
-
} // namespace WebKit
#endif // WebPageGroup_h