Bug 1325325 - Do not record the timestamp for conditional requests. r=michal
authorJunior Hsu <juhsu@mozilla.com>
Wed, 18 Jan 2017 15:29:04 +0800
changeset 374959 aba1bf821277c995fbae47f5a898eef62ba10a14
parent 374958 17542663b5648395038161ac86f3ef91267e73d3
child 374960 b8cf89eff546edd53a31b54b45c8947693e9d4bb
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1325325
milestone53.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 1325325 - Do not record the timestamp for conditional requests. r=michal
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6712,17 +6712,20 @@ nsHttpChannel::OnStopRequest(nsIRequest 
             stickyConn = mTransaction->GetConnectionReference();
         }
 
         mTransferSize = mTransaction->GetTransferSize();
 
         // If we are using the transaction to serve content, we also save the
         // time since async open in the cache entry so we can compare telemetry
         // between cache and net response.
-        if (request == mTransactionPump && mCacheEntry &&
+        // Do not store the time of conditional requests because even if we
+        // fetch the data from the server, the time includes loading of the old
+        // cache entry which would skew the network load time.
+        if (request == mTransactionPump && mCacheEntry && !mDidReval &&
             !mAsyncOpenTime.IsNull() && !mOnStartRequestTimestamp.IsNull()) {
             nsAutoCString onStartTime;
             onStartTime.AppendInt( (uint64_t) (mOnStartRequestTimestamp - mAsyncOpenTime).ToMilliseconds());
             mCacheEntry->SetMetaDataElement("net-response-time-onstart", onStartTime.get());
 
             nsAutoCString responseTime;
             responseTime.AppendInt( (uint64_t) (TimeStamp::Now() - mAsyncOpenTime).ToMilliseconds());
             mCacheEntry->SetMetaDataElement("net-response-time-onstop", responseTime.get());