diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 329d807e1797..a8d45de3b3aa 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -513,6 +513,7 @@ ContentChild::ContentChild() : mID(uint64_t(-1)) , mCanOverrideProcessName(true) , mIsAlive(true) + , mShuttingDown(false) { // This process is a content process, so it's clearly running in // multiprocess mode! @@ -863,6 +864,12 @@ ContentChild::IsAlive() const return mIsAlive; } +bool +ContentChild::IsShuttingDown() const +{ + return mShuttingDown; +} + void ContentChild::GetProcessName(nsACString& aName) const { @@ -2988,6 +2995,8 @@ ContentChild::RecvShutdown() } } + mShuttingDown = true; + if (mPolicy) { mPolicy->Deactivate(); mPolicy = nullptr; diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index b5157fae744a..b86e4e1d312d 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -116,6 +116,8 @@ public: bool IsAlive() const; + bool IsShuttingDown() const; + static void AppendProcessId(nsACString& aName); ContentBridgeParent* GetLastBridge() @@ -682,7 +684,9 @@ private: // Hashtable to keep track of the pending GetFilesHelper objects. // This GetFilesHelperChild objects are removed when RecvGetFilesResponse is // received. - nsRefPtrHashtable mGetFilesPendingRequests; + nsRefPtrHashtable mGetFilesPendingRequests; + + bool mShuttingDown; DISALLOW_EVIL_CONSTRUCTORS(ContentChild); }; diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 0ce2563d8cdc..4c8a77069a7b 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -1990,12 +1990,16 @@ HttpChannelChild::ContinueAsyncOpen() return NS_ERROR_FAILURE; } + ContentChild* cc = static_cast(gNeckoChild->Manager()); + if (cc->IsShuttingDown()) { + return NS_ERROR_FAILURE; + } + // The socket transport in the chrome process now holds a logical ref to us // until OnStopRequest, or we do a redirect, or we hit an IPDL error. AddIPDLReference(); - PBrowserOrId browser = static_cast(gNeckoChild->Manager()) - ->GetBrowserOrId(tabChild); + PBrowserOrId browser = cc->GetBrowserOrId(tabChild); if (!gNeckoChild->SendPHttpChannelConstructor(this, browser, IPC::SerializedLoadContext(this), openArgs)) {