Add a temporarily off by default preference for doing safe browsing checks
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 14:31:39 +0000 (14:31 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Oct 2018 14:31:39 +0000 (14:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=190522

Reviewed by Chris Dumez.

Safe browsing development has taken longer than anticipated.
To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now.
I'll make it on by default when it's actually used.

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _setSafeBrowsingEnabled:]):
(-[WKPreferences _safeBrowsingEnabled]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::decidePolicyForNavigationAction):

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

Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit/UIProcess/WebPageProxy.cpp

index b5334a3..9528972 100644 (file)
@@ -1,5 +1,24 @@
 2018-10-15  Alex Christensen  <achristensen@webkit.org>
 
+        Add a temporarily off by default preference for doing safe browsing checks
+        https://bugs.webkit.org/show_bug.cgi?id=190522
+
+        Reviewed by Chris Dumez.
+
+        Safe browsing development has taken longer than anticipated.
+        To prevent the unused possible contacting the safe browsing provider for no benefit, make this off by default for now.
+        I'll make it on by default when it's actually used.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _setSafeBrowsingEnabled:]):
+        (-[WKPreferences _safeBrowsingEnabled]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::decidePolicyForNavigationAction):
+
+2018-10-15  Alex Christensen  <achristensen@webkit.org>
+
         Include EnumTraits.h less
         https://bugs.webkit.org/show_bug.cgi?id=190535
 
index 756498b..f13e4f2 100644 (file)
@@ -46,6 +46,11 @@ XSSAuditorEnabled:
   type: bool
   defaultValue: true
 
+SafeBrowsingEnabled:
+  type: bool
+  defaultValue: false
+  webcoreBinding: none
+
 PrivateBrowsingEnabled:
   type: bool
   defaultValue: false
index 1dd3f63..53177ec 100644 (file)
@@ -697,6 +697,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setICECandidateFilteringEnabled(enabled);
 }
 
+- (void)_setSafeBrowsingEnabled:(BOOL)enabled
+{
+    _preferences->setSafeBrowsingEnabled(enabled);
+}
+
+- (BOOL)_safeBrowsingEnabled
+{
+    return _preferences->safeBrowsingEnabled();
+}
+
 - (BOOL)_webRTCLegacyAPIEnabled
 {
     return NO;
index 28698bf..ce9889f 100644 (file)
@@ -121,6 +121,7 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) {
 @property (nonatomic, setter=_setICECandidateFilteringEnabled:) BOOL _iceCandidateFilteringEnabled WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 @property (nonatomic, setter=_setWebRTCLegacyAPIEnabled:) BOOL _webRTCLegacyAPIEnabled WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 @property (nonatomic, setter=_setInactiveMediaCaptureSteamRepromptIntervalInMinutes:) double _inactiveMediaCaptureSteamRepromptIntervalInMinutes WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
+@property (nonatomic, setter=_setSafeBrowsingEnabled:) BOOL _safeBrowsingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 @property (nonatomic, setter=_setDOMPasteAllowed:) BOOL _domPasteAllowed WK_API_AVAILABLE(macosx(10.13), ios(11.0));
index e10e88c..64415b2 100644 (file)
@@ -4114,6 +4114,9 @@ void WebPageProxy::decidePolicyForNavigationAction(WebFrameProxy& frame, const W
     UNUSED_PARAM(newNavigationID);
 #endif
 
+    if (!m_preferences->safeBrowsingEnabled())
+        shouldSkipSafeBrowsingCheck = ShouldSkipSafeBrowsingCheck::Yes;
+
     auto listener = makeRef(frame.setUpPolicyListenerProxy([this, protectedThis = makeRef(*this), frame = makeRef(frame), sender = WTFMove(sender), navigation] (WebCore::PolicyAction policyAction, API::WebsitePolicies* policies, ProcessSwapRequestedByClient processSwapRequestedByClient, Vector<Ref<SafeBrowsingResult>>&&) mutable {
         // FIXME: do something with the SafeBrowsingResults.
         receivedNavigationPolicyDecision(policyAction, navigation.get(), processSwapRequestedByClient, frame, policies, WTFMove(sender));