Bug 1622111 - Convert dom.use_components_shim to static pref. r=njn
authorKristen Wright <kwright@mozilla.com>
Thu, 19 Mar 2020 00:54:22 +0000
changeset 520243 2854d51f29f9e25e9c3f229e6c0b18450b0ec4d9
parent 520242 94ee39238ed8bd92cc628e5d054306553c009c30
child 520244 01fd4682384f48338923738ec5325047d47dcd54
push id37246
push useropoprus@mozilla.com
push dateWed, 25 Mar 2020 03:40:33 +0000
treeherdermozilla-central@14b59d4adc95 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1622111
milestone76.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 1622111 - Convert dom.use_components_shim to static pref. r=njn Converts dom.use_components_shim to a static pref and removes its `all.js` entry. Differential Revision: https://phabricator.services.mozilla.com/D67184
dom/base/nsGlobalWindowInner.cpp
modules/libpref/init/StaticPrefList.yaml
modules/libpref/init/all.js
--- a/dom/base/nsGlobalWindowInner.cpp
+++ b/dom/base/nsGlobalWindowInner.cpp
@@ -2808,24 +2808,17 @@ bool nsGlobalWindowInner::DoResolve(
 
   if (found) {
     return true;
   }
 
   // We support a cut-down Components.interfaces in case websites are
   // using Components.interfaces.nsIFoo.CONSTANT_NAME for the ones
   // that have constants.
-  static bool watchingComponentsPref = false;
-  static bool useComponentsShim = false;
-  if (!watchingComponentsPref) {
-    watchingComponentsPref = true;
-    Preferences::AddBoolVarCache(&useComponentsShim, "dom.use_components_shim",
-                                 true);
-  }
-  if (useComponentsShim &&
+  if (StaticPrefs::dom_use_components_shim() &&
       aId == XPCJSRuntime::Get()->GetStringID(XPCJSContext::IDX_COMPONENTS)) {
     return ResolveComponentsShim(aCx, aObj, aDesc);
   }
 
   // We also support a "window.controllers" thing; apparently some
   // sites use it for browser-sniffing.  See bug 1010577.
 #ifdef USE_CONTROLLERS_SHIM
   // Note: We use |aObj| rather than |this| to get the principal here, because
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -2659,16 +2659,22 @@
   mirror: always
 
 # Time limit, in milliseconds, for user gesture transient activation.
 - name: dom.user_activation.transient.timeout
   type: uint32_t
   value: 5000
   mirror: always
 
+# Whether to shim a Components object on untrusted windows.
+- name: dom.use_components_shim
+  type: bool
+  value: @IS_NOT_NIGHTLY_BUILD@
+  mirror: always
+
 - name: dom.vibrator.enabled
   type: bool
   value: true
   mirror: always
 
 - name: dom.vibrator.max_vibrate_ms
   type: uint32_t
   value: 10000
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1050,23 +1050,16 @@ pref("dom.forms.selectSearch", false);
   pref("dom.forms.select.customstyling", false);
 #else
   pref("dom.forms.select.customstyling", true);
 #endif
 pref("dom.select_popup_in_parent.enabled", false);
 
 pref("dom.cycle_collector.incremental", true);
 
-// Whether to shim a Components object on untrusted windows.
-#ifdef NIGHTLY_BUILD
-  pref("dom.use_components_shim", false);
-#else // NIGHTLY_BUILD
-  pref("dom.use_components_shim", true);
-#endif // NIGHTLY_BUILD
-
 // Disable popups from plugins by default
 //   0 = openAllowed
 //   1 = openControlled
 //   2 = openBlocked
 //   3 = openAbused
 pref("privacy.popups.disable_from_plugins", 3);
 
 // Enable Paritioned LocalStorage for a list of hosts when detected as trackers