diff options
author | dvadym <dvadym@chromium.org> | 2014-12-19 03:48:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-19 11:49:11 +0000 |
commit | d5c86b1817eb94935086f525e555ad8e8af224c2 (patch) | |
tree | 4c5627cf65fb265a9495fc489eb40bb2a7d676bd /chrome/renderer/autofill | |
parent | cffa1efaf3f8840b2525f4215c8fe06856ffecec (diff) | |
download | chromium_src-d5c86b1817eb94935086f525e555ad8e8af224c2.zip chromium_src-d5c86b1817eb94935086f525e555ad8e8af224c2.tar.gz chromium_src-d5c86b1817eb94935086f525e555ad8e8af224c2.tar.bz2 |
Save username and password on each user typing.
Fix problem with saving passwords for sites that change username and password with JavaScript before form submit event (for example on mouse click event), by saving username/password on each user typing.
BUG=405574
Review URL: https://codereview.chromium.org/806783003
Cr-Commit-Position: refs/heads/master@{#309183}
Diffstat (limited to 'chrome/renderer/autofill')
-rw-r--r-- | chrome/renderer/autofill/password_autofill_agent_browsertest.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc index 4207b64..31a86f4 100644 --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc @@ -1635,6 +1635,31 @@ TEST_F(PasswordAutofillAgentTest, CheckTextFieldsDOMState(kAliceUsername, true, kAlicePassword, true); } +// The user types in a username and a password, but then just before sending +// the form off, a script changes them. This test checks that +// PasswordAutofillAgent can still remember the username and the password +// typed by the user. +TEST_F(PasswordAutofillAgentTest, + RememberLastTypedUsernameAndPasswordOnSubmit_ScriptChanged) { + SimulateInputChangeForElement("temp", true, GetMainFrame(), username_element_, + true); + SimulateInputChangeForElement("random", true, GetMainFrame(), + password_element_, true); + + // Simulate that the username and the password value was changed by the + // site's JavaScript before submit. + username_element_.setValue(WebString("new username")); + password_element_.setValue(WebString("new password")); + static_cast<content::RenderFrameObserver*>(password_autofill_agent_) + ->WillSendSubmitEvent(username_element_.form()); + static_cast<content::RenderFrameObserver*>(password_autofill_agent_) + ->WillSubmitForm(username_element_.form()); + + // Observe that the PasswordAutofillAgent still remembered the last typed + // username and password and sent that to the browser. + ExpectFormSubmittedWithUsernameAndPasswords("temp", "random", ""); +} + TEST_F(PasswordAutofillAgentTest, FormFillDataMustHaveUsername) { ClearUsernameAndPasswordFields(); |