Bug 1120715 - Part 2: Don't use OPEN_TRUNCATE when reopening a fake synthesized cache entry; r=mayhemer,jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 04 Mar 2016 15:09:27 -0500
changeset 288343 53bafeddc993d5ce88f9658878a7ffbb6be2d91d
parent 288342 6a89a3c368939ea2ac06301e3df821236ac3dbb2
child 288344 1308f7beeaa112f0c1d750cd24b0f18f28253329
push id30079
push userryanvm@gmail.com
push dateSat, 12 Mar 2016 20:24:19 +0000
treeherdermozilla-central@d1d47ba19ce9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer, jdm
bugs1120715
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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.
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3030,16 +3030,20 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
         GetCallback(controller);
 
         RefPtr<InterceptedChannelChrome> intercepted =
                 new InterceptedChannelChrome(this, controller, entry);
         intercepted->NotifyController();
     } else {
         if (mInterceptCache == 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;
             MOZ_ASSERT(NS_SUCCEEDED(cacheStorage->Exists(openURI, extension, &exists)) && exists,
                        "The entry must exist in the cache after we create it here");
         }
         rv = cacheStorage->AsyncOpenURI(openURI, extension, cacheEntryOpenFlags, this);
         NS_ENSURE_SUCCESS(rv, rv);
     }