Changeset 273202 in webkit
- Timestamp:
- Feb 20, 2021 10:17:33 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r273201 r273202 1 2021-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 1 15 2021-02-20 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r273190 r273202 8118 8118 - (NSDictionary *)_autofillContext 8119 8119 { 8120 if (!self._hasFocusedElement) 8120 BOOL provideStrongPasswordAssistance = _focusRequiresStrongPasswordAssistance && _focusedElementInformation.elementType == WebKit::InputType::Password; 8121 if (!self._hasFocusedElement || (!_focusedElementInformation.acceptsAutofilledLoginCredentials && !provideStrongPasswordAssistance)) 8121 8122 return nil; 8122 8123 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() }; 8131 8126 8132 8127 NSURL *platformURL = _focusedElementInformation.representingPageURL; 8133 8128 if (platformURL) 8134 context.get()[@"_WebViewURL"] = platformURL;8135 8136 return context.autorelease();8129 return @{ @"_WebViewURL" : platformURL }; 8130 8131 return nil; 8137 8132 } 8138 8133 -
trunk/Tools/ChangeLog
r273199 r273202 1 2021-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 1 15 2021-02-20 Aakash Jain <aakash_jain@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm
r273154 r273202 690 690 NSDictionary *actual = [[webView textInputContentView] _autofillContext]; 691 691 EXPECT_TRUE([[actual allValues] containsObject:expected]); 692 EXPECT_TRUE([actual[@"_automaticPasswordKeyboard"] boolValue]);693 692 } 694 693 -
trunk/Tools/TestWebKitAPI/Tests/ios/WKWebViewAutofillTests.mm
r273115 r273202 67 67 } 68 68 69 - (BOOL) acceptsAutoFillLoginCredentials70 { 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]]) 73 73 return NO; 74 74 75 NSURL *url = context[@"_WebViewURL"];76 EXPECT_TRUE([url isKindOfClass:NSURL.class]);77 75 EXPECT_WK_STREQ([self stringByEvaluatingJavaScript:@"document.URL"], url.absoluteString); 78 return [context[@"_acceptsLoginCredentials"] boolValue];76 return YES; 79 77 } 80 78 … … 88 86 [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'>"]; 89 87 [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]); 94 92 95 93 auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"]; … … 99 97 100 98 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"]; 101 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);99 EXPECT_FALSE([webView textInputHasAutoFillContext]); 102 100 } 103 101 … … 107 105 [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input type='radio' name='radio_button' value='radio'><input id='password' type='password'>"]; 108 106 [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]); 113 111 114 112 auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"]; … … 119 117 120 118 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"]; 121 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);119 EXPECT_FALSE([webView textInputHasAutoFillContext]); 122 120 } 123 121 … … 127 125 [webView synchronouslyLoadHTMLString:@"<input id='text1' type='email'><input id='text2' type='text'>"]; 128 126 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text1.focus()"]; 129 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);127 EXPECT_FALSE([webView textInputHasAutoFillContext]); 130 128 131 129 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"text2.focus()"]; 132 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);130 EXPECT_FALSE([webView textInputHasAutoFillContext]); 133 131 } 134 132 … … 138 136 [webView synchronouslyLoadHTMLString:@"<input id='password' type='password'>"]; 139 137 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"password.focus()"]; 140 EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);138 EXPECT_TRUE([webView textInputHasAutoFillContext]); 141 139 142 140 auto credentialSuggestion = [UITextAutofillSuggestion autofillSuggestionWithUsername:@"frederik" password:@"famos"]; … … 146 144 147 145 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"document.activeElement.blur()"]; 148 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);146 EXPECT_FALSE([webView textInputHasAutoFillContext]); 149 147 } 150 148 … … 154 152 [webView synchronouslyLoadHTMLString:@"<input id='textfield' type='text'>"]; 155 153 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"textfield.focus()"]; 156 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);154 EXPECT_FALSE([webView textInputHasAutoFillContext]); 157 155 } 158 156 … … 162 160 [webView synchronouslyLoadHTMLString:@"<input id='user' type='email'><input id='password' type='password'><input id='confirm_password' type='password'>"]; 163 161 [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]); 168 166 169 167 [webView evaluateJavaScriptAndWaitForInputSessionToChange:@"confirm_password.focus()"]; 170 EXPECT_TRUE([webView acceptsAutoFillLoginCredentials]);168 EXPECT_TRUE([webView textInputHasAutoFillContext]); 171 169 } 172 170 … … 190 188 Util::run(&done); 191 189 192 EXPECT_FALSE([webView acceptsAutoFillLoginCredentials]);190 EXPECT_FALSE([webView textInputHasAutoFillContext]); 193 191 } 194 192
Note: See TracChangeset
for help on using the changeset viewer.