Diff
Modified: trunk/Source/WebCore/ChangeLog (181043 => 181044)
--- trunk/Source/WebCore/ChangeLog 2015-03-04 23:39:24 UTC (rev 181043)
+++ trunk/Source/WebCore/ChangeLog 2015-03-04 23:52:31 UTC (rev 181044)
@@ -1,3 +1,16 @@
+2015-03-04 Andy Estes <aes...@apple.com>
+
+ [Content Filtering] Rename ContentFilterMac.mm to ContentFilter.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=142313
+
+ Reviewed by Anders Carlsson.
+
+ ContentFilterMac.mm no longer contains any Objective-C code, so rename it to ContentFilter.cpp. It is also no longer Mac-specific, so move it up to platform/.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/ContentFilter.cpp: Renamed from Source/WebCore/platform/mac/ContentFilterMac.mm.
+ * platform/cocoa/NetworkExtensionContentFilter.h: Replaced NSInteger with long.
+
2015-03-04 Dean Jackson <d...@apple.com>
REGRESSION (r179597): Can't see power saver banner for plugins
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181043 => 181044)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-03-04 23:39:24 UTC (rev 181043)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-03-04 23:52:31 UTC (rev 181044)
@@ -1049,7 +1049,6 @@
2917B5631473496C0052C9D0 /* LayerFlushSchedulerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
2917B566147349950052C9D0 /* LayerFlushSchedulerMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */; };
2919A1E916B3376600787213 /* ContentFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2919A1E816B3376600787213 /* ContentFilter.h */; };
- 2919A1EB16B3378900787213 /* ContentFilterMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2919A1EA16B3378900787213 /* ContentFilterMac.mm */; };
2934940A16C02C0700901318 /* PlatformSpeechSynthesisVoice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2527CC9316BF92EC009DDAC0 /* PlatformSpeechSynthesisVoice.cpp */; };
2934940B16C02C0A00901318 /* PlatformSpeechSynthesisUtterance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2527CC9516BF95DD009DDAC0 /* PlatformSpeechSynthesisUtterance.cpp */; };
293EAE1F1356B2FE0067ACF9 /* RuntimeApplicationChecks.h in Headers */ = {isa = PBXBuildFile; fileRef = 293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -3802,6 +3801,7 @@
A14832CD187F682E00DA63A6 /* WebCoreThreadSafe.h in Headers */ = {isa = PBXBuildFile; fileRef = A148329F187F508700DA63A6 /* WebCoreThreadSafe.h */; };
A14832CE187F683400DA63A6 /* WebCoreThreadSystemInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A14832A0187F508700DA63A6 /* WebCoreThreadSystemInterface.cpp */; };
A14832CF187F684700DA63A6 /* WebCoreThreadSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = A14832A1187F508700DA63A6 /* WebCoreThreadSystemInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ A15D329D1AA7CF3B009A234A /* ContentFilter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A15D329C1AA7CF3B009A234A /* ContentFilter.cpp */; };
A17C81220F2A5CF7005DAAEB /* HTMLElementFactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */; };
A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */; };
A18890AE1AA13F250026C301 /* ParentalControlsContentFilter.mm in Sources */ = {isa = PBXBuildFile; fileRef = A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */; };
@@ -8104,7 +8104,6 @@
2917B5601473496C0052C9D0 /* LayerFlushSchedulerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LayerFlushSchedulerClient.h; path = ca/LayerFlushSchedulerClient.h; sourceTree = "<group>"; };
2917B565147349950052C9D0 /* LayerFlushSchedulerMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LayerFlushSchedulerMac.cpp; path = ca/mac/LayerFlushSchedulerMac.cpp; sourceTree = "<group>"; };
2919A1E816B3376600787213 /* ContentFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentFilter.h; sourceTree = "<group>"; };
- 2919A1EA16B3378900787213 /* ContentFilterMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContentFilterMac.mm; sourceTree = "<group>"; };
293EAE1E1356B2FE0067ACF9 /* RuntimeApplicationChecks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeApplicationChecks.h; sourceTree = "<group>"; };
293EAE201356B32E0067ACF9 /* RuntimeApplicationChecks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RuntimeApplicationChecks.cpp; sourceTree = "<group>"; };
29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilityScrollView.h; sourceTree = "<group>"; };
@@ -11035,6 +11034,7 @@
A14832A9187F508700DA63A6 /* WKView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKView.h; path = ios/wak/WKView.h; sourceTree = "<group>"; };
A14832AA187F508700DA63A6 /* WKView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKView.mm; path = ios/wak/WKView.mm; sourceTree = "<group>"; };
A14832AB187F508700DA63A6 /* WKViewPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKViewPrivate.h; path = ios/wak/WKViewPrivate.h; sourceTree = "<group>"; };
+ A15D329C1AA7CF3B009A234A /* ContentFilter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ContentFilter.cpp; sourceTree = "<group>"; };
A17C81200F2A5CF7005DAAEB /* HTMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLElementFactory.cpp; sourceTree = "<group>"; };
A17C81210F2A5CF7005DAAEB /* HTMLElementFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLElementFactory.h; sourceTree = "<group>"; };
A18890AC1AA13F250026C301 /* ParentalControlsContentFilter.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ParentalControlsContentFilter.mm; sourceTree = "<group>"; };
@@ -16585,7 +16585,6 @@
F478755319983AFF0024A287 /* AxisScrollSnapAnimator.mm */,
65A640F00533BB1F0085E777 /* BlockExceptions.h */,
65F80697054D9F86008BF776 /* BlockExceptions.mm */,
- 2919A1EA16B3378900787213 /* ContentFilterMac.mm */,
06027CB20B1CC03D00884B2D /* ContextMenuItemMac.mm */,
93B6A0E90B0BCA8400F5027A /* ContextMenuMac.mm */,
F58784F002DE375901EA4122 /* CursorMac.mm */,
@@ -21511,6 +21510,7 @@
C330A22113EC196B0000B45B /* ColorChooser.h */,
C37CDEBC149EF2030042090D /* ColorChooserClient.h */,
BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
+ A15D329C1AA7CF3B009A234A /* ContentFilter.cpp */,
2919A1E816B3376600787213 /* ContentFilter.h */,
A14090FC1AA51E480091191A /* ContentFilterUnblockHandler.h */,
41D015C90F4B5C71004A662F /* ContentType.cpp */,
@@ -27494,7 +27494,6 @@
A7A78CD51532BA62006C21E4 /* ContainerNodeAlgorithms.cpp in Sources */,
BC5EB9800E82072500B25965 /* ContentData.cpp in Sources */,
57B791A314C6A62900F202D1 /* ContentDistributor.cpp in Sources */,
- 2919A1EB16B3378900787213 /* ContentFilterMac.mm in Sources */,
97C471DB12F925BD0086354B /* ContentSecurityPolicy.cpp in Sources */,
41D015CB0F4B5C71004A662F /* ContentType.cpp in Sources */,
97627B8D14FB3CEE002CDCA1 /* ContextDestructionObserver.cpp in Sources */,
@@ -29103,6 +29102,7 @@
CDB859F7160D48A400E5B07F /* MediaKeyEvent.cpp in Sources */,
CDA98DD816025BEF00FEA3B1 /* MediaKeyMessageEvent.cpp in Sources */,
CD1B4A65160786AE00282DF9 /* MediaKeyNeededEvent.cpp in Sources */,
+ A15D329D1AA7CF3B009A234A /* ContentFilter.cpp in Sources */,
6C568CB019DAFEA000430CA2 /* MaskImageOperation.cpp in Sources */,
CDA98E0D1603FE4A00FEA3B1 /* MediaKeys.cpp in Sources */,
7C93F34D1AA6BF0700A98BAB /* ContentExtensionCompiler.cpp in Sources */,
Copied: trunk/Source/WebCore/platform/ContentFilter.cpp (from rev 181043, trunk/Source/WebCore/platform/mac/ContentFilterMac.mm) (0 => 181044)
--- trunk/Source/WebCore/platform/ContentFilter.cpp (rev 0)
+++ trunk/Source/WebCore/platform/ContentFilter.cpp 2015-03-04 23:52:31 UTC (rev 181044)
@@ -0,0 +1,164 @@
+/*
+ * Copyright (C) 2013 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 "ContentFilter.h"
+
+#if ENABLE(CONTENT_FILTERING)
+
+#include "NetworkExtensionContentFilter.h"
+#include "ParentalControlsContentFilter.h"
+#include <wtf/NeverDestroyed.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+struct ContentFilterType {
+ const std::function<bool(const ResourceResponse&)> canHandleResponse;
+ const std::function<std::unique_ptr<ContentFilter>(const ResourceResponse&)> create;
+};
+
+template <typename T>
+static inline ContentFilterType contentFilterType()
+{
+ return { T::canHandleResponse, T::create };
+}
+
+static const Vector<ContentFilterType>& contentFilterTypes()
+{
+ static NeverDestroyed<Vector<ContentFilterType>> types(
+ Vector<ContentFilterType>({
+ contentFilterType<ParentalControlsContentFilter>(),
+#if HAVE(NE_FILTER_SOURCE)
+ contentFilterType<NetworkExtensionContentFilter>()
+#endif
+ })
+ );
+ return types;
+}
+
+class ContentFilterCollection final : public ContentFilter {
+public:
+ using Container = Vector<std::unique_ptr<ContentFilter>>;
+
+ explicit ContentFilterCollection(Container);
+
+ void addData(const char* data, int length) override;
+ void finishedAddingData() override;
+ bool needsMoreData() const override;
+ bool didBlockData() const override;
+ const char* getReplacementData(int& length) const override;
+ ContentFilterUnblockHandler unblockHandler() const override;
+
+private:
+ Container m_contentFilters;
+};
+
+std::unique_ptr<ContentFilter> ContentFilter::createIfNeeded(const ResourceResponse& response)
+{
+ ContentFilterCollection::Container filters;
+ for (auto& type : contentFilterTypes()) {
+ if (type.canHandleResponse(response))
+ filters.append(type.create(response));
+ }
+
+ if (filters.isEmpty())
+ return nullptr;
+
+ return std::make_unique<ContentFilterCollection>(WTF::move(filters));
+}
+
+ContentFilterCollection::ContentFilterCollection(Container contentFilters)
+ : m_contentFilters { WTF::move(contentFilters) }
+{
+ ASSERT(!m_contentFilters.isEmpty());
+}
+
+void ContentFilterCollection::addData(const char* data, int length)
+{
+ ASSERT(needsMoreData());
+
+ for (auto& contentFilter : m_contentFilters)
+ contentFilter->addData(data, length);
+}
+
+void ContentFilterCollection::finishedAddingData()
+{
+ ASSERT(needsMoreData());
+
+ for (auto& contentFilter : m_contentFilters)
+ contentFilter->finishedAddingData();
+
+ ASSERT(!needsMoreData());
+}
+
+bool ContentFilterCollection::needsMoreData() const
+{
+ for (auto& contentFilter : m_contentFilters) {
+ if (contentFilter->needsMoreData())
+ return true;
+ }
+
+ return false;
+}
+
+bool ContentFilterCollection::didBlockData() const
+{
+ for (auto& contentFilter : m_contentFilters) {
+ if (contentFilter->didBlockData())
+ return true;
+ }
+
+ return false;
+}
+
+const char* ContentFilterCollection::getReplacementData(int& length) const
+{
+ ASSERT(!needsMoreData());
+
+ for (auto& contentFilter : m_contentFilters) {
+ if (contentFilter->didBlockData())
+ return contentFilter->getReplacementData(length);
+ }
+
+ return m_contentFilters[0]->getReplacementData(length);
+}
+
+ContentFilterUnblockHandler ContentFilterCollection::unblockHandler() const
+{
+ ASSERT(didBlockData());
+
+ for (auto& contentFilter : m_contentFilters) {
+ if (contentFilter->didBlockData())
+ return contentFilter->unblockHandler();
+ }
+
+ ASSERT_NOT_REACHED();
+ return { };
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CONTENT_FILTERING)
Modified: trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h (181043 => 181044)
--- trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h 2015-03-04 23:39:24 UTC (rev 181043)
+++ trunk/Source/WebCore/platform/cocoa/NetworkExtensionContentFilter.h 2015-03-04 23:52:31 UTC (rev 181044)
@@ -51,7 +51,7 @@
ContentFilterUnblockHandler unblockHandler() const override;
private:
- NSInteger m_neFilterSourceStatus;
+ long m_neFilterSourceStatus;
RetainPtr<NEFilterSource> m_neFilterSource;
dispatch_queue_t m_neFilterSourceQueue;
RetainPtr<NSMutableData> m_originalData;
Deleted: trunk/Source/WebCore/platform/mac/ContentFilterMac.mm (181043 => 181044)
--- trunk/Source/WebCore/platform/mac/ContentFilterMac.mm 2015-03-04 23:39:24 UTC (rev 181043)
+++ trunk/Source/WebCore/platform/mac/ContentFilterMac.mm 2015-03-04 23:52:31 UTC (rev 181044)
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2013 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.
- */
-
-// FIXME: Rename to ContentFilter.cpp and move to platform/.
-
-#import "config.h"
-#import "ContentFilter.h"
-
-#if ENABLE(CONTENT_FILTERING)
-
-#import "NetworkExtensionContentFilter.h"
-#import "ParentalControlsContentFilter.h"
-#import <wtf/NeverDestroyed.h>
-#import <wtf/Vector.h>
-
-namespace WebCore {
-
-struct ContentFilterType {
- const std::function<bool(const ResourceResponse&)> canHandleResponse;
- const std::function<std::unique_ptr<ContentFilter>(const ResourceResponse&)> create;
-};
-
-template <typename T>
-static inline ContentFilterType contentFilterType()
-{
- return { T::canHandleResponse, T::create };
-}
-
-static const Vector<ContentFilterType>& contentFilterTypes()
-{
- static NeverDestroyed<Vector<ContentFilterType>> types(
- Vector<ContentFilterType>({
- contentFilterType<ParentalControlsContentFilter>(),
-#if HAVE(NE_FILTER_SOURCE)
- contentFilterType<NetworkExtensionContentFilter>()
-#endif
- })
- );
- return types;
-}
-
-class ContentFilterCollection final : public ContentFilter {
-public:
- using Container = Vector<std::unique_ptr<ContentFilter>>;
-
- explicit ContentFilterCollection(Container);
-
- void addData(const char* data, int length) override;
- void finishedAddingData() override;
- bool needsMoreData() const override;
- bool didBlockData() const override;
- const char* getReplacementData(int& length) const override;
- ContentFilterUnblockHandler unblockHandler() const override;
-
-private:
- Container m_contentFilters;
-};
-
-std::unique_ptr<ContentFilter> ContentFilter::createIfNeeded(const ResourceResponse& response)
-{
- ContentFilterCollection::Container filters;
- for (auto& type : contentFilterTypes()) {
- if (type.canHandleResponse(response))
- filters.append(type.create(response));
- }
-
- if (filters.isEmpty())
- return nullptr;
-
- return std::make_unique<ContentFilterCollection>(WTF::move(filters));
-}
-
-ContentFilterCollection::ContentFilterCollection(Container contentFilters)
- : m_contentFilters { WTF::move(contentFilters) }
-{
- ASSERT(!m_contentFilters.isEmpty());
-}
-
-void ContentFilterCollection::addData(const char* data, int length)
-{
- ASSERT(needsMoreData());
-
- for (auto& contentFilter : m_contentFilters)
- contentFilter->addData(data, length);
-}
-
-void ContentFilterCollection::finishedAddingData()
-{
- ASSERT(needsMoreData());
-
- for (auto& contentFilter : m_contentFilters)
- contentFilter->finishedAddingData();
-
- ASSERT(!needsMoreData());
-}
-
-bool ContentFilterCollection::needsMoreData() const
-{
- for (auto& contentFilter : m_contentFilters) {
- if (contentFilter->needsMoreData())
- return true;
- }
-
- return false;
-}
-
-bool ContentFilterCollection::didBlockData() const
-{
- for (auto& contentFilter : m_contentFilters) {
- if (contentFilter->didBlockData())
- return true;
- }
-
- return false;
-}
-
-const char* ContentFilterCollection::getReplacementData(int& length) const
-{
- ASSERT(!needsMoreData());
-
- for (auto& contentFilter : m_contentFilters) {
- if (contentFilter->didBlockData())
- return contentFilter->getReplacementData(length);
- }
-
- return m_contentFilters[0]->getReplacementData(length);
-}
-
-ContentFilterUnblockHandler ContentFilterCollection::unblockHandler() const
-{
- ASSERT(didBlockData());
-
- for (auto& contentFilter : m_contentFilters) {
- if (contentFilter->didBlockData())
- return contentFilter->unblockHandler();
- }
-
- ASSERT_NOT_REACHED();
- return { };
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(CONTENT_FILTERING)