From a2804af3c81155895661d72838af9e868685a47c Mon Sep 17 00:00:00 2001 From: Kershaw Chang Date: Mon, 17 Jan 2022 12:09:56 +0000 Subject: [PATCH] Bug 1749831 - Don't launch/reset socket process when shutdown begins, r=necko-reviewers,valentin Differential Revision: https://phabricator.services.mozilla.com/D135817 --- netwerk/base/nsIOService.cpp | 4 +++- netwerk/ipc/SocketProcessBridgeChild.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 89f30b196b9e..0f3e48edd480 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -37,6 +37,7 @@ #include "nsINode.h" #include "nsIWidget.h" #include "nsThreadUtils.h" +#include "mozilla/AppShutdown.h" #include "mozilla/LoadInfo.h" #include "mozilla/net/NeckoCommon.h" #include "mozilla/Services.h" @@ -514,7 +515,8 @@ nsresult nsIOService::LaunchSocketProcess() { return NS_OK; } - if (mShutdown) { + // We shouldn't launch socket prcess when shutdown begins. + if (AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { return NS_OK; } diff --git a/netwerk/ipc/SocketProcessBridgeChild.cpp b/netwerk/ipc/SocketProcessBridgeChild.cpp index 08f16f2e4b2f..ec7f45b05245 100644 --- a/netwerk/ipc/SocketProcessBridgeChild.cpp +++ b/netwerk/ipc/SocketProcessBridgeChild.cpp @@ -6,6 +6,7 @@ #include "SocketProcessBridgeChild.h" #include "SocketProcessLogging.h" +#include "mozilla/AppShutdown.h" #include "mozilla/dom/ContentChild.h" #include "mozilla/ipc/BackgroundChild.h" #include "mozilla/ipc/Endpoint.h" @@ -156,7 +157,8 @@ mozilla::ipc::IPCResult SocketProcessBridgeChild::RecvTest() { void SocketProcessBridgeChild::ActorDestroy(ActorDestroyReason aWhy) { LOG(("SocketProcessBridgeChild::ActorDestroy\n")); if (AbnormalShutdown == aWhy) { - if (gNeckoChild) { + if (gNeckoChild && + !AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { // Let NeckoParent know that the socket process connections must be // rebuilt. gNeckoChild->SendResetSocketProcessBridge();