Bug 1274042 - Fix checkbox for HTTP auth dialogs in e10s. r=Dolske
MozReview-Commit-ID: CuOBJ9m0DMW
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -505,16 +505,17 @@ LoginManagerPrompter.prototype = {
* @param {nsIAuthInformation} aAuthInfo
*/
promptAuth : function (aChannel, aLevel, aAuthInfo) {
var selectedLogin = null;
var checkbox = { value : false };
var checkboxLabel = null;
var epicfail = false;
var canAutologin = false;
+ var notifyObj;
try {
this.log("===== promptAuth called =====");
// If the user submits a login but it fails, we need to remove the
// notification bar that was displayed. Conveniently, the user will
// be prompted for authentication again, which brings us here.
this._removeLoginNotifications();
@@ -545,18 +546,18 @@ LoginManagerPrompter.prototype = {
checkbox.value = true;
}
var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
if (this._inPrivateBrowsing)
canRememberLogin = false;
// if checkboxLabel is null, the checkbox won't be shown at all.
- var notifyBox = this._getNotifyBox();
- if (canRememberLogin && !notifyBox)
+ notifyObj = this._getPopupNote() || this._getNotifyBox();
+ if (canRememberLogin && !notifyObj)
checkboxLabel = this._getLocalizedString("rememberPassword");
} catch (e) {
// Ignore any errors and display the prompt anyway.
epicfail = true;
Components.utils.reportError("LoginManagerPrompter: " +
"Epic fail in promptAuth: " + e + "\n");
}
@@ -568,17 +569,17 @@ LoginManagerPrompter.prototype = {
aChannel, aLevel, aAuthInfo,
checkboxLabel, checkbox);
}
// If there's a notification box, use it to allow the user to
// determine if the login should be saved. If there isn't a
// notification box, only save the login if the user set the
// checkbox to do so.
- var rememberLogin = notifyBox ? canRememberLogin : checkbox.value;
+ var rememberLogin = notifyObj ? canRememberLogin : checkbox.value;
if (!ok || !rememberLogin || epicfail)
return ok;
try {
var [username, password] = this._GetAuthInfo(aAuthInfo);
if (!password) {
this.log("No password entered, so won't offer to save.");
@@ -595,25 +596,23 @@ LoginManagerPrompter.prototype = {
let newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
newLogin.init(hostname, null, httpRealm,
username, password, "", "");
if (!selectedLogin) {
this.log("New login seen for " + username +
" @ " + hostname + " (" + httpRealm + ")");
- let notifyObj = this._getPopupNote() || notifyBox;
if (notifyObj)
this._showSaveLoginNotification(notifyObj, newLogin);
else
this._pwmgr.addLogin(newLogin);
} else if (password != selectedLogin.password) {
this.log("Updating password for " + username +
" @ " + hostname + " (" + httpRealm + ")");
- let notifyObj = this._getPopupNote() || notifyBox;
if (notifyObj)
this._showChangeLoginNotification(notifyObj,
selectedLogin, newLogin);
else
this._updateLogin(selectedLogin, newLogin);
} else {
this.log("Login unchanged, no further action needed.");
this._updateLogin(selectedLogin);