diff options
author | Moonchild <mcwerewolf@gmail.com> | 2018-03-02 10:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-02 10:32:45 +0100 |
commit | e272829137195b46612b7664c9416364089f7baa (patch) | |
tree | 20b543048260952a2c4ac8bb4cb22aaaa684bd84 /dom | |
parent | ba2c2e5301bb2d993984c62cdf2fd07b361e6bca (diff) | |
parent | c8355b22c047c9737e32f096b816edbb8b0fa181 (diff) | |
download | UXP-e272829137195b46612b7664c9416364089f7baa.tar UXP-e272829137195b46612b7664c9416364089f7baa.tar.gz UXP-e272829137195b46612b7664c9416364089f7baa.tar.lz UXP-e272829137195b46612b7664c9416364089f7baa.tar.xz UXP-e272829137195b46612b7664c9416364089f7baa.zip |
Merge pull request #34 from janekptacijarabaci/devtools_import-from-moebius_1
Port across devtools enhancements
Diffstat (limited to 'dom')
-rw-r--r-- | dom/performance/PerformanceMainThread.cpp | 5 | ||||
-rw-r--r-- | dom/performance/PerformanceResourceTiming.h | 6 | ||||
-rw-r--r-- | dom/performance/PerformanceTiming.cpp | 48 | ||||
-rw-r--r-- | dom/performance/PerformanceTiming.h | 3 | ||||
-rw-r--r-- | dom/webidl/PerformanceTiming.webidl | 3 |
5 files changed, 59 insertions, 6 deletions
diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index b60b68f62..86d42c5f8 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -200,7 +200,7 @@ PerformanceMainThread::IsPerformanceTimingAttribute(const nsAString& aName) static const char* attributes[] = {"navigationStart", "unloadEventStart", "unloadEventEnd", "redirectStart", "redirectEnd", "fetchStart", "domainLookupStart", "domainLookupEnd", - "connectStart", "connectEnd", "requestStart", "responseStart", + "connectStart", "secureConnectionStart", "connectEnd", "requestStart", "responseStart", "responseEnd", "domLoading", "domInteractive", "domContentLoadedEventStart", "domContentLoadedEventEnd", "domComplete", "loadEventStart", "loadEventEnd", nullptr}; @@ -249,6 +249,9 @@ PerformanceMainThread::GetPerformanceTimingFromString(const nsAString& aProperty if (aProperty.EqualsLiteral("connectStart")) { return Timing()->ConnectStart(); } + if (aProperty.EqualsLiteral("secureConnectionStart")) { + return Timing()->SecureConnectionStart(); + } if (aProperty.EqualsLiteral("connectEnd")) { return Timing()->ConnectEnd(); } diff --git a/dom/performance/PerformanceResourceTiming.h b/dom/performance/PerformanceResourceTiming.h index abb653d66..2dd6b4a06 100644 --- a/dom/performance/PerformanceResourceTiming.h +++ b/dom/performance/PerformanceResourceTiming.h @@ -128,9 +128,9 @@ public: DOMHighResTimeStamp SecureConnectionStart() const { - // This measurement is not available for Navigation Timing either. - // There is a different bug submitted for it. - return 0; + return mTiming && mTiming->TimingAllowed() + ? mTiming->SecureConnectionStartHighRes() + : 0; } virtual const PerformanceResourceTiming* ToResourceTiming() const override diff --git a/dom/performance/PerformanceTiming.cpp b/dom/performance/PerformanceTiming.cpp index 527cf9441..4070b6a0f 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; + } + } } } @@ -274,6 +302,26 @@ PerformanceTiming::ConnectStart() } DOMHighResTimeStamp +PerformanceTiming::SecureConnectionStartHighRes() +{ + if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) { + return mZeroTime; + } + + // Round down to the nearest 1ms + const double maxResolutionMs = 1; + return mSecureConnectionStart.IsNull() + ? mZeroTime + : floor(TimeStampToDOMHighRes(mSecureConnectionStart) / maxResolutionMs) * maxResolutionMs; +} + +DOMTimeMilliSec +PerformanceTiming::SecureConnectionStart() +{ + return static_cast<int64_t>(SecureConnectionStartHighRes()); +} + +DOMHighResTimeStamp PerformanceTiming::ConnectEndHighRes() { if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) { diff --git a/dom/performance/PerformanceTiming.h b/dom/performance/PerformanceTiming.h index aef54a258..0bc73fd3f 100644 --- a/dom/performance/PerformanceTiming.h +++ b/dom/performance/PerformanceTiming.h @@ -161,6 +161,7 @@ public: DOMHighResTimeStamp DomainLookupStartHighRes(); DOMHighResTimeStamp DomainLookupEndHighRes(); DOMHighResTimeStamp ConnectStartHighRes(); + DOMHighResTimeStamp SecureConnectionStartHighRes(); DOMHighResTimeStamp ConnectEndHighRes(); DOMHighResTimeStamp RequestStartHighRes(); DOMHighResTimeStamp ResponseStartHighRes(); @@ -173,6 +174,7 @@ public: DOMTimeMilliSec DomainLookupStart(); DOMTimeMilliSec DomainLookupEnd(); DOMTimeMilliSec ConnectStart(); + DOMTimeMilliSec SecureConnectionStart(); DOMTimeMilliSec ConnectEnd(); DOMTimeMilliSec RequestStart(); DOMTimeMilliSec ResponseStart(); @@ -255,6 +257,7 @@ private: TimeStamp mDomainLookupStart; TimeStamp mDomainLookupEnd; TimeStamp mConnectStart; + TimeStamp mSecureConnectionStart; TimeStamp mConnectEnd; TimeStamp mRequestStart; TimeStamp mResponseStart; diff --git a/dom/webidl/PerformanceTiming.webidl b/dom/webidl/PerformanceTiming.webidl index f75a46b7c..e14201440 100644 --- a/dom/webidl/PerformanceTiming.webidl +++ b/dom/webidl/PerformanceTiming.webidl @@ -21,8 +21,7 @@ interface PerformanceTiming { readonly attribute unsigned long long domainLookupEnd; readonly attribute unsigned long long connectStart; readonly attribute unsigned long long connectEnd; - // secureConnectionStart will be implemneted in bug 772589 - // readonly attribute unsigned long long secureConnectionStart; + readonly attribute unsigned long long secureConnectionStart; readonly attribute unsigned long long requestStart; readonly attribute unsigned long long responseStart; readonly attribute unsigned long long responseEnd; |