WebKit Bugzilla
Attachment 362160 Details for
Bug 194723
: Disable safe browsing in WKWebView and remove its WKPreferences API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-194723-20190215144220.patch (text/plain), 11.42 KB, created by
Alex Christensen
on 2019-02-15 14:42:20 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2019-02-15 14:42:20 PST
Size:
11.42 KB
patch
obsolete
>Index: Source/WebKit/ChangeLog >=================================================================== >--- Source/WebKit/ChangeLog (revision 241618) >+++ Source/WebKit/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2019-02-15 Alex Christensen <achristensen@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 NOBODY (OOPS!). >+ >+ * Shared/WebPreferences.yaml: >+ * UIProcess/API/Cocoa/WKPreferences.h: >+ * UIProcess/API/Cocoa/WKPreferences.mm: >+ (-[WKPreferences setSafeBrowsingEnabled:]): Deleted. >+ (-[WKPreferences isSafeBrowsingEnabled]): Deleted. >+ > 2019-02-15 Alex Christensen <achristensen@webkit.org> > > Add SPI version of WKPreferences.safeBrowsingEnabled >Index: Source/WebKit/Shared/WebPreferences.yaml >=================================================================== >--- Source/WebKit/Shared/WebPreferences.yaml (revision 241587) >+++ Source/WebKit/Shared/WebPreferences.yaml (working copy) >@@ -76,7 +76,7 @@ XSSAuditorEnabled: > > SafeBrowsingEnabled: > type: bool >- defaultValue: true >+ defaultValue: false > webcoreBinding: none > > PrivateBrowsingEnabled: >Index: Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h (revision 241587) >+++ Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h (working copy) >@@ -53,12 +53,6 @@ WK_CLASS_AVAILABLE(macosx(10.10), ios(8. > */ > @property (nonatomic) BOOL javaScriptCanOpenWindowsAutomatically; > >-/*! @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. >Index: Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm >=================================================================== >--- Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (revision 241618) >+++ Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm (working copy) >@@ -140,16 +140,6 @@ - (void)_setStorageAccessPromptsEnabled: > _preferences->setStorageAccessPromptsEnabled(enabled); > } > >-- (void)setSafeBrowsingEnabled:(BOOL)enabled >-{ >- _preferences->setSafeBrowsingEnabled(enabled); >-} >- >-- (BOOL)isSafeBrowsingEnabled >-{ >- return _preferences->safeBrowsingEnabled(); >-} >- > #pragma mark OS X-specific methods > > #if PLATFORM(MAC) >Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 241619) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2019-02-15 Alex Christensen <achristensen@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 NOBODY (OOPS!). >+ >+ * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: >+ * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm: >+ (TEST): >+ (safeBrowsingView): >+ Make tests use SPI instead of API. >+ > 2019-02-15 Wenson Hsieh <wenson_hsieh@apple.com> > > [iOS] WKWebView callout bar is missing Change Writing Direction item >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (revision 241587) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (working copy) >@@ -537,7 +537,7 @@ TEST(ProcessSwap, KillWebContentProcessA > 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 @@ TEST(ProcessSwap, TerminateProcessRightA > 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]; >@@ -2627,7 +2627,7 @@ TEST(ProcessSwap, NavigateCrossSiteBefor > 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"]]; >@@ -2655,7 +2655,7 @@ TEST(ProcessSwap, DoSameSiteNavigationAf > 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]; >@@ -3630,7 +3630,7 @@ TEST(ProcessSwap, ClosePageAfterCrossSit > 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); >@@ -3688,7 +3688,7 @@ TEST(ProcessSwap, LoadingStateAfterPolic > 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); >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (revision 241587) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (working copy) >@@ -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> >@@ -170,14 +171,15 @@ TEST(SafeBrowsing, Preference) > > auto webView = adoptNS([WKWebView new]); > [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 +189,7 @@ static RetainPtr<WKWebView> safeBrowsing > > 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 +315,7 @@ TEST(SafeBrowsing, URLObservation) > > 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 +408,7 @@ TEST(SafeBrowsing, WKWebViewGoBack) > > 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); >Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 241587) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-02-15 Alex Christensen <achristensen@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 NOBODY (OOPS!). >+ >+ * 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-14 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r241497. >Index: LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt >=================================================================== >--- LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (revision 241587) >+++ LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt (working copy) >@@ -10,8 +10,6 @@ CONSOLE MESSAGE: line 52: Inserting text > 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.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194723
:
362160
|
362171
|
362186