Bug 1396307 - Set mCacheAsyncOpenCalled back to flase when AsyncOpenURI fails r=michal draft
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 14 Sep 2017 22:08:52 +0200
changeset 665023 6448c3a429612edb0923a44c3a199c96bd3643e7
parent 664992 4ae01e3889b5e1cd3708e9a1273b7e0eb79aca51
child 731629 d2a2f7fadacb3384f7cd87de22378361892724af
push id79901
push uservalentin.gosu@gmail.com
push dateThu, 14 Sep 2017 20:12:28 +0000
reviewersmichal
bugs1396307
milestone57.0a1
Bug 1396307 - Set mCacheAsyncOpenCalled back to flase when AsyncOpenURI fails r=michal MozReview-Commit-ID: VnwI3ERHVt
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -3974,16 +3974,20 @@ nsHttpChannel::OpenCacheEntry(bool isHtt
 
         if (!mCacheOpenDelay) {
             MOZ_ASSERT(NS_IsMainThread(), "Should be called on the main thread");
             mCacheAsyncOpenCalled = true;
             if (mNetworkTriggered) {
                 mRaceCacheWithNetwork = sRCWNEnabled;
             }
             rv = cacheStorage->AsyncOpenURI(openURI, extension, cacheEntryOpenFlags, this);
+            if (NS_FAILED(rv)) {
+                // Drop the flag since the cache open failed
+                mCacheAsyncOpenCalled = false;
+            }
         } 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;