Bug 1243729 - Part Zero, Create another LoginInfo object when username is picked, r=MattN draft
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 25 Mar 2016 18:20:43 +0800
changeset 348003 abedaa9a5a092c0832a70fcdc6d197a1f9f8c463
parent 347901 a235bfcc8c411169b82420c503775c1a3e7edad5
child 348004 7bc361f4810d63b7133a58b4da1791e29ff04229
push id14726
push userbmo:timdream@gmail.com
push dateWed, 06 Apr 2016 09:29:19 +0000
reviewersMattN
bugs1243729
milestone48.0a1
Bug 1243729 - Part Zero, Create another LoginInfo object when username is picked, r=MattN MozReview-Commit-ID: BwhKkMyNRzB
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -1346,17 +1346,23 @@ LoginManagerPrompter.prototype = {
     var ok = this._promptService.select(this._window,
                             dialogTitle, dialogText,
                             usernames.length, usernames,
                             selectedIndex);
     if (ok) {
       // Now that we know which login to use, modify its password.
       var selectedLogin = logins[selectedIndex.value];
       this.log("Updating password for user " + selectedLogin.username);
-      this._updateLogin(selectedLogin, aNewLogin);
+      var newLoginWithUsername = Cc["@mozilla.org/login-manager/loginInfo;1"].
+                     createInstance(Ci.nsILoginInfo);
+      newLoginWithUsername.init(aNewLogin.hostname,
+                                aNewLogin.formSubmitURL, aNewLogin.httpRealm,
+                                selectedLogin.username, aNewLogin.password,
+                                selectedLogin.userNameField, aNewLogin.passwordField);
+      this._updateLogin(selectedLogin, newLoginWithUsername);
     }
   },
 
 
 
 
   /* ---------- Internal Methods ---------- */