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

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

Issue 119493004: [Password Autofill] Trigger onChange events in JavaScript when autofilling passwords. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Temporarily disable part of the test while waiting on http://crbug.com/333144 to be fixed. Created 6 years, 11 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
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('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_autofill_agent.cc
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 9e8155d6da1159a66b38274ba5d18fe5362450ee..93a1aa879b183581b1fe65f3a67f1aafac698660 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -671,7 +671,7 @@ void PasswordAutofillAgent::FillFormOnPasswordRecieved(
if (IsElementAutocompletable(username_element) &&
username_element.value().isEmpty()) {
// TODO(tkent): Check maxlength and pattern.
- username_element.setValue(fill_data.basic_data.fields[0].value);
+ username_element.setValue(fill_data.basic_data.fields[0].value, true);
}
// Fill if we have an exact match for the username. Note that this sets
@@ -742,7 +742,7 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
// Input matches the username, fill in required values.
if (IsElementAutocompletable(*username_element)) {
- username_element->setValue(username);
+ username_element->setValue(username, true);
SetElementAutofilled(username_element, true);
if (set_selection) {
@@ -763,9 +763,12 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
gesture_handler_->addElement(*password_element);
password_element->setSuggestedValue(password);
} else {
- password_element->setValue(password);
+ password_element->setValue(password, true);
}
- SetElementAutofilled(password_element, true);
+ // Note: Don't call SetElementAutofilled() here, as that dispatches an
+ // onChange event in JavaScript, which is not appropriate for the password
+ // element if a user gesture has not yet occured.
+ password_element->setAutofilled(true);
return true;
}
@@ -843,7 +846,7 @@ void PasswordAutofillAgent::AutofillWebUserGestureHandler::onGesture() {
std::vector<blink::WebInputElement>::iterator iter;
for (iter = elements_.begin(); iter != elements_.end(); ++iter) {
if (!iter->isNull() && !iter->suggestedValue().isNull())
- iter->setValue(iter->suggestedValue());
+ iter->setValue(iter->suggestedValue(), true);
}
elements_.clear();
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698