Changeset 246127 in webkit


Ignore:
Timestamp:
Jun 5, 2019 2:24:45 PM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Re-enable safe browsing in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=196161
<rdar://problem/49171413>

Patch by Alex Christensen <achristensen@webkit.org> on 2019-06-05
Reviewed by Ryosuke Niwa.

Source/WebKit:

This is mostly just reverting r241728.

  • Shared/WebPreferences.yaml:
  • UIProcess/API/Cocoa/WKPreferences.h:
  • UIProcess/API/Cocoa/WKPreferences.mm:

(-[WKPreferences setSafeBrowsingEnabled:]):
(-[WKPreferences isSafeBrowsingEnabled]):

Tools:

  • TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
  • TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:

(TEST):
(safeBrowsingView):

LayoutTests:

  • platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246124 r246127  
     12019-06-05  Alex Christensen  <achristensen@webkit.org>
     2
     3        Re-enable safe browsing in WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=196161
     5        <rdar://problem/49171413>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt:
     10
    111== Rolled over to ChangeLog-2019-06-05 ==
  • trunk/LayoutTests/platform/mac-wk2/http/tests/navigation/keyboard-events-during-provisional-navigation-expected.txt

    r241728 r246127  
    1111CONSOLE MESSAGE: line 58: Input element value after text input events: "".
    1212CONSOLE MESSAGE: line 20: Pressing "z" with access key modifiers should navigate to resources/keyboard-events-after-navigation.html.
     13CONSOLE MESSAGE: line 18: keydownevent dispatched (isTrusted: true).
     14CONSOLE MESSAGE: line 18: keyupevent dispatched (isTrusted: true).
    1315CONSOLE MESSAGE: line 6: Finished navigating to resources/keyboard-events-after-navigation.html.
    1416CONSOLE MESSAGE: line 7: Trusted events should be logged and the input element should have the value "acd".
  • trunk/Source/WebKit/ChangeLog

    r246126 r246127  
     12019-06-05  Alex Christensen  <achristensen@webkit.org>
     2
     3        Re-enable safe browsing in WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=196161
     5        <rdar://problem/49171413>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        This is mostly just reverting r241728.
     10
     11        * Shared/WebPreferences.yaml:
     12        * UIProcess/API/Cocoa/WKPreferences.h:
     13        * UIProcess/API/Cocoa/WKPreferences.mm:
     14        (-[WKPreferences setSafeBrowsingEnabled:]):
     15        (-[WKPreferences isSafeBrowsingEnabled]):
     16
    1172019-06-05  Alex Christensen  <achristensen@webkit.org>
    218
  • trunk/Source/WebKit/Shared/WebPreferences.yaml

    r246118 r246127  
    8383SafeBrowsingEnabled:
    8484  type: bool
    85   defaultValue: false
     85  defaultValue: true
    8686  webcoreBinding: none
    8787
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.h

    r244465 r246127  
    5252@property (nonatomic) BOOL javaScriptCanOpenWindowsAutomatically;
    5353
     54/*! @abstract A Boolean value indicating whether warnings should be
     55 shown for suspected fraudulent content such as phishing or malware.
     56 @discussion The default value is YES. This feature is currently available
     57 in the following region: China.
     58 */
     59@property (nonatomic, getter=isFraudulentWebsiteWarningEnabled) BOOL fraudulentWebsiteWarningEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
     60
    5461#if !TARGET_OS_IPHONE
    5562/*!
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm

    r246002 r246127  
    123123}
    124124
     125- (void)setFraudulentWebsiteWarningEnabled:(BOOL)enabled
     126{
     127    _preferences->setSafeBrowsingEnabled(enabled);
     128}
     129
     130- (BOOL)isFraudulentWebsiteWarningEnabled
     131{
     132    return _preferences->safeBrowsingEnabled();
     133}
     134
    125135- (BOOL)javaScriptCanOpenWindowsAutomatically
    126136{
  • trunk/Tools/ChangeLog

    r246124 r246127  
     12019-06-05  Alex Christensen  <achristensen@webkit.org>
     2
     3        Re-enable safe browsing in WKWebView
     4        https://bugs.webkit.org/show_bug.cgi?id=196161
     5        <rdar://problem/49171413>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
     10        * TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm:
     11        (TEST):
     12        (safeBrowsingView):
     13
    114== Rolled over to ChangeLog-2019-06-05 ==
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm

    r245601 r246127  
    607607    [webView setNavigationDelegate:navigationDelegate.get()];
    608608
    609     [webView configuration].preferences._safeBrowsingEnabled = NO;
     609    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    610610
    611611    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     
    16971697    [webView setNavigationDelegate:delegate.get()];
    16981698
    1699     [webView configuration].preferences._safeBrowsingEnabled = NO;
     1699    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    17001700
    17011701    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]];
     
    22462246    [webView setNavigationDelegate:delegate.get()];
    22472247
    2248     [webView configuration].preferences._safeBrowsingEnabled = NO;
     2248    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    22492249
    22502250    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     
    30473047    [webView setNavigationDelegate:delegate.get()];
    30483048
    3049     [webView configuration].preferences._safeBrowsingEnabled = NO;
     3049    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    30503050
    30513051    failed = false;
     
    30753075    [webView setNavigationDelegate:delegate.get()];
    30763076
    3077     [webView configuration].preferences._safeBrowsingEnabled = NO;
     3077    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    30783078
    30793079    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]];
     
    44544454    [webView setNavigationDelegate:navigationDelegate.get()];
    44554455
    4456     [webView configuration].preferences._safeBrowsingEnabled = NO;
     4456    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    44574457
    44584458    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
     
    45124512    [webView setNavigationDelegate:navigationDelegate.get()];
    45134513
    4514     [webView configuration].preferences._safeBrowsingEnabled = NO;
     4514    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    45154515
    45164516    [webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main.html"]]];
  • trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/SafeBrowsing.mm

    r244089 r246127  
    171171
    172172    auto webView = adoptNS([WKWebView new]);
    173     EXPECT_FALSE([webView configuration].preferences._safeBrowsingEnabled);
    174     [webView configuration].preferences._safeBrowsingEnabled = YES;
     173    EXPECT_TRUE([webView configuration].preferences.fraudulentWebsiteWarningEnabled);
     174    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = YES;
    175175    [webView setNavigationDelegate:delegate.get()];
    176     [webView configuration].preferences._safeBrowsingEnabled = YES;
     176    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = YES;
    177177    [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
    178178    while (![webView _safeBrowsingWarning])
    179179        TestWebKitAPI::Util::spinRunLoop();
    180     [webView configuration].preferences._safeBrowsingEnabled = NO;
     180    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = NO;
    181181    [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple2")]];
    182182    TestWebKitAPI::Util::run(&done);
    183     EXPECT_FALSE([webView configuration].preferences._safeBrowsingEnabled);
     183    EXPECT_FALSE([webView configuration].preferences.fraudulentWebsiteWarningEnabled);
    184184    EXPECT_FALSE([webView _safeBrowsingWarning]);
    185185}
     
    191191    static auto delegate = adoptNS([SafeBrowsingNavigationDelegate new]);
    192192    auto webView = adoptNS([WKWebView new]);
    193     [webView configuration].preferences._safeBrowsingEnabled = YES;
     193    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = YES;
    194194    [webView setNavigationDelegate:delegate.get()];
    195195    [webView setUIDelegate:delegate.get()];
     
    320320    auto webViewWithWarning = [&] () -> RetainPtr<WKWebView> {
    321321        auto webView = adoptNS([WKWebView new]);
    322         [webView configuration].preferences._safeBrowsingEnabled = YES;
     322        [webView configuration].preferences.fraudulentWebsiteWarningEnabled = YES;
    323323        [webView addObserver:observer.get() forKeyPath:@"URL" options:NSKeyValueObservingOptionNew context:nil];
    324324
     
    416416    auto delegate = adoptNS([WKWebViewGoBackNavigationDelegate new]);
    417417    auto webView = adoptNS([WKWebView new]);
    418     [webView configuration].preferences._safeBrowsingEnabled = YES;
     418    [webView configuration].preferences.fraudulentWebsiteWarningEnabled = YES;
    419419    [webView setNavigationDelegate:delegate.get()];
    420420    [webView loadRequest:[NSURLRequest requestWithURL:resourceURL(@"simple")]];
Note: See TracChangeset for help on using the changeset viewer.