Diff
Modified: trunk/Source/WebKit/ChangeLog (238292 => 238293)
--- trunk/Source/WebKit/ChangeLog 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Source/WebKit/ChangeLog 2018-11-16 19:59:45 UTC (rev 238293)
@@ -1,3 +1,18 @@
+2018-11-16 Alex Christensen <[email protected]>
+
+ Add API to disable safe browsing checks
+ https://bugs.webkit.org/show_bug.cgi?id=191610
+
+ Reviewed by Dean Jackson.
+
+ * UIProcess/API/Cocoa/WKPreferences.h:
+ * UIProcess/API/Cocoa/WKPreferences.mm:
+ (-[WKPreferences setSafeBrowsingEnabled:]):
+ (-[WKPreferences isSafeBrowsingEnabled]):
+ (-[WKPreferences _setSafeBrowsingEnabled:]): Deleted.
+ (-[WKPreferences _safeBrowsingEnabled]): Deleted.
+ * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
2018-11-16 Chris Dumez <[email protected]>
WebKit.UnavailablePlugIn API test is crashing in debug
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h (238292 => 238293)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h 2018-11-16 19:59:45 UTC (rev 238293)
@@ -53,6 +53,12 @@
*/
@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 (238292 => 238293)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm 2018-11-16 19:59:45 UTC (rev 238293)
@@ -697,12 +697,12 @@
_preferences->setICECandidateFilteringEnabled(enabled);
}
-- (void)_setSafeBrowsingEnabled:(BOOL)enabled
+- (void)setSafeBrowsingEnabled:(BOOL)enabled
{
_preferences->setSafeBrowsingEnabled(enabled);
}
-- (BOOL)_safeBrowsingEnabled
+- (BOOL)isSafeBrowsingEnabled
{
return _preferences->safeBrowsingEnabled();
}
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h (238292 => 238293)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h 2018-11-16 19:59:45 UTC (rev 238293)
@@ -121,7 +121,6 @@
@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));
Modified: trunk/Tools/ChangeLog (238292 => 238293)
--- trunk/Tools/ChangeLog 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Tools/ChangeLog 2018-11-16 19:59:45 UTC (rev 238293)
@@ -1,3 +1,16 @@
+2018-11-16 Alex Christensen <[email protected]>
+
+ Add API to disable safe browsing checks
+ https://bugs.webkit.org/show_bug.cgi?id=191610
+
+ Reviewed by Dean Jackson.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
+ (resourceURL):
+ (TEST):
+ (safeBrowsingView):
+ (simpleURL): Deleted.
+
2018-11-16 Zalan Bujtas <[email protected]>
[LFC][IFC] Add support for out-of-flow positioned boxes
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm (238292 => 238293)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm 2018-11-16 19:19:53 UTC (rev 238292)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm 2018-11-16 19:59:45 UTC (rev 238293)
@@ -29,6 +29,7 @@
#import "ClassMethodSwizzler.h"
#import "PlatformUtilities.h"
+#import "TestNavigationDelegate.h"
#import "TestWKWebView.h"
#import <WebKit/WKNavigationDelegate.h>
#import <WebKit/WKWebViewPrivate.h>
@@ -137,11 +138,34 @@
@end
-static NSURL *simpleURL()
+static NSURL *resourceURL(NSString *resource)
{
- return [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ return [[NSBundle mainBundle] URLForResource:resource withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
}
+TEST(SafeBrowsing, Preference)
+{
+ TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]);
+
+ __block bool done = false;
+ auto delegate = adoptNS([TestNavigationDelegate new]);
+ delegate.get().didStartProvisionalNavigation = ^(WKWebView *, WKNavigation *) {
+ done = true;
+ };
+
+ auto webView = adoptNS([WKWebView new]);
+ [webView setNavigationDelegate:delegate.get()];
+ EXPECT_TRUE([webView configuration].preferences.safeBrowsingEnabled);
+ [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
+ while (![webView _safeBrowsingWarningForTesting])
+ TestWebKitAPI::Util::spinRunLoop();
+ [webView configuration].preferences.safeBrowsingEnabled = NO;
+ [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];
+ TestWebKitAPI::Util::run(&done);
+ EXPECT_FALSE([webView configuration].preferences.safeBrowsingEnabled);
+ EXPECT_FALSE([webView _safeBrowsingWarningForTesting]);
+}
+
static RetainPtr<WKWebView> safeBrowsingView()
{
TestWebKitAPI::ClassMethodSwizzler swizzler(objc_getClass("SSBLookupContext"), @selector(sharedLookupContext), [TestLookupContext methodForSelector:@selector(sharedLookupContext)]);
@@ -149,7 +173,7 @@
static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]);
auto webView = adoptNS([WKWebView new]);
[webView setNavigationDelegate:delegate.get()];
- [webView loadRequest:[NSURLRequest requestWithURL:simpleURL()]];
+ [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
while (![webView _safeBrowsingWarningForTesting])
TestWebKitAPI::Util::spinRunLoop();
#if !PLATFORM(MAC)