Bug 613785 - Tab modal http auth prompts. r=johannh

Differential Revision: https://phabricator.services.mozilla.com/D75568
This commit is contained in:
pbz 2020-09-08 12:07:49 +00:00
Родитель 3e406aa605
Коммит 4f8ee9f2c0
2 изменённых файлов: 38 добавлений и 8 удалений

Просмотреть файл

@ -4428,6 +4428,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);

Просмотреть файл

@ -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",