Closed Bug 734347 Opened 14 years ago Closed 11 years ago

nsILoginManager.fillForm doesn't work if form fields have default values

Categories

(Toolkit :: Password Manager, defect)

10 Branch
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: awu5ima, Unassigned)

Details

User Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2 Build ID: 2012021500 Steps to reproduce: (Tested on Firefox 10) I'm trying to use nsILoginManager.fillForm on a webpage that has default values in username and password fields of a login form. Actual results: Setting preference signon.debug on displays the following error message: "Login Manager: Password not filled. None of the stored logins match the username already present." Expected results: What is of interest, is that when preference signon.autofillForms is on the form gets filled automatically. My current workaround is to clear the fields before doing fillForm but how does Firefox do this? AFAICS, there is no way to skip the check for existing value, please check the snippet of code below. Perhaps nsILoginManager should have a boolean attribute to skip the check or fillForm could take a parameter to determine the behaviour. http://hg.mozilla.org/mozilla-central/file/89d3250b701d/toolkit/components/passwordmgr/nsLoginManager.js ... if (usernameField && usernameField.value) { // If username was specified in the form, only fill in the // password if we find a matching login. var username = usernameField.value.toLowerCase(); let matchingLogins = logins.filter(function(l) l.username.toLowerCase() == username); if (matchingLogins.length) { selectedLogin = matchingLogins[0]; } else { didntFillReason = "existingUsername"; this.log("Password not filled. None of the stored " + "logins match the username already present."); } } else if (logins.length == 1) { selectedLogin = logins[0]; ...
Is this for an extension you are working on? Do you still need this? How some of this works is likely to change in the coming half-year and I suspect there will be a way to do what you need so I'm going to close this for now.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.