2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2011-06-23 14:39:48 +04:00
|
|
|
|
|
|
|
#include "nsDOMNavigationTiming.h"
|
2016-11-11 00:00:45 +03:00
|
|
|
|
|
|
|
#include "GeckoProfiler.h"
|
2020-01-05 09:03:43 +03:00
|
|
|
#include "mozilla/Telemetry.h"
|
|
|
|
#include "mozilla/TimeStamp.h"
|
2020-09-15 00:03:52 +03:00
|
|
|
#include "mozilla/Unused.h"
|
|
|
|
#include "mozilla/dom/ContentChild.h"
|
|
|
|
#include "mozilla/dom/ContentParent.h"
|
2020-01-05 09:03:43 +03:00
|
|
|
#include "mozilla/dom/PerformanceNavigation.h"
|
2020-09-15 00:03:52 +03:00
|
|
|
#include "mozilla/dom/WindowGlobalChild.h"
|
2020-01-05 09:03:43 +03:00
|
|
|
#include "mozilla/ipc/IPDLParamTraits.h"
|
2020-04-29 12:02:05 +03:00
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
2011-06-23 14:39:48 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2013-07-02 22:15:39 +04:00
|
|
|
#include "nsContentUtils.h"
|
2017-04-19 09:00:00 +03:00
|
|
|
#include "nsDocShell.h"
|
2017-12-03 02:13:43 +03:00
|
|
|
#include "nsHttp.h"
|
2013-07-02 22:15:39 +04:00
|
|
|
#include "nsIScriptSecurityManager.h"
|
2013-08-15 22:17:48 +04:00
|
|
|
#include "nsIURI.h"
|
2016-11-11 00:00:45 +03:00
|
|
|
#include "nsPrintfCString.h"
|
2020-01-05 09:03:43 +03:00
|
|
|
#include "prtime.h"
|
2018-10-11 22:55:53 +03:00
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2018-10-11 20:23:28 +03:00
|
|
|
# include "ProfilerMarkerPayload.h"
|
2018-10-11 22:55:53 +03:00
|
|
|
#endif
|
2016-12-01 17:12:42 +03:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2020-09-15 00:03:52 +03:00
|
|
|
using namespace mozilla::dom;
|
2011-06-23 14:39:48 +04:00
|
|
|
|
2019-01-15 20:49:03 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
LazyLogModule gPageLoadLog("PageLoad");
|
|
|
|
#define PAGELOAD_LOG(args) MOZ_LOG(gPageLoadLog, LogLevel::Debug, args)
|
2019-01-15 20:49:03 +03:00
|
|
|
#define PAGELOAD_LOG_ENABLED() MOZ_LOG_TEST(gPageLoadLog, LogLevel::Error)
|
2019-01-15 20:49:03 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-04-19 09:00:00 +03:00
|
|
|
nsDOMNavigationTiming::nsDOMNavigationTiming(nsDocShell* aDocShell) {
|
2011-06-23 14:39:48 +04:00
|
|
|
Clear();
|
2017-04-19 09:00:00 +03:00
|
|
|
|
|
|
|
mDocShell = aDocShell;
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2020-02-21 13:41:47 +03:00
|
|
|
nsDOMNavigationTiming::~nsDOMNavigationTiming() = default;
|
2011-06-23 14:39:48 +04:00
|
|
|
|
|
|
|
void nsDOMNavigationTiming::Clear() {
|
2016-06-10 17:29:46 +03:00
|
|
|
mNavigationType = TYPE_RESERVED;
|
2013-10-16 05:35:44 +04:00
|
|
|
mNavigationStartHighRes = 0;
|
2017-10-04 05:05:39 +03:00
|
|
|
|
|
|
|
mBeforeUnloadStart = TimeStamp();
|
|
|
|
mUnloadStart = TimeStamp();
|
|
|
|
mUnloadEnd = TimeStamp();
|
|
|
|
mLoadEventStart = TimeStamp();
|
|
|
|
mLoadEventEnd = TimeStamp();
|
|
|
|
mDOMLoading = TimeStamp();
|
|
|
|
mDOMInteractive = TimeStamp();
|
|
|
|
mDOMContentLoadedEventStart = TimeStamp();
|
|
|
|
mDOMContentLoadedEventEnd = TimeStamp();
|
|
|
|
mDOMComplete = TimeStamp();
|
2018-10-18 23:16:45 +03:00
|
|
|
mContentfulPaint = TimeStamp();
|
|
|
|
mNonBlankPaint = TimeStamp();
|
2017-10-04 05:05:39 +03:00
|
|
|
|
2016-11-10 22:26:54 +03:00
|
|
|
mDocShellHasBeenActiveSinceNavigationStart = false;
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2020-01-05 08:44:31 +03:00
|
|
|
void nsDOMNavigationTiming::Anonymize(nsIURI* aFinalURI) {
|
|
|
|
mLoadedURI = aFinalURI;
|
|
|
|
mUnloadedURI = nullptr;
|
|
|
|
mBeforeUnloadStart = TimeStamp();
|
|
|
|
mUnloadStart = TimeStamp();
|
|
|
|
mUnloadEnd = TimeStamp();
|
|
|
|
}
|
|
|
|
|
2016-12-01 17:12:42 +03:00
|
|
|
DOMTimeMilliSec nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const {
|
2011-07-04 20:44:00 +04:00
|
|
|
if (aStamp.IsNull()) {
|
2012-07-17 05:42:18 +04:00
|
|
|
return 0;
|
2011-07-04 20:44:00 +04:00
|
|
|
}
|
2016-12-01 17:12:42 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
TimeDuration duration = aStamp - mNavigationStart;
|
2013-10-16 05:35:44 +04:00
|
|
|
return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
|
2011-08-08 16:20:03 +04:00
|
|
|
}
|
|
|
|
|
2016-11-10 22:26:54 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyNavigationStart(
|
|
|
|
DocShellState aDocShellState) {
|
2013-10-16 05:35:44 +04:00
|
|
|
mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
|
2017-10-04 05:05:39 +03:00
|
|
|
mNavigationStart = TimeStamp::Now();
|
2016-11-10 22:26:54 +03:00
|
|
|
mDocShellHasBeenActiveSinceNavigationStart =
|
|
|
|
(aDocShellState == DocShellState::eActive);
|
2020-09-10 06:02:36 +03:00
|
|
|
PROFILER_MARKER_UNTYPED("Navigation::Start", DOM);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2016-06-10 17:29:46 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI,
|
|
|
|
Type aNavigationType) {
|
2011-06-23 14:39:48 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2019-07-29 23:28:38 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyRestoreStart() {
|
|
|
|
mNavigationType = TYPE_BACK_FORWARD;
|
|
|
|
}
|
|
|
|
|
2011-06-23 14:39:48 +04:00
|
|
|
void nsDOMNavigationTiming::NotifyBeforeUnload() {
|
2017-10-04 05:05:39 +03:00
|
|
|
mBeforeUnloadStart = TimeStamp::Now();
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI) {
|
|
|
|
mUnloadStart = mBeforeUnloadStart;
|
|
|
|
mUnloadedURI = aOldURI;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyUnloadEventStart() {
|
2017-10-04 05:05:39 +03:00
|
|
|
mUnloadStart = TimeStamp::Now();
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Unload", NETWORK,
|
|
|
|
TRACING_INTERVAL_START, mDocShell);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyUnloadEventEnd() {
|
2017-10-04 05:05:39 +03:00
|
|
|
mUnloadEnd = TimeStamp::Now();
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Unload", NETWORK,
|
|
|
|
TRACING_INTERVAL_END, mDocShell);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyLoadEventStart() {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mLoadEventStart.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mLoadEventStart = TimeStamp::Now();
|
2017-04-19 09:00:00 +03:00
|
|
|
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Load", NETWORK,
|
|
|
|
TRACING_INTERVAL_START, mDocShell);
|
2017-04-27 05:11:00 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
if (IsTopLevelContentDocumentInContentProcess()) {
|
2020-09-15 00:03:52 +03:00
|
|
|
mLoadEventStartForTelemetry = TimeStamp::Now();
|
2017-12-03 02:13:43 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_START_MS,
|
2020-09-15 00:03:52 +03:00
|
|
|
mNavigationStart,
|
|
|
|
mLoadEventStartForTelemetry);
|
2017-12-03 02:13:43 +03:00
|
|
|
|
|
|
|
if (mDocShellHasBeenActiveSinceNavigationStart) {
|
|
|
|
if (net::nsHttp::IsBeforeLastActiveTabLoadOptimization(
|
|
|
|
mNavigationStart)) {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_LOAD_EVENT_START_ACTIVE_NETOPT_MS,
|
2020-09-15 00:03:52 +03:00
|
|
|
mNavigationStart, mLoadEventStartForTelemetry);
|
2017-12-03 02:13:43 +03:00
|
|
|
} else {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_LOAD_EVENT_START_ACTIVE_MS, mNavigationStart,
|
2020-09-15 00:03:52 +03:00
|
|
|
mLoadEventStartForTelemetry);
|
2017-12-03 02:13:43 +03:00
|
|
|
}
|
|
|
|
}
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyLoadEventEnd() {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mLoadEventEnd.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
mLoadEventEnd = TimeStamp::Now();
|
2017-04-19 09:00:00 +03:00
|
|
|
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Load", NETWORK,
|
|
|
|
TRACING_INTERVAL_END, mDocShell);
|
2017-04-27 05:11:00 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
if (IsTopLevelContentDocumentInContentProcess()) {
|
2019-01-15 20:49:03 +03:00
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2019-09-18 04:22:12 +03:00
|
|
|
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
2019-01-15 20:49:03 +03:00
|
|
|
TimeDuration elapsed = mLoadEventEnd - mNavigationStart;
|
|
|
|
TimeDuration duration = mLoadEventEnd - mLoadEventStart;
|
|
|
|
nsAutoCString spec;
|
|
|
|
if (mLoadedURI) {
|
|
|
|
mLoadedURI->GetSpec(spec);
|
|
|
|
}
|
|
|
|
nsPrintfCString marker(
|
|
|
|
"Document %s loaded after %dms, load event duration %dms", spec.get(),
|
|
|
|
int(elapsed.ToMilliseconds()), int(duration.ToMilliseconds()));
|
|
|
|
PAGELOAD_LOG(("%s", marker.get()));
|
2019-10-10 00:25:11 +03:00
|
|
|
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
|
|
|
"DocumentLoad", DOM, TextMarkerPayload,
|
|
|
|
(marker, mNavigationStart, mLoadEventEnd,
|
|
|
|
profiler_get_inner_window_id_from_docshell(mDocShell)));
|
2019-01-15 20:49:03 +03:00
|
|
|
}
|
|
|
|
#endif
|
2020-09-15 00:03:52 +03:00
|
|
|
TimeStamp loadEventEnd = TimeStamp::Now();
|
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_END_MS,
|
2020-09-15 00:03:52 +03:00
|
|
|
mNavigationStart, loadEventEnd);
|
|
|
|
|
|
|
|
MaybeSubmitTimeToLoadEventPreloadTelemetry(loadEventEnd);
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2016-12-01 17:12:42 +03:00
|
|
|
void nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI,
|
|
|
|
TimeStamp aValue) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMLoading.IsNull()) {
|
|
|
|
return;
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMLoading = aValue;
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMLoading.IsNull()) {
|
|
|
|
return;
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMLoading = TimeStamp::Now();
|
|
|
|
|
2020-09-10 06:02:36 +03:00
|
|
|
PROFILER_MARKER_UNTYPED("Navigation::DOMLoading", DOM);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMInteractive.IsNull()) {
|
|
|
|
return;
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMInteractive = TimeStamp::Now();
|
|
|
|
|
2020-09-10 06:02:36 +03:00
|
|
|
PROFILER_MARKER_UNTYPED("Navigation::DOMInteractive", DOM);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMComplete.IsNull()) {
|
|
|
|
return;
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMComplete = TimeStamp::Now();
|
|
|
|
|
2020-09-10 06:02:36 +03:00
|
|
|
PROFILER_MARKER_UNTYPED("Navigation::DOMComplete", DOM);
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMContentLoadedEventStart.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMContentLoadedEventStart = TimeStamp::Now();
|
2017-04-19 09:00:00 +03:00
|
|
|
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "DOMContentLoaded", NETWORK,
|
|
|
|
TRACING_INTERVAL_START, mDocShell);
|
2017-04-27 05:11:00 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
if (IsTopLevelContentDocumentInContentProcess()) {
|
2017-12-03 02:13:43 +03:00
|
|
|
TimeStamp now = TimeStamp::Now();
|
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_MS, mNavigationStart, now);
|
2017-12-03 02:13:43 +03:00
|
|
|
|
|
|
|
if (mDocShellHasBeenActiveSinceNavigationStart) {
|
|
|
|
if (net::nsHttp::IsBeforeLastActiveTabLoadOptimization(
|
|
|
|
mNavigationStart)) {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_ACTIVE_NETOPT_MS,
|
|
|
|
mNavigationStart, now);
|
|
|
|
} else {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_ACTIVE_MS,
|
|
|
|
mNavigationStart, now);
|
|
|
|
}
|
|
|
|
}
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI) {
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mDOMContentLoadedEventEnd.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
2017-04-19 09:00:00 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
mLoadedURI = aURI;
|
|
|
|
mDOMContentLoadedEventEnd = TimeStamp::Now();
|
2017-04-27 05:11:00 +03:00
|
|
|
|
2020-01-18 00:29:15 +03:00
|
|
|
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "DOMContentLoaded", NETWORK,
|
|
|
|
TRACING_INTERVAL_END, mDocShell);
|
2017-10-04 05:05:39 +03:00
|
|
|
|
|
|
|
if (IsTopLevelContentDocumentInContentProcess()) {
|
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_END_MS,
|
|
|
|
mNavigationStart);
|
2012-08-09 07:47:04 +04:00
|
|
|
}
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2018-10-11 20:23:28 +03:00
|
|
|
// static
|
|
|
|
void nsDOMNavigationTiming::TTITimeoutCallback(nsITimer* aTimer,
|
|
|
|
void* aClosure) {
|
|
|
|
nsDOMNavigationTiming* self = static_cast<nsDOMNavigationTiming*>(aClosure);
|
|
|
|
self->TTITimeout(aTimer);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define TTI_WINDOW_SIZE_MS (5 * 1000)
|
|
|
|
|
|
|
|
void nsDOMNavigationTiming::TTITimeout(nsITimer* aTimer) {
|
|
|
|
// Check TTI: see if it's been 5 seconds since the last Long Task
|
|
|
|
TimeStamp now = TimeStamp::Now();
|
2018-10-18 23:16:45 +03:00
|
|
|
MOZ_RELEASE_ASSERT(!mContentfulPaint.IsNull(),
|
|
|
|
"TTI timeout with no contentful-paint?");
|
2018-10-11 20:23:28 +03:00
|
|
|
|
|
|
|
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
|
|
|
|
TimeStamp lastLongTaskEnded;
|
|
|
|
mainThread->GetLastLongNonIdleTaskEnd(&lastLongTaskEnded);
|
2019-01-15 20:49:03 +03:00
|
|
|
// Window starts at mContentfulPaint; any long task before that is ignored
|
|
|
|
if (lastLongTaskEnded.IsNull() || lastLongTaskEnded < mContentfulPaint) {
|
|
|
|
PAGELOAD_LOG(
|
|
|
|
("no longtask (last was %g ms before ContentfulPaint)",
|
|
|
|
lastLongTaskEnded.IsNull()
|
|
|
|
? 0
|
|
|
|
: (mContentfulPaint - lastLongTaskEnded).ToMilliseconds()));
|
|
|
|
lastLongTaskEnded = mContentfulPaint;
|
2018-10-11 20:23:28 +03:00
|
|
|
}
|
2019-01-15 20:49:03 +03:00
|
|
|
TimeDuration delta = now - lastLongTaskEnded;
|
|
|
|
PAGELOAD_LOG(("TTI delta: %g ms", delta.ToMilliseconds()));
|
|
|
|
if (delta.ToMilliseconds() < TTI_WINDOW_SIZE_MS) {
|
|
|
|
// Less than 5 seconds since the last long task or start of the window.
|
|
|
|
// Schedule another check.
|
|
|
|
PAGELOAD_LOG(("TTI: waiting additional %g ms",
|
|
|
|
(TTI_WINDOW_SIZE_MS + 100) - delta.ToMilliseconds()));
|
|
|
|
aTimer->InitWithNamedFuncCallback(
|
|
|
|
TTITimeoutCallback, this,
|
|
|
|
(TTI_WINDOW_SIZE_MS + 100) -
|
|
|
|
delta.ToMilliseconds(), // slightly after the window ends
|
|
|
|
nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY,
|
|
|
|
"nsDOMNavigationTiming::TTITimeout");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-10-18 23:16:45 +03:00
|
|
|
// To correctly implement TTI/TTFI as proposed, we'd need to not
|
|
|
|
// fire it until there are no more than 2 network loads. By the
|
|
|
|
// proposed definition, without that we're closer to
|
2019-01-15 20:49:03 +03:00
|
|
|
// TimeToFirstInteractive. There are also arguments about what sort
|
|
|
|
// of loads should qualify.
|
2018-10-11 20:23:28 +03:00
|
|
|
|
|
|
|
// XXX check number of network loads, and if > 2 mark to check if loads
|
|
|
|
// decreases to 2 (or record that point and let the normal timer here
|
|
|
|
// handle it)
|
|
|
|
|
|
|
|
// TTI has occurred! TTI is either FCP (if there are no longtasks and no
|
|
|
|
// DCLEnd in the window that starts at FCP), or at the end of the last
|
2019-01-15 20:49:03 +03:00
|
|
|
// Long Task or DOMContentLoadedEnd (whichever is later). lastLongTaskEnded
|
|
|
|
// is >= FCP here.
|
2018-10-11 20:23:28 +03:00
|
|
|
|
|
|
|
if (mTTFI.IsNull()) {
|
2019-01-15 20:49:03 +03:00
|
|
|
// lastLongTaskEnded is >= mContentfulPaint
|
|
|
|
mTTFI = (mDOMContentLoadedEventEnd.IsNull() ||
|
|
|
|
lastLongTaskEnded > mDOMContentLoadedEventEnd)
|
|
|
|
? lastLongTaskEnded
|
|
|
|
: mDOMContentLoadedEventEnd;
|
|
|
|
PAGELOAD_LOG(
|
|
|
|
("TTFI after %dms (LongTask was at %dms, DCL was %dms)",
|
|
|
|
int((mTTFI - mNavigationStart).ToMilliseconds()),
|
|
|
|
lastLongTaskEnded.IsNull()
|
|
|
|
? 0
|
|
|
|
: int((lastLongTaskEnded - mNavigationStart).ToMilliseconds()),
|
|
|
|
mDOMContentLoadedEventEnd.IsNull()
|
|
|
|
? 0
|
|
|
|
: int((mDOMContentLoadedEventEnd - mNavigationStart)
|
|
|
|
.ToMilliseconds())));
|
2018-10-11 20:23:28 +03:00
|
|
|
}
|
|
|
|
// XXX Implement TTI via check number of network loads, and if > 2 mark
|
|
|
|
// to check if loads decreases to 2 (or record that point and let the
|
|
|
|
// normal timer here handle it)
|
|
|
|
|
|
|
|
mTTITimer = nullptr;
|
|
|
|
|
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2019-09-18 04:22:12 +03:00
|
|
|
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
2018-10-11 20:23:28 +03:00
|
|
|
TimeDuration elapsed = mTTFI - mNavigationStart;
|
2019-01-15 20:49:03 +03:00
|
|
|
MOZ_ASSERT(elapsed.ToMilliseconds() > 0);
|
2018-10-11 20:23:28 +03:00
|
|
|
TimeDuration elapsedLongTask =
|
|
|
|
lastLongTaskEnded.IsNull() ? 0 : lastLongTaskEnded - mNavigationStart;
|
|
|
|
nsAutoCString spec;
|
|
|
|
if (mLoadedURI) {
|
|
|
|
mLoadedURI->GetSpec(spec);
|
|
|
|
}
|
2019-01-15 20:49:03 +03:00
|
|
|
nsPrintfCString marker("TTFI after %dms (LongTask was at %dms) for URL %s",
|
2018-10-11 20:23:28 +03:00
|
|
|
int(elapsed.ToMilliseconds()),
|
|
|
|
int(elapsedLongTask.ToMilliseconds()), spec.get());
|
|
|
|
|
2019-09-04 10:56:51 +03:00
|
|
|
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
2020-01-18 00:27:05 +03:00
|
|
|
"TimeToFirstInteractive (TTFI)", DOM, TextMarkerPayload,
|
2019-10-10 00:25:11 +03:00
|
|
|
(marker, mNavigationStart, mTTFI,
|
|
|
|
profiler_get_inner_window_id_from_docshell(mDocShell)));
|
2018-10-11 20:23:28 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-11-10 22:26:54 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
|
2016-11-11 00:00:45 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
2017-10-04 05:05:39 +03:00
|
|
|
MOZ_ASSERT(!mNavigationStart.IsNull());
|
2016-11-11 00:00:45 +03:00
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
if (!mNonBlankPaint.IsNull()) {
|
2016-11-11 00:00:45 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
mNonBlankPaint = TimeStamp::Now();
|
2016-11-11 00:00:45 +03:00
|
|
|
|
2017-10-04 01:11:18 +03:00
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2019-01-15 20:49:03 +03:00
|
|
|
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
|
2017-10-04 01:11:18 +03:00
|
|
|
TimeDuration elapsed = mNonBlankPaint - mNavigationStart;
|
2016-11-11 00:00:45 +03:00
|
|
|
nsAutoCString spec;
|
|
|
|
if (mLoadedURI) {
|
|
|
|
mLoadedURI->GetSpec(spec);
|
|
|
|
}
|
2016-11-10 22:26:54 +03:00
|
|
|
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");
|
2019-01-15 20:49:03 +03:00
|
|
|
PAGELOAD_LOG(("%s", marker.get()));
|
2019-10-10 00:25:11 +03:00
|
|
|
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
|
|
|
"FirstNonBlankPaint", DOM, TextMarkerPayload,
|
|
|
|
(marker, mNavigationStart, mNonBlankPaint,
|
|
|
|
profiler_get_inner_window_id_from_docshell(mDocShell)));
|
2016-11-11 00:00:45 +03:00
|
|
|
}
|
2017-10-04 01:11:18 +03:00
|
|
|
#endif
|
2016-11-10 22:26:54 +03:00
|
|
|
|
|
|
|
if (mDocShellHasBeenActiveSinceNavigationStart) {
|
2017-12-03 02:13:43 +03:00
|
|
|
if (net::nsHttp::IsBeforeLastActiveTabLoadOptimization(mNavigationStart)) {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_NON_BLANK_PAINT_NETOPT_MS, mNavigationStart,
|
|
|
|
mNonBlankPaint);
|
|
|
|
} else {
|
|
|
|
Telemetry::AccumulateTimeDelta(
|
|
|
|
Telemetry::TIME_TO_NON_BLANK_PAINT_NO_NETOPT_MS, mNavigationStart,
|
|
|
|
mNonBlankPaint);
|
|
|
|
}
|
|
|
|
|
2016-11-10 22:26:54 +03:00
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_MS,
|
2017-10-04 05:05:39 +03:00
|
|
|
mNavigationStart, mNonBlankPaint);
|
2016-11-10 22:26:54 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-12 22:09:06 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument(
|
|
|
|
const mozilla::TimeStamp& aCompositeEndTime) {
|
2018-10-18 23:16:45 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(!mNavigationStart.IsNull());
|
|
|
|
|
|
|
|
if (!mContentfulPaint.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-02-12 22:09:06 +03:00
|
|
|
mContentfulPaint = aCompositeEndTime;
|
2018-10-18 23:16:45 +03:00
|
|
|
|
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2019-09-18 04:22:12 +03:00
|
|
|
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
2018-10-18 23:16:45 +03:00
|
|
|
TimeDuration elapsed = mContentfulPaint - mNavigationStart;
|
|
|
|
nsAutoCString spec;
|
|
|
|
if (mLoadedURI) {
|
|
|
|
mLoadedURI->GetSpec(spec);
|
|
|
|
}
|
|
|
|
nsPrintfCString marker(
|
|
|
|
"Contentful 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");
|
2019-01-15 20:49:03 +03:00
|
|
|
PAGELOAD_LOG(("%s", marker.get()));
|
2019-09-04 10:56:51 +03:00
|
|
|
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
|
|
|
"FirstContentfulPaint", DOM, TextMarkerPayload,
|
2019-10-10 00:25:11 +03:00
|
|
|
(marker, mNavigationStart, mContentfulPaint,
|
|
|
|
profiler_get_inner_window_id_from_docshell(mDocShell)));
|
2018-10-18 23:16:45 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (!mTTITimer) {
|
|
|
|
mTTITimer = NS_NewTimer();
|
|
|
|
}
|
|
|
|
|
|
|
|
// TTI is first checked 5 seconds after the FCP (non-blank-paint is very close
|
|
|
|
// to FCP).
|
|
|
|
mTTITimer->InitWithNamedFuncCallback(TTITimeoutCallback, this,
|
|
|
|
TTI_WINDOW_SIZE_MS,
|
|
|
|
nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY,
|
|
|
|
"nsDOMNavigationTiming::TTITimeout");
|
2019-02-12 09:13:48 +03:00
|
|
|
|
|
|
|
if (mDocShellHasBeenActiveSinceNavigationStart) {
|
|
|
|
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_FIRST_CONTENTFUL_PAINT_MS,
|
|
|
|
mNavigationStart, mContentfulPaint);
|
|
|
|
}
|
2018-10-18 23:16:45 +03:00
|
|
|
}
|
|
|
|
|
2018-04-27 01:36:52 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(!mNavigationStart.IsNull());
|
|
|
|
|
|
|
|
if (!mDOMContentFlushed.IsNull()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mDOMContentFlushed = TimeStamp::Now();
|
|
|
|
|
|
|
|
#ifdef MOZ_GECKO_PROFILER
|
2019-01-15 20:49:03 +03:00
|
|
|
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
|
2018-04-27 01:36:52 +03:00
|
|
|
TimeDuration elapsed = mDOMContentFlushed - mNavigationStart;
|
|
|
|
nsAutoCString spec;
|
|
|
|
if (mLoadedURI) {
|
|
|
|
mLoadedURI->GetSpec(spec);
|
|
|
|
}
|
|
|
|
nsPrintfCString marker(
|
|
|
|
"DOMContentFlushed 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 DOMContentFlushed");
|
2019-01-15 20:49:03 +03:00
|
|
|
PAGELOAD_LOG(("%s", marker.get()));
|
2019-09-04 10:56:51 +03:00
|
|
|
PROFILER_ADD_MARKER_WITH_PAYLOAD(
|
|
|
|
"DOMContentFlushed", DOM, TextMarkerPayload,
|
2019-10-10 00:25:11 +03:00
|
|
|
(marker, mNavigationStart, mDOMContentFlushed,
|
|
|
|
profiler_get_inner_window_id_from_docshell(mDocShell)));
|
2018-04-27 01:36:52 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2016-11-10 22:26:54 +03:00
|
|
|
void nsDOMNavigationTiming::NotifyDocShellStateChanged(
|
|
|
|
DocShellState aDocShellState) {
|
|
|
|
mDocShellHasBeenActiveSinceNavigationStart &=
|
|
|
|
(aDocShellState == DocShellState::eActive);
|
2016-11-11 00:00:45 +03:00
|
|
|
}
|
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
mozilla::TimeStamp nsDOMNavigationTiming::GetUnloadEventStartTimeStamp() const {
|
2011-06-23 14:39:48 +04:00
|
|
|
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
2018-09-25 08:25:05 +03:00
|
|
|
// todo: if you intend to update CheckSameOriginURI to log the error to the
|
|
|
|
// console you also need to update the 'aFromPrivateWindow' argument.
|
|
|
|
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false, false);
|
2011-06-23 14:39:48 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2012-07-17 05:42:18 +04:00
|
|
|
return mUnloadStart;
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
return mozilla::TimeStamp();
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
|
|
|
|
2017-10-04 05:05:39 +03:00
|
|
|
mozilla::TimeStamp nsDOMNavigationTiming::GetUnloadEventEndTimeStamp() const {
|
2011-06-23 14:39:48 +04:00
|
|
|
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
2018-09-25 08:25:05 +03:00
|
|
|
// todo: if you intend to update CheckSameOriginURI to log the error to the
|
|
|
|
// console you also need to update the 'aFromPrivateWindow' argument.
|
|
|
|
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false, false);
|
2011-06-23 14:39:48 +04:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2012-07-17 05:42:18 +04:00
|
|
|
return mUnloadEnd;
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
2017-10-04 05:05:39 +03:00
|
|
|
return mozilla::TimeStamp();
|
2011-06-23 14:39:48 +04:00
|
|
|
}
|
2017-04-19 09:00:00 +03:00
|
|
|
|
2017-08-23 06:09:24 +03:00
|
|
|
bool nsDOMNavigationTiming::IsTopLevelContentDocumentInContentProcess() const {
|
2017-04-19 09:00:00 +03:00
|
|
|
if (!mDocShell) {
|
|
|
|
return false;
|
|
|
|
}
|
2017-08-23 06:09:24 +03:00
|
|
|
if (!XRE_IsContentProcess()) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-12-17 00:15:05 +03:00
|
|
|
return mDocShell->GetBrowsingContext()->IsTopContent();
|
2017-04-19 09:00:00 +03:00
|
|
|
}
|
2020-01-05 09:03:43 +03:00
|
|
|
|
2020-09-15 00:03:52 +03:00
|
|
|
void nsDOMNavigationTiming::MaybeSubmitTimeToLoadEventPreloadTelemetry(
|
|
|
|
mozilla::TimeStamp aLoadEventEnd) const {
|
|
|
|
if (!mDocShell) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (const ContentChild* cc = ContentChild::GetSingleton();
|
|
|
|
cc && !(IsWebRemoteType(cc->GetRemoteType()) ||
|
|
|
|
IsPriviligedMozillaRemoteType(cc->GetRemoteType()))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Document* doc = mDocShell->GetExtantDocument();
|
|
|
|
if (!doc ||
|
|
|
|
!doc->ShouldIncludeInTelemetry(/* aAllowExtensionURIs = */ false)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
WindowGlobalChild* wgc = doc->GetWindowGlobalChild();
|
|
|
|
if (!wgc) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
wgc->SendSubmitLoadEventPreloadTelemetry(
|
|
|
|
mNavigationStart, mLoadEventStartForTelemetry, aLoadEventEnd);
|
|
|
|
}
|
|
|
|
|
2020-01-05 08:44:24 +03:00
|
|
|
nsDOMNavigationTiming::nsDOMNavigationTiming(nsDocShell* aDocShell,
|
|
|
|
nsDOMNavigationTiming* aOther)
|
|
|
|
: mDocShell(aDocShell),
|
|
|
|
mUnloadedURI(aOther->mUnloadedURI),
|
|
|
|
mLoadedURI(aOther->mLoadedURI),
|
|
|
|
mNavigationType(aOther->mNavigationType),
|
|
|
|
mNavigationStartHighRes(aOther->mNavigationStartHighRes),
|
|
|
|
mNavigationStart(aOther->mNavigationStart),
|
|
|
|
mNonBlankPaint(aOther->mNonBlankPaint),
|
|
|
|
mContentfulPaint(aOther->mContentfulPaint),
|
|
|
|
mDOMContentFlushed(aOther->mDOMContentFlushed),
|
|
|
|
mBeforeUnloadStart(aOther->mBeforeUnloadStart),
|
|
|
|
mUnloadStart(aOther->mUnloadStart),
|
|
|
|
mUnloadEnd(aOther->mUnloadEnd),
|
|
|
|
mLoadEventStart(aOther->mLoadEventStart),
|
|
|
|
mLoadEventEnd(aOther->mLoadEventEnd),
|
|
|
|
mDOMLoading(aOther->mDOMLoading),
|
|
|
|
mDOMInteractive(aOther->mDOMInteractive),
|
|
|
|
mDOMContentLoadedEventStart(aOther->mDOMContentLoadedEventStart),
|
|
|
|
mDOMContentLoadedEventEnd(aOther->mDOMContentLoadedEventEnd),
|
|
|
|
mDOMComplete(aOther->mDOMComplete),
|
|
|
|
mTTFI(aOther->mTTFI),
|
|
|
|
mDocShellHasBeenActiveSinceNavigationStart(
|
|
|
|
aOther->mDocShellHasBeenActiveSinceNavigationStart) {}
|
|
|
|
|
2020-01-05 09:03:43 +03:00
|
|
|
/* static */
|
|
|
|
void mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Write(
|
|
|
|
IPC::Message* aMsg, IProtocol* aActor, nsDOMNavigationTiming* aParam) {
|
|
|
|
RefPtr<nsIURI> unloadedURI = aParam->mUnloadedURI.get();
|
|
|
|
RefPtr<nsIURI> loadedURI = aParam->mLoadedURI.get();
|
|
|
|
WriteIPDLParam(aMsg, aActor, unloadedURI ? Some(unloadedURI) : Nothing());
|
|
|
|
WriteIPDLParam(aMsg, aActor, loadedURI ? Some(loadedURI) : Nothing());
|
|
|
|
WriteIPDLParam(aMsg, aActor, uint32_t(aParam->mNavigationType));
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mNavigationStartHighRes);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mNavigationStart);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mNonBlankPaint);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mContentfulPaint);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentFlushed);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mBeforeUnloadStart);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mUnloadStart);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mUnloadEnd);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mLoadEventStart);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mLoadEventEnd);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMLoading);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMInteractive);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentLoadedEventStart);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMContentLoadedEventEnd);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mDOMComplete);
|
|
|
|
WriteIPDLParam(aMsg, aActor, aParam->mTTFI);
|
|
|
|
WriteIPDLParam(aMsg, aActor,
|
|
|
|
aParam->mDocShellHasBeenActiveSinceNavigationStart);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
bool mozilla::ipc::IPDLParamTraits<nsDOMNavigationTiming*>::Read(
|
|
|
|
const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor,
|
|
|
|
RefPtr<nsDOMNavigationTiming>* aResult) {
|
|
|
|
auto timing = MakeRefPtr<nsDOMNavigationTiming>(nullptr);
|
|
|
|
uint32_t type;
|
|
|
|
Maybe<RefPtr<nsIURI>> unloadedURI;
|
|
|
|
Maybe<RefPtr<nsIURI>> loadedURI;
|
|
|
|
if (!ReadIPDLParam(aMsg, aIter, aActor, &unloadedURI) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &loadedURI) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &type) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNavigationStartHighRes) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNavigationStart) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mNonBlankPaint) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mContentfulPaint) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMContentFlushed) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mBeforeUnloadStart) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mUnloadStart) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mUnloadEnd) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mLoadEventStart) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mLoadEventEnd) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMLoading) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMInteractive) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor,
|
|
|
|
&timing->mDOMContentLoadedEventStart) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMContentLoadedEventEnd) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mDOMComplete) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor, &timing->mTTFI) ||
|
|
|
|
!ReadIPDLParam(aMsg, aIter, aActor,
|
|
|
|
&timing->mDocShellHasBeenActiveSinceNavigationStart)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
timing->mNavigationType = nsDOMNavigationTiming::Type(type);
|
|
|
|
if (unloadedURI) {
|
2020-02-13 17:38:48 +03:00
|
|
|
timing->mUnloadedURI = std::move(*unloadedURI);
|
2020-01-05 09:03:43 +03:00
|
|
|
}
|
|
|
|
if (loadedURI) {
|
2020-02-13 17:38:48 +03:00
|
|
|
timing->mLoadedURI = std::move(*loadedURI);
|
2020-01-05 09:03:43 +03:00
|
|
|
}
|
2020-02-13 17:38:48 +03:00
|
|
|
*aResult = std::move(timing);
|
2020-01-05 09:03:43 +03:00
|
|
|
return true;
|
|
|
|
}
|