Bug 1403926 - Make sure PerformanceNavigationTiming timestamps are correct r=baku
authorValentin Gosu <valentin.gosu@gmail.com>
Wed, 04 Oct 2017 04:05:39 +0200
changeset 427112 969c5b28ee1663762b3eabfda112ae48785213d6
parent 427111 6df68b0f2c761f29bb1537d9b22d175181a32829
child 427113 7c4fffd110b6e6041eeb4f88f3c780f472476aa8
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewersbaku
bugs1403926
milestone58.0a1
Bug 1403926 - Make sure PerformanceNavigationTiming timestamps are correct r=baku MozReview-Commit-ID: 9qtfwaqSY4J
dom/base/nsDOMNavigationTiming.cpp
dom/base/nsDOMNavigationTiming.h
dom/performance/PerformanceNavigationTiming.cpp
dom/performance/PerformanceNavigationTiming.h
--- a/dom/base/nsDOMNavigationTiming.cpp
+++ b/dom/base/nsDOMNavigationTiming.cpp
@@ -32,268 +32,259 @@ nsDOMNavigationTiming::~nsDOMNavigationT
 {
 }
 
 void
 nsDOMNavigationTiming::Clear()
 {
   mNavigationType = TYPE_RESERVED;
   mNavigationStartHighRes = 0;
-  mBeforeUnloadStart = 0;
-  mUnloadStart = 0;
-  mUnloadEnd = 0;
-  mLoadEventStart = 0;
-  mLoadEventEnd = 0;
-  mDOMLoading = 0;
-  mDOMInteractive = 0;
-  mDOMContentLoadedEventStart = 0;
-  mDOMContentLoadedEventEnd = 0;
-  mDOMComplete = 0;
 
-  mLoadEventStartSet = false;
-  mLoadEventEndSet = false;
-  mDOMLoadingSet = false;
-  mDOMInteractiveSet = false;
-  mDOMContentLoadedEventStartSet = false;
-  mDOMContentLoadedEventEndSet = false;
-  mDOMCompleteSet = false;
+  mBeforeUnloadStart = TimeStamp();
+  mUnloadStart = TimeStamp();
+  mUnloadEnd = TimeStamp();
+  mLoadEventStart = TimeStamp();
+  mLoadEventEnd = TimeStamp();
+  mDOMLoading = TimeStamp();
+  mDOMInteractive = TimeStamp();
+  mDOMContentLoadedEventStart = TimeStamp();
+  mDOMContentLoadedEventEnd = TimeStamp();
+  mDOMComplete = TimeStamp();
+
   mDocShellHasBeenActiveSinceNavigationStart = false;
 }
 
 DOMTimeMilliSec
 nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const
 {
   if (aStamp.IsNull()) {
     return 0;
   }
 
-  TimeDuration duration = aStamp - mNavigationStartTimeStamp;
+  TimeDuration duration = aStamp - mNavigationStart;
   return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
 }
 
-DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart()
-{
-  return TimeStampToDOM(TimeStamp::Now());
-}
-
 void
 nsDOMNavigationTiming::NotifyNavigationStart(DocShellState aDocShellState)
 {
   mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
-  mNavigationStartTimeStamp = TimeStamp::Now();
+  mNavigationStart = TimeStamp::Now();
   mDocShellHasBeenActiveSinceNavigationStart = (aDocShellState == DocShellState::eActive);
   profiler_add_marker("Navigation::Start");
 }
 
 void
 nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, Type aNavigationType)
 {
   mNavigationType = aNavigationType;
   // At the unload event time we don't really know the loading uri.
   // Need it for later check for unload timing access.
   mLoadedURI = aURI;
 }
 
 void
 nsDOMNavigationTiming::NotifyBeforeUnload()
 {
-  mBeforeUnloadStart = DurationFromStart();
+  mBeforeUnloadStart = TimeStamp::Now();
 }
 
 void
 nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI)
 {
   mUnloadStart = mBeforeUnloadStart;
   mUnloadedURI = aOldURI;
 }
 
 void
 nsDOMNavigationTiming::NotifyUnloadEventStart()
 {
-  mUnloadStart = DurationFromStart();
+  mUnloadStart = TimeStamp::Now();
   profiler_tracing("Navigation", "Unload", TRACING_INTERVAL_START);
 }
 
 void
 nsDOMNavigationTiming::NotifyUnloadEventEnd()
 {
-  mUnloadEnd = DurationFromStart();
+  mUnloadEnd = TimeStamp::Now();
   profiler_tracing("Navigation", "Unload", TRACING_INTERVAL_END);
 }
 
 void
 nsDOMNavigationTiming::NotifyLoadEventStart()
 {
-  if (!mLoadEventStartSet) {
-    mLoadEventStart = DurationFromStart();
-    mLoadEventStartSet = true;
+  if (!mLoadEventStart.IsNull()) {
+    return;
+  }
+  mLoadEventStart = TimeStamp::Now();
 
-    profiler_tracing("Navigation", "Load", TRACING_INTERVAL_START);
+  profiler_tracing("Navigation", "Load", TRACING_INTERVAL_START);
 
-    if (IsTopLevelContentDocumentInContentProcess()) {
-      Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_START_MS,
-                                     mNavigationStartTimeStamp);
-    }
+  if (IsTopLevelContentDocumentInContentProcess()) {
+    Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_START_MS,
+                                   mNavigationStart);
   }
 }
 
 void
 nsDOMNavigationTiming::NotifyLoadEventEnd()
 {
-  if (!mLoadEventEndSet) {
-    mLoadEventEnd = DurationFromStart();
-    mLoadEventEndSet = true;
+  if (!mLoadEventEnd.IsNull()) {
+    return;
+  }
+  mLoadEventEnd = TimeStamp::Now();
 
-    profiler_tracing("Navigation", "Load", TRACING_INTERVAL_END);
+  profiler_tracing("Navigation", "Load", TRACING_INTERVAL_END);
 
-    if (IsTopLevelContentDocumentInContentProcess()) {
-      Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_END_MS,
-                                     mNavigationStartTimeStamp);
-    }
+  if (IsTopLevelContentDocumentInContentProcess()) {
+    Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_END_MS,
+                                   mNavigationStart);
   }
 }
 
 void
 nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, TimeStamp aValue)
 {
-  if (!mDOMLoadingSet) {
-    mLoadedURI = aURI;
-    mDOMLoading = TimeStampToDOM(aValue);
-    mDOMLoadingSet = true;
+  if (!mDOMLoading.IsNull()) {
+    return;
   }
+  mLoadedURI = aURI;
+  mDOMLoading = aValue;
 }
 
 void
 nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
 {
-  if (!mDOMLoadingSet) {
-    mLoadedURI = aURI;
-    mDOMLoading = DurationFromStart();
-    mDOMLoadingSet = true;
+  if (!mDOMLoading.IsNull()) {
+    return;
+  }
+  mLoadedURI = aURI;
+  mDOMLoading = TimeStamp::Now();
 
-    profiler_add_marker("Navigation::DOMLoading");
-  }
+  profiler_add_marker("Navigation::DOMLoading");
 }
 
 void
 nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
 {
-  if (!mDOMInteractiveSet) {
-    mLoadedURI = aURI;
-    mDOMInteractive = DurationFromStart();
-    mDOMInteractiveSet = true;
+  if (!mDOMInteractive.IsNull()) {
+    return;
+  }
+  mLoadedURI = aURI;
+  mDOMInteractive = TimeStamp::Now();
 
-    profiler_add_marker("Navigation::DOMInteractive");
-  }
+  profiler_add_marker("Navigation::DOMInteractive");
 }
 
 void
 nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
 {
-  if (!mDOMCompleteSet) {
-    mLoadedURI = aURI;
-    mDOMComplete = DurationFromStart();
-    mDOMCompleteSet = true;
+  if (!mDOMComplete.IsNull()) {
+    return;
+  }
+  mLoadedURI = aURI;
+  mDOMComplete = TimeStamp::Now();
 
-    profiler_add_marker("Navigation::DOMComplete");
-  }
+  profiler_add_marker("Navigation::DOMComplete");
 }
 
 void
 nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
 {
-  if (!mDOMContentLoadedEventStartSet) {
-    mLoadedURI = aURI;
-    mDOMContentLoadedEventStart = DurationFromStart();
-    mDOMContentLoadedEventStartSet = true;
+  if (!mDOMContentLoadedEventStart.IsNull()) {
+    return;
+  }
 
-    profiler_tracing("Navigation", "DOMContentLoaded", TRACING_INTERVAL_START);
+  mLoadedURI = aURI;
+  mDOMContentLoadedEventStart = TimeStamp::Now();
 
-    if (IsTopLevelContentDocumentInContentProcess()) {
-      Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_MS,
-                                     mNavigationStartTimeStamp);
-    }
+  profiler_tracing("Navigation", "DOMContentLoaded", TRACING_INTERVAL_START);
+
+  if (IsTopLevelContentDocumentInContentProcess()) {
+    Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_MS,
+                                   mNavigationStart);
   }
 }
 
 void
 nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
 {
-  if (!mDOMContentLoadedEventEndSet) {
-    mLoadedURI = aURI;
-    mDOMContentLoadedEventEnd = DurationFromStart();
-    mDOMContentLoadedEventEndSet = true;
+  if (!mDOMContentLoadedEventEnd.IsNull()) {
+    return;
+  }
 
-    profiler_tracing("Navigation", "DOMContentLoaded", TRACING_INTERVAL_END);
+  mLoadedURI = aURI;
+  mDOMContentLoadedEventEnd = TimeStamp::Now();
 
-    if (IsTopLevelContentDocumentInContentProcess()) {
-      Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_END_MS,
-                                     mNavigationStartTimeStamp);
-    }
+  profiler_tracing("Navigation", "DOMContentLoaded", TRACING_INTERVAL_END);
+
+  if (IsTopLevelContentDocumentInContentProcess()) {
+    Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_END_MS,
+                                   mNavigationStart);
   }
 }
 
 void
 nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(!mNavigationStartTimeStamp.IsNull());
