Commit 4534ef38 authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

🔐 Don't fill password and username if the values are already there

Filling will trigger JS events, which can be interpreted by the page as
a change in the values.

Bug: 784391
Change-Id: I4e9fa8a6ef6a35d545aabd91725e18c69599c77d
Reviewed-on: https://chromium-review.googlesource.com/771634Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Cr-Commit-Position: refs/heads/master@{#517474}
parent c2dbedf8
......@@ -1815,6 +1815,7 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
if (!username_element->IsNull() &&
IsElementAutocompletable(*username_element)) {
// TODO(crbug.com/507714): Why not setSuggestedValue?
if (username_element->Value().Utf16() != username)
username_element->SetAutofillValue(blink::WebString::FromUTF16(username));
UpdateFieldValueAndPropertiesMaskMap(*username_element, &username,
FieldPropertiesFlags::AUTOFILLED,
......@@ -1831,6 +1832,7 @@ bool PasswordAutofillAgent::FillUserNameAndPassword(
// Wait to fill in the password until a user gesture occurs. This is to make
// sure that we do not fill in the DOM with a password until we believe the
// user is intentionally interacting with the page.
if (password_element->Value().Utf16() != password)
password_element->SetSuggestedValue(blink::WebString::FromUTF16(password));
UpdateFieldValueAndPropertiesMaskMap(*password_element, &password,
FieldPropertiesFlags::AUTOFILLED,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment