Bug 1120715 - Part 2: Don't use OPEN_TRUNCATE when reopening a fake synthesized cache entry; r=mayhemer,jdm
☠☠ backed out by 60633fe1415f ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 04 Mar 2016 15:09:27 -0500
changeset 288102 44f346712a3a
parent 288101 60d6045125e2
child 288103 c731944ecc64
push id73306
push usereakhgari@mozilla.com
push dateThu, 10 Mar 2016 22:29:29 +0000
treeherdermozilla-inbound@043770204431 [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);
     }