+  MOZ_ASSERT(!mNavigationStart.IsNull());
 
-  if (!mNonBlankPaintTimeStamp.IsNull()) {
+  if (!mNonBlankPaint.IsNull()) {
     return;
   }
 
-  mNonBlankPaintTimeStamp = TimeStamp::Now();
-  TimeDuration elapsed = mNonBlankPaintTimeStamp - mNavigationStartTimeStamp;
+  mNonBlankPaint = TimeStamp::Now();
+  TimeDuration elapsed = mNonBlankPaint - mNavigationStart;
 
   if (profiler_is_active()) {
     nsAutoCString spec;
     if (mLoadedURI) {
       mLoadedURI->GetSpec(spec);
     }
     nsPrintfCString marker("Non-blank paint after %dms for URL %s, %s",
                            int(elapsed.ToMilliseconds()), spec.get(),
                            mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and first non-blank paint");
     profiler_add_marker(marker.get());
   }
 
   if (mDocShellHasBeenActiveSinceNavigationStart) {
     Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_MS,
-                                   mNavigationStartTimeStamp,
-                                   mNonBlankPaintTimeStamp);
+                                   mNavigationStart,
+                                   mNonBlankPaint);
   }
 }
 
 void
 nsDOMNavigationTiming::NotifyDocShellStateChanged(DocShellState aDocShellState)
 {
   mDocShellHasBeenActiveSinceNavigationStart &=
     (aDocShellState == DocShellState::eActive);
 }
 
-DOMTimeMilliSec
-nsDOMNavigationTiming::GetUnloadEventStart()
+mozilla::TimeStamp
+nsDOMNavigationTiming::GetUnloadEventStartTimeStamp() const
 {
   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
   nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false);
   if (NS_SUCCEEDED(rv)) {
     return mUnloadStart;
   }
-  return 0;
+  return mozilla::TimeStamp();
 }
 
-DOMTimeMilliSec
-nsDOMNavigationTiming::GetUnloadEventEnd()
+mozilla::TimeStamp
+nsDOMNavigationTiming::GetUnloadEventEndTimeStamp() const
 {
   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
   nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false);
   if (NS_SUCCEEDED(rv)) {
     return mUnloadEnd;
   }
