Bug 1610390 - Add Thunderbird specific code to allow master password unlocking at startup time. r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D60530

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kai Engert 2020-01-23 22:19:03 +00:00
Родитель 9e846bd48a
Коммит 9dd97e9923
1 изменённых файлов: 21 добавлений и 0 удалений

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

@ -232,6 +232,11 @@
#include "mozilla/mozalloc_oom.h"
#include "SafeMode.h"
#ifdef MOZ_THUNDERBIRD
# include "nsIPK11TokenDB.h"
# include "nsIPK11Token.h"
#endif
extern uint32_t gRestartMode;
extern void InstallSignalHandlers(const char* ProgramName);
@ -4417,6 +4422,22 @@ nsresult XREMain::XRE_mainRun() {
mDirProvider.DoStartup();
#ifdef MOZ_THUNDERBIRD
if (Preferences::GetBool("security.prompt_for_master_password_on_startup",
false)) {
// Prompt for the master password prior to opening application windows,
// to avoid the race that triggers multiple prompts (see bug 177175).
// We use this code until we have a better solution, possibly as
// described in bug 177175 comment 384.
nsCOMPtr<nsIPK11TokenDB> db =
do_GetService("@mozilla.org/security/pk11tokendb;1");
nsCOMPtr<nsIPK11Token> token;
if (NS_SUCCEEDED(db->GetInternalKeyToken(getter_AddRefs(token)))) {
Unused << token->Login(false);
}
}
#endif
// As FilePreferences need the profile directory, we must initialize right
// here.
mozilla::FilePreferences::InitDirectoriesWhitelist();