Bug 1396307 - Make sure we only set mRaceCacheWithNetwork to true when the feature is enabled r=michal draft
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 06 Sep 2017 10:24:01 +0200
changeset 664991 21ec1409444b202fcb73aee8b8d04475c5179679
parent 664985 593158cd491002031b4527a95d9bfac79c0cdcef
child 664992 4ae01e3889b5e1cd3708e9a1273b7e0eb79aca51
push id79893
push uservalentin.gosu@gmail.com
push dateThu, 14 Sep 2017 19:51:11 +0000
reviewersmichal
bugs1396307
milestone57.0a1
Bug 1396307 - Make sure we only set mRaceCacheWithNetwork to true when the feature is enabled r=michal MozReview-Commit-ID: FrLjfuExmYV
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3971,17 +3971,17 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
             NS_SUCCEEDED(rv) && !hasAltData && sizeInKb < sRCWNSmallResourceSizeKB) {
             MaybeRaceCacheWithNetwork();
         }
 
         if (!mCacheOpenDelay) {
             MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread");
             mCacheAsyncOpenCalled = true;
             if (mNetworkTriggered) {
-                mRaceCacheWithNetwork = true;
+                mRaceCacheWithNetwork = sRCWNEnabled;
             }
             rv = cacheStorage->AsyncOpenURI(openURI, extension, cacheEntryOpenFlags, this);
         } else {
             // We pass `this` explicitly as a parameter due to the raw pointer
             // to refcounted object in lambda analysis.
             mCacheOpenFunc = [openURI, extension, cacheEntryOpenFlags, cacheStorage] (nsHttpChannel* self) -> void {
                 MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread");
                 self->mCacheAsyncOpenCalled = true;
@@ -9382,17 +9382,17 @@ nsHttpChannel::TriggerNetwork()
     // for the cache callbacks.
     if (mProxyRequest) {
         LOG(("  proxy request in progress. Delaying network trigger.\n"));
         mWaitingForProxy = true;
         return NS_OK;
     }
 
     if (mCacheAsyncOpenCalled && !mOnCacheAvailableCalled) {
-        mRaceCacheWithNetwork = true;
+        mRaceCacheWithNetwork = sRCWNEnabled;
     }
 
     LOG(("  triggering network\n"));
     return TryHSTSPriming();
 }
 
 nsresult
 nsHttpChannel::MaybeRaceCacheWithNetwork()