Skip to content

Commit 04d475d

Browse files
committed
Bug 1559448 - Move Thunderbird primary password prompt earlier in start-up. r=kaie,xpcom-reviewers,mccr8 DONTBUILD
Triggering the password prompt after the Add-Ons Manager start-up is causing the latter to fail. I'm not sure if something needs to be unlocked by the password, or if the existence of the prompt is causing some bad interaction, but prompting slightly earlier appears to fix it. Differential Revision: https://phabricator.services.mozilla.com/D106382
1 parent 896135c commit 04d475d

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

toolkit/xre/nsAppRunner.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,6 @@
242242
#include "mozilla/mozalloc_oom.h"
243243
#include "SafeMode.h"
244244

245-
#ifdef MOZ_THUNDERBIRD
246-
# include "nsIPK11TokenDB.h"
247-
# include "nsIPK11Token.h"
248-
#endif
249-
250245
#ifdef MOZ_BACKGROUNDTASKS
251246
# include "mozilla/BackgroundTasks.h"
252247
# include "nsIPowerManagerService.h"
@@ -5017,22 +5012,6 @@ nsresult XREMain::XRE_mainRun() {
50175012

50185013
mDirProvider.DoStartup();
50195014

5020-
#ifdef MOZ_THUNDERBIRD
5021-
if (Preferences::GetBool("security.prompt_for_master_password_on_startup",
5022-
false)) {
5023-
// Prompt for the master password prior to opening application windows,
5024-
// to avoid the race that triggers multiple prompts (see bug 177175).
5025-
// We use this code until we have a better solution, possibly as
5026-
// described in bug 177175 comment 384.
5027-
nsCOMPtr<nsIPK11TokenDB> db =
5028-
do_GetService("@mozilla.org/security/pk11tokendb;1");
5029-
nsCOMPtr<nsIPK11Token> token;
5030-
if (NS_SUCCEEDED(db->GetInternalKeyToken(getter_AddRefs(token)))) {
5031-
Unused << token->Login(false);
5032-
}
5033-
}
5034-
#endif
5035-
50365015
// As FilePreferences need the profile directory, we must initialize right
50375016
// here.
50385017
mozilla::FilePreferences::InitDirectoriesWhitelist();

toolkit/xre/nsXREDirProvider.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
#include "mozilla/XREAppData.h"
5252
#include "nsPrintfCString.h"
5353

54+
#ifdef MOZ_THUNDERBIRD
55+
# include "nsIPK11TokenDB.h"
56+
# include "nsIPK11Token.h"
57+
#endif
58+
5459
#include <stdlib.h>
5560

5661
#ifdef XP_WIN
@@ -980,6 +985,22 @@ nsXREDirProvider::DoStartup() {
980985
mozilla::SandboxBroker::GeckoDependentInitialize();
981986
#endif
982987

988+
#ifdef MOZ_THUNDERBIRD
989+
if (mozilla::Preferences::GetBool(
990+
"security.prompt_for_master_password_on_startup", false)) {
991+
// Prompt for the master password prior to opening application windows,
992+
// to avoid the race that triggers multiple prompts (see bug 177175).
993+
// We use this code until we have a better solution, possibly as
994+
// described in bug 177175 comment 384.
995+
nsCOMPtr<nsIPK11TokenDB> db =
996+
do_GetService("@mozilla.org/security/pk11tokendb;1");
997+
nsCOMPtr<nsIPK11Token> token;
998+
if (NS_SUCCEEDED(db->GetInternalKeyToken(getter_AddRefs(token)))) {
999+
mozilla::Unused << token->Login(false);
1000+
}
1001+
}
1002+
#endif
1003+
9831004
bool initExtensionManager =
9841005
#ifdef MOZ_BACKGROUNDTASKS
9851006
!mozilla::BackgroundTasks::IsBackgroundTaskMode();

0 commit comments

Comments
 (0)