-  return 0;
+  return mozilla::TimeStamp();
 }
 
 bool
 nsDOMNavigationTiming::IsTopLevelContentDocumentInContentProcess() const
 {
   if (!mDocShell) {
     return false;
   }
--- a/dom/base/nsDOMNavigationTiming.h
+++ b/dom/base/nsDOMNavigationTiming.h
@@ -44,52 +44,101 @@ public:
 
   DOMTimeMilliSec GetNavigationStart() const
   {
     return static_cast<int64_t>(GetNavigationStartHighRes());
   }
 
   mozilla::TimeStamp GetNavigationStartTimeStamp() const
   {
-    return mNavigationStartTimeStamp;
+    return mNavigationStart;
+  }
+
+  DOMTimeMilliSec GetUnloadEventStart()
+  {
+    return TimeStampToDOM(GetUnloadEventStartTimeStamp());
   }
 
-  DOMTimeMilliSec GetUnloadEventStart();
-  DOMTimeMilliSec GetUnloadEventEnd();
+  DOMTimeMilliSec GetUnloadEventEnd()
+  {
+    return TimeStampToDOM(GetUnloadEventEndTimeStamp());
+  }
+
   DOMTimeMilliSec GetDomLoading() const
   {
-    return mDOMLoading;
+    return TimeStampToDOM(mDOMLoading);
   }
   DOMTimeMilliSec GetDomInteractive() const
   {
-    return mDOMInteractive;
+    return TimeStampToDOM(mDOMInteractive);
   }
   DOMTimeMilliSec GetDomContentLoadedEventStart() const
   {
-    return mDOMContentLoadedEventStart;
+    return TimeStampToDOM(mDOMContentLoadedEventStart);
   }
   DOMTimeMilliSec GetDomContentLoadedEventEnd() const
   {
-    return mDOMContentLoadedEventEnd;
+    return TimeStampToDOM(mDOMContentLoadedEventEnd);
   }
   DOMTimeMilliSec GetDomComplete() const
   {
-    return mDOMComplete;
+    return TimeStampToDOM(mDOMComplete);
   }
   DOMTimeMilliSec GetLoadEventStart() const
   {
-    return mLoadEventStart;
+    return TimeStampToDOM(mLoadEventStart);
   }
   DOMTimeMilliSec GetLoadEventEnd() const
   {
-    return mLoadEventEnd;
+    return TimeStampToDOM(mLoadEventEnd);
   }
   DOMTimeMilliSec GetTimeToNonBlankPaint() const
   {
-    return TimeStampToDOM(mNonBlankPaintTimeStamp);
+    return TimeStampToDOM(mNonBlankPaint);
+  }
+
+  DOMHighResTimeStamp GetUnloadEventStartHighRes()
+  {
+    mozilla::TimeStamp stamp = GetUnloadEventStartTimeStamp();
+    if (stamp.IsNull()) {
+      return 0;
+    }
+    return TimeStampToDOMHighRes(stamp);
+  }
+  DOMHighResTimeStamp GetUnloadEventEndHighRes()
+  {
+    mozilla::TimeStamp stamp = GetUnloadEventEndTimeStamp();
+    if (stamp.IsNull()) {
+      return 0;
+    }
+    return TimeStampToDOMHighRes(stamp);
+  }
+  DOMHighResTimeStamp GetDomInteractiveHighRes() const
+  {
+    return TimeStampToDOMHighRes(mDOMInteractive);
+  }
+  DOMHighResTimeStamp GetDomContentLoadedEventStartHighRes() const
+  {
+    return TimeStampToDOMHighRes(mDOMContentLoadedEventStart);
+  }
+  DOMHighResTimeStamp GetDomContentLoadedEventEndHighRes() const
+  {
+    return TimeStampToDOMHighRes(mDOMContentLoadedEventEnd);
+  }
+  DOMHighResTimeStamp GetDomCompleteHighRes() const
+  {
+    return TimeStampToDOMHighRes(mDOMComplete);
+  }
+  DOMHighResTimeStamp GetLoadEventStartHighRes() const
+  {
+    return TimeStampToDOMHighRes(mLoadEventStart);
+  }
+  DOMHighResTimeStamp GetLoadEventEndHighRes() const
+  {
+    return TimeStampToDOMHighRes(mLoadEventEnd);
   }
 
   enum class DocShellState : uint8_t {
     eActive,
     eInactive
   };
 
   void NotifyNavigationStart(DocShellState aDocShellState);
@@ -111,57 +160,53 @@ public:
 
   void NotifyNonBlankPaintForRootContentDocument();
   void NotifyDocShellStateChanged(DocShellState aDocShellState);
 
   DOMTimeMilliSec TimeStampToDOM(mozilla::TimeStamp aStamp) const;
 
   inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp) const
   {
-    mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
+    MOZ_ASSERT(!aStamp.IsNull(), "The timestamp should not be null");
+    if (aStamp.IsNull()) {
+      return 0;
+    }
+    mozilla::TimeDuration duration = aStamp - mNavigationStart;
     return duration.ToMilliseconds();
   }
 
 private:
   nsDOMNavigationTiming(const nsDOMNavigationTiming &) = delete;
   ~nsDOMNavigationTiming();
 
   void Clear();
 
