mozilla/persona — pull request #4202 by aleth (2014-10-31 12:03:55+00:00)
Title: Fix #4009 - Firefox Password Manager does not pre-fill username/password

The issue was analyszd in detail in comment 8 and 9 on bug 906300. The password manager autofills the email and password fields correctly, but Persona then clears the username/email and password field on startup.

The former is clearly a bug and should be fixed by 9a653c3 below (which only sets the value of the email field if lastEmail is not empty).

The latter behaviour was added by 1d0cca2 in response to issue #1540, to clear the password field whenever the user changes the email field. The bug reporter already flagged this as an edge case: "obviously is a very rare scenario and I can see an argument for leaving the previously typed characters should be kept and letting the user decide what to do." I agree with this argument - trying to second-guess is going to annoy the user as often as it helps. The user may just as well have typed out the password and then remembered it belonged to a different email address, and then ends up frustrated when it is reset when he corrects the email field. It seems to me the cleanest solution is to restore the default form behaviour rather than trying to come up with a more complicated logic of when to clear the field and when to leave it as is.

This patch is **untested** (I don't have a local persona instance set up to test with) but as the changes appear straightforward I'm pretty hopeful this pull request isn't going to be a waste of reviewer time ;)