Bug 1411697 - Make sure to SendDocumentChannelCleanup even when mPreferredCachedAltDataType is set r=michal

MozReview-Commit-ID: ApXNqS9tcfh

--HG--
extra : rebase_source : 6ef619331af3f3dd3424c5ac932a2c828bd9d50f
This commit is contained in:
Valentin Gosu 2017-10-26 15:54:37 +02:00
Родитель c4d1881741
Коммит 996793e8e8
4 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -1096,10 +1096,12 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
CleanupBackgroundChannel();
// DocumentChannelCleanup actually nulls out mCacheEntry in the parent, which
// we might need later to open the Alt-Data output stream, so just return here
// If there is a possibility we might want to write alt data to the cache
// entry, we keep the channel alive. We still send the DocumentChannelCleanup
// message but request the cache entry to be kept by the parent.
if (!mPreferredCachedAltDataType.IsEmpty()) {
mKeptAlive = true;
SendDocumentChannelCleanup(false); // don't clear cache entry
return;
}
@ -1108,7 +1110,7 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
// If IPDL is already closed, then do nothing.
if (mIPCOpen) {
mKeptAlive = true;
SendDocumentChannelCleanup();
SendDocumentChannelCleanup(true);
}
} else {
// The parent process will respond by sending a DeleteSelf message and

Просмотреть файл

@ -1121,12 +1121,14 @@ HttpChannelParent::ContinueRedirect2Verify(const nsresult& aResult)
}
mozilla::ipc::IPCResult
HttpChannelParent::RecvDocumentChannelCleanup()
HttpChannelParent::RecvDocumentChannelCleanup(const bool& clearCacheEntry)
{
// From now on only using mAssociatedContentSecurity. Free everything else.
CleanupBackgroundChannel(); // Background channel can be closed.
mChannel = nullptr; // Reclaim some memory sooner.
if (clearCacheEntry) {
mCacheEntry = nullptr; // Else we'll block other channels reading same URI
}
return IPC_OK();
}

Просмотреть файл

@ -193,7 +193,7 @@ protected:
const bool& aChooseAppcache) override;
virtual mozilla::ipc::IPCResult RecvUpdateAssociatedContentSecurity(const int32_t& broken,
const int32_t& no) override;
virtual mozilla::ipc::IPCResult RecvDocumentChannelCleanup() override;
virtual mozilla::ipc::IPCResult RecvDocumentChannelCleanup(const bool& clearCacheEntry) override;
virtual mozilla::ipc::IPCResult RecvMarkOfflineCacheEntryAsForeign() override;
virtual mozilla::ipc::IPCResult RecvDivertOnDataAvailable(const nsCString& data,
const uint64_t& offset,

Просмотреть файл

@ -53,7 +53,7 @@ parent:
// For document loads we keep this protocol open after child's
// OnStopRequest, and send this msg (instead of __delete__) to allow
// partial cleanup on parent.
async DocumentChannelCleanup();
async DocumentChannelCleanup(bool clearCacheEntry);
// This might have to be sync. If this fails we must fail the document load
// to avoid endless loop.