Title: [241728] trunk
Revision
241728
Author
achristen...@apple.com
Date
2019-02-18 10:34:41 -0800 (Mon, 18 Feb 2019)

Log Message

Disable safe browsing in WKWebView and remove its WKPreferences API
https://bugs.webkit.org/show_bug.cgi?id=194723
<rdar://problem/48122993>

Reviewed by Geoffrey Garen.

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/Cocoa/WKPreferences.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
(-[WKPreferences isSafeBrowsingEnabled]): Deleted.

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
(TEST):
(safeBrowsingView):
Make tests use SPI instead of API.

LayoutTests:

* platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
This test has results that depend on timing, and I need to update its results when I disable safe browsing.
I've done this several times before.  See r237876 for an example.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (241727 => 241728)


--- trunk/LayoutTests/ChangeLog	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/LayoutTests/ChangeLog	2019-02-18 18:34:41 UTC (rev 241728)
@@ -1,3 +1,15 @@
+2019-02-18  Alex Christensen  <achristen...@webkit.org>
+
+        Disable safe browsing in WKWebView and remove its WKPreferences API
+        https://bugs.webkit.org/show_bug.cgi?id=194723
+        <rdar://problem/48122993>
+
+        Reviewed by Geoffrey Garen.
+
+        * platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
+        This test has results that depend on timing, and I need to update its results when I disable safe browsing.
+        I've done this several times before.  See r237876 for an example.
+
 2019-02-18  Antoine Quint  <grao...@apple.com>
 
         [iOS] Dispatch additional events along with pointerdown and pointerup

Modified: trunk/LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (241727 => 241728)


--- trunk/LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt	2019-02-18 18:34:41 UTC (rev 241728)
@@ -10,8 +10,6 @@
 CONSOLE MESSAGE: line 55: Pasting text "d".
 CONSOLE MESSAGE: line 58: Input element value after text input events: "".
 CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
-CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
-CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
 CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
 CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
 CONSOLE MESSAGE: line 34: Dispatching untrusted keypress event.

Modified: trunk/Source/WebKit/ChangeLog (241727 => 241728)


--- trunk/Source/WebKit/ChangeLog	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Source/WebKit/ChangeLog	2019-02-18 18:34:41 UTC (rev 241728)
@@ -1,3 +1,17 @@
+2019-02-18  Alex Christensen  <achristen...@webkit.org>
+
+        Disable safe browsing in WKWebView and remove its WKPreferences API
+        https://bugs.webkit.org/show_bug.cgi?id=194723
+        <rdar://problem/48122993>
+
+        Reviewed by Geoffrey Garen.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/Cocoa/WKPreferences.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences setSafeBrowsingEnabled:]): Deleted.
+        (-[WKPreferences isSafeBrowsingEnabled]): Deleted.
+
 2019-02-18  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: PSON: Going back from apple.com to search results, cannot interact with HTML content. Disabling Swap Processes on Cross-Site Navigation resolves the issue.

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (241727 => 241728)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2019-02-18 18:34:41 UTC (rev 241728)
@@ -76,7 +76,7 @@
 
 SafeBrowsingEnabled:
   type: bool
-  defaultValue: true
+  defaultValue: false
   webcoreBinding: none
 
 PrivateBrowsingEnabled:

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h (241727 => 241728)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h	2019-02-18 18:34:41 UTC (rev 241728)
@@ -53,12 +53,6 @@
  */
 @property (nonatomic) BOOL _javascript_CanOpenWindowsAutomatically;
 
