Closed Bug 1625242 Opened 6 years ago Closed 6 years ago

"Password Saved!" toast is displayed every time after editing the username for a newly generated password

Categories

(Toolkit :: Password Manager, defect, P1)

Desktop
All
defect

Tracking

()

VERIFIED FIXED
mozilla76
Tracking Status
firefox74 --- disabled
firefox75 --- disabled
firefox76 --- verified

People

(Reporter: tbabos, Assigned: sfoster)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Affected Versions:
Nightly 76 (03-26-2020)

Tested on:
Windows 10 x64

Steps to reproduce:

  1. Launch FF
  2. Go to Facebook.com
  3. Generate a password
  4. Type in a username and click out
  5. Edit the username and click out multiple times

Expected Results:
The "Password Saved!" toast should not be displayed for username edits

Actual Results:
"Password Saved!" toast is displayed every time after editing the username for a newly generated password

Notes:
Recording can be found here
Dismissed doorhanger is not enabled yet on Beta and Release

Priority: -- → P1
Assignee: nobody → sfoster
Status: NEW → ASSIGNED
Pushed by sfoster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/210fed59a348 Only show the login saved toast when the autosaved login is actually saved. r=MattN

(In reply to Cristian Brindusan [:cbrindusan] from comment #3)

Push with failures:
https://treeherder.mozilla.org/#/jobs?repo=autoland&selectedJob=296216841&resultStatus=pending%2Crunning%2Csuccess%2Ctestfailed%2Cbusted%2Cexception&revision=210fed59a348d868d59a5d3dfb415c80e83d89ac

Oops, I guess I forgot to run the xpcshells tests. Thanks for the backout.
That test had a related bug - it expected that updating the (generated) password wouldn't trigger the toast (when it should). The fix is trivial but I want to understand why this was passing before (and why my patch exposed this issue)

Flags: needinfo?(sfoster)

In test_addUsernameBeforeAutoSaveEdit:

  • We first call into _onPasswordEditedOrGenerated to generate a password and store the auto-saved no-username login
  • We then update the auto-saved login to give it a username
  • The next call to _onPasswordEditedOrGenerated correctly matches the auto-saved login and updates it with the new password value
    • The conditions for first block that calls to promptToChangePassword say that if shouldAutoSaveLogin && !formLogin.username is true. Its not, the form has a username value. Or existingLogin.password != formLogin.password is true. Its not, we already updated existingLogin.password to be the newly changed (originally generated) password. So, onto the next..
    • The next block asks if !existingLogin.username && formLogin.username is true. Its not, the existing login here is the auto-saved login, and this test put a username on that login earlier
  • So we fall into the last block, where the comment says "No change to existing login". As its assumed there was no change here, the notifySaved param is false.
  • The asserts on the arguments to promptToChangePassword expect notifySaved to be false. It was (but shouldn't have been)

Ok. So the patch fixes the above logic so notifySaved is true whenever we save or modify the auto-saved login. And I've updated the patch to correct the assertion so that notifySaved should be true for this case (as the password changed and the auto-saved login was indeed saved)

Pushed by sfoster@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/4758bb63aeb1 Only show the login saved toast when the autosaved login is actually saved. r=MattN
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76

Verified-fixed on latest Firefox Nightly 76.0a1 (2020-04-06) on Windows 10, MacOS 10.13 and Ubuntu 16.04.
The "Password Saved!" toast no longer appears for username edits of a generated password.
The blue key turns into grey when the username is edited and the edits are correctly reflected in the doorhanger.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: