Move the plug-in and WebGL blacklist code to WebCore
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Aug 2016 16:43:13 +0000 (16:43 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Aug 2016 16:43:13 +0000 (16:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160831

Reviewed by Sam Weinig.

Source/WebCore:

* 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.

Source/WebKit/mac:

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):

Source/WebKit2:

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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204462 268f45cc-cd09-0410-ab3c-d52691b4dbfc

16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/mac/BlacklistUpdater.h [new file with mode: 0644]
Source/WebCore/platform/mac/BlacklistUpdater.mm [new file with mode: 0644]
Source/WebCore/platform/mac/PluginBlacklist.h [new file with mode: 0644]
Source/WebCore/platform/mac/PluginBlacklist.mm [new file with mode: 0644]
Source/WebCore/platform/mac/WebGLBlacklist.h [new file with mode: 0644]
Source/WebCore/platform/mac/WebGLBlacklist.mm [new file with mode: 0644]
Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h [new file with mode: 0644]
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/Plugins/Netscape/mac/PluginInformationMac.mm
Source/WebKit2/Shared/Plugins/PluginModuleInfo.h
Source/WebKit2/UIProcess/API/C/mac/WKContextPrivateMac.mm
Source/WebKit2/UIProcess/Plugins/mac/PluginInfoStoreMac.mm

index e12bab6..078886d 100644 (file)
@@ -1,3 +1,49 @@
+2016-08-12  Anders Carlsson  <andersca@apple.com>
+
+        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  <cdumez@apple.com>
 
         Align the event listener firing code with the latest DOM Specification and simplify it
index 5cb6382..c02a18e 100644 (file)
                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, ); }; };
                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>"; };
                                65086DA719AC1719009AF46B /* CFLocaleSPI.h */,
                                A10D7FEB1C2676D100C6C115 /* CFNetworkConnectionCacheSPI.h */,
                                CE12525A1A1C018200864480 /* CFNetworkSPI.h */,
