Bug 1843384 - Crash in [@ shutdownhang | mozilla::net::nsSocketTransportService::SetOffline] r=valentin,necko-reviewers

We abort the re-initialization of the socketTransportService during shutdown to prevent a deadlock.

Differential Revision: https://phabricator.services.mozilla.com/D187915
This commit is contained in:
Andrew Creskey 2023-09-13 21:22:13 +00:00
parent 853c898826
commit aa287f4e06

View File

@ -425,6 +425,13 @@ nsresult nsIOService::InitializeCaptivePortalService() {
nsresult nsIOService::InitializeSocketTransportService() {
nsresult rv = NS_OK;
if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) {
LOG(
("nsIOService aborting InitializeSocketTransportService because of app "
"shutdown"));
return NS_ERROR_ILLEGAL_DURING_SHUTDOWN;
}
if (!mSocketTransportService) {
mSocketTransportService =
do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID, &rv);