Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - dom.event.handling-user-input-time-limit, r=Ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 01 May 2019 21:09:14 +0000
changeset 530991 e323ab3dd2b383038bda388694c327b3a9387118
parent 530990 ce2fd287bfe3720a93abd23e94fdb50a92743a98
child 530992 c64a91442fa0bb7547b1095970a53005ddb5aba1
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.event.handling-user-input-time-limit, r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D29512
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
modules/libpref/init/StaticPrefList.h
modules/libpref/init/all.js
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -325,18 +325,16 @@ bool nsContentUtils::sBypassCSSOMOriginC
 
 bool nsContentUtils::sIsBytecodeCacheEnabled = false;
 int32_t nsContentUtils::sBytecodeCacheStrategy = 0;
 nsCString* nsContentUtils::sJSBytecodeMimeType = nullptr;
 
 nsContentUtils::UserInteractionObserver*
     nsContentUtils::sUserInteractionObserver = nullptr;
 
-uint32_t nsContentUtils::sHandlingInputTimeout = 1000;
-
 nsHtml5StringParser* nsContentUtils::sHTMLFragmentParser = nullptr;
 nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
 nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
 bool nsContentUtils::sFragmentParsingActive = false;
 
 bool nsContentUtils::sDoNotTrackEnabled = false;
 
 bool nsContentUtils::sAntiTrackingControlCenterUIEnabled = false;
@@ -545,17 +543,18 @@ class nsContentUtils::UserInteractionObs
   static Atomic<bool> sUserActive;
 
  private:
   ~UserInteractionObserver() {}
 };
 
 /* static */
 TimeDuration nsContentUtils::HandlingUserInputTimeout() {
-  return TimeDuration::FromMilliseconds(sHandlingInputTimeout);
+  return TimeDuration::FromMilliseconds(
+      StaticPrefs::dom_event_handling_user_input_time_limit());
 }
 
 // static
 nsresult nsContentUtils::Init() {
   if (sInitialized) {
     NS_WARNING("Init() called twice");
 
     return NS_OK;
@@ -615,19 +614,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::AddUintVarCache(
-      &sHandlingInputTimeout, "dom.event.handling-user-input-time-limit", 1000);
-
   Preferences::AddBoolVarCache(
       &sSendPerformanceTimingNotifications,
       "dom.performance.enable_notify_performance_timing", false);
 
   Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
                                "privacy.donottrackheader.enabled", false);
 
   Preferences::AddBoolVarCache(&sUseActivityCursor, "ui.use_activity_cursor",
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -3455,17 +3455,16 @@ class nsContentUtils {
   static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners;
   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 sSendPerformanceTimingNotifications;
   static bool sUseActivityCursor;
   static bool sAnimationsAPICoreEnabled;
   static bool sGetBoxQuadsEnabled;
   static bool sSkipCursorMoveForSameValueSet;
   static bool sRequestIdleCallbackEnabled;
   static bool sTailingEnabled;
   static bool sShowInputPlaceholderOnFocus;
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -2425,16 +2425,24 @@ VARCACHE_PREF(
 )
 
 VARCACHE_PREF(
   "privacy.window.maxInnerHeight",
    privacy_window_maxInnerHeight,
   int32_t, 1000
 )
 
+// Time limit, in milliseconds, for EventStateManager::IsHandlingUserInput().
+// Used to detect long running handlers of user-generated events.
+VARCACHE_PREF(
+  "dom.event.handling-user-input-time-limit",
+   dom_event_handling_user_input_time_limit,
+  uint32_t, 1000
+)
+
 // Password protection
 VARCACHE_PREF(
   "browser.safebrowsing.passwords.enabled",
    browser_safebrowsing_passwords_enabled,
   bool, false
 )
 
 // Malware protection
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5292,20 +5292,16 @@ pref("full-screen-api.transition.timeout
 pref("full-screen-api.warning.timeout", 3000);
 // delay for the warning box to show when pointer stays on the top, unit: ms
 pref("full-screen-api.warning.delay", 500);
 
 // DOM pointerlock API
 // time for the warning box stays on the screen before sliding out, unit: ms
 pref("pointer-lock-api.warning.timeout", 3000);
 
-// Time limit, in milliseconds, for EventStateManager::IsHandlingUserInput().
-// Used to detect long running handlers of user-generated events.
-pref("dom.event.handling-user-input-time-limit", 1000);
-
 // Whether we should layerize all animated images (if otherwise possible).
 pref("layout.animated-image-layers.enabled", false);
 
 pref("dom.vibrator.enabled", true);
 pref("dom.vibrator.max_vibrate_ms", 10000);
 pref("dom.vibrator.max_vibrate_list_len", 128);
 
 // Battery API