Bug 1384478 - browser/base/content/test/general/browser_save_video.js fails when we enable rcwn, r=honzab
authorMichal Novotny <michal.novotny@gmail.com>
Thu, 31 Aug 2017 19:26:13 +0200
changeset 378119 d1768de3e9f2ed9539b681bb31a491c426205ee5
parent 378118 b6c7cf7bb17cec0cabd7a46719805020546e6444
child 378120 b0066ef926e105ad6985fc53df554bdccc476552
push id32422
push userarchaeopteryx@coole-files.de
push dateFri, 01 Sep 2017 08:39:53 +0000
treeherdermozilla-central@a3585c77e2b1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs1384478
milestone57.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 1384478 - browser/base/content/test/general/browser_save_video.js fails when we enable rcwn, r=honzab
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1719,18 +1719,22 @@ nsHttpChannel::CallOnStartRequest()
 
     // if this channel is for a download, close off access to the cache.
     if (mCacheEntry && mChannelIsForDownload) {
         mCacheEntry->AsyncDoom(nullptr);
 
         // We must keep the cache entry in case of partial request.
         // Concurrent access is the same, we need the entry in
         // OnStopRequest.
-        if (!mCachedContentIsPartial && !mConcurrentCacheAccess)
+        // We also need the cache entry when racing cache with network to find
+        // out what is the source of the data.
+        if (!mCachedContentIsPartial && !mConcurrentCacheAccess &&
+            !(mRaceCacheWithNetwork && mFirstResponseSource == RESPONSE_FROM_CACHE)) {
             CloseCacheEntry(false);
+        }
     }
 
     if (!mCanceled) {
         // create offline cache entry if offline caching was requested
         if (ShouldUpdateOfflineCacheEntry()) {
             LOG(("writing to the offline cache"));
             rv = InitOfflineCacheEntry();
             if (NS_FAILED(rv)) return rv;