From 9b2d85e6e1a4b056671726e96bdbcafb1930673c Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Wed, 4 Oct 2017 02:48:36 +0200 Subject: [PATCH] Bug 1403926 - Make the PerformanceNavigationTiming timestamps be relative to startTime r=baku MozReview-Commit-ID: 7lvSsde9dzh --HG-- extra : rebase_source : bc4b7fa0526a3fe749c17ce10f70baa8a33f8bb1 --- dom/performance/PerformanceMainThread.cpp | 4 +++- dom/performance/PerformanceNavigationTiming.h | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp index aa24b068898a..636a8af39787 100644 --- a/dom/performance/PerformanceMainThread.cpp +++ b/dom/performance/PerformanceMainThread.cpp @@ -314,7 +314,9 @@ PerformanceMainThread::EnsureDocEntry() { if (!mDocEntry && nsContentUtils::IsPerformanceNavigationTimingEnabled()) { nsCOMPtr httpChannel = do_QueryInterface(mChannel); - mDocEntry = new PerformanceNavigationTiming(Timing(), this, + RefPtr timing = + new PerformanceTiming(this, mChannel, nullptr, 0); + mDocEntry = new PerformanceNavigationTiming(timing, this, httpChannel); } } diff --git a/dom/performance/PerformanceNavigationTiming.h b/dom/performance/PerformanceNavigationTiming.h index dc055015ddd7..69e326e21ceb 100644 --- a/dom/performance/PerformanceNavigationTiming.h +++ b/dom/performance/PerformanceNavigationTiming.h @@ -24,6 +24,10 @@ class PerformanceNavigationTiming final public: NS_DECL_ISUPPORTS_INHERITED + // Note that aPerformanceTiming must be initalized with zeroTime = 0 + // so that timestamps are relative to startTime, as opposed to the + // performance.timing object for which timestamps are absolute and has a + // zeroTime initialized to navigationStart explicit PerformanceNavigationTiming(PerformanceTiming* aPerformanceTiming, Performance* aPerformance, nsIHttpChannel* aChannel)