Bug 1277582 - Don't send HTTP constructor when content process has started to shut down (r=mrbkap)

This commit is contained in:
Bill McCloskey 2016-09-02 16:23:00 -07:00
parent 4a912b4f3a
commit 64d9762e21
3 changed files with 20 additions and 3 deletions

View File

@ -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;

View File

@ -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<nsIDHashKey, GetFilesHelperChild> mGetFilesPendingRequests;
nsRefPtrHashtable<nsIDHashKey, GetFilesHelperChild> mGetFilesPendingRequests;
bool mShuttingDown;
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
};

View File

@ -1990,12 +1990,16 @@ HttpChannelChild::ContinueAsyncOpen()
return NS_ERROR_FAILURE;
}
ContentChild* cc = static_cast<ContentChild*>(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<ContentChild*>(gNeckoChild->Manager())
->GetBrowserOrId(tabChild);
PBrowserOrId browser = cc->GetBrowserOrId(tabChild);
if (!gNeckoChild->SendPHttpChannelConstructor(this, browser,
IPC::SerializedLoadContext(this),
openArgs)) {