Bug 1317297 - nextHopProtocol is an empty string for local fetch

https://hg.mozilla.org/mozilla-central/rev/9e5cd2bf4d66
This commit is contained in:
janekptacijarabaci 2018-04-29 11:59:22 +02:00 committed by Roy Tam
commit 4e7b6e6d22

View file

@ -6,6 +6,7 @@
#include "PerformanceMainThread.h"
#include "PerformanceNavigation.h"
#include "nsICacheInfoChannel.h"
namespace mozilla {
namespace dom {
@ -165,6 +166,17 @@ PerformanceMainThread::AddEntry(nsIHttpChannel* channel,
nsAutoCString protocol;
channel->GetProtocolVersion(protocol);
// If this is a local fetch, nextHopProtocol should be set to empty string.
nsCOMPtr<nsICacheInfoChannel> cachedChannel = do_QueryInterface(channel);
if (cachedChannel) {
bool isFromCache;
if (NS_SUCCEEDED(cachedChannel->IsFromCache(&isFromCache))
&& isFromCache) {
protocol.Truncate();
}
}
performanceEntry->SetNextHopProtocol(NS_ConvertUTF8toUTF16(protocol));
uint64_t encodedBodySize = 0;