Bug 1399541 - Add assertion that we rcwn is enabled when mRaceCacheWithNetwork is true. r=michal
☠☠ backed out by 943c2c2a1daf ☠ ☠
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 13 Sep 2017 18:41:45 +0200
changeset 380838 4198b9d273b9db50b5ffe4cdd078da073d8483db
parent 380837 db0bc6f63bc429741509ea5d789b71236482530c
child 380839 b2a36230e1936ff5e6554e3809274fa87e4297b1
push id32497
push userkwierso@gmail.com
push dateThu, 14 Sep 2017 07:03:42 +0000
treeherdermozilla-central@4702042aa919 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1399541
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 1399541 - Add assertion that we rcwn is enabled when mRaceCacheWithNetwork is true. r=michal MozReview-Commit-ID: 8UDaIklOOmw
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3972,26 +3972,30 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
             MaybeRaceCacheWithNetwork();
         }
 
         if (!mCacheOpenDelay) {
             MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread");
             mCacheAsyncOpenCalled = true;
             if (mNetworkTriggered) {
                 mRaceCacheWithNetwork = true;
+                MOZ_RELEASE_ASSERT(sRCWNEnabled, "Racing should be enabled");
             }
             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;
                 if (self->mNetworkTriggered) {
                     self->mRaceCacheWithNetwork = true;
+                    // This is only done in xpcshell-test to simulate a slow
+                    // opening of the cache, so we don't need to assert that
+                    // sRCWNEnabled == true
                 }
                 cacheStorage->AsyncOpenURI(openURI, extension, cacheEntryOpenFlags, self);
             };
 
             mCacheOpenTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
             // calls nsHttpChannel::Notify after `mCacheOpenDelay` milliseconds
             mCacheOpenTimer->InitWithCallback(this, mCacheOpenDelay, nsITimer::TYPE_ONE_SHOT);
 
@@ -9383,16 +9387,17 @@ nsHttpChannel::TriggerNetwork()
     if (mProxyRequest) {
         LOG(("  proxy request in progress. Delaying network trigger.\n"));
         mWaitingForProxy = true;
         return NS_OK;
     }
 
     if (mCacheAsyncOpenCalled && !mOnCacheAvailableCalled) {
         mRaceCacheWithNetwork = true;
+        MOZ_RELEASE_ASSERT(sRCWNEnabled, "Racing should be enabled");
     }
 
     LOG(("  triggering network\n"));
     return TryHSTSPriming();
 }
 
 nsresult
 nsHttpChannel::MaybeRaceCacheWithNetwork()