Bug 1403926 - Add pref for PerformanceNavigationTiming r=baku

MozReview-Commit-ID: 9f6fcCk8mh

--HG--
extra : rebase_source : 0a1252a7cff2cfaec8f0ab5f8ffa755a0a8a4b5e
This commit is contained in:
Valentin Gosu 2017-10-04 02:48:33 +02:00
Родитель 8bcf96f172
Коммит 3fba909015
4 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -290,6 +290,7 @@ bool nsContentUtils::sIsCutCopyAllowed = true;
bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
bool nsContentUtils::sIsResourceTimingEnabled = false;
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
bool nsContentUtils::sIsWebComponentsEnabled = false;
@ -691,6 +692,9 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
"dom.enable_resource_timing", true);
Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
"dom.enable_performance_navigation_timing", true);
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
"dom.performance.enable_user_timing_logging", false);

Просмотреть файл

@ -2273,6 +2273,14 @@ public:
return sIsResourceTimingEnabled;
}
/*
* Returns true if the performance timing APIs are enabled.
*/
static bool IsPerformanceNavigationTimingEnabled()
{
return sIsPerformanceNavigationTimingEnabled;
}
/*
* Returns true if notification should be sent for peformance timing events.
*/
@ -3340,6 +3348,7 @@ private:
static uint32_t sHandlingInputTimeout;
static bool sIsPerformanceTimingEnabled;
static bool sIsResourceTimingEnabled;
static bool sIsPerformanceNavigationTimingEnabled;
static bool sIsUserTimingLoggingEnabled;
static bool sIsFrameTimingPrefEnabled;
static bool sIsFormAutofillAutocompleteEnabled;

Просмотреть файл

@ -312,7 +312,7 @@ PerformanceMainThread::CreationTime() const
void
PerformanceMainThread::EnsureDocEntry()
{
if (!mDocEntry) {
if (!mDocEntry && nsContentUtils::IsPerformanceNavigationTimingEnabled()) {
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
mDocEntry = new PerformanceNavigationTiming(Timing(), this,
httpChannel);

Просмотреть файл

@ -163,6 +163,9 @@ pref("dom.enable_performance", true);
// Whether resource timing will be gathered and returned by performance.GetEntries*
pref("dom.enable_resource_timing", true);
// Whether performance.GetEntries* will contain an entry for the active document
pref("dom.enable_performance_navigation_timing", true);
// Enable printing performance marks/measures to log
pref("dom.performance.enable_user_timing_logging", false);