Bug 1823655: Set IdentityCredentialStorageService.mShuttingDown if the init() is called during shutdown. r=pbz

The mShuttingDown wasn't set in the init() function during shutdown. In
this case, we won't register ShutdownBlocker, so we won't flip
mShuttingDown. This could case shutdown hanging becasue
WaitForInitialization() could be called during shutdown becasue of
sanitizer.

We need to flip mShuttingDown to prevent waiting in WaitForInitialization.

Differential Revision: https://phabricator.services.mozilla.com/D174212
This commit is contained in:
Tim Huang 2023-03-31 11:05:15 +00:00
Родитель 029d2f8315
Коммит 24deee83f7
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -126,6 +126,8 @@ nsresult IdentityCredentialStorageService::Init() {
AssertIsOnMainThread();
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdown)) {
MonitorAutoLock lock(mMonitor);
mShuttingDown.Flip();
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}