From de9560af3e0e0d0dc93c5401c9b6ca2f0a173e36 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Sun, 29 Apr 2018 11:59:22 +0200 Subject: Bug 1317297 - nextHopProtocol is an empty string for local fetch https://hg.mozilla.org/mozilla-central/rev/9e5cd2bf4d66 --- dom/performance/PerformanceMainThread.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index 86d42c5f8..fa03408c6 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -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 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; -- cgit v1.2.3