Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Unified Diff: third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp

Issue 2492553002: Allow PasswordCredential instantiation when an input element has multiple 'autocomplete' tokens. (Closed)
Patch Set: change test Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp
diff --git a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp
index ed79cfe61ff52871a165ef77b80ba56e2b4ca8f9..dc627e982186c5a39b50bad9f2b209cdb43093ab 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp
+++ b/third_party/WebKit/Source/modules/credentialmanager/PasswordCredential.cpp
@@ -64,20 +64,24 @@ PasswordCredential* PasswordCredential::create(HTMLFormElement* form,
if (!result.isUSVString())
continue;
- AtomicString autocomplete =
- toHTMLElement(element)->fastGetAttribute(HTMLNames::autocompleteAttr);
- if (equalIgnoringCase(autocomplete, "current-password") ||
- equalIgnoringCase(autocomplete, "new-password")) {
- data.setPassword(result.getAsUSVString());
- passwordName = element->name();
- } else if (equalIgnoringCase(autocomplete, "photo")) {
- data.setIconURL(result.getAsUSVString());
- } else if (equalIgnoringCase(autocomplete, "name") ||
- equalIgnoringCase(autocomplete, "nickname")) {
- data.setName(result.getAsUSVString());
- } else if (equalIgnoringCase(autocomplete, "username")) {
- data.setId(result.getAsUSVString());
- idName = element->name();
+ Vector<String> autofillTokens;
+ toHTMLElement(element)
+ ->fastGetAttribute(HTMLNames::autocompleteAttr)
+ .getString()
+ .lower() // Lowercase here once to avoid the case-folding logic below.
+ .split(' ', autofillTokens);
+ for (const auto& token : autofillTokens) {
+ if (token == "current-password" || token == "new-password") {
+ data.setPassword(result.getAsUSVString());
+ passwordName = element->name();
+ } else if (token == "photo") {
+ data.setIconURL(result.getAsUSVString());
+ } else if (token == "name" || token == "nickname") {
+ data.setName(result.getAsUSVString());
+ } else if (token == "username") {
+ data.setId(result.getAsUSVString());
+ idName = element->name();
+ }
}
}
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/credentialmanager/passwordcredential-basics.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698