From 644e9db1092df1477b1facc52cd3ee45ebd13040 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Thu, 1 Mar 2018 11:52:50 +0100 Subject: DevTools - network - implement the secureConnectionStart property for the PerformanceTiming https://github.com/MoonchildProductions/moebius/pull/116 ("/testing" and "/toolkit" in in the previous commit) --- dom/performance/PerformanceTiming.cpp | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'dom/performance/PerformanceTiming.cpp') diff --git a/dom/performance/PerformanceTiming.cpp b/dom/performance/PerformanceTiming.cpp index 527cf9441..4428f81c2 100644 --- a/dom/performance/PerformanceTiming.cpp +++ b/dom/performance/PerformanceTiming.cpp @@ -63,12 +63,40 @@ PerformanceTiming::InitializeTimingInfo(nsITimedChannel* aChannel) aChannel->GetDomainLookupStart(&mDomainLookupStart); aChannel->GetDomainLookupEnd(&mDomainLookupEnd); aChannel->GetConnectStart(&mConnectStart); + aChannel->GetSecureConnectionStart(&mSecureConnectionStart); aChannel->GetConnectEnd(&mConnectEnd); aChannel->GetRequestStart(&mRequestStart); aChannel->GetResponseStart(&mResponseStart); aChannel->GetCacheReadStart(&mCacheReadStart); aChannel->GetResponseEnd(&mResponseEnd); aChannel->GetCacheReadEnd(&mCacheReadEnd); + + // the performance timing api essentially requires that the event timestamps + // are >= asyncOpen().. but in truth the browser engages in a number of + // speculative activities that sometimes mean connections and lookups begin + // earlier. Workaround that here by just using asyncOpen as the minimum + // timestamp for dns and connection info. + if (!mAsyncOpen.IsNull()) { + if (!mDomainLookupStart.IsNull() && mDomainLookupStart < mAsyncOpen) { + mDomainLookupStart = mAsyncOpen; + } + + if (!mDomainLookupEnd.IsNull() && mDomainLookupEnd < mAsyncOpen) { + mDomainLookupEnd = mAsyncOpen; + } + + if (!mConnectStart.IsNull() && mConnectStart < mAsyncOpen) { + mConnectStart = mAsyncOpen; + } + + if (!mSecureConnectionStart.IsNull() && mSecureConnectionStart < mAsyncOpen) { + mSecureConnectionStart = mAsyncOpen; + } + + if (!mConnectEnd.IsNull() && mConnectEnd < mAsyncOpen) { + mConnectEnd = mAsyncOpen; + } + } } } @@ -273,6 +301,22 @@ PerformanceTiming::ConnectStart() return static_cast(ConnectStartHighRes()); } +DOMHighResTimeStamp +PerformanceTiming::SecureConnectionStartHighRes() +{ + if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) { + return mZeroTime; + } + return mSecureConnectionStart.IsNull() ? mZeroTime + : TimeStampToDOMHighRes(mSecureConnectionStart); +} + +DOMTimeMilliSec +PerformanceTiming::SecureConnectionStart() +{ + return static_cast(SecureConnectionStartHighRes()); +} + DOMHighResTimeStamp PerformanceTiming::ConnectEndHighRes() { -- cgit v1.2.3