summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorgcasto@chromium.org <gcasto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 04:00:55 +0000
committergcasto@chromium.org <gcasto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-31 04:00:55 +0000
commitfa6487d025e63f60aec905d9ae043c778b3fe9dc (patch)
tree648112ab5c7abee24325c8d0547be1b0a4319c14 /components
parent570b2639c0e25e62abb0204949739fdad0a3d12d (diff)
downloadchromium_src-fa6487d025e63f60aec905d9ae043c778b3fe9dc.zip
chromium_src-fa6487d025e63f60aec905d9ae043c778b3fe9dc.tar.gz
chromium_src-fa6487d025e63f60aec905d9ae043c778b3fe9dc.tar.bz2
[password autofill] Don't autofill a form where any field can't be filled.
That is, if either the username or password field can't be filled (autocomplete="off", readonly, or disabled), don't fill the other field. Currently we will partially fill the form. This behavior is particularly surprising if the username can't be filled, as a password will be entered, but will disappear as soon as the user tries to enter a username. BUG=264969 R=isherman@chromium.org Review URL: https://codereview.chromium.org/20866002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214548 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
-rw-r--r--components/autofill/content/renderer/password_autofill_agent.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index e82f8ae..b6294ab 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -176,16 +176,17 @@ void FillForm(FormElements* fe, const FormData& data) {
// want to fill with.
if (!element.value().isEmpty() && element.value() != data_map[it->first])
return;
+
+ // Don't fill forms with uneditable fields or fields with autocomplete
+ // disabled.
+ if (!IsElementEditable(element) || !element.autoComplete())
+ return;
}
for (FormInputElementMap::iterator it = fe->input_elements.begin();
it != fe->input_elements.end(); ++it) {
WebKit::WebInputElement element = it->second;
- // Don't fill uneditable fields or fields with autocomplete disabled.
- if (!IsElementEditable(element) || !element.autoComplete())
- continue;
-
// TODO(tkent): Check maxlength and pattern.
element.setValue(data_map[it->first]);
element.setAutofilled(true);