DevTools - network - implement the secureConnectionStart property for the PerformanceTiming

https://github.com/MoonchildProductions/moebius/pull/116
("/testing" and "/toolkit" in in the previous commit)
This commit is contained in:
janekptacijarabaci 2018-03-01 11:52:50 +01:00 committed by Roy Tam
commit 54f2e6eafd
32 changed files with 263 additions and 13 deletions

View file

@ -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<int64_t>(ConnectStartHighRes());
}
DOMHighResTimeStamp
PerformanceTiming::SecureConnectionStartHighRes()
{
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
return mSecureConnectionStart.IsNull() ? mZeroTime
: TimeStampToDOMHighRes(mSecureConnectionStart);
}
DOMTimeMilliSec
PerformanceTiming::SecureConnectionStart()
{
return static_cast<int64_t>(SecureConnectionStartHighRes());
}
DOMHighResTimeStamp
PerformanceTiming::ConnectEndHighRes()
{