Changeset 273202 in webkit


Ignore:
Timestamp:
Feb 20, 2021 10:17:33 AM (3 years ago)
Author:
Wenson Hsieh
Message:

Unreviewed, reverting r273115.

Breaks autocorrect without the accompanying change in
rdar://problem/74211293

Reverted changeset:

"Unconditionally return information in _autofillContext SPI
when a field is focused"
https://bugs.webkit.org/show_bug.cgi?id=221828
https://commits.webkit.org/r273115

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r273201 r273202  
     12021-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Unreviewed, reverting r273115.
     4
     5        Breaks autocorrect without the accompanying change in
     6        rdar://problem/74211293
     7
     8        Reverted changeset:
     9
     10        "Unconditionally return information in _autofillContext SPI
     11        when a field is focused"
     12        https://bugs.webkit.org/show_bug.cgi?id=221828
     13        https://commits.webkit.org/r273115
     14
    1152021-02-20  Chris Dumez  <cdumez@apple.com>
    216
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r273190 r273202  
    81188118- (NSDictionary *)_autofillContext
    81198119{
    8120     if (!self._hasFocusedElement)
     8120    BOOL provideStrongPasswordAssistance = _focusRequiresStrongPasswordAssistance && _focusedElementInformation.elementType == WebKit::InputType::Password;
     8121    if (!self._hasFocusedElement || (!_focusedElementInformation.acceptsAutofilledLoginCredentials && !provideStrongPasswordAssistance))
    81218122        return nil;
    81228123
    8123     auto context = adoptNS([[NSMutableDictionary alloc] init]);
    8124     context.get()[@"_WKAutofillContextVersion"] = @(2);
    8125 
    8126     if (_focusRequiresStrongPasswordAssistance && _focusedElementInformation.elementType == WebKit::InputType::Password) {
    8127         context.get()[@"_automaticPasswordKeyboard"] = @YES;
    8128         context.get()[@"strongPasswordAdditionalContext"] = _additionalContextForStrongPasswordAssistance.get();
    8129     } else if (_focusedElementInformation.acceptsAutofilledLoginCredentials)
    8130         context.get()[@"_acceptsLoginCredentials"] = @YES;
     8124    if (provideStrongPasswordAssistance)
     8125        return @{ @"_automaticPasswordKeyboard" : @YES, @"strongPasswordAdditionalContext" : _additionalContextForStrongPasswordAssistance.get() };
    81318126
    81328127    NSURL *platformURL = _focusedElementInformation.representingPageURL;
    81338128    if (platformURL)
    8134         context.get()[@"_WebViewURL"] = platformURL;
    8135 
    8136     return context.autorelease();
     8129        return @{ @"_WebViewURL" : platformURL };
     8130
     8131    return nil;
    81378132}
    81388133
  • trunk/Tools/ChangeLog

    r273199 r273202  
     12021-02-20  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Unreviewed, reverting r273115.
     4
     5        Breaks autocorrect without the accompanying change in
     6        rdar://problem/74211293
     7
     8        Reverted changeset:
     9
     10        "Unconditionally return information in _autofillContext SPI
     11        when a field is focused"
     12        https://bugs.webkit.org/show_bug.cgi?id=221828
     13        https://commits.webkit.org/r273115
     14
    1152021-02-20  Aakash Jain  <aakash_jain@apple.com>
    216
  • trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm

    r273154 r273202  
    690690    NSDictionary *actual = [[webView textInputContentView] _autofillContext];
    691691    EXPECT_TRUE([[actual allValues] containsObject:expected]);
    692     EXPECT_TRUE([actual[@"_automaticPasswordKeyboard"] boolValue]);
    693692}
    694693
  • trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm

    r273115 r273202  
    6767}
    6868
    69 - (BOOL)acceptsAutoFillLoginCredentials
    70 {
    71     auto context = self._autofillInputView._autofillContext;
    72     if (!context)
     69- (BOOL)textInputHasAutoFillContext
     70{
     71    NSURL *url = [self._autofillInputView._autofillContext objectForKey:@"_WebViewURL"];
     72    if (![url isKindOfClass:[NSURL class]])
    7373        return NO;
    7474
    75     NSURL *url = context[@"_WebViewURL"];
    76     EXPECT_TRUE([url isKindOfClass:NSURL.class]);
    7775    EXPECT_WK_STREQ([self stringByEvaluatingJavaScript:@"document.URL"], url.absoluteString);
    78     return [context[@"_acceptsLoginCredentials"] boolValue];
     76    return YES;
    7977}
    8078
     
    8886    [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'>"];
    8987    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
    90     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
    91 
    92     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
    93     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
     88    EXPECT_TRUE([webView textInputHasAutoFillContext]);
     89
     90    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
     91    EXPECT_TRUE([webView textInputHasAutoFillContext]);
    9492
    9593    auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     
    9997
    10098    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
    101     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     99    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    102100}
    103101
     
    107105    [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input type='radio' name='radio_button' value='radio'><input id='password' type='password'>"];
    108106    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
    109     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
    110 
    111     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
    112     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
     107    EXPECT_TRUE([webView textInputHasAutoFillContext]);
     108
     109    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
     110    EXPECT_TRUE([webView textInputHasAutoFillContext]);
    113111
    114112    auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     
    119117
    120118    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
    121     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     119    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    122120}
    123121
     
    127125    [webView synchronouslyLoadHTMLString:@"<input id='text1' type='email'><input id='text2' type='text'>"];
    128126    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text1.focus()"];
    129     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     127    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    130128
    131129    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text2.focus()"];
    132     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     130    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    133131}
    134132
     
    138136    [webView synchronouslyLoadHTMLString:@"<input id='password' type='password'>"];
    139137    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
    140     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
     138    EXPECT_TRUE([webView textInputHasAutoFillContext]);
    141139
    142140    auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"];
     
    146144
    147145    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"];
    148     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     146    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    149147}
    150148
     
    154152    [webView synchronouslyLoadHTMLString:@"<input id='textfield' type='text'>"];
    155153    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"textfield.focus()"];
    156     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     154    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    157155}
    158156
     
    162160    [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'><input id='confirm_password' type='password'>"];
    163161    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"user.focus()"];
    164     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
    165 
    166     [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
    167     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
     162    EXPECT_TRUE([webView textInputHasAutoFillContext]);
     163
     164    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"];
     165    EXPECT_TRUE([webView textInputHasAutoFillContext]);
    168166
    169167    [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"confirm_password.focus()"];
    170     EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);
     168    EXPECT_TRUE([webView textInputHasAutoFillContext]);
    171169}
    172170
     
    190188    Util::run(&done);
    191189
    192     EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);
     190    EXPECT_FALSE([webView textInputHasAutoFillContext]);
    193191}
    194192
Note: See TracChangeset for help on using the changeset viewer.