Bug 1470661 - Remove tabbrowser-newtab-popup binding;r=dao draft
authorBrian Grinstead <bgrinstead@mozilla.com>
Sat, 23 Jun 2018 07:23:37 -0700
changeset 809891 97997cd6c03bc3b0b13f6ef30b18407d1e1c5545
parent 809889 5bbe54174894e1b71aaf83006c2744bb8836816e
push id113837
push userbgrinstead@mozilla.com
push dateSat, 23 Jun 2018 14:25:56 +0000
reviewersdao
bugs1470661, 1446101
milestone62.0a1
Bug 1470661 - Remove tabbrowser-newtab-popup binding;r=dao After Bug 1446101, this binding only shows the menupopup to select a container when long-pressing the new tab button. There is only one instance of this binding (created by #tabbrowser-tabs), so this patch moves the event listener alongside the element creation. MozReview-Commit-ID: EoA3MpTkBNj
browser/base/content/browser.css
browser/base/content/tabbrowser.xml
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -246,20 +246,16 @@ panelview[mainview] > .panel-header {
 /* Allow dropping a tab on buttons with associated drop actions. */
 #TabsToolbar[movingtab] + #nav-bar > #nav-bar-customization-target > #personal-bookmarks,
 #TabsToolbar[movingtab] + #nav-bar > #nav-bar-customization-target > #home-button,
 #TabsToolbar[movingtab] + #nav-bar > #nav-bar-customization-target > #downloads-button,
 #TabsToolbar[movingtab] + #nav-bar > #nav-bar-customization-target > #bookmarks-menu-button {
   pointer-events: auto;
 }
 
-.new-tab-popup {
-  -moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-newtab-popup");
-}
-
 toolbar[printpreview="true"] {
   -moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar");
 }
 
 toolbar[overflowable] > .customization-target {
   overflow: hidden;
 }
 
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -216,16 +216,22 @@
                                 "menupopup");
                   if (parent.id) {
                     popup.id = "newtab-popup";
                   } else {
                     popup.setAttribute("anonid", "newtab-popup");
                   }
                   popup.className = "new-tab-popup";
                   popup.setAttribute("position", "after_end");
+                  popup.addEventListener("popupshowing", event => {
+                    createUserContextMenu(event, {
+                      useAccessKeys: false,
+                      showDefaultTab: Services.prefs.getIntPref("privacy.userContext.longPressBehavior") == 1
+                    });
+                  });
                   parent.appendChild(popup);
 
                   // longPressBehavior == 2 means that the menu is shown after X
                   // millisecs. Otherwise, with 1, the menu is open immediatelly.
                   if (longPressBehavior == 2) {
                     gClickAndHoldListenersOnElement.add(parent);
                   }
 
@@ -2079,29 +2085,16 @@
         if (event.originalTarget.getAttribute("anonid") == "tab-loading-burst") {
           this.removeAttribute("bursting");
         }
       ]]>
       </handler>
     </handlers>
   </binding>
 
-  <binding id="tabbrowser-newtab-popup"
-           extends="chrome://global/content/bindings/popup.xml#popup">
-    <handlers>
-      <handler event="popupshowing">
-      <![CDATA[
-        createUserContextMenu(event, {
-          useAccessKeys: false,
-          showDefaultTab: Services.prefs.getIntPref("privacy.userContext.longPressBehavior") == 1
-        });
-      ]]></handler>
-    </handlers>
-  </binding>
-
   <binding id="tabbrowser-tabpanels"
            extends="chrome://global/content/bindings/tabbox.xml#tabpanels">
     <implementation>
       <field name="_selectedIndex">0</field>
 
       <property name="selectedIndex">
         <getter>
         <![CDATA[