Diff
Modified: trunk/Source/WebCore/ChangeLog (178633 => 178634)
--- trunk/Source/WebCore/ChangeLog 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/ChangeLog 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1,3 +1,48 @@
+2015-01-17 Sam Weinig <[email protected]>
+
+ Add initial experimental user content filtering API
+ https://bugs.webkit.org/show_bug.cgi?id=140584
+
+ Reviewed by Benjamin Poulain.
+
+ Change content extensions to be managed through the UserContentController.
+
+ * WebCore.exp.in:
+ Update exports.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Update for removed files.
+
+ * contentextensions/ContentExtensionsBackend.cpp:
+ (WebCore::ContentExtensions::ContentExtensionsBackend::removeAllRuleLists):
+ (WebCore::ContentExtensions::ContentExtensionsBackend::sharedInstance): Deleted.
+ * contentextensions/ContentExtensionsBackend.h:
+ Remove concept of a shared instance and add a removeAllRuleLists() function.
+
+ * contentextensions/ContentExtensionsInterface.cpp: Removed.
+ * contentextensions/ContentExtensionsInterface.h: Removed.
+ Since there is no shared instance anymore, checking if a URL should be blocked
+ now has to go directly to the backend.
+
+ * contentextensions/ContentExtensionsManager.cpp:
+ (WebCore::ContentExtensions::ExtensionsManager::createRuleList):
+ (WebCore::ContentExtensions::ExtensionsManager::loadExtension): Deleted.
+ * contentextensions/ContentExtensionsManager.h:
+ Update interface to accommodate the lack of a shared instance. Now, all this
+ file does is take a serialized rule list and outputs the Vector of ContentExtensionRules
+
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestResource):
+ Check with the UserContentController to see if the URL should be blocked.
+
+ * page/UserContentController.cpp:
+ (WebCore::UserContentController::addUserContentFilter):
+ (WebCore::UserContentController::removeAllUserContentFilters):
+ (WebCore::UserContentController::contentFilterBlocksURL):
+ * page/UserContentController.h:
+ Add single point of interaction for both the WebKit level to add and remove
+ content filters and WebCore to check to see if URLs should be blocked.
+
2015-01-18 Darin Adler <[email protected]>
REGRESSION (r125251): wrapper lifetimes of SVGElementInstance are incorrect
Modified: trunk/Source/WebCore/WebCore.exp.in (178633 => 178634)
--- trunk/Source/WebCore/WebCore.exp.in 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/WebCore.exp.in 2015-01-18 21:54:12 UTC (rev 178634)
@@ -3011,7 +3011,8 @@
#endif
#if ENABLE(CONTENT_EXTENSIONS)
-__ZN7WebCore17ContentExtensions17ExtensionsManager13loadExtensionERKN3WTF6StringES5_
+__ZN7WebCore21UserContentController20addUserContentFilterERKN3WTF6StringES4_
+__ZN7WebCore21UserContentController27removeAllUserContentFiltersEv
#endif
#if ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (178633 => 178634)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1045,8 +1045,6 @@
26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */; settings = {ATTRIBUTES = (Private, ); }; };
26C17A3F1491D2D400D12BA2 /* FileSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */; };
26E98A10130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h in Headers */ = {isa = PBXBuildFile; fileRef = 26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */; };
- 26F0C8921A2D79CB002794F8 /* ContentExtensionsInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */; };
- 26F0C8941A2D7A76002794F8 /* ContentExtensionsInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */; };
26F0C8971A2E724B002794F8 /* ContentExtensionsManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */; };
26F0C8981A2E724B002794F8 /* ContentExtensionsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
26F0C89B1A2EC110002794F8 /* ContentExtensionRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */; };
@@ -8049,8 +8047,6 @@
26C17A3C1491D2D400D12BA2 /* FileSystemIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileSystemIOS.h; path = ios/FileSystemIOS.h; sourceTree = "<group>"; };
26C17A3D1491D2D400D12BA2 /* FileSystemIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FileSystemIOS.mm; path = ios/FileSystemIOS.mm; sourceTree = "<group>"; };
26E98A0F130A9FCA008EB7B2 /* TextCodecASCIIFastPath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecASCIIFastPath.h; sourceTree = "<group>"; };
- 26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionsInterface.h; sourceTree = "<group>"; };
- 26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsInterface.cpp; sourceTree = "<group>"; };
26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionsManager.cpp; sourceTree = "<group>"; };
26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionsManager.h; sourceTree = "<group>"; };
26F0C8991A2EC110002794F8 /* ContentExtensionRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentExtensionRule.cpp; sourceTree = "<group>"; };
@@ -9720,8 +9716,8 @@
839AAFEA1A0C0C8D00605F99 /* HTMLWBRElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLWBRElement.cpp; sourceTree = "<group>"; };
839AAFEB1A0C0C8D00605F99 /* HTMLWBRElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLWBRElement.h; sourceTree = "<group>"; };
83B9687919F8AB83004EF7AF /* StyleBuilderConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleBuilderConverter.h; sourceTree = "<group>"; };
- 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; name = StylePropertyShorthandFunctions.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
- 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; name = StylePropertyShorthandFunctions.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
+ 83C05A581A686212007E5DEA /* StylePropertyShorthandFunctions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StylePropertyShorthandFunctions.cpp; sourceTree = "<group>"; };
+ 83C05A591A686212007E5DEA /* StylePropertyShorthandFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StylePropertyShorthandFunctions.h; sourceTree = "<group>"; };
83C1D413178D5AB400141E68 /* SVGPathSegArcAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcAbs.h; sourceTree = "<group>"; };
83C1D414178D5AB400141E68 /* SVGPathSegArcRel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegArcRel.h; sourceTree = "<group>"; };
83C1D415178D5AB400141E68 /* SVGPathSegCurvetoCubicAbs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGPathSegCurvetoCubicAbs.h; sourceTree = "<group>"; };
@@ -15328,8 +15324,6 @@
26F0C89D1A2EC3BE002794F8 /* ContentExtensionsBackend.cpp */,
26F0C89E1A2EC3BE002794F8 /* ContentExtensionsBackend.h */,
262391351A648CEE007251A3 /* ContentExtensionsDebugging.h */,
- 26F0C8931A2D7A76002794F8 /* ContentExtensionsInterface.cpp */,
- 26F0C8911A2D79CB002794F8 /* ContentExtensionsInterface.h */,
26F0C8951A2E724B002794F8 /* ContentExtensionsManager.cpp */,
26F0C8961A2E724B002794F8 /* ContentExtensionsManager.h */,
267725F61A5B3AD9003C24DD /* DFA.cpp */,
@@ -26283,7 +26277,6 @@
8419D2AD120D92FC00141F8F /* SVGPathByteStreamSource.h in Headers */,
8476C9EC11DF6A2900555B02 /* SVGPathConsumer.h in Headers */,
71537A01146BD9D7008BD615 /* SVGPathData.h in Headers */,
- 26F0C8921A2D79CB002794F8 /* ContentExtensionsInterface.h in Headers */,
B2227A590D00BF220071B782 /* SVGPathElement.h in Headers */,
8476C9F011DF6A5800555B02 /* SVGPathParser.h in Headers */,
B2227A5B0D00BF220071B782 /* SVGPathSeg.h in Headers */,
@@ -27471,7 +27464,6 @@
93309DDE099E64920056E581 /* DeleteFromTextNodeCommand.cpp in Sources */,
93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
- 26F0C8941A2D7A76002794F8 /* ContentExtensionsInterface.cpp in Sources */,
CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */,
31EAF97F121435A400E7C1BF /* DeviceMotionClientIOS.mm in Sources */,
31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -42,12 +42,6 @@
namespace ContentExtensions {
-ContentExtensionsBackend& ContentExtensionsBackend::sharedInstance()
-{
- static NeverDestroyed<ContentExtensionsBackend> instance;
- return instance;
-}
-
void ContentExtensionsBackend::setRuleList(const String& identifier, const Vector<ContentExtensionRule>& ruleList)
{
ASSERT(!identifier.isEmpty());
@@ -112,6 +106,11 @@
m_ruleLists.remove(identifier);
}
+void ContentExtensionsBackend::removeAllRuleLists()
+{
+ m_ruleLists.clear();
+}
+
bool ContentExtensionsBackend::shouldBlockURL(const URL& url)
{
const String& urlString = url.string();
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsBackend.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -47,15 +47,13 @@
// 2) It provides APIs for the WebCore interfaces to use those rules efficiently.
class ContentExtensionsBackend {
public:
- static ContentExtensionsBackend& sharedInstance();
-
// - Rule management interface. This can be used by upper layer.
// Set a list of rules for a given name. If there were existing rules for the name, they are overriden.
// The identifier cannot be empty.
void setRuleList(const String& identifier, const Vector<ContentExtensionRule>&);
-
void removeRuleList(const String& identifier);
+ void removeAllRuleLists();
// - Internal WebCore Interface.
bool shouldBlockURL(const URL&);
Deleted: trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "ContentExtensionsInterface.h"
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-#include "ContentExtensionsBackend.h"
-
-namespace WebCore {
-namespace ContentExtensions {
-
-bool shouldBlockURL(const URL& url)
-{
- return ContentExtensionsBackend::sharedInstance().shouldBlockURL(url);
-}
-
-} // namespace ContentExtensions
-} // namespace WebCore
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
Deleted: trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsInterface.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef ContentExtensionsInterface_h
-#define ContentExtensionsInterface_h
-
-#if ENABLE(CONTENT_EXTENSIONS)
-
-namespace WebCore {
-
-class URL;
-
-// This defines the interface by which WebCore interact with Content Extensions.
-namespace ContentExtensions {
-bool shouldBlockURL(const URL&);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(CONTENT_EXTENSIONS)
-
-#endif // ContentExtensionsInterface_h
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -158,7 +158,7 @@
return Vector<ContentExtensionRule>();
}
-void loadExtension(const String& identifier, const String& rules)
+Vector<ContentExtensionRule> createRuleList(const String& rules)
{
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
double loadExtensionStartTime = monotonicallyIncreasingTime();
@@ -173,17 +173,15 @@
vm.clear();
- if (ruleList.isEmpty()) {
+ if (ruleList.isEmpty())
WTFLogAlways("Empty extension.");
- return;
- }
#if CONTENT_EXTENSIONS_PERFORMANCE_REPORTING
double loadExtensionEndTime = monotonicallyIncreasingTime();
dataLogF("Time spent loading extension %s: %f\n", identifier.utf8().data(), (loadExtensionEndTime - loadExtensionStartTime));
#endif
- ContentExtensionsBackend::sharedInstance().setRuleList(identifier, ruleList);
+ return ruleList;
}
} // namespace ExtensionsManager
Modified: trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h (178633 => 178634)
--- trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionsManager.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -29,15 +29,18 @@
#if ENABLE(CONTENT_EXTENSIONS)
#include <wtf/Forward.h>
+#include <wtf/Vector.h>
namespace WebCore {
namespace ContentExtensions {
+class ContentExtensionRule;
+
// The ExtensionsManager loads serialized content extension rules directly into WebCore.
namespace ExtensionsManager {
-void loadExtension(const String& identifier, const String& rules);
+Vector<ContentExtensionRule> createRuleList(const String& rules);
} // namespace ExtensionsManager
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (178633 => 178634)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -60,13 +60,10 @@
#include "SecurityOrigin.h"
#include "SessionID.h"
#include "Settings.h"
+#include "UserContentController.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
-#if ENABLE(CONTENT_EXTENSIONS)
-#include "ContentExtensionsInterface.h"
-#endif
-
#if ENABLE(VIDEO_TRACK)
#include "CachedTextTrack.h"
#endif
@@ -458,7 +455,7 @@
return 0;
#if ENABLE(CONTENT_EXTENSIONS)
- if (ContentExtensions::shouldBlockURL(url))
+ if (frame() && frame()->page() && frame()->page()->userContentController() && frame()->page()->userContentController()->contentFilterBlocksURL(url))
return nullptr;
#endif
Modified: trunk/Source/WebCore/page/UserContentController.cpp (178633 => 178634)
--- trunk/Source/WebCore/page/UserContentController.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/page/UserContentController.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -37,6 +37,11 @@
#include "UserMessageHandlerDescriptor.h"
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+#include "ContentExtensionsBackend.h"
+#include "ContentExtensionsManager.h"
+#endif
+
namespace WebCore {
RefPtr<UserContentController> UserContentController::create()
@@ -173,6 +178,33 @@
}
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+void UserContentController::addUserContentFilter(const String& name, const String& ruleList)
+{
+ if (!m_contentExtensionBackend)
+ m_contentExtensionBackend = std::make_unique<ContentExtensions::ContentExtensionsBackend>();
+
+ m_contentExtensionBackend->setRuleList(name, ContentExtensions::ExtensionsManager::createRuleList(ruleList));
+}
+
+void UserContentController::removeAllUserContentFilters()
+{
+ if (!m_contentExtensionBackend)
+ return;
+
+ m_contentExtensionBackend->removeAllRuleLists();
+}
+
+bool UserContentController::contentFilterBlocksURL(const URL& url)
+{
+ if (!m_contentExtensionBackend)
+ return false;
+
+ return m_contentExtensionBackend->shouldBlockURL(url);
+}
+
+#endif
+
void UserContentController::removeAllUserContent()
{
m_userScripts = nullptr;
Modified: trunk/Source/WebCore/page/UserContentController.h (178633 => 178634)
--- trunk/Source/WebCore/page/UserContentController.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebCore/page/UserContentController.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -45,6 +45,10 @@
class UserStyleSheet;
class UserMessageHandlerDescriptor;
+namespace ContentExtensions {
+class ContentExtensionsBackend;
+}
+
class UserContentController : public RefCounted<UserContentController> {
public:
WEBCORE_EXPORT static RefPtr<UserContentController> create();
@@ -74,6 +78,15 @@
WEBCORE_EXPORT void removeUserMessageHandlerDescriptor(UserMessageHandlerDescriptor&);
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+ // FIXME: This should really take a pointer to a compiled UserContentFilter.
+ WEBCORE_EXPORT void addUserContentFilter(const String& name, const String& ruleList);
+ WEBCORE_EXPORT void removeAllUserContentFilters();
+
+ // FIXME: Consider putting this (and other future content filter predicates) in its own class.
+ bool contentFilterBlocksURL(const URL&);
+#endif
+
private:
UserContentController();
@@ -86,6 +99,9 @@
#if ENABLE(USER_MESSAGE_HANDLERS)
std::unique_ptr<UserMessageHandlerDescriptorMap> m_userMessageHandlerDescriptors;
#endif
+#if ENABLE(CONTENT_EXTENSIONS)
+ std::unique_ptr<ContentExtensions::ContentExtensionsBackend> m_contentExtensionBackend;
+#endif
};
} // namespace WebCore
Modified: trunk/Source/WebKit2/CMakeLists.txt (178633 => 178634)
--- trunk/Source/WebKit2/CMakeLists.txt 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/CMakeLists.txt 2015-01-18 21:54:12 UTC (rev 178634)
@@ -366,6 +366,7 @@
UIProcess/API/APINavigation.cpp
UIProcess/API/APISessionState.cpp
UIProcess/API/APIWebsiteDataStore.cpp
+ UIProcess/API/APIUserContentFilter.cpp
UIProcess/API/C/WKApplicationCacheManager.cpp
UIProcess/API/C/WKAuthenticationChallenge.cpp
Modified: trunk/Source/WebKit2/ChangeLog (178633 => 178634)
--- trunk/Source/WebKit2/ChangeLog 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/ChangeLog 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1,3 +1,73 @@
+2015-01-17 Sam Weinig <[email protected]>
+
+ Add initial experimental user content filtering API
+ https://bugs.webkit.org/show_bug.cgi?id=140584
+
+ Reviewed by Benjamin Poulain.
+
+ Moves content filtering from being per-ProcessPool to per-UserContentController.
+
+ * Shared/API/APIObject.h:
+ * Shared/API/c/WKBase.h:
+ * UIProcess/API/APIUserContentFilter.cpp: Added.
+ (API::UserContentFilter::UserContentFilter):
+ (API::UserContentFilter::~UserContentFilter):
+ * UIProcess/API/APIUserContentFilter.h: Added.
+ * UIProcess/API/C/WKAPICast.h:
+ * UIProcess/API/C/WKUserContentFilterRef.cpp: Added.
+ (WKUserContentFilterGetTypeID):
+ (WKUserContentFilterCreate):
+ * UIProcess/API/C/WKUserContentFilterRef.h: Added.
+ * UIProcess/API/C/WebKit2_C.h:
+ * UIProcess/API/Cocoa/_WKUserContentFilter.h: Added.
+ * UIProcess/API/Cocoa/_WKUserContentFilter.mm: Added.
+ (WKUserContentControllerAddUserContentFilter):
+ (WKUserContentControllerRemoveAllUserContentFilters):
+ (-[_WKUserContentFilter _initWithName:ruleList:]):
+ * UIProcess/API/Cocoa/_WKUserContentFilterInternal.h: Added.
+ Add a basic UserContentFilter type and expose it via both the Objective-C API (as _WKUserContentFilter)
+ and via the C SPI (as WKUserContentFilterRef).
+
+ * UIProcess/API/C/WKUserContentControllerRef.h:
+ * UIProcess/API/C/WKUserContentControllerRef.cpp:
+ Add C-SPI to set and remove WKUserContentFilterRefs.
+
+ * UIProcess/API/Cocoa/WKProcessPool.mm:
+ (-[WKProcessPool _loadContentExtensionWithIdentifier:serializedRules:successCompletionHandler:errorCompletionHandler:]): Deleted.
+ * UIProcess/API/Cocoa/WKProcessPoolPrivate.h:
+ * UIProcess/WebProcessPool.cpp:
+ (WebKit::WebProcessPool::processDidFinishLaunching):
+ (WebKit::WebProcessPool::loadContentExtension): Deleted.
+ * UIProcess/WebProcessPool.h:
+ * WebProcess/WebProcess.cpp:
+ (WebKit::WebProcess::loadContentExtension): Deleted.
+ * WebProcess/WebProcess.h:
+ * WebProcess/WebProcess.messages.in:
+ Remove the old SPI for loading content filters that was per-ProcessPool. Content filters now follow
+ the same pattern as UserScripts and UserStyleSheets as being per-UserContentController.
+
+ * UIProcess/API/Cocoa/WKUserContentController.mm:
+ (-[WKUserContentController _addUserContentFilter:]):
+ (-[WKUserContentController _removeAllUserContentFilters]):
+ * UIProcess/API/Cocoa/WKUserContentControllerInternal.h:
+ * UIProcess/API/Cocoa/WKUserContentControllerPrivate.h: Added.
+ * UIProcess/UserContent/WebUserContentControllerProxy.cpp:
+ (WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
+ (WebKit::WebUserContentControllerProxy::addProcess):
+ (WebKit::WebUserContentControllerProxy::addUserContentFilter):
+ (WebKit::WebUserContentControllerProxy::removeAllUserContentFilters):
+ * UIProcess/UserContent/WebUserContentControllerProxy.h:
+ * WebProcess/UserContent/WebUserContentController.cpp:
+ (WebKit::WebUserContentController::addUserContentFilters):
+ (WebKit::WebUserContentController::removeAllUserContentFilters):
+ * WebProcess/UserContent/WebUserContentController.h:
+ * WebProcess/UserContent/WebUserContentController.messages.in:
+ Pipe user content filters over to all the WebProcesses that the UserContentController is
+ connected to.
+
+ * WebKit2.xcodeproj/project.pbxproj:
+ Add new files.
+
2015-01-17 Chris Dumez <[email protected]>
[WK2][iOS] Add Cocoa delegate for logging diagnostic messages
Modified: trunk/Source/WebKit2/Shared/API/APIObject.h (178633 => 178634)
--- trunk/Source/WebKit2/Shared/API/APIObject.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/Shared/API/APIObject.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -81,6 +81,7 @@
URLRequest,
URLResponse,
UserContentURLPattern,
+ UserContentFilter,
UserScript,
WebArchive,
WebArchiveResource,
Modified: trunk/Source/WebKit2/Shared/API/c/WKBase.h (178633 => 178634)
--- trunk/Source/WebKit2/Shared/API/c/WKBase.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/Shared/API/c/WKBase.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -129,6 +129,7 @@
typedef const struct OpaqueWKSession* WKSessionRef;
typedef const struct OpaqueWKSessionState* WKSessionStateRef;
typedef const struct OpaqueWKUserContentController* WKUserContentControllerRef;
+typedef const struct OpaqueWKUserContentFilter* WKUserContentFilterRef;
typedef const struct OpaqueWKUserMediaPermissionRequest* WKUserMediaPermissionRequestRef;
typedef const struct OpaqueWKUserScript* WKUserScriptRef;
typedef const struct OpaqueWKVibration* WKVibrationRef;
Added: trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.cpp (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "APIUserContentFilter.h"
+
+namespace API {
+
+UserContentFilter::UserContentFilter(const WTF::String& name, const WTF::String& serializedRules)
+ : m_name(name)
+ , m_serializedRules(serializedRules)
+{
+}
+
+UserContentFilter::~UserContentFilter()
+{
+}
+
+} // namespace API
Added: trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.h (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIUserContentFilter.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APIUserContentFilter_h
+#define APIUserContentFilter_h
+
+#include "APIObject.h"
+#include <wtf/text/WTFString.h>
+
+namespace API {
+
+class UserContentFilter final : public ObjectImpl<Object::Type::UserContentFilter> {
+public:
+ static Ref<UserContentFilter> create(const WTF::String& name, const WTF::String& serializedRules)
+ {
+ return adoptRef(*new UserContentFilter(name, serializedRules));
+ }
+
+ UserContentFilter(const WTF::String& name, const WTF::String& serializedRules);
+ ~UserContentFilter();
+
+ const WTF::String& name() const { return m_name; }
+ const WTF::String& serializedRules() const { return m_serializedRules; }
+
+private:
+ WTF::String m_name;
+ WTF::String m_serializedRules;
+};
+
+} // namespace API
+
+#endif // APIUserContentFilter_h
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKAPICast.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -55,6 +55,7 @@
class PageConfiguration;
class ProcessPoolConfiguration;
class SessionState;
+class UserContentFilter;
class UserScript;
}
@@ -152,6 +153,7 @@
WK_ADD_API_MAPPING(WKSessionStateRef, API::SessionState)
WK_ADD_API_MAPPING(WKTextCheckerRef, WebTextChecker)
WK_ADD_API_MAPPING(WKUserContentControllerRef, WebUserContentControllerProxy)
+WK_ADD_API_MAPPING(WKUserContentFilterRef, API::UserContentFilter)
WK_ADD_API_MAPPING(WKUserMediaPermissionRequestRef, UserMediaPermissionRequestProxy)
WK_ADD_API_MAPPING(WKUserScriptRef, API::UserScript)
WK_ADD_API_MAPPING(WKVibrationRef, WebVibrationProxy)
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -56,3 +56,17 @@
{
toImpl(userContentControllerRef)->removeAllUserScripts();
}
+
+void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentControllerRef, WKUserContentFilterRef userContentFilterRef)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ toImpl(userContentControllerRef)->addUserContentFilter(*toImpl(userContentFilterRef));
+#endif
+}
+
+void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentControllerRef)
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ toImpl(userContentControllerRef)->removeAllUserContentFilters();
+#endif
+}
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentControllerRef.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -40,6 +40,8 @@
WK_EXPORT void WKUserContentControllerAddUserScript(WKUserContentControllerRef userContentController, WKUserScriptRef userScript);
WK_EXPORT void WKUserContentControllerRemoveAllUserScripts(WKUserContentControllerRef userContentController);
+WK_EXPORT void WKUserContentControllerAddUserContentFilter(WKUserContentControllerRef userContentController, WKUserContentFilterRef userContentFilter);
+WK_EXPORT void WKUserContentControllerRemoveAllUserContentFilters(WKUserContentControllerRef userContentController);
#ifdef __cplusplus
}
Added: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.cpp (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WKUserContentFilterRef.h"
+
+#include "APIUserContentFilter.h"
+#include "WKAPICast.h"
+
+using namespace WebKit;
+
+WKTypeID WKUserContentFilterGetTypeID()
+{
+ return toAPI(API::UserContentFilter::APIType);
+}
+
+WKUserContentFilterRef WKUserContentFilterCreate(WKStringRef nameRef, WKStringRef serializedRulesRef)
+{
+ return toAPI(&API::UserContentFilter::create(toWTFString(nameRef), toWTFString(serializedRulesRef)).leakRef());
+}
Added: trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.h (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKUserContentFilterRef.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WKUserContentFilterRef_h
+#define WKUserContentFilterRef_h
+
+#include <WebKit/WKBase.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+WK_EXPORT WKTypeID WKUserContentFilterGetTypeID();
+
+WK_EXPORT WKUserContentFilterRef WKUserContentFilterCreate(WKStringRef name, WKStringRef serializedRules);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WKUserContentFilterRef_h */
Modified: trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/C/WebKit2_C.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -59,6 +59,7 @@
#include <WebKit/WKURLRequest.h>
#include <WebKit/WKURLResponse.h>
#include <WebKit/WKUserContentControllerRef.h>
+#include <WebKit/WKUserContentFilterRef.h>
#include <WebKit/WKUserMediaPermissionRequest.h>
#include <WebKit/WKUserScriptRef.h>
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm 2015-01-18 21:54:12 UTC (rev 178634)
@@ -247,20 +247,6 @@
_processPool->sendToAllProcesses(Messages::WebProcess::SetInjectedBundleParameter(parameter, IPC::DataReference(static_cast<const uint8_t*>([data bytes]), [data length])));
}
-- (void)_loadContentExtensionWithIdentifier:(NSString *)identifier serializedRules:(NSString *)serializedRules successCompletionHandler:(void (^)(NSDictionary *info))successCompletionHandler errorCompletionHandler:(void (^)(NSError *error))errorCompletionHandler
-{
-#if ENABLE(CONTENT_EXTENSIONS)
- // For this experimentation, the ContentExtensions are handled by each WebProcess.
- // Eventually the ContentExtension will have to be handled separately from the WebProcesses and we'll be able
- // to provide meaningful completion handlers.
- UNUSED_PARAM(errorCompletionHandler);
-
- _processPool->loadContentExtension(identifier, serializedRules);
-
- successCompletionHandler(nil);
-#endif
-}
-
- (id <_WKDownloadDelegate>)_downloadDelegate
{
return _downloadDelegate.getAutoreleased();
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -43,9 +43,6 @@
- (id)_objectForBundleParameter:(NSString *)parameter;
- (void)_setObject:(id <NSCopying, NSSecureCoding>)object forBundleParameter:(NSString *)parameter;
-// FIXME: move the API to a better place.
-- (void)_loadContentExtensionWithIdentifier:(NSString *)identifier serializedRules:(NSString *)serializedRules successCompletionHandler:(void (^)(NSDictionary *info))successCompletionHandler errorCompletionHandler:(void (^)(NSError *error))errorCompletionHandler WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
-
@property (nonatomic, weak, setter=_setDownloadDelegate:) id <_WKDownloadDelegate> _downloadDelegate;
+ (NSURL *)_websiteDataURLForContainerWithURL:(NSURL *)containerURL;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentController.mm 2015-01-18 21:54:12 UTC (rev 178634)
@@ -36,6 +36,7 @@
#import "WKWebViewInternal.h"
#import "WebScriptMessageHandler.h"
#import "WebUserContentControllerProxy.h"
+#import "_WKUserContentFilterInternal.h"
#import <_javascript_Core/JSContext.h>
#import <_javascript_Core/JSValue.h>
#import <WebCore/SerializedScriptValue.h>
@@ -124,5 +125,23 @@
@end
+@implementation WKUserContentController (WKPrivate)
+
+- (void)_addUserContentFilter:(_WKUserContentFilter *)userContentFilter
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ _userContentControllerProxy->addUserContentFilter(*userContentFilter->_userContentFilter);
#endif
+}
+- (void)_removeAllUserContentFilters
+{
+#if ENABLE(CONTENT_EXTENSIONS)
+ _userContentControllerProxy->removeAllUserContentFilters();
+#endif
+}
+
+@end
+
+#endif
+
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerInternal.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -23,7 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#import "WKUserContentController.h"
+#import "WKUserContentControllerPrivate.h"
#if WK_API_ENABLED
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUserContentControllerPrivate.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKUserContentController.h>
+
+#if WK_API_ENABLED
+
+@class _WKUserContentFilter;
+
+@interface WKUserContentController (WKPrivate)
+
+- (void)_addUserContentFilter:(_WKUserContentFilter *)userContentFilter;
+- (void)_removeAllUserContentFilters;
+
+@end
+
+#endif
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.h (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+WK_CLASS_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA)
+@interface _WKUserContentFilter : NSObject
+
+- (instancetype)_initWithName:(NSString *)name serializedRules:(NSString *)serializedRules;
+
+@end
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilter.mm 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "_WKUserContentFilterInternal.h"
+
+#if WK_API_ENABLED
+
+@implementation _WKUserContentFilter
+
+- (instancetype)_initWithName:(NSString *)name serializedRules:(NSString *)serializedRules
+{
+ if (!(self = [super init]))
+ return nil;
+
+ API::Object::constructInWrapper<API::UserContentFilter>(self, String(name), String(serializedRules));
+
+ return self;
+}
+
+- (void)dealloc
+{
+ _userContentFilter->~UserContentFilter();
+
+ [super dealloc];
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+ return *_userContentFilter;
+}
+
+@end
+
+#endif // WK_API_ENABLED
Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h (0 => 178634)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKUserContentFilterInternal.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "_WKUserContentFilter.h"
+
+#if WK_API_ENABLED
+
+#import "APIUserContentFilter.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+inline _WKUserContentFilter *wrapper(API::UserContentFilter& userContentFilter)
+{
+ ASSERT([userContentFilter.wrapper() isKindOfClass:[_WKUserContentFilter class]]);
+ return (_WKUserContentFilter *)userContentFilter.wrapper();
+}
+
+}
+
+@interface _WKUserContentFilter () <WKObject> {
+@package
+ API::ObjectStorage<API::UserContentFilter> _userContentFilter;
+}
+@end
+
+#endif // WK_API_ENABLED
Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -35,6 +35,10 @@
#include "WebUserContentControllerProxyMessages.h"
#include <WebCore/SerializedScriptValue.h>
+#if ENABLE(CONTENT_EXTENSIONS)
+#include "APIUserContentFilter.h"
+#endif
+
namespace WebKit {
static uint64_t generateIdentifier()
@@ -47,6 +51,9 @@
WebUserContentControllerProxy::WebUserContentControllerProxy()
: m_identifier(generateIdentifier())
, m_userScripts(*API::Array::create())
+#if ENABLE(CONTENT_EXTENSIONS)
+ , m_userContentFilters(*API::Array::create())
+#endif
{
}
@@ -76,6 +83,13 @@
for (auto& handler : m_scriptMessageHandlers.values())
messageHandlerHandles.append(handler->handle());
webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserScriptMessageHandlers(messageHandlerHandles), m_identifier);
+
+#if ENABLE(CONTENT_EXTENSIONS)
+ Vector<std::pair<String, String>> userContentFilters;
+ for (const auto& userContentFilter : m_userContentFilters->elementsOfType<API::UserContentFilter>())
+ userContentFilters.append(std::make_pair(userContentFilter->name(), userContentFilter->serializedRules()));
+ webProcessProxy.connection()->send(Messages::WebUserContentController::AddUserContentFilters(userContentFilters), m_identifier);
+#endif
}
void WebUserContentControllerProxy::removeProcess(WebProcessProxy& webProcessProxy)
@@ -169,4 +183,25 @@
handler->client().didPostMessage(*page, *frame, *value);
}
+
+#if ENABLE(CONTENT_EXTENSIONS)
+void WebUserContentControllerProxy::addUserContentFilter(API::UserContentFilter& userContentFilter)
+{
+ m_userContentFilters->elements().append(&userContentFilter);
+
+ auto pair = std::make_pair(userContentFilter.name(), userContentFilter.serializedRules());
+
+ for (WebProcessProxy* process : m_processes)
+ process->connection()->send(Messages::WebUserContentController::AddUserContentFilters({ pair }), m_identifier);
+}
+
+void WebUserContentControllerProxy::removeAllUserContentFilters()
+{
+ m_userContentFilters->elements().clear();
+
+ for (WebProcessProxy* process : m_processes)
+ process->connection()->send(Messages::WebUserContentController::RemoveAllUserContentFilters(), m_identifier);
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/UserContent/WebUserContentControllerProxy.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -38,6 +38,7 @@
namespace API {
class Array;
+class UserContentFilter;
class UserScript;
}
@@ -80,6 +81,11 @@
bool addUserScriptMessageHandler(WebScriptMessageHandler*);
void removeUserMessageHandlerForName(const String&);
+#if ENABLE(CONTENT_EXTENSIONS)
+ void addUserContentFilter(API::UserContentFilter&);
+ void removeAllUserContentFilters();
+#endif
+
private:
// IPC::MessageReceiver.
virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
@@ -91,6 +97,10 @@
Ref<API::Array> m_userScripts;
Vector<WebCore::UserStyleSheet> m_userStyleSheets;
HashMap<uint64_t, RefPtr<WebScriptMessageHandler>> m_scriptMessageHandlers;
+
+#if ENABLE(CONTENT_EXTENSIONS)
+ Ref<API::Array> m_userContentFilters;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -799,11 +799,6 @@
process->send(Messages::WebProcess::StartMemorySampler(sampleLogSandboxHandle, sampleLogFilePath, m_memorySamplerInterval), 0);
}
-#if ENABLE(CONTENT_EXTENSIONS)
- for (const auto& slot : m_encodedContentExtensions)
- process->send(Messages::WebProcess::LoadContentExtension(slot.key, slot.value), 0);
-#endif
-
m_connectionClient.didCreateConnection(this, process->webConnection());
}
@@ -1425,12 +1420,4 @@
sendToAllProcesses(Messages::WebProcess::SetMemoryCacheDisabled(disabled));
}
-#if ENABLE(CONTENT_EXTENSIONS)
-void WebProcessPool::loadContentExtension(const String& identifier, const String& serializedRules)
-{
- m_encodedContentExtensions.set(identifier, serializedRules);
- sendToAllProcesses(Messages::WebProcess::LoadContentExtension(identifier, serializedRules));
-}
-#endif
-
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (178633 => 178634)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -355,10 +355,6 @@
return m_processSuppressionDisabledForPageCounter.token<ProcessSuppressionDisabledTokenType>();
}
-#if ENABLE(CONTENT_EXTENSIONS)
- void loadContentExtension(const String& identifier, const String& serializedRules);
-#endif
-
private:
void platformInitialize();
Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (178633 => 178634)
--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj 2015-01-18 21:54:12 UTC (rev 178634)
@@ -1079,6 +1079,14 @@
7C89D2A31A678875003A5FDE /* WKUserScriptRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */; };
7C89D2A41A678875003A5FDE /* WKUserScriptRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C89D2A61A6789EA003A5FDE /* APIUserScript.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */; };
+ 7C89D2B31A6B068C003A5FDE /* APIUserContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B11A6B068C003A5FDE /* APIUserContentFilter.cpp */; };
+ 7C89D2B41A6B068C003A5FDE /* APIUserContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B21A6B068C003A5FDE /* APIUserContentFilter.h */; };
+ 7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */; };
+ 7C89D2BA1A6B0F2C003A5FDE /* _WKUserContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 7C89D2BC1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2BB1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h */; };
+ 7C89D2BF1A6B11EF003A5FDE /* WKUserContentFilterRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7C89D2BD1A6B11EF003A5FDE /* WKUserContentFilterRef.cpp */; };
+ 7C89D2C01A6B11EF003A5FDE /* WKUserContentFilterRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C89D2BE1A6B11EF003A5FDE /* WKUserContentFilterRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C8EB11718DB6A19007917C2 /* WKPreferencesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C8EB11618DB6A19007917C2 /* WKPreferencesPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
7C9D1537184584DA009D3918 /* WKBrowsingContextGroupInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */; };
7CA254EB182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3204,6 +3212,14 @@
7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserScriptRef.cpp; sourceTree = "<group>"; };
7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserScriptRef.h; sourceTree = "<group>"; };
7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserScript.cpp; sourceTree = "<group>"; };
+ 7C89D2B11A6B068C003A5FDE /* APIUserContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIUserContentFilter.cpp; sourceTree = "<group>"; };
+ 7C89D2B21A6B068C003A5FDE /* APIUserContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIUserContentFilter.h; sourceTree = "<group>"; };
+ 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentControllerPrivate.h; sourceTree = "<group>"; };
+ 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKUserContentFilter.mm; sourceTree = "<group>"; };
+ 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilter.h; sourceTree = "<group>"; };
+ 7C89D2BB1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKUserContentFilterInternal.h; sourceTree = "<group>"; };
+ 7C89D2BD1A6B11EF003A5FDE /* WKUserContentFilterRef.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserContentFilterRef.cpp; sourceTree = "<group>"; };
+ 7C89D2BE1A6B11EF003A5FDE /* WKUserContentFilterRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserContentFilterRef.h; sourceTree = "<group>"; };
7C8EB11618DB6A19007917C2 /* WKPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPreferencesPrivate.h; sourceTree = "<group>"; };
7C9D1536184584DA009D3918 /* WKBrowsingContextGroupInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextGroupInternal.h; sourceTree = "<group>"; };
7CA254EA182993CE00FC8A41 /* WKBrowsingContextPolicyDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBrowsingContextPolicyDelegate.h; sourceTree = "<group>"; };
@@ -5165,6 +5181,9 @@
2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */,
2D6B371A18A967AD0042AE80 /* _WKThumbnailView.mm */,
2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */,
+ 7C89D2B81A6B0F2C003A5FDE /* _WKUserContentFilter.h */,
+ 7C89D2B71A6B0F2C003A5FDE /* _WKUserContentFilter.mm */,
+ 7C89D2BB1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h */,
1A81B37F18BD66AD0007FDAC /* _WKVisitedLinkProvider.h */,
1A81B37E18BD66AD0007FDAC /* _WKVisitedLinkProvider.mm */,
1A81B38418BD673A0007FDAC /* _WKVisitedLinkProviderInternal.h */,
@@ -5219,6 +5238,7 @@
1AFA3AC718E61C61003CCBAE /* WKUserContentController.h */,
1AFA3AC618E61C61003CCBAE /* WKUserContentController.mm */,
1AAF08A3192682DA00B6390C /* WKUserContentControllerInternal.h */,
+ 7C89D2B51A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h */,
1AAF089919267EE500B6390C /* WKUserScript.h */,
1AAF089819267EE500B6390C /* WKUserScript.mm */,
1AAF089C19267FC800B6390C /* WKUserScriptInternal.h */,
@@ -6100,6 +6120,8 @@
1AFDE65F1954E9B100C48FFA /* APISessionState.cpp */,
1AFDE6601954E9B100C48FFA /* APISessionState.h */,
1A4D664718A2D91A00D82E21 /* APIUIClient.h */,
+ 7C89D2B11A6B068C003A5FDE /* APIUserContentFilter.cpp */,
+ 7C89D2B21A6B068C003A5FDE /* APIUserContentFilter.h */,
7C89D2A51A6789EA003A5FDE /* APIUserScript.cpp */,
7C89D2921A67122F003A5FDE /* APIUserScript.h */,
1A3635A71A3144A300ED6197 /* APIWebsiteDataStore.cpp */,
@@ -6217,6 +6239,8 @@
7C89D29E1A678554003A5FDE /* WKUserContentControllerRef.h */,
7C89D2A11A678875003A5FDE /* WKUserScriptRef.cpp */,
7C89D2A21A678875003A5FDE /* WKUserScriptRef.h */,
+ 7C89D2BD1A6B11EF003A5FDE /* WKUserContentFilterRef.cpp */,
+ 7C89D2BE1A6B11EF003A5FDE /* WKUserContentFilterRef.h */,
);
path = C;
sourceTree = "<group>";
@@ -7359,6 +7383,7 @@
0F174AA3142A4CB70039250F /* APIGeometry.h in Headers */,
3769079E18F340A2001DFF04 /* APIInjectedBundleFormClient.h in Headers */,
3769079A18F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h in Headers */,
+ 7C89D2B61A6B0DD9003A5FDE /* WKUserContentControllerPrivate.h in Headers */,
7CE4D2071A46776100C7F152 /* APILegacyContextHistoryClient.h in Headers */,
1A2464F31891E45100234C5B /* APILoaderClient.h in Headers */,
7CD3A4831A5D02FA009623B8 /* APINavigation.h in Headers */,
@@ -7438,6 +7463,7 @@
C517388112DF8F4F00EE3F47 /* DragControllerAction.h in Headers */,
BC8452A81162C80900CAB9B5 /* DrawingArea.h in Headers */,
0FB659231208B4DB0044816C /* DrawingAreaInfo.h in Headers */,
+ 7C89D2C01A6B11EF003A5FDE /* WKUserContentFilterRef.h in Headers */,
1A64229A12DD029200CAAE2C /* DrawingAreaMessages.h in Headers */,
BC2652171182608100243E12 /* DrawingAreaProxy.h in Headers */,
1A64230912DD09EB00CAAE2C /* DrawingAreaProxyMessages.h in Headers */,
@@ -7572,6 +7598,7 @@
1A8EF96F1252AF6B00F7067F /* PluginControllerProxyMessages.h in Headers */,
1A179780137EE82C00F97D45 /* PluginCreationParameters.h in Headers */,
7C3F8C91173AF52D007B7F39 /* PluginInformation.h in Headers */,
+ 7C89D2B41A6B068C003A5FDE /* APIUserContentFilter.h in Headers */,
1AEFCC1211D01F96008219D3 /* PluginInfoStore.h in Headers */,
1A3D610213A7CC2A00F95D4E /* PluginModuleInfo.h in Headers */,
1A043976124D034800FFBFB5 /* PluginProcess.h in Headers */,
@@ -7905,6 +7932,7 @@
8372DB2F1A677D4A00C697C5 /* WKDiagnosticLoggingResultType.h in Headers */,
1AB474E4184D44980051B622 /* WKBundlePageContextMenuClient.h in Headers */,
1AB474E8184D44D00051B622 /* WKBundlePageDiagnosticLoggingClient.h in Headers */,
+ 7C89D2BC1A6B0F5B003A5FDE /* _WKUserContentFilterInternal.h in Headers */,
1AB474E0184D446A0051B622 /* WKBundlePageEditorClient.h in Headers */,
1AB474E2184D44800051B622 /* WKBundlePageFormClient.h in Headers */,
1AB474E6184D44B40051B622 /* WKBundlePageFullScreenClient.h in Headers */,
@@ -7995,6 +8023,7 @@
51A9E10B1315CD18009E7031 /* WKKeyValueStorageManager.h in Headers */,
33D3A3B61339600B00709BE4 /* WKMediaCacheManager.h in Headers */,
BC4075FE124FF0270068F20A /* WKMutableArray.h in Headers */,
+ 7C89D2BA1A6B0F2C003A5FDE /* _WKUserContentFilter.h in Headers */,
BC407600124FF0270068F20A /* WKMutableDictionary.h in Headers */,
C09AE5E9125257C20025825D /* WKNativeEvent.h in Headers */,
83891B631A68B3420030F386 /* APIDiagnosticLoggingClient.h in Headers */,
@@ -9227,6 +9256,7 @@
E4436ECD1A0D040B00EAD204 /* NetworkCacheKey.cpp in Sources */,
E4436ED01A0D040B00EAD204 /* NetworkCacheStorageCocoa.mm in Sources */,
513A164C1630A9BF005D7D22 /* NetworkConnectionToWebProcess.cpp in Sources */,
+ 7C89D2B91A6B0F2C003A5FDE /* _WKUserContentFilter.mm in Sources */,
51DD9F2816367DA2001578E9 /* NetworkConnectionToWebProcessMessageReceiver.cpp in Sources */,
5167EEA1170377BF007681CA /* NetworkDiskCacheMonitor.mm in Sources */,
51795568162876CF00FA43B6 /* NetworkProcess.cpp in Sources */,
@@ -9494,6 +9524,7 @@
51C96118183D294700D2002E /* WebIDBServerConnectionMessageReceiver.cpp in Sources */,
BCCF6ABC12C91EF9008F9C35 /* WebImage.cpp in Sources */,
1C8E28211275D15400BC7BD0 /* WebInspector.cpp in Sources */,
+ 7C89D2B31A6B068C003A5FDE /* APIUserContentFilter.cpp in Sources */,
BC111A60112F4FBB00337BAB /* WebInspectorClient.cpp in Sources */,
1C8E2A351277852400BC7BD0 /* WebInspectorMessageReceiver.cpp in Sources */,
1C8E28351275D73800BC7BD0 /* WebInspectorProxy.cpp in Sources */,
@@ -9671,6 +9702,7 @@
BC017D2016263308007054F5 /* WKDOMTextIterator.mm in Sources */,
1AB7D78E1288CD9A00CFD08C /* WKDownload.cpp in Sources */,
1AF4592E19464B2000F9D4A2 /* WKError.mm in Sources */,
+ 7C89D2BF1A6B11EF003A5FDE /* WKUserContentFilterRef.cpp in Sources */,
BCFD548B132D82680055D816 /* WKErrorCF.cpp in Sources */,
BC4075FB124FF0270068F20A /* WKErrorRef.cpp in Sources */,
7C89D2A31A678875003A5FDE /* WKUserScriptRef.cpp in Sources */,
Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -180,4 +180,17 @@
#endif
}
+#if ENABLE(CONTENT_EXTENSIONS)
+void WebUserContentController::addUserContentFilters(const Vector<std::pair<String, String>>& userContentFilters)
+{
+ for (const auto& userContentFilter : userContentFilters)
+ m_userContentController->addUserContentFilter(userContentFilter.first, userContentFilter.second);
+}
+
+void WebUserContentController::removeAllUserContentFilters()
+{
+ m_userContentController->removeAllUserContentFilters();
+}
+#endif
+
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -51,15 +51,20 @@
// IPC::MessageReceiver.
virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
- void addUserScripts(const Vector<WebCore::UserScript>& userScripts);
+ void addUserScripts(const Vector<WebCore::UserScript>&);
void removeAllUserScripts();
- void addUserStyleSheets(const Vector<WebCore::UserStyleSheet>& userStyleSheets);
+ void addUserStyleSheets(const Vector<WebCore::UserStyleSheet>&);
void removeAllUserStyleSheets();
- void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerHandle>& scriptMessageHandlers);
+ void addUserScriptMessageHandlers(const Vector<WebScriptMessageHandlerHandle>&);
void removeUserScriptMessageHandler(uint64_t);
+#if ENABLE(CONTENT_EXTENSIONS)
+ void addUserContentFilters(const Vector<std::pair<String, String>>&);
+ void removeAllUserContentFilters();
+#endif
+
uint64_t m_identifier;
Ref<WebCore::UserContentController> m_userContentController;
#if ENABLE(USER_MESSAGE_HANDLERS)
Modified: trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/UserContent/WebUserContentController.messages.in 2015-01-18 21:54:12 UTC (rev 178634)
@@ -25,11 +25,16 @@
messages -> WebUserContentController {
AddUserScripts(Vector<WebCore::UserScript> userScripts);
- RemoveAllUserScripts()
+ RemoveAllUserScripts();
- AddUserStyleSheets(Vector<WebCore::UserStyleSheet> userStyleShhets);
- RemoveAllUserStyleSheets()
+ AddUserStyleSheets(Vector<WebCore::UserStyleSheet> userStyleSheets);
+ RemoveAllUserStyleSheets();
AddUserScriptMessageHandlers(Vector<WebKit::WebScriptMessageHandlerHandle> scriptMessageHandlers);
- RemoveUserScriptMessageHandler(uint64_t identifier)
+ RemoveUserScriptMessageHandler(uint64_t identifier);
+
+#if ENABLE(CONTENT_EXTENSIONS)
+ AddUserContentFilters(Vector<std::pair<String, String>> userContentFilters);
+ RemoveAllUserContentFilters();
+#endif
}
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp 2015-01-18 21:54:12 UTC (rev 178634)
@@ -104,10 +104,6 @@
#include "NetworkProcessConnection.h"
#endif
-#if ENABLE(CONTENT_EXTENSIONS)
-#include <WebCore/ContentExtensionsManager.h>
-#endif
-
#if ENABLE(SEC_ITEM_SHIM)
#include "SecItemShim.h"
#endif
@@ -1319,13 +1315,6 @@
return UserData::transform(object, Transformer());
}
-#if ENABLE(CONTENT_EXTENSIONS)
-void WebProcess::loadContentExtension(const String& identifier, const String& serializedRules)
-{
- ContentExtensions::ExtensionsManager::loadExtension(identifier, serializedRules);
-}
-#endif
-
void WebProcess::setMemoryCacheDisabled(bool disabled)
{
if (memoryCache().disabled() != disabled)
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/WebProcess.h 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h 2015-01-18 21:54:12 UTC (rev 178634)
@@ -202,10 +202,6 @@
bool hasRichContentServices() const { return m_hasRichContentServices; }
#endif
-#if ENABLE(CONTENT_EXTENSIONS)
- void loadContentExtension(const String& identifier, const String& serializedRules);
-#endif
-
private:
WebProcess();
Modified: trunk/Source/WebKit2/WebProcess/WebProcess.messages.in (178633 => 178634)
--- trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2015-01-18 20:57:26 UTC (rev 178633)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.messages.in 2015-01-18 21:54:12 UTC (rev 178634)
@@ -93,10 +93,6 @@
SetEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices)
#endif
-#if ENABLE(CONTENT_EXTENSIONS)
- LoadContentExtension(String identifier, String serializedRules)
-#endif
-
ProcessWillSuspend()
CancelProcessWillSuspend()
}