Bug 1120715 - Part 2: Don't use OPEN_TRUNCATE when reopening a fake synthesized cache entry; r=mayhemer,jdm
☠☠ backed out by dd3a0551e7b1 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 04 Mar 2016 15:09:27 -0500
changeset 287552 7e003fb64d41
parent 287551 ef66b64e9f8a
child 287553 c5bf9f7bb86e
push id73221
push usereakhgari@mozilla.com
push dateWed, 09 Mar 2016 21:46:40 +0000
treeherdermozilla-inbound@2ee4b18f6b3a [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);
     }