-/*! @abstract A Boolean value indicating whether warnings should be
- shown for suspected unsafe content such as phishing or malware.
- @discussion The default value is YES.
- */
-@property (nonatomic, getter=isSafeBrowsingEnabled) BOOL safeBrowsingEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
-
 #if !TARGET_OS_IPHONE
 /*! @abstract A Boolean value indicating whether Java is enabled.
  @discussion The default value is NO.

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (241727 => 241728)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm	2019-02-18 18:34:41 UTC (rev 241728)
@@ -140,16 +140,6 @@
     _preferences->setStorageAccessPromptsEnabled(enabled);
 }
 
-- (void)setSafeBrowsingEnabled:(BOOL)enabled
-{
-    _preferences->setSafeBrowsingEnabled(enabled);
-}
-
-- (BOOL)isSafeBrowsingEnabled
-{
-    return _preferences->safeBrowsingEnabled();
-}
-
 #pragma mark OS X-specific methods
 
 #if PLATFORM(MAC)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (241727 => 241728)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h	2019-02-18 18:34:41 UTC (rev 241728)
@@ -1,3 +1,4 @@
+
 /*
  * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
  *

Modified: trunk/Tools/ChangeLog (241727 => 241728)


--- trunk/Tools/ChangeLog	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Tools/ChangeLog	2019-02-18 18:34:41 UTC (rev 241728)
@@ -1,3 +1,17 @@
+2019-02-18  Alex Christensen  <achristen...@webkit.org>
+
+        Disable safe browsing in WKWebView and remove its WKPreferences API
+        https://bugs.webkit.org/show_bug.cgi?id=194723
+        <rdar://problem/48122993>
+
+        Reviewed by Geoffrey Garen.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
+        * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
+        (TEST):
+        (safeBrowsingView):
+        Make tests use SPI instead of API.
+
 2019-02-17  Fujii Hironori  <hironori.fu...@sony.com>
 
         Use dumpJSConsoleLogInStdErr=true webkit-test-runner option for non-imported tests instead of using DumpJSConsoleLogInStdErr expectation in TestExpectations

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (241727 => 241728)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm	2019-02-18 18:34:41 UTC (rev 241728)
@@ -537,7 +537,7 @@
     auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:navigationDelegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     [webView loadRequest:request];
@@ -1489,7 +1489,7 @@
     auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:delegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     [webView loadRequest:request];
@@ -2038,7 +2038,7 @@
     auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:delegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     [webView loadRequest:request];
@@ -2702,7 +2702,7 @@
     auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:delegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     failed = false;
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
@@ -2730,7 +2730,7 @@
     auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:delegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     [webView loadRequest:request];
@@ -3705,7 +3705,7 @@
     auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:navigationDelegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
     TestWebKitAPI::Util::run(&done);
@@ -3763,7 +3763,7 @@
     auto navigationDelegate = adoptNS([[PSONNavigationDelegate alloc] init]);
     [webView setNavigationDelegate:navigationDelegate.get()];
 
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
 
     [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
     TestWebKitAPI::Util::run(&done);

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (241727 => 241728)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm	2019-02-18 18:19:58 UTC (rev 241727)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm	2019-02-18 18:34:41 UTC (rev 241728)
@@ -32,6 +32,7 @@
 #import "TestNavigationDelegate.h"
 #import "TestWKWebView.h"
 #import <WebKit/WKNavigationDelegate.h>
+#import <WebKit/WKPreferencesPrivate.h>
 #import <WebKit/WKUIDelegatePrivate.h>
 #import <WebKit/WKWebViewPrivate.h>
 #import <wtf/RetainPtr.h>
@@ -169,15 +170,17 @@
     };
 
     auto webView = adoptNS([WKWebView new]);
+    [webView configuration].preferences._safeBrowsingEnabled = YES;
     [webView setNavigationDelegate:delegate.get()];
-    EXPECT_TRUE([webView configuration].preferences.safeBrowsingEnabled);
+    EXPECT_FALSE([webView configuration].preferences._safeBrowsingEnabled);
+    [webView configuration].preferences._safeBrowsingEnabled = YES;
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
     while (![webView _safeBrowsingWarning])
         TestWebKitAPI::Util::spinRunLoop();
-    [webView configuration].preferences.safeBrowsingEnabled = NO;
+    [webView configuration].preferences._safeBrowsingEnabled = NO;
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];
     TestWebKitAPI::Util::run(&done);
-    EXPECT_FALSE([webView configuration].preferences.safeBrowsingEnabled);
+    EXPECT_FALSE([webView configuration].preferences._safeBrowsingEnabled);
     EXPECT_FALSE([webView _safeBrowsingWarning]);
 }
 
@@ -187,6 +190,7 @@
 
     static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]);
     auto webView = adoptNS([WKWebView new]);
+    [webView configuration].preferences._safeBrowsingEnabled = YES;
     [webView setNavigationDelegate:delegate.get()];
     [webView setUIDelegate:delegate.get()];
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
@@ -312,6 +316,7 @@
 
     auto webViewWithWarning = [&] () -> RetainPtr<WKWebView> {
         auto webView = adoptNS([WKWebView new]);
+        [webView configuration].preferences._safeBrowsingEnabled = YES;
         [webView addObserver:observer.get() forKeyPath:@"URL" options:NSKeyValueObservingOptionNew context:nil];
 
         [webView loadHTMLString:@"meaningful content to be drawn" baseURL:simpleURL.get()];
@@ -404,6 +409,7 @@
     
     auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);
     auto webView = adoptNS([WKWebView new]);
+    [webView configuration].preferences._safeBrowsingEnabled = YES;
     [webView setNavigationDelegate:delegate.get()];
     [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
     TestWebKitAPI::Util::run(&navigationFinished);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to