+                               1AFFC4561D5E83A700267A66 /* CFUtilitiesSPI.h */,
                                4449A4041A964B0000B64AD5 /* CoreMediaSPI.h */,
                        );
                        path = cf;
                6582A14809999D6C00BEEB6D /* mac */ = {
                        isa = PBXGroup;
                        children = (
+                               1AFFC44D1D5E7EC700267A66 /* BlacklistUpdater.h */,
+                               1AFFC44E1D5E7EC700267A66 /* BlacklistUpdater.mm */,
                                F58784F002DE375901EA4122 /* CursorMac.mm */,
                                A795463D0B5C4C80007B438F /* DragDataMac.mm */,
                                A7CFB3D40B7ED1180070C32D /* DragImageMac.mm */,
                                C5F765BA14E1ECF4006C899B /* PlatformPasteboardMac.mm */,
                                BC94D1070C274F88006BC617 /* PlatformScreenMac.mm */,
                                29E4D8E016B0959800C84704 /* PlatformSpeechSynthesizerMac.mm */,
+                               1AFFC44F1D5E7EC700267A66 /* PluginBlacklist.h */,
+                               1AFFC4501D5E7EC700267A66 /* PluginBlacklist.mm */,
                                4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */,
                                46DBB64E1AB8C96F00D9A813 /* PowerObserverMac.h */,
                                0081FEFE16B0A2B6008AAA7A /* PublicSuffixMac.mm */,
                                93EB169409F880B00091F8FF /* WebCoreSystemInterface.mm */,
                                BE855F7F0701E83500239769 /* WebCoreView.h */,
                                BE8560510701F91100239769 /* WebCoreView.m */,
+                               1AFFC4511D5E7EC700267A66 /* WebGLBlacklist.h */,
+                               1AFFC4521D5E7EC700267A66 /* WebGLBlacklist.mm */,
                                E1A3162B134BC32D007C9A4F /* WebNSAttributedStringExtras.h */,
                                E1A3162C134BC32D007C9A4F /* WebNSAttributedStringExtras.mm */,
                                CD5896E01CD2B15100B3BCC8 /* WebPlaybackControlsManager.h */,
                BCF1A5BA097832090061A123 /* platform */ = {
                        isa = PBXGroup;
                        children = (
-                               5C6E653F1D5CEDC900F7862E /* URLParser.cpp */,
-                               5C6E65401D5CEDC900F7862E /* URLParser.h */,
                                49E912A40EFAC8E6009D0CAF /* animation */,
                                FD31604012B026A300C1A359 /* audio */,
                                1AE42F670AA4B8CB00C8612D /* cf */,
                                6593923509AE4346002C531F /* URL.cpp */,
                                6593923609AE4346002C531F /* URL.h */,
                                BCBD21AA0E417AD400A070F2 /* URLHash.h */,
+                               5C6E653F1D5CEDC900F7862E /* URLParser.cpp */,
+                               5C6E65401D5CEDC900F7862E /* URLParser.h */,
                                868160D1187669C40021E79D /* UserActivity.cpp */,
                                868160D2187669C40021E79D /* UserActivity.h */,
                                71C916071D1483A300ACA47D /* UserInterfaceLayoutDirection.h */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
                                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 */,
diff --git a/Source/WebCore/platform/mac/BlacklistUpdater.h b/Source/WebCore/platform/mac/BlacklistUpdater.h
new file mode 100644 (file)
index 0000000..6c1f260
--- /dev/null
@@ -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
diff --git a/Source/WebCore/platform/mac/BlacklistUpdater.mm b/Source/WebCore/platform/mac/BlacklistUpdater.mm
new file mode 100644 (file)
index 0000000..de738c1
--- /dev/null
@@ -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 = [NSData 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
diff --git a/Source/WebCore/platform/mac/PluginBlacklist.h b/Source/WebCore/platform/mac/PluginBlacklist.h
new file mode 100644 (file)
index 0000000..85365fb
--- /dev/null
@@ -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
diff --git a/Source/WebCore/platform/mac/PluginBlacklist.mm b/Source/WebCore/platform/mac/PluginBlacklist.mm
new file mode 100644 (file)
index 0000000..ebcc94f
--- /dev/null
@@ -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
diff --git a/Source/WebCore/platform/mac/WebGLBlacklist.h b/Source/WebCore/platform/mac/WebGLBlacklist.h
new file mode 100644 (file)
index 0000000..5ff72a2
--- /dev/null
@@ -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
diff --git a/Source/WebCore/platform/mac/WebGLBlacklist.mm b/Source/WebCore/platform/mac/WebGLBlacklist.mm
new file mode 100644 (file)
index 0000000..f868f81
--- /dev/null
@@ -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
diff --git a/Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h b/Source/WebCore/platform/spi/cf/CFUtilitiesSPI.h
new file mode 100644 (file)
index 0000000..15686b4
--- /dev/null
@@ -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;
+}
index fc6a034..c7b3bf8 100644 (file)
@@ -1,3 +1,20 @@
+2016-08-12  Anders Carlsson  <andersca@apple.com>
+
+        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  <dabates@apple.com>
 
         Fix compiler errors when building iOS WebKit using the iOS 10 beta SDK
index ecf2f50..2e07bc4 100644 (file)
 #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>
 #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 @@ private:
 
 #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 @@ RefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, HTMLPlugI
     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 @@ PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget(const IntSize& s
     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 @@ String WebFrameLoaderClient::overrideMediaType() const
 }
 
 #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)
 
index c8fb88c..48ea9a4 100644 (file)
@@ -1,3 +1,27 @@
+2016-08-12  Anders Carlsson  <andersca@apple.com>
+
+        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  <bfulgham@apple.com>
 
         Add Sandbox profile for Enterprise support version of Flash Player
index 4393691..5ec8424 100644 (file)
@@ -32,7 +32,9 @@
 #import "APIString.h"
 #import "PluginModuleInfo.h"
 #import "StringUtilities.h"
-#import <WebKitSystemInterface.h>
+#import <WebCore/PluginBlacklist.h>
+
+using namespace WebCore;
 
 namespace WebKit {
 
@@ -41,7 +43,7 @@ void getPlatformPluginModuleInformation(const PluginModuleInfo& plugin, API::Dic
     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));
 }
 
index cbc1876..e5360f8 100644 (file)
@@ -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 @@ struct PluginModuleInfo {
 };
 
 } // namespace WebKit
-
-#endif // PluginModuleInfo_h
index b258632..7f93c1e 100644 (file)
@@ -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 @@ bool WKContextIsPlugInUpdateAvailable(WKContextRef contextRef, WKStringRef plugI
 #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 @@ WKStringRef WKPlugInInfoIsSandboxedKey()
 
 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
 }
index 9622765..a1b06bd 100644 (file)
@@ -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 @@ bool PluginInfoStore::getPluginInfo(const String& pluginPath, PluginModuleInfo&
 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,27 +108,16 @@ bool PluginInfoStore::shouldUsePlugin(Vector<PluginModuleInfo>& alreadyLoadedPlu
     return true;
 }
 
-inline PluginModuleLoadPolicy WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy(WKPlugInModuleLoadPolicy wksiPolicy)
-{
-
-    switch (wksiPolicy) {
-        case WKPlugInModuleLoadPolicyLoadNormally:
-            return PluginModuleLoadNormally;
-        case WKPlugInModuleLoadPolicyLoadUnsandboxed:
-            return PluginModuleLoadUnsandboxed;
-        case WKPlugInModuleLoadPolicyBlockedForSecurity:
-            return PluginModuleBlockedForSecurity;
-        case WKPlugInModuleLoadPolicyBlockedForCompatibility:
-            return PluginModuleBlockedForCompatibility;
-    }
-
-    ASSERT_NOT_REACHED();
-    return PluginModuleBlockedForSecurity;
-}
-
 PluginModuleLoadPolicy PluginInfoStore::defaultLoadPolicyForPlugin(const PluginModuleInfo& plugin)
 {
-    return WKPlugInModuleLoadPolicyToPluginModuleLoadPolicy(WKLoadPolicyForPluginVersion(plugin.bundleIdentifier, plugin.versionString));
+    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;
+    }
 }
 
 PluginModuleInfo PluginInfoStore::findPluginWithBundleIdentifier(const String& bundleIdentifier)