Bug 1416682 - Don't allow writing alt-data to HTTP cache entry when the loading channel has failed to release the entry, r=michal

This commit is contained in:
Honza Bambas 2017-12-01 11:01:00 +02:00
Родитель 5c04388149
Коммит be74fa61ca
1 изменённых файлов: 3 добавлений и 1 удалений

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

@ -1105,7 +1105,9 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
// 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()) {
// If the channel has failed, the cache entry is in a non-writtable state and
// we want to release it to not block following consumers.
if (NS_SUCCEEDED(channelStatus) && !mPreferredCachedAltDataType.IsEmpty()) {
mKeptAlive = true;
SendDocumentChannelCleanup(false); // don't clear cache entry
return;