зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1430508: Return 0 for ProcessId() when channel IPC is closed. r=dragana
There are some corner cases where we try to attach StreamFilter endpoints to a channel after its IPC has been closed from from the other side, but request listeners haven't been notified. This causes crashes in any of several places. This patch changes nsHttpChannel::ProcessId to return 0 when IPC is closed, so callers can detect that it's no longer possible to attach endpoints to it. MozReview-Commit-ID: BZTOqezih0P --HG-- extra : rebase_source : dfdb5bf7a11fccea51a1fbb161e688f10167da30
This commit is contained in:
Родитель
3a19777b1f
Коммит
bef381375c
|
@ -265,6 +265,15 @@ HttpChannelParent::CleanupBackgroundChannel()
|
|||
}
|
||||
}
|
||||
|
||||
base::ProcessId
|
||||
HttpChannelParent::OtherPid() const
|
||||
{
|
||||
if (mIPCClosed) {
|
||||
return 0;
|
||||
}
|
||||
return Manager()->OtherPid();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HttpChannelParent::nsISupports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
@ -120,6 +120,8 @@ public:
|
|||
// Callback while background channel is destroyed.
|
||||
void OnBackgroundParentDestroyed();
|
||||
|
||||
base::ProcessId OtherPid() const override;
|
||||
|
||||
protected:
|
||||
// used to connect redirected-to channel in parent with just created
|
||||
// ChildChannel. Used during redirects.
|
||||
|
|
|
@ -136,9 +136,12 @@ StreamFilterParent::Create(dom::ContentParent* aContentParent, uint64_t aChannel
|
|||
RefPtr<nsHttpChannel> chan = do_QueryObject(channel);
|
||||
NS_ENSURE_TRUE(chan, false);
|
||||
|
||||
auto channelPid = chan->ProcessId();
|
||||
NS_ENSURE_TRUE(channelPid, false);
|
||||
|
||||
Endpoint<PStreamFilterParent> parent;
|
||||
Endpoint<PStreamFilterChild> child;
|
||||
nsresult rv = PStreamFilter::CreateEndpoints(chan->ProcessId(),
|
||||
nsresult rv = PStreamFilter::CreateEndpoints(channelPid,
|
||||
aContentParent ? aContentParent->OtherPid()
|
||||
: base::GetCurrentProcId(),
|
||||
&parent, &child);
|
||||
|
|
Загрузка…
Ссылка в новой задаче