Bug 1588720 - Part 1: Convert dom.popup_maximum to a static pref; r=smaug
authorEdgar Chen <echen@mozilla.com>
Fri, 18 Oct 2019 02:52:25 +0000
changeset 562756 729a6c2005ad46a6009e45e7e14db4a38ed338c8
parent 562755 2cd0249984214c8898195de11a61d0724ea99179
child 562757 996e48d8e990d0dd2cf08492c946a08d0b2dc246
push id2195
push userffxbld-merge
push dateMon, 25 Nov 2019 12:02:33 +0000
treeherdermozilla-release@19adee6f7bb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1588720
milestone71.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 1588720 - Part 1: Convert dom.popup_maximum to a static pref; r=smaug Differential Revision: https://phabricator.services.mozilla.com/D49275
dom/base/nsGlobalWindowOuter.cpp
modules/libpref/init/StaticPrefList.yaml
modules/libpref/init/all.js
--- a/dom/base/nsGlobalWindowOuter.cpp
+++ b/dom/base/nsGlobalWindowOuter.cpp
@@ -5693,17 +5693,17 @@ PopupBlocker::PopupControlState nsGlobal
       break;
     default:
       NS_WARNING("Strange PopupControlState!");
   }
 
   // limit the number of simultaneously open popups
   if (abuse == PopupBlocker::openAbused || abuse == PopupBlocker::openBlocked ||
       abuse == PopupBlocker::openControlled) {
-    int32_t popupMax = Preferences::GetInt("dom.popup_maximum", -1);
+    int32_t popupMax = StaticPrefs::dom_popup_maximum();
     if (popupMax >= 0 && gOpenPopupSpamCount >= popupMax)
       abuse = PopupBlocker::openOverridden;
   }
 
   // If this popup is allowed, let's block any other for this event, forcing
   // PopupBlocker::openBlocked state.
   if ((abuse == PopupBlocker::openAllowed ||
        abuse == PopupBlocker::openControlled) &&
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -1308,16 +1308,23 @@
   mirror: always
 
 # Block multiple window.open() per single event.
 - name: dom.block_multiple_popups
   type: bool
   value: true
   mirror: always
 
+# The maximum number of popup that is allowed to be opened. Set to -1 for no
+# limit.
+- name: dom.popup_maximum
+  type: int32_t
+  value: 20
+  mirror: always
+
 # Whether window.location.reload() and window.history.go(0) should be blocked
 # if called directly from a window resize event handler.
 #
 # This used to be necessary long ago to prevent terrible UX when using stuff
 # like TypeAheadFind (bug 258917), but it also causes compat issues on mobile
 # (bug 1570566).
 #
 # So for now disable it on Android and Desktop Nightly, to see if we have any
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -950,17 +950,16 @@ pref("dom.disable_window_open_feature.me
 pref("dom.disable_window_open_feature.resizable",   true);
 pref("dom.disable_window_open_feature.minimizable", false);
 pref("dom.disable_window_open_feature.status",      true);
 
 pref("dom.allow_scripts_to_close_windows",          false);
 
 pref("dom.require_user_interaction_for_beforeunload", true);
 
-pref("dom.popup_maximum",                           20);
 pref("dom.popup_allowed_events", "change click dblclick auxclick mouseup pointerup notificationclick reset submit touchend contextmenu");
 
 pref("dom.serviceWorkers.disable_open_click_delay", 1000);
 
 pref("dom.storage.enabled", true);
 // Whether or not LSNG (Next Generation Local Storage) is enabled.
 // See bug 1517090 for enabling this on Nightly.
 // See bug 1534736 for changing it to EARLY_BETA_OR_EARLIER.