From 1a27f6f0f6c9a794235431ead364993ced02de98 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Sun, 5 Jan 2020 05:44:31 +0000 Subject: [PATCH] Bug 1603187 - P3. Add Anonymize method. r=smaug This method will be used by the DocumentLoadListener on the timing information object before sending it to the new content process following a cross-origin redirect. Differential Revision: https://phabricator.services.mozilla.com/D57939 --HG-- extra : moz-landing-system : lando --- dom/base/nsDOMNavigationTiming.cpp | 8 ++++++++ dom/base/nsDOMNavigationTiming.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/dom/base/nsDOMNavigationTiming.cpp b/dom/base/nsDOMNavigationTiming.cpp index 8b9fdc1dc03e..8a79823149ce 100644 --- a/dom/base/nsDOMNavigationTiming.cpp +++ b/dom/base/nsDOMNavigationTiming.cpp @@ -61,6 +61,14 @@ void nsDOMNavigationTiming::Clear() { mDocShellHasBeenActiveSinceNavigationStart = false; } +void nsDOMNavigationTiming::Anonymize(nsIURI* aFinalURI) { + mLoadedURI = aFinalURI; + mUnloadedURI = nullptr; + mBeforeUnloadStart = TimeStamp(); + mUnloadStart = TimeStamp(); + mUnloadEnd = TimeStamp(); +} + DOMTimeMilliSec nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const { if (aStamp.IsNull()) { return 0; diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h index 96b135c1f004..88fe53de5714 100644 --- a/dom/base/nsDOMNavigationTiming.h +++ b/dom/base/nsDOMNavigationTiming.h @@ -174,6 +174,10 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline { return duration.ToMilliseconds(); } + // Called by the DocumentLoadListener before sending the timing information + // to the new content process. + void Anonymize(nsIURI* aFinalURI); + private: friend class nsDocShell; nsDOMNavigationTiming(nsDocShell* aDocShell, nsDOMNavigationTiming* aOther);