Bug 1838894 - webauthn: prevent dispatches to the IPC thread after threads have been shut down r=jschanck

Depends on D183057

Differential Revision: https://phabricator.services.mozilla.com/D185232
This commit is contained in:
Dana Keeler 2023-08-09 20:47:57 +00:00
Родитель 42f505d658
Коммит 390be83e74
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -323,6 +323,9 @@ WebAuthnController::ResumeRegister(uint64_t aTransactionId,
&WebAuthnController::RunResumeRegister, aTransactionId,
aForceNoneAttestation));
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}
@ -355,6 +358,9 @@ WebAuthnController::FinishRegister(uint64_t aTransactionId,
if (!gWebAuthnBackgroundThread) {
return NS_ERROR_FAILURE;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}
@ -493,6 +499,9 @@ WebAuthnController::FinishSign(
if (!gWebAuthnBackgroundThread) {
return NS_ERROR_FAILURE;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}
@ -589,6 +598,9 @@ WebAuthnController::SignatureSelectionCallback(uint64_t aTransactionId,
if (!gWebAuthnBackgroundThread) {
return NS_ERROR_FAILURE;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}
@ -666,6 +678,9 @@ WebAuthnController::PinCallback(uint64_t aTransactionId,
if (!gWebAuthnBackgroundThread) {
return NS_ERROR_FAILURE;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}
@ -690,6 +705,9 @@ WebAuthnController::Cancel(uint64_t aTransactionId) {
if (!gWebAuthnBackgroundThread) {
return NS_ERROR_FAILURE;
}
if (AppShutdown::IsInOrBeyond(ShutdownPhase::XPCOMShutdownThreads)) {
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
return gWebAuthnBackgroundThread->Dispatch(r.forget(), NS_DISPATCH_NORMAL);
}