Bug 1243729 - (m-b) Create another LoginInfo object when username is picked, r=MattN, a=lizzard
authorTimothy Guan-tin Chien <timdream@gmail.com>
Wed, 20 Apr 2016 08:41:09 +0800
changeset 324018 b91e9c497db9007877d1c0b9661e486591af8d9d
parent 324017 834fed3f42db37b6427d1140a6e32a3cb6af1ed9
child 324019 88c060c38873d2373efd49a2e58acc46c22ba532
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, lizzard
bugs1243729
milestone47.0a2
Bug 1243729 - (m-b) Create another LoginInfo object when username is picked, r=MattN, a=lizzard MozReview-Commit-ID: IRGUTFXiN9S
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 ---------- */