OlgaTPark/tenfourfox#14 — M1520960 M1660998 - Allow saving passwords in private windows with a dismissed-by-default doorhanger and fix preferences accordingly (#637)
Testcases aren't included because they require async/await. References: https://bugzilla.mozilla.org/show_bug.cgi?id=1520960 (Allow saving passwords in private windows with a dismissed-by-default doorhanger) https://hg.mozilla.org/mozilla-central/rev/b4645dc802f9 (Allow login capture from form submissions in private browsing when pref'd on.) https://hg.mozilla.org/mozilla-central/rev/5656f8b5c547 (Allow login capture from HTTP auth prompts in private browsing when pref'd on.) https://bugzilla.mozilla.org/show_bug.cgi?id=1660998 (Option to save logins does not keep state in private mode) https://hg.mozilla.org/mozilla-central/rev/d67d3463b4aa (Don't disable the password manager checkbox in permanent private browsing mode.)
This commit is contained in:
parent
a750ff0843
commit
fcfba098e5
|
@ -1622,6 +1622,8 @@ pref("browser.pocket.oAuthConsumerKey", "40249-e88c401e1b1f2242d9e441c4");
|
|||
pref("browser.pocket.useLocaleList", true);
|
||||
pref("browser.pocket.enabledLocales", "cs de en-GB en-US en-ZA es-ES es-MX fr hu it ja ja-JP-mac ko nl pl pt-BR pt-PT ru zh-CN zh-TW");
|
||||
|
||||
pref("signon.privateBrowsingCapture.enabled", true);
|
||||
|
||||
pref("view_source.tab", true);
|
||||
|
||||
pref("dom.webnotifications.serviceworker.enabled", true);
|
||||
|
|
|
@ -99,23 +99,15 @@ var gSecurityPane = {
|
|||
|
||||
/**
|
||||
* Enables/disables the Exceptions button used to configure sites where
|
||||
* passwords are never saved. When browser is set to start in Private
|
||||
* Browsing mode, the "Remember passwords" UI is useless, so we disable it.
|
||||
* passwords are never saved.
|
||||
*/
|
||||
readSavePasswords: function ()
|
||||
{
|
||||
var pref = document.getElementById("signon.rememberSignons");
|
||||
var excepts = document.getElementById("passwordExceptions");
|
||||
var prefValue = document.getElementById("signon.rememberSignons").value;
|
||||
document.getElementById("passwordExceptions").disabled = !prefValue;
|
||||
|
||||
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
|
||||
document.getElementById("savePasswords").disabled = true;
|
||||
excepts.disabled = true;
|
||||
return false;
|
||||
} else {
|
||||
excepts.disabled = !pref.value;
|
||||
// don't override pref value in UI
|
||||
return undefined;
|
||||
}
|
||||
// don't override pref value in UI
|
||||
return undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -4098,6 +4098,7 @@ pref("signon.rememberSignons.visibilityToggle", false);
|
|||
#endif
|
||||
pref("signon.autofillForms", true);
|
||||
pref("signon.autologin.proxy", false);
|
||||
pref("signon.privateBrowsingCapture.enabled", false);
|
||||
pref("signon.storeWhenAutocompleteOff", true);
|
||||
pref("signon.ui.experimental", false);
|
||||
pref("signon.debug", false);
|
||||
|
|
|
@ -37,6 +37,8 @@ this.LoginHelper = {
|
|||
* Warning: this only updates if a logger was created.
|
||||
*/
|
||||
debug: Services.prefs.getBoolPref("signon.debug"),
|
||||
privateBrowsingCaptureEnabled:
|
||||
Services.prefs.getBoolPref("signon.privateBrowsingCapture.enabled"),
|
||||
|
||||
createLogger(aLogPrefix) {
|
||||
let getMaxLogLevel = () => {
|
||||
|
@ -54,6 +56,8 @@ this.LoginHelper = {
|
|||
// Watch for pref changes and update this.debug and the maxLogLevel for created loggers
|
||||
Services.prefs.addObserver("signon.", () => {
|
||||
this.debug = Services.prefs.getBoolPref("signon.debug");
|
||||
this.privateBrowsingCaptureEnabled =
|
||||
Services.prefs.getBoolPref("signon.privateBrowsingCapture.enabled");
|
||||
logger.maxLogLevel = getMaxLogLevel();
|
||||
}, false);
|
||||
|
||||
|
|
|
@ -752,7 +752,8 @@ var LoginManagerContent = {
|
|||
var doc = form.ownerDocument;
|
||||
var win = doc.defaultView;
|
||||
|
||||
if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
|
||||
if (PrivateBrowsingUtils.isContentWindowPrivate(win) &&
|
||||
!LoginHelper.privateBrowsingCaptureEnabled) {
|
||||
// We won't do anything in private browsing mode anyway,
|
||||
// so there's no need to perform further checks.
|
||||
log("(form submission ignored in private browsing mode)");
|
||||
|
|
|
@ -21,6 +21,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "LoginDoorhangers",
|
|||
"resource://gre/modules/LoginDoorhangers.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
|
||||
"resource://gre/modules/LoginHelper.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
|
||||
"resource://gre/modules/PrivateBrowsingUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let logger = LoginHelper.createLogger("LoginManagerParent");
|
||||
|
@ -435,6 +437,10 @@ var LoginManagerParent = {
|
|||
}
|
||||
|
||||
function recordLoginUse(login) {
|
||||
if (!target || PrivateBrowsingUtils.isBrowserPrivate(target)) {
|
||||
// don't record non-interactive use in private browsing
|
||||
return;
|
||||
}
|
||||
// Update the lastUsed timestamp and increment the use count.
|
||||
let propBag = Cc["@mozilla.org/hash-property-bag;1"].
|
||||
createInstance(Ci.nsIWritablePropertyBag);
|
||||
|
|
|
@ -326,6 +326,12 @@ LoginManagerPrompter.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
get _allowRememberLogin() {
|
||||
if (!this._inPrivateBrowsing) {
|
||||
return true;
|
||||
}
|
||||
return LoginHelper.privateBrowsingCaptureEnabled;
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
@ -376,10 +382,8 @@ LoginManagerPrompter.prototype = {
|
|||
|
||||
// If hostname is null, we can't save this login.
|
||||
if (hostname) {
|
||||
var canRememberLogin;
|
||||
if (this._inPrivateBrowsing)
|
||||
canRememberLogin = false;
|
||||
else
|
||||
var canRememberLogin = false;
|
||||
if (this._allowRememberLogin)
|
||||
canRememberLogin = (aSavePassword ==
|
||||
Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
|
||||
this._pwmgr.getLoginSavingEnabled(hostname);
|
||||
|
@ -614,7 +618,7 @@ LoginManagerPrompter.prototype = {
|
|||
}
|
||||
|
||||
var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
|
||||
if (this._inPrivateBrowsing)
|
||||
if (!this._allowRememberLogin)
|
||||
canRememberLogin = false;
|
||||
|
||||
// if checkboxLabel is null, the checkbox won't be shown at all.
|
||||
|
@ -828,7 +832,7 @@ LoginManagerPrompter.prototype = {
|
|||
* This is "password-save" or "password-change" depending on the
|
||||
* original notification type. This is used for telemetry and tests.
|
||||
*/
|
||||
_showLoginCaptureDoorhanger(login, type) {
|
||||
_showLoginCaptureDoorhanger(login, type, options = {}) {
|
||||
let { browser } = this._getNotifyWindow();
|
||||
|
||||
let saveMsgNames = {
|
||||
|
@ -1036,7 +1040,7 @@ LoginManagerPrompter.prototype = {
|
|||
"password-notification-icon",
|
||||
mainAction,
|
||||
secondaryActions,
|
||||
{
|
||||
Object.assign({
|
||||
timeout: Date.now() + 10000,
|
||||
displayURI: Services.io.newURI(login.hostname, null, null),
|
||||
persistWhileVisible: true,
|
||||
|
@ -1080,7 +1084,7 @@ LoginManagerPrompter.prototype = {
|
|||
}
|
||||
return false;
|
||||
},
|
||||
}
|
||||
}, options)
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -1120,7 +1124,9 @@ LoginManagerPrompter.prototype = {
|
|||
|
||||
// Notification is a PopupNotification
|
||||
if (aNotifyObj == this._getPopupNote()) {
|
||||
this._showLoginCaptureDoorhanger(aLogin, "password-save");
|
||||
this._showLoginCaptureDoorhanger(aLogin, "password-save", {
|
||||
dismissed: this._inPrivateBrowsing,
|
||||
});
|
||||
} else {
|
||||
var notNowButtonText =
|
||||
this._getLocalizedString("notifyBarNotNowButtonText");
|
||||
|
|
Loading…
Reference in New Issue