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

Unified Diff: components/autofill/content/renderer/password_form_conversion_utils.cc

Issue 944163003: [Password Manager] Fix password saving on Macys registration page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests Created 5 years, 10 months 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
Index: components/autofill/content/renderer/password_form_conversion_utils.cc
diff --git a/components/autofill/content/renderer/password_form_conversion_utils.cc b/components/autofill/content/renderer/password_form_conversion_utils.cc
index af3cbd8bcbfb7f50423dd7c43c65922aa1467517..3918ef2d375ce8f657ece8faca4549277cc0827c 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -60,6 +60,9 @@ bool LocateSpecificPasswords(std::vector<WebInputElement> passwords,
if (!current_password->isNull() || !new_password->isNull())
return true;
+ if (passwords.empty())
+ return false;
+
switch (passwords.size()) {
case 1:
// Single password, easy.
@@ -77,7 +80,7 @@ bool LocateSpecificPasswords(std::vector<WebInputElement> passwords,
*new_password = passwords[1];
}
break;
- case 3:
+ default:
if (!passwords[0].value().isEmpty() &&
passwords[0].value() == passwords[1].value() &&
passwords[0].value() == passwords[2].value()) {
@@ -91,17 +94,15 @@ bool LocateSpecificPasswords(std::vector<WebInputElement> passwords,
*new_password = passwords[1];
} else if (passwords[0].value() == passwords[1].value()) {
// It is strange that the new password comes first, but trust more which
- // fields are duplicated than the ordering of fields.
- *current_password = passwords[2];
+ // fields are duplicated than the ordering of fields. Assume that
+ // any password fields after the new password contain sensitive
+ // information that isn't actually a password (security hint, SSN, etc.)
*new_password = passwords[0];
} else {
// Three different passwords, or first and last match with middle
// different. No idea which is which, so no luck.
return false;
}
- break;
- default:
- return false;
}
return true;
}

Powered by Google App Engine
This is Rietveld 408576698