Bug 1120715 - Part 2: Don't use OPEN_TRUNCATE when reopening a fake synthesized cache entry; r=mayhemer,jdm

This shows up when intercepting the reload cache type channels, since
the cache storage will reopen the cache entry that has been used to fill
up the synthesized response otherwise because of the LOAD_BYPASS_CACHE
flag.
This commit is contained in:
Ehsan Akhgari 2016-03-04 15:09:27 -05:00
Родитель fded90051d
Коммит 456b0a7460
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -3035,6 +3035,10 @@ nsHttpChannel::OpenCacheEntry(bool isHttps)
} else { } else {
if (mInterceptCache == INTERCEPTED) { if (mInterceptCache == INTERCEPTED) {
cacheEntryOpenFlags |= nsICacheStorage::OPEN_INTERCEPTED; cacheEntryOpenFlags |= nsICacheStorage::OPEN_INTERCEPTED;
// Clear OPEN_TRUNCATE for the fake cache entry, since otherwise
// cache storage will close the current entry which breaks the
// response synthesis.
cacheEntryOpenFlags &= ~nsICacheStorage::OPEN_TRUNCATE;
DebugOnly<bool> exists; DebugOnly<bool> exists;
MOZ_ASSERT(NS_SUCCEEDED(cacheStorage->Exists(openURI, extension, &exists)) && exists, MOZ_ASSERT(NS_SUCCEEDED(cacheStorage->Exists(openURI, extension, &exists)) && exists,
"The entry must exist in the cache after we create it here"); "The entry must exist in the cache after we create it here");