gecko-dev/dom/base/nsDOMNavigationTiming.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

679 строки
24 KiB
C++
Исходник Обычный вид История

/* -*- 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/. */
#include "nsDOMNavigationTiming.h"
#include "GeckoProfiler.h"
#include "mozilla/Telemetry.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/dom/WindowGlobalChild.h"
#include "mozilla/ipc/IPDLParamTraits.h"
#include "mozilla/ipc/URIUtils.h"
#include "nsCOMPtr.h"
#include "nsContentUtils.h"
#include "nsDocShell.h"
#include "nsHttp.h"
#include "nsIScriptSecurityManager.h"
#include "nsIURI.h"
#include "nsPrintfCString.h"
#include "prtime.h"
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerMarkerPayload.h"
#endif
Bug 1321261 - create dom/file for File APIs, r=qdot --HG-- rename : dom/base/BlobSet.cpp => dom/file/BlobSet.cpp rename : dom/base/BlobSet.h => dom/file/BlobSet.h rename : dom/base/File.cpp => dom/file/File.cpp rename : dom/base/File.h => dom/file/File.h rename : dom/base/FileList.cpp => dom/file/FileList.cpp rename : dom/base/FileList.h => dom/file/FileList.h rename : dom/base/FileReader.cpp => dom/file/FileReader.cpp rename : dom/base/FileReader.h => dom/file/FileReader.h rename : dom/base/MultipartBlobImpl.cpp => dom/file/MultipartBlobImpl.cpp rename : dom/base/MultipartBlobImpl.h => dom/file/MultipartBlobImpl.h rename : dom/base/MutableBlobStorage.cpp => dom/file/MutableBlobStorage.cpp rename : dom/base/MutableBlobStorage.h => dom/file/MutableBlobStorage.h rename : dom/base/MutableBlobStreamListener.cpp => dom/file/MutableBlobStreamListener.cpp rename : dom/base/MutableBlobStreamListener.h => dom/file/MutableBlobStreamListener.h rename : dom/ipc/Blob.cpp => dom/file/ipc/Blob.cpp rename : dom/ipc/BlobChild.h => dom/file/ipc/BlobChild.h rename : dom/ipc/BlobParent.h => dom/file/ipc/BlobParent.h rename : dom/ipc/BlobTypes.ipdlh => dom/file/ipc/BlobTypes.ipdlh rename : dom/ipc/PBlob.ipdl => dom/file/ipc/PBlob.ipdl rename : dom/ipc/PBlobStream.ipdl => dom/file/ipc/PBlobStream.ipdl rename : dom/ipc/nsIRemoteBlob.h => dom/file/ipc/nsIRemoteBlob.h rename : dom/base/nsHostObjectProtocolHandler.cpp => dom/file/nsHostObjectProtocolHandler.cpp rename : dom/base/nsHostObjectProtocolHandler.h => dom/file/nsHostObjectProtocolHandler.h rename : dom/base/nsHostObjectURI.cpp => dom/file/nsHostObjectURI.cpp rename : dom/base/nsHostObjectURI.h => dom/file/nsHostObjectURI.h rename : dom/base/nsIDOMBlob.idl => dom/file/nsIDOMBlob.idl rename : dom/base/nsIDOMFileList.idl => dom/file/nsIDOMFileList.idl rename : dom/base/test/create_file_objects.js => dom/file/tests/create_file_objects.js rename : dom/base/test/file_blobURL_expiring.html => dom/file/tests/file_blobURL_expiring.html rename : dom/base/test/file_mozfiledataurl_audio.ogg => dom/file/tests/file_mozfiledataurl_audio.ogg rename : dom/base/test/file_mozfiledataurl_doc.html => dom/file/tests/file_mozfiledataurl_doc.html rename : dom/base/test/file_mozfiledataurl_img.jpg => dom/file/tests/file_mozfiledataurl_img.jpg rename : dom/base/test/file_mozfiledataurl_inner.html => dom/file/tests/file_mozfiledataurl_inner.html rename : dom/base/test/file_mozfiledataurl_text.txt => dom/file/tests/file_mozfiledataurl_text.txt rename : dom/base/test/file_nonascii_blob_url.html => dom/file/tests/file_nonascii_blob_url.html rename : dom/base/test/fileapi_chromeScript.js => dom/file/tests/fileapi_chromeScript.js rename : dom/base/test/fileutils.js => dom/file/tests/fileutils.js rename : dom/base/test/test_blobURL_expiring.html => dom/file/tests/test_blobURL_expiring.html rename : dom/base/test/test_blob_fragment_and_query.html => dom/file/tests/test_blob_fragment_and_query.html rename : dom/base/test/test_blobconstructor.html => dom/file/tests/test_blobconstructor.html rename : dom/base/test/test_file_from_blob.html => dom/file/tests/test_file_from_blob.html rename : dom/base/test/test_file_negative_date.html => dom/file/tests/test_file_negative_date.html rename : dom/base/test/test_fileapi.html => dom/file/tests/test_fileapi.html rename : dom/base/test/test_fileapi_slice.html => dom/file/tests/test_fileapi_slice.html rename : dom/base/test/test_ipc_messagemanager_blob.html => dom/file/tests/test_ipc_messagemanager_blob.html rename : dom/base/test/test_mozfiledataurl.html => dom/file/tests/test_mozfiledataurl.html rename : dom/base/test/test_nonascii_blob_url.html => dom/file/tests/test_nonascii_blob_url.html
2016-12-01 17:12:42 +03:00
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
LazyLogModule gPageLoadLog("PageLoad");
#define PAGELOAD_LOG(args) MOZ_LOG(gPageLoadLog, LogLevel::Debug, args)
#define PAGELOAD_LOG_ENABLED() MOZ_LOG_TEST(gPageLoadLog, LogLevel::Error)
} // namespace mozilla
nsDOMNavigationTiming::nsDOMNavigationTiming(nsDocShell* aDocShell) {
Clear();
mDocShell = aDocShell;
}
nsDOMNavigationTiming::~nsDOMNavigationTiming() = default;
void nsDOMNavigationTiming::Clear() {
mNavigationType = TYPE_RESERVED;
mNavigationStartHighRes = 0;
mBeforeUnloadStart = TimeStamp();
mUnloadStart = TimeStamp();
mUnloadEnd = TimeStamp();
mLoadEventStart = TimeStamp();
mLoadEventEnd = TimeStamp();
mDOMLoading = TimeStamp();
mDOMInteractive = TimeStamp();
mDOMContentLoadedEventStart = TimeStamp();
mDOMContentLoadedEventEnd = TimeStamp();
mDOMComplete = TimeStamp();
mContentfulPaint = TimeStamp();
mNonBlankPaint = TimeStamp();
mDocShellHasBeenActiveSinceNavigationStart = false;
}
void nsDOMNavigationTiming::Anonymize(nsIURI* aFinalURI) {
mLoadedURI = aFinalURI;
mUnloadedURI = nullptr;
mBeforeUnloadStart = TimeStamp();
mUnloadStart = TimeStamp();
mUnloadEnd = TimeStamp();
}
Bug 1321261 - create dom/file for File APIs, r=qdot --HG-- rename : dom/base/BlobSet.cpp => dom/file/BlobSet.cpp rename : dom/base/BlobSet.h => dom/file/BlobSet.h rename : dom/base/File.cpp => dom/file/File.cpp rename : dom/base/File.h => dom/file/File.h rename : dom/base/FileList.cpp => dom/file/FileList.cpp rename : dom/base/FileList.h => dom/file/FileList.h rename : dom/base/FileReader.cpp => dom/file/FileReader.cpp rename : dom/base/FileReader.h => dom/file/FileReader.h rename : dom/base/MultipartBlobImpl.cpp => dom/file/MultipartBlobImpl.cpp rename : dom/base/MultipartBlobImpl.h => dom/file/MultipartBlobImpl.h rename : dom/base/MutableBlobStorage.cpp => dom/file/MutableBlobStorage.cpp rename : dom/base/MutableBlobStorage.h => dom/file/MutableBlobStorage.h rename : dom/base/MutableBlobStreamListener.cpp => dom/file/MutableBlobStreamListener.cpp rename : dom/base/MutableBlobStreamListener.h => dom/file/MutableBlobStreamListener.h rename : dom/ipc/Blob.cpp => dom/file/ipc/Blob.cpp rename : dom/ipc/BlobChild.h => dom/file/ipc/BlobChild.h rename : dom/ipc/BlobParent.h => dom/file/ipc/BlobParent.h rename : dom/ipc/BlobTypes.ipdlh => dom/file/ipc/BlobTypes.ipdlh rename : dom/ipc/PBlob.ipdl => dom/file/ipc/PBlob.ipdl rename : dom/ipc/PBlobStream.ipdl => dom/file/ipc/PBlobStream.ipdl rename : dom/ipc/nsIRemoteBlob.h => dom/file/ipc/nsIRemoteBlob.h rename : dom/base/nsHostObjectProtocolHandler.cpp => dom/file/nsHostObjectProtocolHandler.cpp rename : dom/base/nsHostObjectProtocolHandler.h => dom/file/nsHostObjectProtocolHandler.h rename : dom/base/nsHostObjectURI.cpp => dom/file/nsHostObjectURI.cpp rename : dom/base/nsHostObjectURI.h => dom/file/nsHostObjectURI.h rename : dom/base/nsIDOMBlob.idl => dom/file/nsIDOMBlob.idl rename : dom/base/nsIDOMFileList.idl => dom/file/nsIDOMFileList.idl rename : dom/base/test/create_file_objects.js => dom/file/tests/create_file_objects.js rename : dom/base/test/file_blobURL_expiring.html => dom/file/tests/file_blobURL_expiring.html rename : dom/base/test/file_mozfiledataurl_audio.ogg => dom/file/tests/file_mozfiledataurl_audio.ogg rename : dom/base/test/file_mozfiledataurl_doc.html => dom/file/tests/file_mozfiledataurl_doc.html rename : dom/base/test/file_mozfiledataurl_img.jpg => dom/file/tests/file_mozfiledataurl_img.jpg rename : dom/base/test/file_mozfiledataurl_inner.html => dom/file/tests/file_mozfiledataurl_inner.html rename : dom/base/test/file_mozfiledataurl_text.txt => dom/file/tests/file_mozfiledataurl_text.txt rename : dom/base/test/file_nonascii_blob_url.html => dom/file/tests/file_nonascii_blob_url.html rename : dom/base/test/fileapi_chromeScript.js => dom/file/tests/fileapi_chromeScript.js rename : dom/base/test/fileutils.js => dom/file/tests/fileutils.js rename : dom/base/test/test_blobURL_expiring.html => dom/file/tests/test_blobURL_expiring.html rename : dom/base/test/test_blob_fragment_and_query.html => dom/file/tests/test_blob_fragment_and_query.html rename : dom/base/test/test_blobconstructor.html => dom/file/tests/test_blobconstructor.html rename : dom/base/test/test_file_from_blob.html => dom/file/tests/test_file_from_blob.html rename : dom/base/test/test_file_negative_date.html => dom/file/tests/test_file_negative_date.html rename : dom/base/test/test_fileapi.html => dom/file/tests/test_fileapi.html rename : dom/base/test/test_fileapi_slice.html => dom/file/tests/test_fileapi_slice.html rename : dom/base/test/test_ipc_messagemanager_blob.html => dom/file/tests/test_ipc_messagemanager_blob.html rename : dom/base/test/test_mozfiledataurl.html => dom/file/tests/test_mozfiledataurl.html rename : dom/base/test/test_nonascii_blob_url.html => dom/file/tests/test_nonascii_blob_url.html
2016-12-01 17:12:42 +03:00
DOMTimeMilliSec nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const {
if (aStamp.IsNull()) {
return 0;
}
Bug 1321261 - create dom/file for File APIs, r=qdot --HG-- rename : dom/base/BlobSet.cpp => dom/file/BlobSet.cpp rename : dom/base/BlobSet.h => dom/file/BlobSet.h rename : dom/base/File.cpp => dom/file/File.cpp rename : dom/base/File.h => dom/file/File.h rename : dom/base/FileList.cpp => dom/file/FileList.cpp rename : dom/base/FileList.h => dom/file/FileList.h rename : dom/base/FileReader.cpp => dom/file/FileReader.cpp rename : dom/base/FileReader.h => dom/file/FileReader.h rename : dom/base/MultipartBlobImpl.cpp => dom/file/MultipartBlobImpl.cpp rename : dom/base/MultipartBlobImpl.h => dom/file/MultipartBlobImpl.h rename : dom/base/MutableBlobStorage.cpp => dom/file/MutableBlobStorage.cpp rename : dom/base/MutableBlobStorage.h => dom/file/MutableBlobStorage.h rename : dom/base/MutableBlobStreamListener.cpp => dom/file/MutableBlobStreamListener.cpp rename : dom/base/MutableBlobStreamListener.h => dom/file/MutableBlobStreamListener.h rename : dom/ipc/Blob.cpp => dom/file/ipc/Blob.cpp rename : dom/ipc/BlobChild.h => dom/file/ipc/BlobChild.h rename : dom/ipc/BlobParent.h => dom/file/ipc/BlobParent.h rename : dom/ipc/BlobTypes.ipdlh => dom/file/ipc/BlobTypes.ipdlh rename : dom/ipc/PBlob.ipdl => dom/file/ipc/PBlob.ipdl rename : dom/ipc/PBlobStream.ipdl => dom/file/ipc/PBlobStream.ipdl rename : dom/ipc/nsIRemoteBlob.h => dom/file/ipc/nsIRemoteBlob.h rename : dom/base/nsHostObjectProtocolHandler.cpp => dom/file/nsHostObjectProtocolHandler.cpp rename : dom/base/nsHostObjectProtocolHandler.h => dom/file/nsHostObjectProtocolHandler.h rename : dom/base/nsHostObjectURI.cpp => dom/file/nsHostObjectURI.cpp rename : dom/base/nsHostObjectURI.h => dom/file/nsHostObjectURI.h rename : dom/base/nsIDOMBlob.idl => dom/file/nsIDOMBlob.idl rename : dom/base/nsIDOMFileList.idl => dom/file/nsIDOMFileList.idl rename : dom/base/test/create_file_objects.js => dom/file/tests/create_file_objects.js rename : dom/base/test/file_blobURL_expiring.html => dom/file/tests/file_blobURL_expiring.html rename : dom/base/test/file_mozfiledataurl_audio.ogg => dom/file/tests/file_mozfiledataurl_audio.ogg rename : dom/base/test/file_mozfiledataurl_doc.html => dom/file/tests/file_mozfiledataurl_doc.html rename : dom/base/test/file_mozfiledataurl_img.jpg => dom/file/tests/file_mozfiledataurl_img.jpg rename : dom/base/test/file_mozfiledataurl_inner.html => dom/file/tests/file_mozfiledataurl_inner.html rename : dom/base/test/file_mozfiledataurl_text.txt => dom/file/tests/file_mozfiledataurl_text.txt rename : dom/base/test/file_nonascii_blob_url.html => dom/file/tests/file_nonascii_blob_url.html rename : dom/base/test/fileapi_chromeScript.js => dom/file/tests/fileapi_chromeScript.js rename : dom/base/test/fileutils.js => dom/file/tests/fileutils.js rename : dom/base/test/test_blobURL_expiring.html => dom/file/tests/test_blobURL_expiring.html rename : dom/base/test/test_blob_fragment_and_query.html => dom/file/tests/test_blob_fragment_and_query.html rename : dom/base/test/test_blobconstructor.html => dom/file/tests/test_blobconstructor.html rename : dom/base/test/test_file_from_blob.html => dom/file/tests/test_file_from_blob.html rename : dom/base/test/test_file_negative_date.html => dom/file/tests/test_file_negative_date.html rename : dom/base/test/test_fileapi.html => dom/file/tests/test_fileapi.html rename : dom/base/test/test_fileapi_slice.html => dom/file/tests/test_fileapi_slice.html rename : dom/base/test/test_ipc_messagemanager_blob.html => dom/file/tests/test_ipc_messagemanager_blob.html rename : dom/base/test/test_mozfiledataurl.html => dom/file/tests/test_mozfiledataurl.html rename : dom/base/test/test_nonascii_blob_url.html => dom/file/tests/test_nonascii_blob_url.html
2016-12-01 17:12:42 +03:00
TimeDuration duration = aStamp - mNavigationStart;
return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
}
void nsDOMNavigationTiming::NotifyNavigationStart(
DocShellState aDocShellState) {
mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
mNavigationStart = TimeStamp::Now();
mDocShellHasBeenActiveSinceNavigationStart =
(aDocShellState == DocShellState::eActive);
PROFILER_MARKER_UNTYPED("Navigation::Start", DOM);
}
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::NotifyRestoreStart() {
mNavigationType = TYPE_BACK_FORWARD;
}
void nsDOMNavigationTiming::NotifyBeforeUnload() {
mBeforeUnloadStart = TimeStamp::Now();
}
void nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI) {
mUnloadStart = mBeforeUnloadStart;
mUnloadedURI = aOldURI;
}
void nsDOMNavigationTiming::NotifyUnloadEventStart() {
mUnloadStart = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Unload", NETWORK,
TRACING_INTERVAL_START, mDocShell);
}
void nsDOMNavigationTiming::NotifyUnloadEventEnd() {
mUnloadEnd = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Unload", NETWORK,
TRACING_INTERVAL_END, mDocShell);
}
void nsDOMNavigationTiming::NotifyLoadEventStart() {
if (!mLoadEventStart.IsNull()) {
return;
}
mLoadEventStart = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Load", NETWORK,
TRACING_INTERVAL_START, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
mLoadEventStartForTelemetry = TimeStamp::Now();
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_START_MS,
mNavigationStart,
mLoadEventStartForTelemetry);
if (mDocShellHasBeenActiveSinceNavigationStart) {
if (net::nsHttp::IsBeforeLastActiveTabLoadOptimization(
mNavigationStart)) {
Telemetry::AccumulateTimeDelta(
Telemetry::TIME_TO_LOAD_EVENT_START_ACTIVE_NETOPT_MS,
mNavigationStart, mLoadEventStartForTelemetry);
} else {
Telemetry::AccumulateTimeDelta(
Telemetry::TIME_TO_LOAD_EVENT_START_ACTIVE_MS, mNavigationStart,
mLoadEventStartForTelemetry);
}
}
}
}
void nsDOMNavigationTiming::NotifyLoadEventEnd() {
if (!mLoadEventEnd.IsNull()) {
return;
}
mLoadEventEnd = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "Load", NETWORK,
TRACING_INTERVAL_END, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
#ifdef MOZ_GECKO_PROFILER
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
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()));
Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They weren't quite good because: 1. While loading an iframe, they were being registered twice with the same ids(for about:blank and the real URL) sometimes. 2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child processes if the parent is in a different process. That may not be the case for now, but it will be after fission. So we had to find other IDs to: 1. Determine the Tab of the frames. 2. Determine the URLs of the frames. For the first use case, we were using nsDocShell::mHistoryId for that purpose but that was wrong. The closest thing that we can get to a tab ID is BrowsingContext ID because they don't change after a navigation. But iframes have different BrowsingContext's, so we still need to create a tree to construct a tab content. That can be either in the front-end or capture time. For the second use case, we were using a key pair of mHistoryId and mOSHE. We now chose to keep inner window IDs for that purpose. Inner window IDs are unique for each navigation loads because inner window correspond to each JS window global objects. That's why we can use that without any problem. But one problem is that we cannot handle `history.pushState` and `history.replaceState` changes with that change since window global objects won't change during those. But that was the best thing we can do after fission. So this will be a small sacrifice for us to keep that functionality working after fission. In that patch we also remove the registration/unregistration calls. We are going to add those calls in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D47065 --HG-- extra : moz-landing-system : lando
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)));
}
#endif
TimeStamp loadEventEnd = TimeStamp::Now();
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_LOAD_EVENT_END_MS,
mNavigationStart, loadEventEnd);
MaybeSubmitTimeToLoadEventPreloadTelemetry(loadEventEnd);
}
}
Bug 1321261 - create dom/file for File APIs, r=qdot --HG-- rename : dom/base/BlobSet.cpp => dom/file/BlobSet.cpp rename : dom/base/BlobSet.h => dom/file/BlobSet.h rename : dom/base/File.cpp => dom/file/File.cpp rename : dom/base/File.h => dom/file/File.h rename : dom/base/FileList.cpp => dom/file/FileList.cpp rename : dom/base/FileList.h => dom/file/FileList.h rename : dom/base/FileReader.cpp => dom/file/FileReader.cpp rename : dom/base/FileReader.h => dom/file/FileReader.h rename : dom/base/MultipartBlobImpl.cpp => dom/file/MultipartBlobImpl.cpp rename : dom/base/MultipartBlobImpl.h => dom/file/MultipartBlobImpl.h rename : dom/base/MutableBlobStorage.cpp => dom/file/MutableBlobStorage.cpp rename : dom/base/MutableBlobStorage.h => dom/file/MutableBlobStorage.h rename : dom/base/MutableBlobStreamListener.cpp => dom/file/MutableBlobStreamListener.cpp rename : dom/base/MutableBlobStreamListener.h => dom/file/MutableBlobStreamListener.h rename : dom/ipc/Blob.cpp => dom/file/ipc/Blob.cpp rename : dom/ipc/BlobChild.h => dom/file/ipc/BlobChild.h rename : dom/ipc/BlobParent.h => dom/file/ipc/BlobParent.h rename : dom/ipc/BlobTypes.ipdlh => dom/file/ipc/BlobTypes.ipdlh rename : dom/ipc/PBlob.ipdl => dom/file/ipc/PBlob.ipdl rename : dom/ipc/PBlobStream.ipdl => dom/file/ipc/PBlobStream.ipdl rename : dom/ipc/nsIRemoteBlob.h => dom/file/ipc/nsIRemoteBlob.h rename : dom/base/nsHostObjectProtocolHandler.cpp => dom/file/nsHostObjectProtocolHandler.cpp rename : dom/base/nsHostObjectProtocolHandler.h => dom/file/nsHostObjectProtocolHandler.h rename : dom/base/nsHostObjectURI.cpp => dom/file/nsHostObjectURI.cpp rename : dom/base/nsHostObjectURI.h => dom/file/nsHostObjectURI.h rename : dom/base/nsIDOMBlob.idl => dom/file/nsIDOMBlob.idl rename : dom/base/nsIDOMFileList.idl => dom/file/nsIDOMFileList.idl rename : dom/base/test/create_file_objects.js => dom/file/tests/create_file_objects.js rename : dom/base/test/file_blobURL_expiring.html => dom/file/tests/file_blobURL_expiring.html rename : dom/base/test/file_mozfiledataurl_audio.ogg => dom/file/tests/file_mozfiledataurl_audio.ogg rename : dom/base/test/file_mozfiledataurl_doc.html => dom/file/tests/file_mozfiledataurl_doc.html rename : dom/base/test/file_mozfiledataurl_img.jpg => dom/file/tests/file_mozfiledataurl_img.jpg rename : dom/base/test/file_mozfiledataurl_inner.html => dom/file/tests/file_mozfiledataurl_inner.html rename : dom/base/test/file_mozfiledataurl_text.txt => dom/file/tests/file_mozfiledataurl_text.txt rename : dom/base/test/file_nonascii_blob_url.html => dom/file/tests/file_nonascii_blob_url.html rename : dom/base/test/fileapi_chromeScript.js => dom/file/tests/fileapi_chromeScript.js rename : dom/base/test/fileutils.js => dom/file/tests/fileutils.js rename : dom/base/test/test_blobURL_expiring.html => dom/file/tests/test_blobURL_expiring.html rename : dom/base/test/test_blob_fragment_and_query.html => dom/file/tests/test_blob_fragment_and_query.html rename : dom/base/test/test_blobconstructor.html => dom/file/tests/test_blobconstructor.html rename : dom/base/test/test_file_from_blob.html => dom/file/tests/test_file_from_blob.html rename : dom/base/test/test_file_negative_date.html => dom/file/tests/test_file_negative_date.html rename : dom/base/test/test_fileapi.html => dom/file/tests/test_fileapi.html rename : dom/base/test/test_fileapi_slice.html => dom/file/tests/test_fileapi_slice.html rename : dom/base/test/test_ipc_messagemanager_blob.html => dom/file/tests/test_ipc_messagemanager_blob.html rename : dom/base/test/test_mozfiledataurl.html => dom/file/tests/test_mozfiledataurl.html rename : dom/base/test/test_nonascii_blob_url.html => dom/file/tests/test_nonascii_blob_url.html
2016-12-01 17:12:42 +03:00
void nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI,
TimeStamp aValue) {
if (!mDOMLoading.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMLoading = aValue;
}
void nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI) {
if (!mDOMLoading.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMLoading = TimeStamp::Now();
PROFILER_MARKER_UNTYPED("Navigation::DOMLoading", DOM);
}
void nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI) {
if (!mDOMInteractive.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMInteractive = TimeStamp::Now();
PROFILER_MARKER_UNTYPED("Navigation::DOMInteractive", DOM);
}
void nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI) {
if (!mDOMComplete.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMComplete = TimeStamp::Now();
PROFILER_MARKER_UNTYPED("Navigation::DOMComplete", DOM);
}
void nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI) {
if (!mDOMContentLoadedEventStart.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMContentLoadedEventStart = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "DOMContentLoaded", NETWORK,
TRACING_INTERVAL_START, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
TimeStamp now = TimeStamp::Now();
Telemetry::AccumulateTimeDelta(
Telemetry::TIME_TO_DOM_CONTENT_LOADED_START_MS, mNavigationStart, now);
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);
}
}
}
}
void nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI) {
if (!mDOMContentLoadedEventEnd.IsNull()) {
return;
}
mLoadedURI = aURI;
mDOMContentLoadedEventEnd = TimeStamp::Now();
PROFILER_TRACING_MARKER_DOCSHELL("Navigation", "DOMContentLoaded", NETWORK,
TRACING_INTERVAL_END, mDocShell);
if (IsTopLevelContentDocumentInContentProcess()) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_DOM_CONTENT_LOADED_END_MS,
mNavigationStart);
}
}
// 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();
MOZ_RELEASE_ASSERT(!mContentfulPaint.IsNull(),
"TTI timeout with no contentful-paint?");
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
TimeStamp lastLongTaskEnded;
mainThread->GetLastLongNonIdleTaskEnd(&lastLongTaskEnded);
// 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;
}
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;
}
// 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
// TimeToFirstInteractive. There are also arguments about what sort
// of loads should qualify.
// 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
// Long Task or DOMContentLoadedEnd (whichever is later). lastLongTaskEnded
// is >= FCP here.
if (mTTFI.IsNull()) {
// 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())));
}
// 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
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
TimeDuration elapsed = mTTFI - mNavigationStart;
MOZ_ASSERT(elapsed.ToMilliseconds() > 0);
TimeDuration elapsedLongTask =
lastLongTaskEnded.IsNull() ? 0 : lastLongTaskEnded - mNavigationStart;
nsAutoCString spec;
if (mLoadedURI) {
mLoadedURI->GetSpec(spec);
}
nsPrintfCString marker("TTFI after %dms (LongTask was at %dms) for URL %s",
int(elapsed.ToMilliseconds()),
int(elapsedLongTask.ToMilliseconds()), spec.get());
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"TimeToFirstInteractive (TTFI)", DOM, TextMarkerPayload,
Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They weren't quite good because: 1. While loading an iframe, they were being registered twice with the same ids(for about:blank and the real URL) sometimes. 2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child processes if the parent is in a different process. That may not be the case for now, but it will be after fission. So we had to find other IDs to: 1. Determine the Tab of the frames. 2. Determine the URLs of the frames. For the first use case, we were using nsDocShell::mHistoryId for that purpose but that was wrong. The closest thing that we can get to a tab ID is BrowsingContext ID because they don't change after a navigation. But iframes have different BrowsingContext's, so we still need to create a tree to construct a tab content. That can be either in the front-end or capture time. For the second use case, we were using a key pair of mHistoryId and mOSHE. We now chose to keep inner window IDs for that purpose. Inner window IDs are unique for each navigation loads because inner window correspond to each JS window global objects. That's why we can use that without any problem. But one problem is that we cannot handle `history.pushState` and `history.replaceState` changes with that change since window global objects won't change during those. But that was the best thing we can do after fission. So this will be a small sacrifice for us to keep that functionality working after fission. In that patch we also remove the registration/unregistration calls. We are going to add those calls in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D47065 --HG-- extra : moz-landing-system : lando
2019-10-10 00:25:11 +03:00
(marker, mNavigationStart, mTTFI,
profiler_get_inner_window_id_from_docshell(mDocShell)));
}
#endif
}
void nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mNavigationStart.IsNull());
if (!mNonBlankPaint.IsNull()) {
return;
}
mNonBlankPaint = TimeStamp::Now();
#ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
TimeDuration elapsed = mNonBlankPaint - mNavigationStart;
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");
PAGELOAD_LOG(("%s", marker.get()));
Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They weren't quite good because: 1. While loading an iframe, they were being registered twice with the same ids(for about:blank and the real URL) sometimes. 2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child processes if the parent is in a different process. That may not be the case for now, but it will be after fission. So we had to find other IDs to: 1. Determine the Tab of the frames. 2. Determine the URLs of the frames. For the first use case, we were using nsDocShell::mHistoryId for that purpose but that was wrong. The closest thing that we can get to a tab ID is BrowsingContext ID because they don't change after a navigation. But iframes have different BrowsingContext's, so we still need to create a tree to construct a tab content. That can be either in the front-end or capture time. For the second use case, we were using a key pair of mHistoryId and mOSHE. We now chose to keep inner window IDs for that purpose. Inner window IDs are unique for each navigation loads because inner window correspond to each JS window global objects. That's why we can use that without any problem. But one problem is that we cannot handle `history.pushState` and `history.replaceState` changes with that change since window global objects won't change during those. But that was the best thing we can do after fission. So this will be a small sacrifice for us to keep that functionality working after fission. In that patch we also remove the registration/unregistration calls. We are going to add those calls in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D47065 --HG-- extra : moz-landing-system : lando
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)));
}
#endif
if (mDocShellHasBeenActiveSinceNavigationStart) {
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);
}
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_MS,
mNavigationStart, mNonBlankPaint);
}
}
void nsDOMNavigationTiming::NotifyContentfulPaintForRootContentDocument(
const mozilla::TimeStamp& aCompositeEndTime) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mNavigationStart.IsNull());
if (!mContentfulPaint.IsNull()) {
return;
}
mContentfulPaint = aCompositeEndTime;
#ifdef MOZ_GECKO_PROFILER
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
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");
PAGELOAD_LOG(("%s", marker.get()));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"FirstContentfulPaint", DOM, TextMarkerPayload,
Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They weren't quite good because: 1. While loading an iframe, they were being registered twice with the same ids(for about:blank and the real URL) sometimes. 2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child processes if the parent is in a different process. That may not be the case for now, but it will be after fission. So we had to find other IDs to: 1. Determine the Tab of the frames. 2. Determine the URLs of the frames. For the first use case, we were using nsDocShell::mHistoryId for that purpose but that was wrong. The closest thing that we can get to a tab ID is BrowsingContext ID because they don't change after a navigation. But iframes have different BrowsingContext's, so we still need to create a tree to construct a tab content. That can be either in the front-end or capture time. For the second use case, we were using a key pair of mHistoryId and mOSHE. We now chose to keep inner window IDs for that purpose. Inner window IDs are unique for each navigation loads because inner window correspond to each JS window global objects. That's why we can use that without any problem. But one problem is that we cannot handle `history.pushState` and `history.replaceState` changes with that change since window global objects won't change during those. But that was the best thing we can do after fission. So this will be a small sacrifice for us to keep that functionality working after fission. In that patch we also remove the registration/unregistration calls. We are going to add those calls in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D47065 --HG-- extra : moz-landing-system : lando
2019-10-10 00:25:11 +03:00
(marker, mNavigationStart, mContentfulPaint,
profiler_get_inner_window_id_from_docshell(mDocShell)));
}
#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");
if (mDocShellHasBeenActiveSinceNavigationStart) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_FIRST_CONTENTFUL_PAINT_MS,
mNavigationStart, mContentfulPaint);
}
}
void nsDOMNavigationTiming::NotifyDOMContentFlushedForRootContentDocument() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mNavigationStart.IsNull());
if (!mDOMContentFlushed.IsNull()) {
return;
}
mDOMContentFlushed = TimeStamp::Now();
#ifdef MOZ_GECKO_PROFILER
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
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");
PAGELOAD_LOG(("%s", marker.get()));
PROFILER_ADD_MARKER_WITH_PAYLOAD(
"DOMContentFlushed", DOM, TextMarkerPayload,
Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika We were keeping nsDocShell::mHistoryId and nsDocShell::mOSHE as keys. They weren't quite good because: 1. While loading an iframe, they were being registered twice with the same ids(for about:blank and the real URL) sometimes. 2. It wasn't possible to access to the parent mHistoryId and mOSHE from a child processes if the parent is in a different process. That may not be the case for now, but it will be after fission. So we had to find other IDs to: 1. Determine the Tab of the frames. 2. Determine the URLs of the frames. For the first use case, we were using nsDocShell::mHistoryId for that purpose but that was wrong. The closest thing that we can get to a tab ID is BrowsingContext ID because they don't change after a navigation. But iframes have different BrowsingContext's, so we still need to create a tree to construct a tab content. That can be either in the front-end or capture time. For the second use case, we were using a key pair of mHistoryId and mOSHE. We now chose to keep inner window IDs for that purpose. Inner window IDs are unique for each navigation loads because inner window correspond to each JS window global objects. That's why we can use that without any problem. But one problem is that we cannot handle `history.pushState` and `history.replaceState` changes with that change since window global objects won't change during those. But that was the best thing we can do after fission. So this will be a small sacrifice for us to keep that functionality working after fission. In that patch we also remove the registration/unregistration calls. We are going to add those calls in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D47065 --HG-- extra : moz-landing-system : lando
2019-10-10 00:25:11 +03:00
(marker, mNavigationStart, mDOMContentFlushed,
profiler_get_inner_window_id_from_docshell(mDocShell)));
}
#endif
}
void nsDOMNavigationTiming::NotifyDocShellStateChanged(
DocShellState aDocShellState) {
mDocShellHasBeenActiveSinceNavigationStart &=
(aDocShellState == DocShellState::eActive);
}
mozilla::TimeStamp nsDOMNavigationTiming::GetUnloadEventStartTimeStamp() const {
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
// 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);
if (NS_SUCCEEDED(rv)) {
return mUnloadStart;
}
return mozilla::TimeStamp();
}
mozilla::TimeStamp nsDOMNavigationTiming::GetUnloadEventEndTimeStamp() const {
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
// 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);
if (NS_SUCCEEDED(rv)) {
return mUnloadEnd;
}
return mozilla::TimeStamp();
}
bool nsDOMNavigationTiming::IsTopLevelContentDocumentInContentProcess() const {
if (!mDocShell) {
return false;
}
if (!XRE_IsContentProcess()) {
return false;
}
return mDocShell->GetBrowsingContext()->IsTopContent();
}
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);
}
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) {}
/* 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) {
timing->mUnloadedURI = std::move(*unloadedURI);
}
if (loadedURI) {
timing->mLoadedURI = std::move(*loadedURI);
}
*aResult = std::move(timing);
return true;
}