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

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

Issue 1428283002: Fix of password autofilling on hidden passwords forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix Created 5 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 | « components/autofill/content/renderer/password_autofill_agent.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e600fcd2980726378412d5c57c2d329493837436..155efaeee82a64325a0a6041b4a3371beb6087da 100644
--- a/components/autofill/content/renderer/password_form_conversion_utils.cc
+++ b/components/autofill/content/renderer/password_form_conversion_utils.cc
@@ -338,6 +338,7 @@ bool GetPasswordForm(const SyntheticForm& form,
std::string layout_sequence;
layout_sequence.reserve(form.control_elements.size());
+ bool visible_passwords_fields_found = false;
for (size_t i = 0; i < form.control_elements.size(); ++i) {
WebFormControlElement control_element = form.control_elements[i];
@@ -364,12 +365,23 @@ bool GetPasswordForm(const SyntheticForm& form,
// was made readonly by JavaScript before submission. We can do this by
// checking whether password element was updated not from JavaScript.
if (input_element->isPasswordField() &&
- form_util::IsWebNodeVisible(*input_element) &&
(!input_element->isReadOnly() ||
(nonscript_modified_values &&
nonscript_modified_values->find(*input_element) !=
nonscript_modified_values->end()) ||
password_marked_by_autocomplete_attribute)) {
+ if (form_util::IsWebNodeVisible(*input_element)) {
+ if (!visible_passwords_fields_found) {
+ // Remove all invisible passwords fields, we don't care about them
+ // anymore.
+ passwords.clear();
+ visible_passwords_fields_found = true;
+ }
+ } else {
+ if (visible_passwords_fields_found)
+ continue;
+ }
+
// We add the field to the list of password fields if it was not flagged
// as a special NOT_PASSWORD prediction by Autofill. The NOT_PASSWORD
// mechanism exists because some webpages use the type "password" for
« no previous file with comments | « components/autofill/content/renderer/password_autofill_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698