Bug 1420749 - Allow browser.bookmarks.openInTabClosesMenu to work with containers as well as single menuitems draft
authorTawny Hoover <stayopenmenu@gmail.com>
Thu, 08 Feb 2018 20:59:08 -0500
changeset 752882 0409ee58e4aabb9c0b9b84003cbdd5edc09421cf
parent 749226 c1154ebbe3fa43176dffcb0782809c648a027bcd
push id98408
push userbmo:stayopenmenu@gmail.com
push dateFri, 09 Feb 2018 02:03:23 +0000
bugs1420749
milestone60.0a1
Bug 1420749 - Allow browser.bookmarks.openInTabClosesMenu to work with containers as well as single menuitems MozReview-Commit-ID: Bba3pLyHZUV
browser/base/content/browser-places.js
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -776,18 +776,17 @@ var BookmarksEventHandler = {
     // Handles left-click with modifier if not browser.bookmarks.openInTabClosesMenu.
     if (aEvent.button != 0 || PlacesUIUtils.openInTabClosesMenu)
       return;
     let target = aEvent.originalTarget;
     if (target.tagName != "menuitem")
       return;
     let modifKey = AppConstants.platform === "macosx" ? aEvent.metaKey
                                                       : aEvent.ctrlKey;
-    // Don't keep menu open for 'Open all in Tabs'.
-    if (modifKey && !target.classList.contains("openintabs-menuitem")) {
+    if (modifKey) {
       target.setAttribute("closemenu", "none");
     }
   },
 
   onClick: function BEH_onClick(aEvent, aView) {
     // Only handle middle-click or left-click with modifiers.
     let modifKey;
     if (AppConstants.platform == "macosx") {
@@ -797,22 +796,21 @@ var BookmarksEventHandler = {
     }
 
     if (aEvent.button == 2 || (aEvent.button == 0 && !modifKey))
       return;
 
     var target = aEvent.originalTarget;
     // If this event bubbled up from a menu or menuitem,
     // close the menus if browser.bookmarks.openInTabClosesMenu.
-    if ((PlacesUIUtils.openInTabClosesMenu && target.tagName == "menuitem") ||
-        target.tagName == "menu" ||
-        target.classList.contains("openintabs-menuitem")) {
+    var tag = target.tagName;
+    if (PlacesUIUtils.openInTabClosesMenu && (tag == "menuitem" || tag == "menu")) {
       closeMenus(aEvent.target);
     }
-    // Command already precesssed so remove any closemenu attr set in onMouseUp.
+    // Command already processed so remove any closemenu attr set in onMouseUp.
     if (aEvent.button == 0 &&
         target.tagName == "menuitem" &&
         target.getAttribute("closemenu") == "none") {
       // On Mac we need to extend when we remove the flag, to avoid any pre-close
       // animations.
       setTimeout(() => {
         target.removeAttribute("closemenu");
       }, 500);