Bug 1396307 - Make sure we only set mRaceCacheWithNetwork to true when the feature is enabled. r=michal, a=lizzard
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 06 Sep 2017 10:24:01 +0200
changeset 666735 16a31f23b98a98e4cb843658cd4a3189d0c134f4
parent 666734 e5b95529a8f804e828de22037d40947f60dd84a9
child 666736 09f4708df24cde4ce73032d3196f1593bb259ee4
push id80488
push userbmo:mkelly@mozilla.com
push dateTue, 19 Sep 2017 04:42:30 +0000
reviewersmichal, lizzard
bugs1396307
milestone56.0
Bug 1396307 - Make sure we only set mRaceCacheWithNetwork to true when the feature is enabled. r=michal, a=lizzard MozReview-Commit-ID: FrLjfuExmYV
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3899,17 +3899,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;
@@ -9185,17 +9185,17 @@ nsHttpChannel::TriggerNetwork(int32_t aT
         // 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();
     }
 
     LOG(("  setting timer to trigger network: %d ms\n", aTimeout));
     mNetworkTriggerTimer = do_CreateInstance(NS_TIMER_CONTRACTID);