Bug 1397593 - Assertion failure: !mOnStartRequestCalled (We should not call OnStartRequest twice) in HttpBaseChannel::DoNotifyListener(), r=valentin
☠☠ backed out by bb26b7c3357a ☠ ☠
authorMichal Novotny <michal.novotny@gmail.com>
Wed, 13 Sep 2017 08:41:01 +0200
changeset 430138 e6f1fbbfdd1ffe1c16449a90e918568d3b14c0c6
parent 430137 0657b94b692499a4707d832f9f0d1378c94a0326
child 430139 a1dfff8f131db045f60c4b70642f0b537d42c77c
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1397593
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 1397593 - Assertion failure: !mOnStartRequestCalled (We should not call OnStartRequest twice) in HttpBaseChannel::DoNotifyListener(), r=valentin
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -4432,17 +4432,26 @@ nsHttpChannel::OnCacheEntryAvailable(nsI
     if (!mIsPending) {
         mCacheInputStream.CloseAndRelease();
         return NS_OK;
     }
 
     rv = OnCacheEntryAvailableInternal(entry, aNew, aAppCache, status);
     if (NS_FAILED(rv)) {
         CloseCacheEntry(false);
-        Unused << AsyncAbort(rv);
+        if (mNetworkTriggered && mFirstResponseSource != RESPONSE_FROM_CACHE) {
+            // Ignore the error if we're racing cache with network and the cache
+            // didn't win, The network part will handle cancelation or any other
+            // error. Otherwise we could end up calling the listener twice, see
+            // bug 1397593.
+            MOZ_RELEASE_ASSERT(mRaceCacheWithNetwork);
+            LOG(("  not calling AsyncAbort() because we're racing cache with network"));
+        } else {
+            Unused << AsyncAbort(rv);
+        }
     }
 
     return NS_OK;
 }
 
 nsresult
 nsHttpChannel::OnCacheEntryAvailableInternal(nsICacheEntry *entry,
                                              bool aNew,