Bug 1379466 - Set EventPopupControlState of auxclick as 'openControlled'. r=smaug
authorBen Tian <btian@mozilla.com>
Thu, 18 Apr 2019 12:57:36 +0000
changeset 470157 8ff0d835d90bb268325fd16fa70c8d4a31662127
parent 470156 32d8c9a17e507428e6e7b447e38b26f6e09ad9d1
child 470158 4e152cfac89d9f368599cadf8b9dc1e87fd06d2b
push id35888
push useraiakab@mozilla.com
push dateFri, 19 Apr 2019 09:47:45 +0000
treeherdermozilla-central@0160424142d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1379466
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 1379466 - Set EventPopupControlState of auxclick as 'openControlled'. r=smaug Differential Revision: https://phabricator.services.mozilla.com/D26790
dom/base/PopupBlocker.cpp
modules/libpref/init/all.js
--- a/dom/base/PopupBlocker.cpp
+++ b/dom/base/PopupBlocker.cpp
@@ -288,16 +288,17 @@ PopupBlocker::PopupControlState PopupBlo
             break;
           default:
             break;
         }
       }
       break;
     case eMouseEventClass:
       if (aEvent->IsTrusted()) {
+        // eLeftButton
         if (aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
           abuse = PopupBlocker::openBlocked;
           switch (aEvent->mMessage) {
             case eMouseUp:
               if (PopupAllowedForEvent("mouseup")) {
                 abuse = PopupBlocker::openControlled;
               }
               break;
@@ -318,16 +319,26 @@ PopupBlocker::PopupControlState PopupBlo
             case eMouseDoubleClick:
               if (PopupAllowedForEvent("dblclick")) {
                 abuse = PopupBlocker::openControlled;
               }
               break;
             default:
               break;
           }
+        } else if (aEvent->mMessage == eMouseAuxClick) {
+          // Not eLeftButton
+          // There's not a strong reason to ignore other events (eg eMouseUp)
+          // for non-primary clicks as far as we know, so we could add them if
+          // it becomes a compat issue
+          if (PopupAllowedForEvent("auxclick")) {
+            abuse = PopupBlocker::openControlled;
+          } else {
+            abuse = PopupBlocker::openBlocked;
+          }
         }
 
         switch (aEvent->mMessage) {
           case eContextMenu:
             if (PopupAllowedForEvent("contextmenu")) {
               abuse = PopupBlocker::openControlled;
             } else {
               abuse = PopupBlocker::openBlocked;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1287,17 +1287,17 @@ pref("dom.disable_window_open_feature.mi
 pref("dom.disable_window_open_feature.status",      true);
 pref("dom.disable_window_showModalDialog",          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 mouseup pointerup notificationclick reset submit touchend contextmenu");
+pref("dom.popup_allowed_events", "change click dblclick auxclick mouseup pointerup notificationclick reset submit touchend contextmenu");
 
 pref("dom.disable_open_click_delay", 1000);
 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.