Diff
Modified: trunk/Source/WebCore/ChangeLog (204461 => 204462)
--- trunk/Source/WebCore/ChangeLog 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebCore/ChangeLog 2016-08-15 16:43:13 UTC (rev 204462)
@@ -1,3 +1,49 @@
+2016-08-12 Anders Carlsson <[email protected]>
+
+ Move the plug-in and WebGL blacklist code to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160831
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/mac/BlacklistUpdater.h: Added.
+ (WebCore::BlacklistUpdater::queue):
+ (WebCore::BlacklistUpdater::pluginBlacklist):
+ (WebCore::BlacklistUpdater::webGLBlacklist):
+ * platform/mac/BlacklistUpdater.mm: Added.
+ (WebCore::BlacklistUpdater::readBlacklistData):
+ (WebCore::BlacklistUpdater::reloadIfNecessary):
+ (WebCore::BlacklistUpdater::initializeQueue):
+ * platform/mac/PluginBlacklist.h: Added.
+ * platform/mac/PluginBlacklist.mm: Added.
+ (WebCore::PluginBlacklist::loadPolicyForPluginVersion):
+ (WebCore::PluginBlacklist::isPluginUpdateAvailable):
+ (WebCore::PluginBlacklist::create):
+ (WebCore::PluginBlacklist::~PluginBlacklist):
+ (WebCore::PluginBlacklist::splitOSVersion):
+ (WebCore::PluginBlacklist::loadPolicyForPlugin):
+ (WebCore::PluginBlacklist::isUpdateAvailable):
+ (WebCore::PluginBlacklist::PluginBlacklist):
+ * platform/mac/WebGLBlacklist.h: Added.
+ * platform/mac/WebGLBlacklist.mm: Added.
+ (WebCore::OSBuildInfo::OSBuildInfo):
+ (WebCore::OSBuildInfo::operator==):
+ (WebCore::OSBuildInfo::operator>):
+ (WebCore::OSBuildInfo::operator<=):
+ (WebCore::OSBuildInfo::operator<):
+ (WebCore::buildInfoFromOSBuildString):
+ (WebCore::WebGLBlacklist::shouldBlockWebGL):
+ (WebCore::WebGLBlacklist::shouldSuggestBlockingWebGL):
+ (WebCore::matchesGPU):
+ (WebCore::gpuMaskFromString):
+ (WebCore::matchesBuildInfo):
+ (WebCore::WebGLBlacklist::create):
+ (WebCore::WebGLBlacklist::shouldBlock):
+ (WebCore::WebGLBlacklist::shouldSuggestBlocking):
+ (WebCore::WebGLBlacklist::WebGLBlacklist):
+ (WebCore::WebGLBlacklist::~WebGLBlacklist):
+ * platform/spi/cf/CFUtilitiesSPI.h: Added.
+
2016-08-14 Chris Dumez <[email protected]>
Align the event listener firing code with the latest DOM Specification and simplify it
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204461 => 204462)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2016-08-15 16:43:13 UTC (rev 204462)
@@ -1020,6 +1020,12 @@
1AF8E1C3125673E000230FF7 /* ProxyServerCFNet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */; };
1AFE11990CBFFCC4003017FA /* JSSQLResultSetRowList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AFE11970CBFFCC4003017FA /* JSSQLResultSetRowList.cpp */; };
1AFE119A0CBFFCC4003017FA /* JSSQLResultSetRowList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFE11980CBFFCC4003017FA /* JSSQLResultSetRowList.h */; };
+ 1AFFC4531D5E81C400267A66 /* WebGLBlacklist.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFFC4521D5E7EC700267A66 /* WebGLBlacklist.mm */; };
+ 1AFFC4541D5E81CB00267A66 /* BlacklistUpdater.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFFC44E1D5E7EC700267A66 /* BlacklistUpdater.mm */; };
+ 1AFFC4551D5E81D000267A66 /* PluginBlacklist.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AFFC4501D5E7EC700267A66 /* PluginBlacklist.mm */; };
+ 1AFFC4571D5E83A700267A66 /* CFUtilitiesSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC4561D5E83A700267A66 /* CFUtilitiesSPI.h */; };
+ 1AFFC4581D5E865500267A66 /* WebGLBlacklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1AFFC4591D5E866100267A66 /* PluginBlacklist.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */; settings = {ATTRIBUTES = (Private, ); }; };
1B124D8D1D380B7000ECDFB0 /* MediaSampleAVFObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = 1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */; };
1B124D8F1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */; };
1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EC7181ED60100EE4C41 /* MediaSample.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8247,6 +8253,13 @@
1AF8E1C1125673E000230FF7 /* ProxyServerCFNet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ProxyServerCFNet.cpp; sourceTree = "<group>"; };
1AFE11970CBFFCC4003017FA /* JSSQLResultSetRowList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLResultSetRowList.cpp; sourceTree = "<group>"; };
1AFE11980CBFFCC4003017FA /* JSSQLResultSetRowList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLResultSetRowList.h; sourceTree = "<group>"; };
+ 1AFFC44D1D5E7EC700267A66 /* BlacklistUpdater.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BlacklistUpdater.h; sourceTree = "<group>"; };
+ 1AFFC44E1D5E7EC700267A66 /* BlacklistUpdater.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BlacklistUpdater.mm; sourceTree = "<group>"; };
+ 1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PluginBlacklist.h; sourceTree = "<group>"; };
+ 1AFFC4501D5E7EC700267A66 /* PluginBlacklist.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginBlacklist.mm; sourceTree = "<group>"; };
+ 1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLBlacklist.h; sourceTree = "<group>"; };
+ 1AFFC4521D5E7EC700267A66 /* WebGLBlacklist.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebGLBlacklist.mm; sourceTree = "<group>"; };
+ 1AFFC4561D5E83A700267A66 /* CFUtilitiesSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFUtilitiesSPI.h; sourceTree = "<group>"; };
1B124D8C1D380B7000ECDFB0 /* MediaSampleAVFObjC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MediaSampleAVFObjC.h; path = ../MediaSampleAVFObjC.h; sourceTree = "<group>"; };
1B124D8E1D380BB600ECDFB0 /* MediaSampleAVFObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaSampleAVFObjC.mm; sourceTree = "<group>"; };
1C0106FE192594DF008A4201 /* InlineTextBoxStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InlineTextBoxStyle.cpp; sourceTree = "<group>"; };
@@ -17714,6 +17727,7 @@
65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
A10D7FEB1C2676D100C6C115 /* CFNetworkConnectionCacheSPI.h */,
CE12525A1A1C018200864480 /* CFNetworkSPI.h */,
+ 1AFFC4561D5E83A700267A66 /* CFUtilitiesSPI.h */,
4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */,
);
path = cf;
@@ -18000,6 +18014,8 @@
6582A14809999D6C00BEEB6D /* mac */ = {
isa = PBXGroup;
children = (
+ 1AFFC44D1D5E7EC700267A66 /* BlacklistUpdater.h */,
+ 1AFFC44E1D5E7EC700267A66 /* BlacklistUpdater.mm */,
F58784F002DE375901EA4122 /* CursorMac.mm */,
A795463D0B5C4C80007B438F /* DragDataMac.mm */,
A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */,
@@ -18025,6 +18041,8 @@
C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
+ 1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */,
+ 1AFFC4501D5E7EC700267A66 /* PluginBlacklist.mm */,
4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */,
46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */,
0081FEFE16B0A2B6008AAA7A /* PublicSuffixMac.mm */,
@@ -18064,6 +18082,8 @@
93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */,
BE855F7F0701E83500239769 /* WebCoreView.h */,
BE8560510701F91100239769 /* WebCoreView.m */,
+ 1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */,
+ 1AFFC4521D5E7EC700267A66 /* WebGLBlacklist.mm */,
E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */,
E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */,
CD5896E01CD2B15100B3BCC8 /* WebPlaybackControlsManager.h */,
@@ -22530,8 +22550,6 @@
BCF1A5BA097832090061A123 /* platform */ = {
isa = PBXGroup;
children = (
- 5C6E653F1D5CEDC900F7862E /* URLParser.cpp */,
- 5C6E65401D5CEDC900F7862E /* URLParser.h */,
49E912A40EFAC8E6009D0CAF /* animation */,
FD31604012B026A300C1A359 /* audio */,
1AE42F670AA4B8CB00C8612D /* cf */,
@@ -22705,6 +22723,8 @@
6593923509AE4346002C531F /* URL.cpp */,
6593923609AE4346002C531F /* URL.h */,
BCBD21AA0E417AD400A070F2 /* URLHash.h */,
+ 5C6E653F1D5CEDC900F7862E /* URLParser.cpp */,
+ 5C6E65401D5CEDC900F7862E /* URLParser.h */,
868160D1187669C40021E79D /* UserActivity.cpp */,
868160D2187669C40021E79D /* UserActivity.h */,
71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */,
@@ -24859,6 +24879,7 @@
070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */,
F45C231E1995B73B00A6E2E3 /* AxisScrollSnapOffsets.h in Headers */,
29A812380FBB9C1D00510293 /* AXObjectCache.h in Headers */,
+ 1AFFC4591D5E866100267A66 /* PluginBlacklist.h in Headers */,
91C9F2F91AE3BEB00095B61C /* AXTextStateChangeIntent.h in Headers */,
51741D0F0B07259A00ED442C /* BackForwardClient.h in Headers */,
BCA8C81E11E3D36900812FB7 /* BackForwardController.h in Headers */,
@@ -25309,6 +25330,7 @@
A8185F3909765766005826D9 /* DocumentType.h in Headers */,
973889A1116EA9DC00ADF313 /* DocumentWriter.h in Headers */,
BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */,
+ 1AFFC4571D5E83A700267A66 /* CFUtilitiesSPI.h in Headers */,
8538F0190AD718D8006A81D1 /* DOMAbstractView.h in Headers */,
BC99812E0DBE807A008CE9EF /* DOMAbstractViewFrame.h in Headers */,
8538F01B0AD718D8006A81D1 /* DOMAbstractViewInternal.h in Headers */,
@@ -27477,6 +27499,7 @@
93C38C03164473DD00091EB2 /* ScrollingTreeFixedNode.h in Headers */,
0FEA3E88191B3BD7000F1B55 /* ScrollingTreeFrameScrollingNode.h in Headers */,
0FC4E411187F82E10045882C /* ScrollingTreeFrameScrollingNodeIOS.h in Headers */,
+ 1AFFC4581D5E865500267A66 /* WebGLBlacklist.h in Headers */,
93C4A4151629DF5A00C3EB6E /* ScrollingTreeFrameScrollingNodeMac.h in Headers */,
0FC4E410187F82E10045882C /* ScrollingTreeIOS.h in Headers */,
0FE5806419327A6200DE32EB /* ScrollingTreeMac.h in Headers */,
@@ -29608,6 +29631,7 @@
A871DB260A150BD600B12A68 /* HTMLTableSectionElement.cpp in Sources */,
D66817FA166FE6D700FA07B4 /* HTMLTemplateElement.cpp in Sources */,
A81369D7097374F600D74463 /* HTMLTextAreaElement.cpp in Sources */,
+ 1AFFC4551D5E81D000267A66 /* PluginBlacklist.mm in Sources */,
9BC6C21C13CCC97B008E0337 /* HTMLTextFormControlElement.cpp in Sources */,
830519951BB0F11000F3772E /* HTMLTimeElement.cpp in Sources */,
A871DC290A15205700B12A68 /* HTMLTitleElement.cpp in Sources */,
@@ -30717,6 +30741,7 @@
854FE7340A2297BE0058D7AD /* NodeIterator.cpp in Sources */,
4FFC022B1643B710004E1638 /* NodeRareData.cpp in Sources */,
E43105B816750F0C00DB2FB8 /* NodeTraversal.cpp in Sources */,
+ 1AFFC4531D5E81C400267A66 /* WebGLBlacklist.mm in Sources */,
33503CC71017A1B1003B47E1 /* Notification.cpp in Sources */,
3390CA550FFC157B00921962 /* NotificationCenter.cpp in Sources */,
3128CA68147331520074C72A /* NotificationController.cpp in Sources */,
@@ -31407,6 +31432,7 @@
B2227A430D00BF220071B782 /* SVGMarkerElement.cpp in Sources */,
B2227A460D00BF220071B782 /* SVGMaskElement.cpp in Sources */,
B2227A4A0D00BF220071B782 /* SVGMetadataElement.cpp in Sources */,
+ 1AFFC4541D5E81CB00267A66 /* BlacklistUpdater.mm in Sources */,
B2A1F2B00CEF0ABF00442F6A /* SVGMissingGlyphElement.cpp in Sources */,
B2227A4D0D00BF220071B782 /* SVGMPathElement.cpp in Sources */,
A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */,
Copied: trunk/Source/WebCore/platform/mac/BlacklistUpdater.h (from rev 204461, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 204462)
--- trunk/Source/WebCore/platform/mac/BlacklistUpdater.h (rev 0)
+++ trunk/Source/WebCore/platform/mac/BlacklistUpdater.h 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC)
+
+#import <dispatch/dispatch.h>
+
+namespace WebCore {
+
+class PluginBlacklist;
+class WebGLBlacklist;
+
+class BlacklistUpdater {
+public:
+ static void initializeQueue();
+ static void reloadIfNecessary();
+
+ static dispatch_queue_t queue() { return s_queue; }
+ static PluginBlacklist* pluginBlacklist() { return s_pluginBlacklist; }
+ static WebGLBlacklist* webGLBlacklist() { return s_webGLBlacklist; };
+
+private:
+
+ static NSDictionary *readBlacklistData();
+
+ static dispatch_queue_t s_queue;
+ static PluginBlacklist* s_pluginBlacklist;
+ static WebGLBlacklist* s_webGLBlacklist;
+};
+
+}
+
+#endif
Added: trunk/Source/WebCore/platform/mac/BlacklistUpdater.mm (0 => 204462)
--- trunk/Source/WebCore/platform/mac/BlacklistUpdater.mm (rev 0)
+++ trunk/Source/WebCore/platform/mac/BlacklistUpdater.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "BlacklistUpdater.h"
+
+#if PLATFORM(MAC)
+
+#import "PluginBlacklist.h"
+#import "WebGLBlacklist.h"
+#import <sys/stat.h>
+#import <sys/time.h>
+#import <wtf/RetainPtr.h>
+
+// The time after which we'll check the blacklist data.
+static time_t blacklistNextCheckTime;
+
+// The number of seconds before we'll check if the blacklist data has changed.
+const time_t blacklistCheckTimeInterval = 60 * 10;
+
+// The time when we last re-parsed the blacklist file.
+static time_t blacklistUpdateTime;
+
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+NSString * const blacklistPath = @"/System/Library/CoreServices/XProtect.bundle/Contents/Resources/XProtect.meta.plist";
+#else
+NSString * const blacklistPath = @"/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist";
+#endif
+
+namespace WebCore {
+
+dispatch_queue_t BlacklistUpdater::s_queue;
+
+PluginBlacklist* BlacklistUpdater::s_pluginBlacklist = nullptr;
+WebGLBlacklist* BlacklistUpdater::s_webGLBlacklist = nullptr;
+
+NSDictionary * BlacklistUpdater::readBlacklistData()
+{
+ NSData *data = "" dataWithContentsOfFile:blacklistPath];
+ if (!data)
+ return nil;
+
+ return dynamic_objc_cast<NSDictionary>([NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:nullptr error:nullptr]);
+}
+
+void BlacklistUpdater::reloadIfNecessary()
+{
+ struct timeval timeVal;
+ if (!gettimeofday(&timeVal, NULL)) {
+ if (timeVal.tv_sec < blacklistNextCheckTime)
+ return;
+ }
+
+ blacklistNextCheckTime = timeVal.tv_sec + blacklistCheckTimeInterval;
+
+ struct stat statBuf;
+ if (stat([blacklistPath fileSystemRepresentation], &statBuf) == -1)
+ return;
+
+ if (statBuf.st_mtimespec.tv_sec == blacklistUpdateTime)
+ return;
+ NSDictionary *propertyList = readBlacklistData();
+ if (!propertyList)
+ return;
+
+ if (s_pluginBlacklist) {
+ delete s_pluginBlacklist;
+ s_pluginBlacklist = 0;
+ }
+
+ if (s_webGLBlacklist) {
+ delete s_webGLBlacklist;
+ s_webGLBlacklist = 0;
+ }
+
+ s_pluginBlacklist = PluginBlacklist::create(propertyList).release();
+ s_webGLBlacklist = WebGLBlacklist::create(propertyList).release();
+
+ blacklistUpdateTime = statBuf.st_mtimespec.tv_sec;
+}
+
+void BlacklistUpdater::initializeQueue()
+{
+ static dispatch_once_t once;
+ dispatch_once(&once, ^{
+ s_queue = dispatch_queue_create("com.apple.WebKit.Blacklist", 0);
+ });
+}
+
+}
+
+#endif
Added: trunk/Source/WebCore/platform/mac/PluginBlacklist.h (0 => 204462)
--- trunk/Source/WebCore/platform/mac/PluginBlacklist.h (rev 0)
+++ trunk/Source/WebCore/platform/mac/PluginBlacklist.h 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC)
+
+#include <memory>
+#include <string>
+#include <vector>
+
+OBJC_CLASS NSArray;
+OBJC_CLASS NSDictionary;
+OBJC_CLASS NSSet;
+OBJC_CLASS NSString;
+
+namespace WebCore {
+
+class PluginBlacklist {
+public:
+ enum class LoadPolicy {
+ LoadNormally,
+ BlockedForSecurity,
+ BlockedForCompatibility,
+ };
+
+ WEBCORE_EXPORT static LoadPolicy loadPolicyForPluginVersion(NSString *bundleIdentifier, NSString *bundleVersionString);
+ WEBCORE_EXPORT static bool isPluginUpdateAvailable(NSString *bundleIdentifier);
+
+ static std::unique_ptr<PluginBlacklist> create(NSDictionary *);
+ ~PluginBlacklist();
+
+ static NSArray *splitOSVersion(NSString *osVersion);
+
+ LoadPolicy loadPolicyForPlugin(NSString *bundleIdentifier, NSString *bundleVersionString) const;
+ bool isUpdateAvailable(NSString *bundleIdentifier) const;
+
+private:
+ PluginBlacklist(NSDictionary *bundleIDToMinimumSecureVersion, NSDictionary *bundleIDToMinimumCompatibleVersion, NSDictionary *bundleIDToBlockedVersions, NSSet *bundleIDsWithAvailableUpdates);
+
+ NSDictionary *m_bundleIDToMinimumSecureVersion;
+ NSDictionary *m_bundleIDToMinimumCompatibleVersion;
+ NSDictionary *m_bundleIDToBlockedVersions;
+ NSSet *m_bundleIDsWithAvailableUpdates;
+};
+
+}
+
+#endif
Added: trunk/Source/WebCore/platform/mac/PluginBlacklist.mm (0 => 204462)
--- trunk/Source/WebCore/platform/mac/PluginBlacklist.mm (rev 0)
+++ trunk/Source/WebCore/platform/mac/PluginBlacklist.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "PluginBlacklist.h"
+
+#if PLATFORM(MAC)
+
+#import "BlacklistUpdater.h"
+#import "CFUtilitiesSPI.h"
+#import <sys/stat.h>
+#import <sys/time.h>
+
+namespace WebCore {
+
+PluginBlacklist::LoadPolicy PluginBlacklist::loadPolicyForPluginVersion(NSString *bundleIdentifier, NSString *bundleVersionString)
+{
+ BlacklistUpdater::initializeQueue();
+
+ __block PluginBlacklist::LoadPolicy loadPolicy = LoadPolicy::LoadNormally;
+ dispatch_sync(BlacklistUpdater::queue(), ^{
+ BlacklistUpdater::reloadIfNecessary();
+
+ PluginBlacklist* pluginBlacklist = BlacklistUpdater::pluginBlacklist();
+ if (pluginBlacklist)
+ loadPolicy = pluginBlacklist->loadPolicyForPlugin(bundleIdentifier, bundleVersionString);
+ });
+
+ return loadPolicy;
+}
+
+bool PluginBlacklist::isPluginUpdateAvailable(NSString *bundleIdentifier)
+{
+ BlacklistUpdater::initializeQueue();
+
+ __block bool isPluginUpdateAvailable = false;
+ dispatch_sync(BlacklistUpdater::queue(), ^{
+ BlacklistUpdater::reloadIfNecessary();
+
+ PluginBlacklist* pluginBlacklist = BlacklistUpdater::pluginBlacklist();
+ if (pluginBlacklist)
+ isPluginUpdateAvailable = pluginBlacklist->isUpdateAvailable(bundleIdentifier);
+ });
+
+ return isPluginUpdateAvailable;
+}
+
+std::unique_ptr<PluginBlacklist> PluginBlacklist::create(NSDictionary *propertyList)
+{
+ CFDictionaryRef systemVersionDictionary = _CFCopySystemVersionDictionary();
+ CFStringRef osVersion = static_cast<CFStringRef>(CFDictionaryGetValue(systemVersionDictionary, _kCFSystemVersionProductVersionKey));
+
+ NSDictionary *dictionary = [propertyList objectForKey:@"PlugInBlacklist"];
+
+ NSMutableDictionary *bundleIDToMinimumSecureVersion = [NSMutableDictionary dictionary];
+ NSMutableDictionary *bundleIDToMinimumCompatibleVersion = [NSMutableDictionary dictionary];
+ NSMutableDictionary *bundleIDToBlockedVersions = [NSMutableDictionary dictionary];
+ NSMutableSet *bundleIDsWithAvailableUpdates = [NSMutableSet set];
+
+ for (NSString *osVersionComponent in splitOSVersion((NSString *)osVersion)) {
+ NSDictionary *bundleIDs = [dictionary objectForKey:osVersionComponent];
+ if (!bundleIDs)
+ continue;
+
+ for (NSString *bundleID in bundleIDs) {
+ NSDictionary *versionInfo = [bundleIDs objectForKey:bundleID];
+ assert(versionInfo);
+
+ if (![versionInfo isKindOfClass:[NSDictionary class]])
+ continue;
+
+ [bundleIDToMinimumSecureVersion removeObjectForKey:bundleID];
+ [bundleIDToMinimumCompatibleVersion removeObjectForKey:bundleID];
+ [bundleIDToBlockedVersions removeObjectForKey:bundleID];
+
+ if (NSArray *blockedVersions = [versionInfo objectForKey:@"BlockedPlugInBundleVersions"])
+ [bundleIDToBlockedVersions setObject:blockedVersions forKey:bundleID];
+
+ if (NSString *minimumSecureVersion = [versionInfo objectForKey:@"MinimumPlugInBundleVersion"])
+ [bundleIDToMinimumSecureVersion setObject:minimumSecureVersion forKey:bundleID];
+
+ if (NSString *minimumCompatibleVersion = [versionInfo objectForKey:@"MinimumCompatiblePlugInBundleVersion"])
+ [bundleIDToMinimumCompatibleVersion setObject:minimumCompatibleVersion forKey:bundleID];
+
+ if (NSNumber *updateAvailable = [versionInfo objectForKey:@"PlugInUpdateAvailable"]) {
+ // A missing PlugInUpdateAvailable key means that there is a plug-in update available.
+ if (!updateAvailable || [updateAvailable boolValue])
+ [bundleIDsWithAvailableUpdates addObject:bundleID];
+ }
+ }
+ }
+
+ CFRelease(systemVersionDictionary);
+
+ return std::unique_ptr<PluginBlacklist>(new PluginBlacklist(bundleIDToMinimumSecureVersion, bundleIDToMinimumCompatibleVersion, bundleIDToBlockedVersions, bundleIDsWithAvailableUpdates));
+}
+
+PluginBlacklist::~PluginBlacklist()
+{
+ CFRelease(m_bundleIDToMinimumSecureVersion);
+ CFRelease(m_bundleIDToMinimumCompatibleVersion);
+ CFRelease(m_bundleIDToBlockedVersions);
+ CFRelease(m_bundleIDsWithAvailableUpdates);
+}
+
+NSArray *PluginBlacklist::splitOSVersion(NSString *osVersion)
+{
+ NSArray *components = [osVersion componentsSeparatedByString:@"."];
+
+ NSMutableArray *result = [NSMutableArray array];
+
+ for (NSUInteger i = 0; i < [components count]; ++i) {
+ NSString *versionString = [[components subarrayWithRange:NSMakeRange(0, i + 1)] componentsJoinedByString:@"."];
+
+ [result addObject:versionString];
+ }
+
+ return result;
+}
+
+
+PluginBlacklist::LoadPolicy PluginBlacklist::loadPolicyForPlugin(NSString *bundleIdentifier, NSString *bundleVersionString) const
+{
+ if (!bundleIdentifier || !bundleVersionString)
+ return LoadPolicy::LoadNormally;
+
+ // First, check for explicitly blocked versions.
+ for (NSString *blockedVersion in [m_bundleIDToBlockedVersions objectForKey:bundleIdentifier]) {
+ if ([blockedVersion isEqualToString:bundleVersionString])
+ return LoadPolicy::BlockedForSecurity;
+ }
+
+ // Then, check if there's a forced minimum version for security issues.
+ if (NSString *minimumSecureVersion = [m_bundleIDToMinimumSecureVersion objectForKey:bundleIdentifier]) {
+ if ([bundleVersionString compare:minimumSecureVersion options:NSNumericSearch] == NSOrderedAscending)
+ return LoadPolicy::BlockedForSecurity;
+ }
+
+ // Then, check if there's a forced minimum version for compatibility issues.
+ if (NSString *minimumCompatibleVersion = [m_bundleIDToMinimumCompatibleVersion objectForKey:bundleIdentifier]) {
+ if ([bundleVersionString compare:minimumCompatibleVersion options:NSNumericSearch] == NSOrderedAscending)
+ return LoadPolicy::BlockedForCompatibility;
+ }
+
+ return LoadPolicy::LoadNormally;
+}
+
+bool PluginBlacklist::isUpdateAvailable(NSString *bundleIdentifier) const
+{
+ return [m_bundleIDsWithAvailableUpdates containsObject:bundleIdentifier];
+}
+
+PluginBlacklist::PluginBlacklist(NSDictionary *bundleIDToMinimumSecureVersion, NSDictionary *bundleIDToMinimumCompatibleVersion, NSDictionary *bundleIDToBlockedVersions, NSSet *bundleIDsWithAvailableUpdates)
+ : m_bundleIDToMinimumSecureVersion([bundleIDToMinimumSecureVersion copy])
+ , m_bundleIDToMinimumCompatibleVersion([bundleIDToMinimumCompatibleVersion copy])
+ , m_bundleIDToBlockedVersions([bundleIDToBlockedVersions copy])
+ , m_bundleIDsWithAvailableUpdates([bundleIDsWithAvailableUpdates copy])
+{
+ // This ensures that the dictionaries do not get destroyed under Objective-C grabage collection.
+ CFRetain(m_bundleIDToMinimumSecureVersion);
+ [m_bundleIDToMinimumSecureVersion release];
+ CFRetain(m_bundleIDToMinimumCompatibleVersion);
+ [m_bundleIDToMinimumCompatibleVersion release];
+ CFRetain(m_bundleIDToBlockedVersions);
+ [m_bundleIDToBlockedVersions release];
+ CFRetain(m_bundleIDsWithAvailableUpdates);
+ [m_bundleIDsWithAvailableUpdates release];
+}
+
+}
+
+#endif
Copied: trunk/Source/WebCore/platform/mac/WebGLBlacklist.h (from rev 204461, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 204462)
--- trunk/Source/WebCore/platform/mac/WebGLBlacklist.h (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebGLBlacklist.h 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if PLATFORM(MAC)
+
+#include <memory>
+#include <string>
+#include <vector>
+
+OBJC_CLASS NSDictionary;
+
+namespace WebCore {
+
+class WebGLBlacklist {
+public:
+ enum BlockComparison {
+ Equals,
+ LessThan,
+ LessThanEquals
+ };
+
+ WEBCORE_EXPORT static bool shouldBlockWebGL();
+ WEBCORE_EXPORT static bool shouldSuggestBlockingWebGL();
+
+ static std::unique_ptr<WebGLBlacklist> create(NSDictionary *propertyList);
+ ~WebGLBlacklist();
+
+ bool shouldBlock() const;
+ bool shouldSuggestBlocking() const;
+
+private:
+ enum class BlockCommand {
+ Allow,
+ Block,
+ SuggestBlocking
+ };
+
+ WebGLBlacklist(BlockCommand);
+
+ BlockCommand m_command;
+};
+
+}
+
+#endif
Added: trunk/Source/WebCore/platform/mac/WebGLBlacklist.mm (0 => 204462)
--- trunk/Source/WebCore/platform/mac/WebGLBlacklist.mm (rev 0)
+++ trunk/Source/WebCore/platform/mac/WebGLBlacklist.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,265 @@
+/*
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebGLBlacklist.h"
+
+#if PLATFORM(MAC)
+
+#import "BlacklistUpdater.h"
+#import "CFUtilitiesSPI.h"
+#import <OpenGL/OpenGL.h>
+
+namespace WebCore {
+
+struct OSBuildInfo {
+ OSBuildInfo()
+ : major(0)
+ , minor(0)
+ , build(0)
+ {
+ }
+
+ OSBuildInfo(int major, int minor, int build)
+ : major(major)
+ , minor(minor)
+ , build(build)
+ {
+ }
+
+ bool operator==(const OSBuildInfo& other) const
+ {
+ return major == other.major && minor == other.minor && build == other.build;
+ }
+
+ bool operator>(const OSBuildInfo& other) const
+ {
+ return std::tie(major, minor, build) > std::tie(other.major, other.minor, other.build);
+ }
+
+ bool operator<=(const OSBuildInfo& other) const
+ {
+ return std::tie(major, minor, build) <= std::tie(other.major, other.minor, other.build);
+ }
+
+ bool operator<(const OSBuildInfo& other) const
+ {
+ return std::tie(major, minor, build) < std::tie(other.major, other.minor, other.build);
+ }
+
+ int major; // Represents the 13 in 13C64.
+ int minor; // Represents the C in 13C64 (as a number where A == 1, i.e. 3).
+ int build; // Represents the 64 in 13C64.
+};
+
+static OSBuildInfo buildInfoFromOSBuildString(NSString *buildString)
+{
+ NSError *error = NULL;
+ NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(\\d+)([A-Z])(\\d+)" options:0 error:&error];
+ NSArray *matches = [regex matchesInString:buildString options:0 range:NSMakeRange(0, [buildString length])];
+ if (!matches || matches.count != 1) {
+#ifndef NDEBUG
+ NSLog(@"WebGLBlacklist could not parse OSBuild entry: %@", buildString);
+#endif
+ return OSBuildInfo();
+ }
+
+ NSTextCheckingResult *matchResult = [matches objectAtIndex:0];
+
+ if (matchResult.numberOfRanges != 4) {
+#ifndef NDEBUG
+ NSLog(@"WebGLBlacklist could not parse OSBuild entry: %@", buildString);
+#endif
+ return OSBuildInfo();
+ }
+
+ int majorVersion = [[buildString substringWithRange:[matchResult rangeAtIndex:1]] intValue];
+ int minorVersion = [[buildString substringWithRange:[matchResult rangeAtIndex:2]] characterAtIndex:0] - 'A' + 1;
+ int buildVersion = [[buildString substringWithRange:[matchResult rangeAtIndex:3]] intValue];
+
+ return OSBuildInfo(majorVersion, minorVersion, buildVersion);
+}
+
+bool WebGLBlacklist::shouldBlockWebGL()
+{
+ BlacklistUpdater::initializeQueue();
+
+ __block bool shouldBlock = false;
+ dispatch_sync(BlacklistUpdater::queue(), ^{
+ BlacklistUpdater::reloadIfNecessary();
+
+ WebGLBlacklist* webGLBlacklist = BlacklistUpdater::webGLBlacklist();
+ if (webGLBlacklist)
+ shouldBlock = webGLBlacklist->shouldBlock();
+ });
+
+ return shouldBlock;
+}
+
+bool WebGLBlacklist::shouldSuggestBlockingWebGL()
+{
+ BlacklistUpdater::initializeQueue();
+
+ __block bool shouldSuggestBlocking = false;
+ dispatch_sync(BlacklistUpdater::queue(), ^{
+ BlacklistUpdater::reloadIfNecessary();
+
+ WebGLBlacklist* webGLBlacklist = BlacklistUpdater::webGLBlacklist();
+ if (webGLBlacklist)
+ shouldSuggestBlocking = webGLBlacklist->shouldSuggestBlocking();
+ });
+
+ return shouldSuggestBlocking;
+}
+
+static bool matchesGPU(GLint machineId, GLint rendererMask)
+{
+ // If the last two bytes of the rendererMask are not zero, then we're
+ // looking for an exact GPU match. Otherwise we're matching against
+ // a class of GPUs.
+
+ if (rendererMask & 0xFF)
+ return machineId == rendererMask;
+
+ return (machineId & kCGLRendererIDMatchingMask) == rendererMask;
+}
+
+static GLint gpuMaskFromString(NSString *input)
+{
+ NSScanner* scanner = [NSScanner scannerWithString:input];
+ unsigned maskValue;
+ [scanner scanHexInt:&maskValue];
+ return static_cast<GLint>(maskValue & (kCGLRendererIDMatchingMask | 0xFF));
+}
+
+static bool matchesBuildInfo(OSBuildInfo machineInfo, OSBuildInfo blockInfo, WebGLBlacklist::BlockComparison comparison)
+{
+ switch (comparison) {
+ case WebGLBlacklist::BlockComparison::Equals:
+ return machineInfo == blockInfo;
+ case WebGLBlacklist::BlockComparison::LessThan:
+ return machineInfo < blockInfo;
+ case WebGLBlacklist::BlockComparison::LessThanEquals:
+ return machineInfo <= blockInfo;
+ }
+}
+
+std::unique_ptr<WebGLBlacklist> WebGLBlacklist::create(NSDictionary *propertyList)
+{
+ CFDictionaryRef systemVersionDictionary = _CFCopySystemVersionDictionary();
+ CFStringRef osBuild = static_cast<CFStringRef>(CFDictionaryGetValue(systemVersionDictionary, _kCFSystemVersionBuildVersionKey));
+ OSBuildInfo buildInfo = buildInfoFromOSBuildString((NSString *)osBuild);
+ CFRelease(systemVersionDictionary);
+
+ if (!buildInfo.major)
+ return nullptr;
+
+ NSArray *blockEntries = [propertyList objectForKey:@"WebGLBlacklist"];
+
+ if (![blockEntries isKindOfClass:[NSArray class]] || !blockEntries.count)
+ return nullptr;
+
+ CGLPixelFormatAttribute attribs[12] = {
+ kCGLPFAColorSize, (CGLPixelFormatAttribute)32,
+ kCGLPFADepthSize, (CGLPixelFormatAttribute)32,
+ kCGLPFAAccelerated,
+ kCGLPFASupersample,
+ kCGLPFAMultisample,
+ kCGLPFASampleBuffers, (CGLPixelFormatAttribute)1,
+ kCGLPFASamples, (CGLPixelFormatAttribute)4,
+ (CGLPixelFormatAttribute)0
+ };
+
+ CGLPixelFormatObj pix;
+ GLint npix;
+ CGLChoosePixelFormat(attribs, &pix, &npix);
+ CGLContextObj ctx;
+ CGLCreateContext(pix, 0, &ctx);
+ GLint rendererId = 0;
+ CGLGetParameter(ctx, kCGLCPCurrentRendererID, &rendererId);
+ GLint supportsSeparateAddressSpace = 0;
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
+ CGLGetParameter(ctx, kCGLCPSupportSeparateAddressSpace, &supportsSeparateAddressSpace);
+#endif
+ CGLDestroyContext(ctx);
+ CGLReleasePixelFormat(pix);
+
+ rendererId &= kCGLRendererIDMatchingMask | 0xFF;
+
+ BlockCommand globalCommand = BlockCommand::Allow;
+
+ for (NSDictionary *blockData in blockEntries) {
+
+ GLint gpuMask = gpuMaskFromString([blockData objectForKey:@"GPU"]);
+
+ OSBuildInfo blockedBuildInfo = buildInfoFromOSBuildString(static_cast<NSString*>([blockData objectForKey:@"OSBuild"]));
+
+ NSString *comparisonString = [blockData objectForKey:@"Comparison"];
+ BlockComparison comparison = BlockComparison::Equals;
+ if ([comparisonString isEqualToString:@"LessThan"])
+ comparison = BlockComparison::LessThan;
+ else if ([comparisonString isEqualToString:@"LessThanEquals"])
+ comparison = BlockComparison::LessThanEquals;
+
+ NSString *commandString = [blockData objectForKey:@"Command"];
+ BlockCommand command = BlockCommand::Allow;
+ if ([commandString isEqualToString:@"Block"])
+ command = BlockCommand::Block;
+ else if ([commandString isEqualToString:@"SuggestBlocking"])
+ command = BlockCommand::SuggestBlocking;
+
+ if (matchesGPU(rendererId, gpuMask) && matchesBuildInfo(buildInfo, blockedBuildInfo, comparison)) {
+ globalCommand = command;
+ break;
+ }
+ }
+
+ if (!supportsSeparateAddressSpace && globalCommand == BlockCommand::Allow)
+ globalCommand = BlockCommand::SuggestBlocking;
+
+ return std::unique_ptr<WebGLBlacklist>(new WebGLBlacklist(globalCommand));
+}
+
+bool WebGLBlacklist::shouldBlock() const
+{
+ return m_command == BlockCommand::Block;
+}
+
+bool WebGLBlacklist::shouldSuggestBlocking() const
+{
+ return m_command == BlockCommand::SuggestBlocking;
+}
+
+WebGLBlacklist::WebGLBlacklist(BlockCommand command)
+ : m_command(command)
+{
+}
+
+WebGLBlacklist::~WebGLBlacklist()
+{
+}
+
+}
+#endif
Copied: trunk/Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h (from rev 204461, trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h) (0 => 204462)
--- trunk/Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h (rev 0)
+++ trunk/Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h 2016-08-15 16:43:13 UTC (rev 204462)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#if USE(APPLE_INTERNAL_SDK)
+#import <CoreFoundation/CFPriv.h>
+#endif
+
+extern "C" {
+CFDictionaryRef _CFCopySystemVersionDictionary(void);
+extern const CFStringRef _kCFSystemVersionProductVersionKey;
+extern const CFStringRef _kCFSystemVersionBuildVersionKey;
+}
Modified: trunk/Source/WebKit/mac/ChangeLog (204461 => 204462)
--- trunk/Source/WebKit/mac/ChangeLog 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit/mac/ChangeLog 2016-08-15 16:43:13 UTC (rev 204462)
@@ -1,3 +1,20 @@
+2016-08-12 Anders Carlsson <[email protected]>
+
+ Move the plug-in and WebGL blacklist code to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160831
+
+ Reviewed by Sam Weinig.
+
+ Adopt the plug-in and WebGL blacklist code from WebCore instead of using the code from WebKitSystemInterface.
+
+ * WebCoreSupport/WebFrameLoaderClient.mm:
+ (shouldBlockPlugin):
+ (WebFrameLoaderClient::createPlugin):
+ (WebFrameLoaderClient::createJavaAppletWidget):
+ (shouldBlockWebGL):
+ (WebFrameLoaderClient::webGLPolicyForURL):
+ (WebFrameLoaderClient::resolveWebGLPolicyForURL):
+
2016-08-14 Daniel Bates <[email protected]>
Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm (204461 => 204462)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -108,6 +108,7 @@
#import <WebCore/NSURLDownloadSPI.h>
#import <WebCore/NSURLFileTypeMappingsSPI.h>
#import <WebCore/Page.h>
+#import <WebCore/PluginBlacklist.h>
#import <WebCore/PluginViewBase.h>
#import <WebCore/ProtectionSpace.h>
#import <WebCore/ResourceError.h>
@@ -118,6 +119,7 @@
#import <WebCore/SharedBuffer.h>
#import <WebCore/SubresourceLoader.h>
#import <WebCore/WebCoreObjCExtras.h>
+#import <WebCore/WebGLBlacklist.h>
#import <WebCore/WebScriptObjectPrivate.h>
#import <WebCore/Widget.h>
#import <WebKitLegacy/DOMElement.h>
@@ -1890,6 +1892,17 @@
#endif // ENABLE(NETSCAPE_PLUGIN_API)
+static bool shouldBlockPlugin(WebBasePluginPackage *pluginPackage)
+{
+#if PLATFORM(MAC)
+ auto loadPolicy = PluginBlacklist::loadPolicyForPluginVersion(pluginPackage.bundleIdentifier, pluginPackage.bundleVersion);
+ return loadPolicy == PluginBlacklist::LoadPolicy::BlockedForSecurity || loadPolicy == PluginBlacklist::LoadPolicy::BlockedForCompatibility;
+#else
+ UNUSED_PARAM(pluginPackage);
+ return false;
+#endif
+}
+
RefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLPlugInElement* element, const URL& url,
const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType, bool loadManually)
{
@@ -1973,7 +1986,7 @@
NSView *view = nil;
if (pluginPackage) {
- if (WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) {
+ if (shouldBlockPlugin(pluginPackage)) {
errorCode = WebKitErrorBlockedPlugInVersion;
if (is<RenderEmbeddedObject>(element->renderer()))
downcast<RenderEmbeddedObject>(*element->renderer()).setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
@@ -2078,7 +2091,7 @@
int errorCode = WebKitErrorJavaUnavailable;
if (pluginPackage) {
- if (WKShouldBlockPlugin([pluginPackage bundleIdentifier], [pluginPackage bundleVersion])) {
+ if (shouldBlockPlugin(pluginPackage)) {
errorCode = WebKitErrorBlockedPlugInVersion;
if (is<RenderEmbeddedObject>(element->renderer()))
downcast<RenderEmbeddedObject>(*element->renderer()).setPluginUnavailabilityReason(RenderEmbeddedObject::InsecurePluginVersion);
@@ -2126,14 +2139,23 @@
}
#if ENABLE(WEBGL)
+static bool shouldBlockWebGL()
+{
+#if PLATFORM(MAC)
+ return WebGLBlacklist::shouldBlockWebGL();
+#else
+ return false;
+#endif
+}
+
WebCore::WebGLLoadPolicy WebFrameLoaderClient::webGLPolicyForURL(const String&) const
{
- return WKShouldBlockWebGL() ? WebGLBlockCreation : WebGLAllowCreation;
+ return shouldBlockWebGL() ? WebGLBlockCreation : WebGLAllowCreation;
}
WebCore::WebGLLoadPolicy WebFrameLoaderClient::resolveWebGLPolicyForURL(const String&) const
{
- return WKShouldBlockWebGL() ? WebGLBlockCreation : WebGLAllowCreation;
+ return shouldBlockWebGL() ? WebGLBlockCreation : WebGLAllowCreation;
}
#endif // ENABLE(WEBGL)
Modified: trunk/Source/WebKit2/ChangeLog (204461 => 204462)
--- trunk/Source/WebKit2/ChangeLog 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-15 16:43:13 UTC (rev 204462)
@@ -1,3 +1,27 @@
+2016-08-12 Anders Carlsson <[email protected]>
+
+ Move the plug-in and WebGL blacklist code to WebCore
+ https://bugs.webkit.org/show_bug.cgi?id=160831
+
+ Reviewed by Sam Weinig.
+
+ Adopt the plug-in and WebGL blacklist code from WebCore instead of using the code from WebKitSystemInterface.
+
+ * Shared/Plugins/Netscape/mac/PluginInformationMac.mm:
+ (WebKit::getPlatformPluginModuleInformation):
+ * Shared/Plugins/PluginModuleInfo.h:
+ * UIProcess/API/C/mac/WKContextPrivateMac.mm:
+ (WKContextIsPlugInUpdateAvailable):
+ (WKContextShouldBlockWebGL):
+ (WKContextShouldSuggestBlockWebGL):
+ * UIProcess/Plugins/PluginInfoStore.h:
+ * UIProcess/Plugins/mac/PluginInfoStoreMac.mm:
+ (WebKit::shouldBlockPlugin):
+ (WebKit::PluginInfoStore::defaultLoadPolicyForPlugin):
+ (WebKit::WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy): Deleted.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::findPlugin):
+
2016-08-10 Brent Fulgham <[email protected]>
Add Sandbox profile for Enterprise support version of Flash Player
Modified: trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/PluginInformationMac.mm (204461 => 204462)
--- trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/PluginInformationMac.mm 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit2/Shared/Plugins/Netscape/mac/PluginInformationMac.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -32,8 +32,10 @@
#import "APIString.h"
#import "PluginModuleInfo.h"
#import "StringUtilities.h"
-#import <WebKitSystemInterface.h>
+#import <WebCore/PluginBlacklist.h>
+using namespace WebCore;
+
namespace WebKit {
void getPlatformPluginModuleInformation(const PluginModuleInfo& plugin, API::Dictionary::MapType& map)
@@ -41,7 +43,7 @@
map.set(pluginInformationBundleIdentifierKey(), API::String::create(plugin.bundleIdentifier));
map.set(pluginInformationBundleVersionKey(), API::String::create(plugin.versionString));
map.set(pluginInformationBundleShortVersionKey(), API::String::create(plugin.shortVersionString));
- map.set(pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey(), API::Boolean::create(WKIsPluginUpdateAvailable(nsStringFromWebCoreString(plugin.bundleIdentifier))));
+ map.set(pluginInformationUpdatePastLastBlockedVersionIsKnownAvailableKey(), API::Boolean::create(WebCore::PluginBlacklist::isPluginUpdateAvailable(nsStringFromWebCoreString(plugin.bundleIdentifier))));
map.set(pluginInformationHasSandboxProfileKey(), API::Boolean::create(plugin.hasSandboxProfile));
}
Modified: trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h (204461 => 204462)
--- trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit2/Shared/Plugins/PluginModuleInfo.h 2016-08-15 16:43:13 UTC (rev 204462)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PluginModuleInfo_h
-#define PluginModuleInfo_h
+#pragma once
#include <WebCore/PluginData.h>
@@ -63,5 +62,3 @@
};
} // namespace WebKit
-
-#endif // PluginModuleInfo_h
Modified: trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm (204461 => 204462)
--- trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -38,7 +38,8 @@
#import "WKSharedAPICast.h"
#import "WKStringCF.h"
#import "WebProcessPool.h"
-#import <WebKitSystemInterface.h>
+#import <WebCore/PluginBlacklist.h>
+#import <WebCore/WebGLBlacklist.h>
#import <wtf/RetainPtr.h>
using namespace WebKit;
@@ -48,7 +49,7 @@
#if PLATFORM(IOS)
return false;
#else
- return WKIsPluginUpdateAvailable((NSString *)adoptCF(WKStringCopyCFString(kCFAllocatorDefault, plugInBundleIdentifierRef)).get());
+ return WebCore::PluginBlacklist::isPluginUpdateAvailable((NSString *)adoptCF(WKStringCopyCFString(kCFAllocatorDefault, plugInBundleIdentifierRef)).get());
#endif
}
@@ -156,10 +157,18 @@
bool WKContextShouldBlockWebGL()
{
- return WKShouldBlockWebGL();
+#if PLATFORM(MAC)
+ return WebCore::WebGLBlacklist::shouldBlockWebGL();
+#else
+ return false;
+#endif
}
bool WKContextShouldSuggestBlockWebGL()
{
- return WKShouldSuggestBlockingWebGL();
+#if PLATFORM(MAC)
+ return WebCore::WebGLBlacklist::shouldSuggestBlockingWebGL();
+#else
+ return false;
+#endif
}
Modified: trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm (204461 => 204462)
--- trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm 2016-08-15 16:10:09 UTC (rev 204461)
+++ trunk/Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm 2016-08-15 16:43:13 UTC (rev 204462)
@@ -31,7 +31,7 @@
#import "Logging.h"
#import "NetscapePluginModule.h"
#import "SandboxUtilities.h"
-#import "WebKitSystemInterface.h"
+#import <WebCore/PluginBlacklist.h>
#import <WebCore/WebCoreNSStringExtras.h>
#import <wtf/HashSet.h>
#import <wtf/RetainPtr.h>
@@ -76,7 +76,7 @@
static bool shouldBlockPlugin(const PluginModuleInfo& plugin)
{
PluginModuleLoadPolicy loadPolicy = PluginInfoStore::defaultLoadPolicyForPlugin(plugin);
- return (loadPolicy == PluginModuleBlockedForSecurity) || (loadPolicy == PluginModuleBlockedForCompatibility);
+ return loadPolicy == PluginModuleBlockedForSecurity || loadPolicy == PluginModuleBlockedForCompatibility;
}
bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlugins, const PluginModuleInfo& plugin)
@@ -108,29 +108,18 @@
return true;
}
-inline PluginModuleLoadPolicy WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy(WKPlugInModuleLoadPolicy wksiPolicy)
+PluginModuleLoadPolicy PluginInfoStore::defaultLoadPolicyForPlugin(const PluginModuleInfo& plugin)
{
-
- switch (wksiPolicy) {
- case WKPlugInModuleLoadPolicyLoadNormally:
- return PluginModuleLoadNormally;
- case WKPlugInModuleLoadPolicyLoadUnsandboxed:
- return PluginModuleLoadUnsandboxed;
- case WKPlugInModuleLoadPolicyBlockedForSecurity:
- return PluginModuleBlockedForSecurity;
- case WKPlugInModuleLoadPolicyBlockedForCompatibility:
- return PluginModuleBlockedForCompatibility;
+ switch (PluginBlacklist::loadPolicyForPluginVersion(plugin.bundleIdentifier, plugin.versionString)) {
+ case PluginBlacklist::LoadPolicy::LoadNormally:
+ return PluginModuleLoadNormally;
+ case PluginBlacklist::LoadPolicy::BlockedForSecurity:
+ return PluginModuleBlockedForSecurity;
+ case PluginBlacklist::LoadPolicy::BlockedForCompatibility:
+ return PluginModuleBlockedForCompatibility;
}
-
- ASSERT_NOT_REACHED();
- return PluginModuleBlockedForSecurity;
}
-PluginModuleLoadPolicy PluginInfoStore::defaultLoadPolicyForPlugin(const PluginModuleInfo& plugin)
-{
- return WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy(WKLoadPolicyForPluginVersion(plugin.bundleIdentifier, plugin.versionString));
-}
-
PluginModuleInfo PluginInfoStore::findPluginWithBundleIdentifier(const String& bundleIdentifier)
{
loadPluginsIfNecessary();