From cde7f99f558ef6762d9d4fab2090ee9a55de93c5 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Tue, 11 Jul 2017 14:18:58 +0200 Subject: [PATCH] Bug 1378714 - [RCWN] Make sure we ReadFromCache even when OnCacheEntryAvailable is called before AsyncOpenURI is called. r=michal MozReview-Commit-ID: KHUmZp8RuT8 --- netwerk/protocol/http/nsHttpChannel.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index a28bb41b7f9e..928a1d667d04 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -485,6 +485,14 @@ nsHttpChannel::Connect() // otherwise, let's just proceed without using the cache. } + // When racing, if OnCacheEntryAvailable is called before AsyncOpenURI + // returns, then we may not have started reading from the cache. + // If the content is valid, we should attempt to do so, as technically the + // cache has won the race. + if (sRCWNEnabled && mCachedContentIsValid && mNetworkTriggered) { + Unused << ReadFromCache(true); + } + return TriggerNetwork(0); }