Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom.enable_resource_timing, r=Ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 01 May 2019 21:08:36 +0000
changeset 530985 4826fedb277de974714e473ea71b4ca9167b4d3a
parent 530984 04c2cdd7311b3eceb88173cda0ffc834bba55efb
child 530986 8dd0d629bbb40a00b30aed51861bf7aaf6f40b57
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1548253
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom.enable_resource_timing, r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D29506
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
dom/performance/PerformanceTiming.cpp
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -307,17 +307,16 @@ nsString* nsContentUtils::sControlText =
 nsString* nsContentUtils::sMetaText = nullptr;
 nsString* nsContentUtils::sOSText = nullptr;
 nsString* nsContentUtils::sAltText = nullptr;
 nsString* nsContentUtils::sModifierSeparator = nullptr;
 
 bool nsContentUtils::sInitialized = false;
 bool nsContentUtils::sIsUpgradableDisplayContentPrefEnabled = false;
 bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
-bool nsContentUtils::sIsResourceTimingEnabled = false;
 bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
 bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
 bool nsContentUtils::sSendPerformanceTimingNotifications = false;
 bool nsContentUtils::sUseActivityCursor = false;
 bool nsContentUtils::sAnimationsAPICoreEnabled = false;
 bool nsContentUtils::sGetBoxQuadsEnabled = false;
 bool nsContentUtils::sSkipCursorMoveForSameValueSet = false;
 bool nsContentUtils::sRequestIdleCallbackEnabled = false;
@@ -623,19 +622,16 @@ nsresult nsContentUtils::Init() {
     RegisterStrongMemoryReporter(new DOMEventListenerManagersHashReporter());
   }
 
   sBlockedScriptRunners = new AutoTArray<nsCOMPtr<nsIRunnable>, 8>;
 
   Preferences::AddBoolVarCache(&sAllowXULXBL_for_file,
                                "dom.allow_XUL_XBL_for_file");
 
-  Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
-                               "dom.enable_resource_timing", true);
-
   Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
                                "dom.enable_performance_navigation_timing",
                                true);
 
   Preferences::AddBoolVarCache(&sIsUpgradableDisplayContentPrefEnabled,
                                "security.mixed_content.upgrade_display_content",
                                false);
 
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -2338,21 +2338,16 @@ class nsContentUtils {
    * allowed for the given subject principal. These are only allowed if the user
    * initiated them (like with a mouse-click or key press).
    */
   static bool IsCutCopyAllowed(nsIPrincipal* aSubjectPrincipal);
 
   /*
    * Returns true if the performance timing APIs are enabled.
    */
-  static bool IsResourceTimingEnabled() { 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.
    */
   static bool SendPerformanceTimingNotifications() {
@@ -3473,17 +3468,16 @@ class nsContentUtils {
   static uint32_t sRunnersCountAtFirstBlocker;
   static uint32_t sScriptBlockerCountWhereRunnersPrevented;
 
   static nsIInterfaceRequestor* sSameOriginChecker;
 
   static bool sIsHandlingKeyBoardEvent;
   static bool sAllowXULXBL_for_file;
   static uint32_t sHandlingInputTimeout;
-  static bool sIsResourceTimingEnabled;
   static bool sIsPerformanceNavigationTimingEnabled;
   static bool sIsUpgradableDisplayContentPrefEnabled;
   static bool sIsFrameTimingPrefEnabled;
   static bool sIsFormAutofillAutocompleteEnabled;
   static bool sSendPerformanceTimingNotifications;
   static bool sUseActivityCursor;
   static bool sAnimationsAPICoreEnabled;
   static bool sGetBoxQuadsEnabled;
--- a/dom/performance/PerformanceTiming.cpp
+++ b/dom/performance/PerformanceTiming.cpp
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "PerformanceTiming.h"
 #include "mozilla/dom/PerformanceTimingBinding.h"
+#include "mozilla/StaticPrefs.h"
 #include "mozilla/Telemetry.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "mozilla/dom/Document.h"
 #include "nsITimedChannel.h"
 
 namespace mozilla {
 namespace dom {
@@ -23,17 +24,17 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(P
 /* static */
 PerformanceTimingData* PerformanceTimingData::Create(
     nsITimedChannel* aTimedChannel, nsIHttpChannel* aChannel,
     DOMHighResTimeStamp aZeroTime, nsAString& aInitiatorType,
     nsAString& aEntryName) {
   MOZ_ASSERT(NS_IsMainThread());
 
   // Check if resource timing is prefed off.
-  if (!nsContentUtils::IsResourceTimingEnabled()) {
+  if (!StaticPrefs::dom_enable_resource_timing()) {
     return nullptr;
   }
 
   if (!aChannel || !aTimedChannel) {
     return nullptr;
   }
 
   bool reportTiming = true;
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -469,16 +469,23 @@ VARCACHE_PREF(
 
 // Enable Performance Observer API
 VARCACHE_PREF(
   "dom.enable_performance_observer",
    dom_enable_performance_observer,
   RelaxedAtomicBool, true
 )
 
+// Whether resource timing will be gathered and returned by performance.GetEntries*
+VARCACHE_PREF(
+  "dom.enable_resource_timing",
+   dom_enable_resource_timing,
+  bool, true
+)
+
 // Render animations and videos as a solid color
 VARCACHE_PREF(
   "browser.measurement.render_anims_and_video_solid",
   browser_measurement_render_anims_and_video_solid,
   RelaxedAtomicBool, false
 )
 
 // Enable passing the "storage" option to indexedDB.open.
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -149,19 +149,16 @@ pref("dom.serviceWorkers.idle_extended_t
 
 // The amount of time (milliseconds) an update request is delayed when triggered
 // by a service worker that doesn't control any clients.
 pref("dom.serviceWorkers.update_delay", 1000);
 
 // Enable test for 24 hours update, service workers will always treat last update check time is over 24 hours
 pref("dom.serviceWorkers.testUpdateOverOneDay", false);
 
-// 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 notification of performance timing
 pref("dom.performance.enable_notify_performance_timing", false);
 
 // Enable collecting of docgroup activity in the scheduler
 pref("dom.performance.enable_scheduler_timing", true);