+  mozilla::TimeStamp GetUnloadEventStartTimeStamp() const;
+  mozilla::TimeStamp GetUnloadEventEndTimeStamp() const;
+
   bool IsTopLevelContentDocumentInContentProcess() const;
 
   mozilla::WeakPtr<nsDocShell> mDocShell;
 
   nsCOMPtr<nsIURI> mUnloadedURI;
   nsCOMPtr<nsIURI> mLoadedURI;
 
   Type mNavigationType;
   DOMHighResTimeStamp mNavigationStartHighRes;
-  mozilla::TimeStamp mNavigationStartTimeStamp;
-  mozilla::TimeStamp mNonBlankPaintTimeStamp;
-  DOMTimeMilliSec DurationFromStart();
-
-  DOMTimeMilliSec mBeforeUnloadStart;
-  DOMTimeMilliSec mUnloadStart;
-  DOMTimeMilliSec mUnloadEnd;
-  DOMTimeMilliSec mLoadEventStart;
-  DOMTimeMilliSec mLoadEventEnd;
+  mozilla::TimeStamp mNavigationStart;
+  mozilla::TimeStamp mNonBlankPaint;
 
-  DOMTimeMilliSec mDOMLoading;
-  DOMTimeMilliSec mDOMInteractive;
-  DOMTimeMilliSec mDOMContentLoadedEventStart;
-  DOMTimeMilliSec mDOMContentLoadedEventEnd;
-  DOMTimeMilliSec mDOMComplete;
+  mozilla::TimeStamp mBeforeUnloadStart;
+  mozilla::TimeStamp mUnloadStart;
+  mozilla::TimeStamp mUnloadEnd;
+  mozilla::TimeStamp mLoadEventStart;
+  mozilla::TimeStamp mLoadEventEnd;
 
-  // Booleans to keep track of what things we've already been notified
-  // about.  We don't update those once we've been notified about them
-  // once.
-  bool mLoadEventStartSet : 1;
-  bool mLoadEventEndSet : 1;
-  bool mDOMLoadingSet : 1;
-  bool mDOMInteractiveSet : 1;
-  bool mDOMContentLoadedEventStartSet : 1;
-  bool mDOMContentLoadedEventEndSet : 1;
-  bool mDOMCompleteSet : 1;
+  mozilla::TimeStamp mDOMLoading;
+  mozilla::TimeStamp mDOMInteractive;
+  mozilla::TimeStamp mDOMContentLoadedEventStart;
+  mozilla::TimeStamp mDOMContentLoadedEventEnd;
+  mozilla::TimeStamp mDOMComplete;
+
   bool mDocShellHasBeenActiveSinceNavigationStart : 1;
 };
 
 #endif /* nsDOMNavigationTiming_h___ */
