Bug 1263428 - Make sure we don't set the domainLookupEnd timestamp after connectStart for non-persistant connections. r=mcmanus, a=sylvestre
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 27 Apr 2016 22:13:30 +0200
changeset 333011 9d9a6bbe53f41c2926066a1c8f9a7d2a4d2fefff
parent 333010 a10c6f6843af1352b1989be55d59447fb7faa34b
child 333012 95ddeda3ebef5c4be9af59ed7f58ca59a2ca9658
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcmanus, sylvestre
bugs1263428
milestone48.0a2
Bug 1263428 - Make sure we don't set the domainLookupEnd timestamp after connectStart for non-persistant connections. r=mcmanus, a=sylvestre
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6090,19 +6090,20 @@ nsHttpChannel::OnStopRequest(nsIRequest 
         // at this point, we're done with the transaction
         mTransactionTimings = mTransaction->Timings();
         mTransaction = nullptr;
         mTransactionPump = nullptr;
 
         // We no longer need the dns prefetch object
         if (mDNSPrefetch && mDNSPrefetch->TimingsValid()
             && !mTransactionTimings.requestStart.IsNull()
-            && mDNSPrefetch->EndTimestamp() <= mTransactionTimings.requestStart) {
+            && !mTransactionTimings.connectStart.IsNull()
+            && mDNSPrefetch->EndTimestamp() <= mTransactionTimings.connectStart) {
             // We only need the domainLookup timestamps when not using a
-            // persistent connection, meaning if the endTimestamp < requestStart
+            // persistent connection, meaning if the endTimestamp < connectStart
             mTransactionTimings.domainLookupStart =
                 mDNSPrefetch->StartTimestamp();
             mTransactionTimings.domainLookupEnd =
                 mDNSPrefetch->EndTimestamp();
         }
         mDNSPrefetch = nullptr;
 
         // handle auth retry...
@@ -7021,20 +7022,21 @@ nsHttpChannel::OnLookupComplete(nsICance
          "%s status[0x%x]\n",
          this, mCaps & NS_HTTP_REFRESH_DNS ? ", refresh requested" : "",
          NS_SUCCEEDED(status) ? "success" : "failure", status));
 
     // We no longer need the dns prefetch object. Note: mDNSPrefetch could be
     // validly null if OnStopRequest has already been called.
     // We only need the domainLookup timestamps when not loading from cache
     if (mDNSPrefetch && mDNSPrefetch->TimingsValid() && mTransaction) {
+        TimeStamp connectStart = mTransaction->GetConnectStart();
         TimeStamp requestStart = mTransaction->GetRequestStart();
         // We only set the domainLookup timestamps if we're not using a
         // persistent connection.
-        if (requestStart.IsNull() || (mDNSPrefetch->EndTimestamp() < requestStart)) {
+        if (requestStart.IsNull() && connectStart.IsNull()) {
             mTransaction->SetDomainLookupStart(mDNSPrefetch->StartTimestamp());
             mTransaction->SetDomainLookupEnd(mDNSPrefetch->EndTimestamp());
         }
     }
     mDNSPrefetch = nullptr;
 
     // Unset DNS cache refresh if it was requested,
     if (mCaps & NS_HTTP_REFRESH_DNS) {