diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 11:59:22 +0200 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-04-29 11:59:22 +0200 |
commit | de9560af3e0e0d0dc93c5401c9b6ca2f0a173e36 (patch) | |
tree | 42fd41070c51eef1215a61bf44ed9f453366e2bb | |
parent | e040ed925030f899f845d458c226f7e439f4ec8b (diff) | |
download | uxp-de9560af3e0e0d0dc93c5401c9b6ca2f0a173e36.tar.gz |
Bug 1317297 - nextHopProtocol is an empty string for local fetch
https://hg.mozilla.org/mozilla-central/rev/9e5cd2bf4d66
-rw-r--r-- | dom/performance/PerformanceMainThread.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index 86d42c5f86..fa03408c6b 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<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; |