--- a/dom/performance/PerformanceNavigationTiming.cpp
+++ b/dom/performance/PerformanceNavigationTiming.cpp
@@ -17,65 +17,65 @@ NS_IMPL_RELEASE_INHERITED(PerformanceNav
 
 JSObject*
 PerformanceNavigationTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
 {
   return PerformanceNavigationTimingBinding::Wrap(aCx, this, aGivenProto);
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::UnloadEventStart()
+PerformanceNavigationTiming::UnloadEventStart() const
 {
-  return mTiming->GetDOMTiming()->GetUnloadEventStart();
+  return mTiming->GetDOMTiming()->GetUnloadEventStartHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::UnloadEventEnd()
+PerformanceNavigationTiming::UnloadEventEnd() const
 {
-  return mTiming->GetDOMTiming()->GetUnloadEventEnd();
+  return mTiming->GetDOMTiming()->GetUnloadEventEndHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::DomInteractive()
+PerformanceNavigationTiming::DomInteractive() const
 {
-  return mTiming->GetDOMTiming()->GetDomInteractive();
+  return mTiming->GetDOMTiming()->GetDomInteractiveHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::DomContentLoadedEventStart()
+PerformanceNavigationTiming::DomContentLoadedEventStart() const
 {
-  return mTiming->GetDOMTiming()->GetDomContentLoadedEventStart();
+  return mTiming->GetDOMTiming()->GetDomContentLoadedEventStartHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::DomContentLoadedEventEnd()
+PerformanceNavigationTiming::DomContentLoadedEventEnd() const
 {
-  return mTiming->GetDOMTiming()->GetDomContentLoadedEventEnd();
+  return mTiming->GetDOMTiming()->GetDomContentLoadedEventEndHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::DomComplete()
+PerformanceNavigationTiming::DomComplete() const
 {
-  return mTiming->GetDOMTiming()->GetDomComplete();
+  return mTiming->GetDOMTiming()->GetDomCompleteHighRes();
 }
 
 DOMHighResTimeStamp
-PerformanceNavigationTiming::LoadEventStart()
+PerformanceNavigationTiming::LoadEventStart() const
 {
-  return mTiming->GetDOMTiming()->GetLoadEventStart();
+  return mTiming->GetDOMTiming()->GetLoadEventStartHighRes();
 }
 
 DOMHighResTimeStamp
 PerformanceNavigationTiming::LoadEventEnd() const
 {
-  return mTiming->GetDOMTiming()->GetLoadEventEnd();
+  return mTiming->GetDOMTiming()->GetLoadEventEndHighRes();
 }
 
 NavigationType
-PerformanceNavigationTiming::Type()
+PerformanceNavigationTiming::Type() const
 {
   switch(mTiming->GetDOMTiming()->GetType()) {
     case nsDOMNavigationTiming::TYPE_NAVIGATE:
       return NavigationType::Navigate;
       break;
     case nsDOMNavigationTiming::TYPE_RELOAD:
       return NavigationType::Reload;
       break;
@@ -85,12 +85,12 @@ PerformanceNavigationTiming::Type()
     default:
       // The type is TYPE_RESERVED or some other value that was later added.
       // We fallback to the default of Navigate.
       return NavigationType::Navigate;
   }
 }
 
 uint16_t
-PerformanceNavigationTiming::RedirectCount()
+PerformanceNavigationTiming::RedirectCount() const
 {
   return mTiming->GetRedirectCount();
 }
--- a/dom/performance/PerformanceNavigationTiming.h
+++ b/dom/performance/PerformanceNavigationTiming.h
@@ -44,27 +44,27 @@ public:
 
   DOMHighResTimeStamp StartTime() const override
   {
     return 0;
   }
 
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
-  DOMHighResTimeStamp UnloadEventStart();
-  DOMHighResTimeStamp UnloadEventEnd();
+  DOMHighResTimeStamp UnloadEventStart() const;
+  DOMHighResTimeStamp UnloadEventEnd() const;
 
-  DOMHighResTimeStamp DomInteractive();
-  DOMHighResTimeStamp DomContentLoadedEventStart();
-  DOMHighResTimeStamp DomContentLoadedEventEnd();
-  DOMHighResTimeStamp DomComplete();
-  DOMHighResTimeStamp LoadEventStart();
+  DOMHighResTimeStamp DomInteractive() const;
+  DOMHighResTimeStamp DomContentLoadedEventStart() const;
+  DOMHighResTimeStamp DomContentLoadedEventEnd() const;
+  DOMHighResTimeStamp DomComplete() const;
+  DOMHighResTimeStamp LoadEventStart() const;
   DOMHighResTimeStamp LoadEventEnd() const;
-  NavigationType Type();
-  uint16_t RedirectCount();
+  NavigationType Type() const;
+  uint16_t RedirectCount() const;
 
 private:
   ~PerformanceNavigationTiming() {}
 };
 
 } // namespace dom
 } // namespace mozilla