diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 9bed94bc4b51..62d50869dd3f 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4411,6 +4411,14 @@ pref("browser.sanitizer.loglevel", "Warn"); // To disable blocking of auth prompts, set the limit to -1. pref("prompts.authentication_dialog_abuse_limit", 2); +// The prompt type to use for http auth prompts +// content: 1, tab: 2, window: 3 +#ifdef NIGHTLY_BUILD + pref("prompts.modalType.httpAuth", 2); +#else + pref("prompts.modalType.httpAuth", 3); +#endif + // Payment Request API preferences pref("dom.payments.loglevel", "Warn"); pref("dom.payments.defaults.saveCreditCard", false); diff --git a/toolkit/components/passwordmgr/LoginManagerAuthPrompter.jsm b/toolkit/components/passwordmgr/LoginManagerAuthPrompter.jsm index 9ef00ad4e6dc..e048438909d3 100644 --- a/toolkit/components/passwordmgr/LoginManagerAuthPrompter.jsm +++ b/toolkit/components/passwordmgr/LoginManagerAuthPrompter.jsm @@ -756,14 +756,29 @@ LoginManagerAuthPrompter.prototype = { this._browser ); } - ok = Services.prompt.promptAuth( - this._chromeWindow, - aChannel, - aLevel, - aAuthInfo, - checkboxLabel, - checkbox - ); + if (this._browser) { + ok = Services.prompt.promptAuthBC( + this._browser.browsingContext, + LoginManagerAuthPrompter.promptAuthModalType, + aChannel, + aLevel, + aAuthInfo, + checkboxLabel, + checkbox + ); + } else { + // Can't tab prompt without browser. Fallback to window prompt. + // For cases where this._chromeWindow is defined, this will keep our + // parent relationship intact as opposed to passing null above. + ok = Services.prompt.promptAuth( + this._chromeWindow, + aChannel, + aLevel, + aAuthInfo, + checkboxLabel, + checkbox + ); + } } let [username, password] = this._GetAuthInfo(aAuthInfo); @@ -1296,6 +1311,13 @@ XPCOMUtils.defineLazyGetter(LoginManagerAuthPrompter.prototype, "log", () => { return logger.log.bind(logger); }); +XPCOMUtils.defineLazyPreferenceGetter( + LoginManagerAuthPrompter, + "promptAuthModalType", + "prompts.modalType.httpAuth", + Services.prompt.MODAL_TYPE_WINDOW +); + const EXPORTED_SYMBOLS = [ "LoginManagerAuthPromptFactory", "LoginManagerAuthPrompter",