Backed out changeset 12dcd7c35b36 (bug 1474340) for ESlint failure CLOSED TREE
authorCiure Andrei <aciure@mozilla.com>
Tue, 18 Sep 2018 17:05:49 +0300
changeset 436977 941266ad9f8f4093f5de294955ffabe67fcb1e08
parent 436976 12dcd7c35b36a48d8a1e101255df15b9112157eb
child 436978 e1c0d8cbad372a23defa707164b405af703af394
push id69490
push useraciure@mozilla.com
push dateTue, 18 Sep 2018 14:06:24 +0000
treeherderautoland@941266ad9f8f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1474340
milestone64.0a1
backs out12dcd7c35b36a48d8a1e101255df15b9112157eb
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
Backed out changeset 12dcd7c35b36 (bug 1474340) for ESlint failure CLOSED TREE
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/content/toolbar.xml
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -847,17 +847,17 @@ var CustomizableUIInternal = {
         if (gResetting) {
           this.notifyListeners("onWidgetReset", node, container);
         } else if (gUndoResetting) {
           this.notifyListeners("onWidgetUndoMove", node, container);
         }
       }
 
       if (currentNode) {
-        let palette = window.gNavToolbox ? window.gNavToolbox.palette : null;
+        let palette = aAreaNode.toolbox ? aAreaNode.toolbox.palette : null;
         let limit = currentNode.previousElementSibling;
         let node = container.lastElementChild;
         while (node && node != limit) {
           let previousSibling = node.previousElementSibling;
           // Nodes opt-in to removability. If they're removable, and we haven't
           // seen them in the placements array, then we toss them into the palette
           // if one exists. If no palette exists, we just remove the node. If the
           // node is not removable, we leave it where it is. However, we can only
@@ -997,16 +997,17 @@ var CustomizableUIInternal = {
 
   registerMenuPanel(aPanelContents, aArea) {
     if (gBuildAreas.has(aArea) && gBuildAreas.get(aArea).has(aPanelContents)) {
       return;
     }
 
     let document = aPanelContents.ownerDocument;
 
+    aPanelContents.toolbox = document.getElementById("navigator-toolbox");
     aPanelContents.customizationTarget = aPanelContents;
 
     this.addPanelCloseListeners(this._getPanelForNode(aPanelContents));
 
     let placements = gPlacements.get(aArea);
     this.buildArea(aArea, placements, aPanelContents);
     this.notifyListeners("onAreaNodeRegistered", aArea, aPanelContents);
 
@@ -1067,17 +1068,17 @@ var CustomizableUIInternal = {
       // We remove location attributes here to make sure they're gone too when a
       // widget is removed from a toolbar to the palette. See bug 930950.
       this.removeLocationAttributes(widgetNode);
       // We also need to remove the panel context menu if it's there:
       this.ensureButtonContextMenu(widgetNode);
       if (gPalette.has(aWidgetId) || this.isSpecialWidget(aWidgetId)) {
         container.removeChild(widgetNode);
       } else {
-        window.gNavToolbox.palette.appendChild(widgetNode);
+        areaNode.toolbox.palette.appendChild(widgetNode);
       }
       this.notifyListeners("onWidgetAfterDOMChange", widgetNode, null, container, true);
 
       if (isToolbar) {
         areaNode.setAttribute("currentset", gPlacements.get(aArea).join(","));
       }
 
       let windowCache = gSingleWrapperCache.get(window);
@@ -1106,18 +1107,18 @@ var CustomizableUIInternal = {
     // cleaned up when unloading.
     let window = aNode.ownerGlobal;
     if (window.closed) {
       return;
     }
     this.registerBuildWindow(window);
 
     // Also register this build area's toolbox.
-    if (window.gNavToolbox) {
-      gBuildWindows.get(window).add(window.gNavToolbox);
+    if (aNode.toolbox) {
+      gBuildWindows.get(window).add(aNode.toolbox);
     }
 
     if (!gBuildAreas.has(aArea)) {
       gBuildAreas.set(aArea, new Set());
     }
 
     gBuildAreas.get(aArea).add(aNode);
 
@@ -1393,17 +1394,17 @@ var CustomizableUIInternal = {
         parent = parent.parentNode;
       }
 
       if (parent) {
         let nodeInArea = node.parentNode.localName == "toolbarpaletteitem" ?
                          node.parentNode : node;
         // Check if we're in a customization target, or in the palette:
         if ((parent.customizationTarget == nodeInArea.parentNode &&
-             gBuildWindows.get(aWindow).has(aWindow.gNavToolbox)) ||
+             gBuildWindows.get(aWindow).has(parent.toolbox)) ||
             aWindow.gNavToolbox.palette == nodeInArea.parentNode) {
           // Normalize the removable attribute. For backwards compat, if
           // the widget is not located in a toolbox palette then absence
           // of the "removable" attribute means it is not removable.
           if (!node.hasAttribute("removable")) {
             // If we first see this in customization mode, it may be in the
             // customization palette instead of the toolbox palette.
             node.setAttribute("removable", !parent.customizationTarget);
@@ -4229,16 +4230,17 @@ function OverflowableToolbar(aToolbarNod
   this._enabled = true;
   this._toolbar.addEventListener("overflow", this);
   this._toolbar.addEventListener("underflow", this);
 
   this._toolbar.setAttribute("overflowable", "true");
   let doc = this._toolbar.ownerDocument;
   this._target = this._toolbar.customizationTarget;
   this._list = doc.getElementById(this._toolbar.getAttribute("overflowtarget"));
+  this._list.toolbox = this._toolbar.toolbox;
   this._list.customizationTarget = this._list;
 
   let window = this._toolbar.ownerGlobal;
   if (window.gBrowserInit.delayedStartupFinished) {
     this.init();
   } else {
     Services.obs.addObserver(this, "browser-delayed-startup-finished");
   }
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -12,17 +12,17 @@
     <implementation>
       <constructor><![CDATA[
           let scope = {};
           ChromeUtils.import("resource:///modules/CustomizableUI.jsm", scope);
           let CustomizableUI = scope.CustomizableUI;
 
           // Searching for the toolbox palette in the toolbar binding because
           // toolbars are constructed first.
-          let toolbox = this.closest("toolbox");
+          let toolbox = this.toolbox;
           if (toolbox && !toolbox.palette) {
             for (let node of toolbox.children) {
               if (node.localName == "toolbarpalette") {
                 // Hold on to the palette but remove it from the document.
                 toolbox.palette = node;
                 toolbox.removeChild(node);
                 break;
               }
@@ -78,16 +78,38 @@
             this._customizationTarget.insertItem = this.insertItem.bind(this);
           else
             this._customizationTarget = this;
 
           return this._customizationTarget;
         ]]></getter>
       </property>
 
+      <property name="toolbox" readonly="true">
+        <getter><![CDATA[
+          if (this._toolbox)
+            return this._toolbox;
+
+          let toolboxId = this.getAttribute("toolboxid");
+          if (toolboxId) {
+            let toolbox = document.getElementById(toolboxId);
+            if (toolbox) {
+              this._toolbox = toolbox;
+            }
+          }
+
+          if (!this._toolbox && this.parentNode &&
+              this.parentNode.localName == "toolbox") {
+            this._toolbox = this.parentNode;
+          }
+
+          return this._toolbox;
+        ]]></getter>
+      </property>
+
       <property name="currentSet">
         <getter><![CDATA[
           let currentWidgets = new Set();
           for (let node of this.customizationTarget.children) {
             let realNode = node.localName == "toolbarpaletteitem" ? node.firstElementChild : node;
             if (realNode.getAttribute("skipintoolbarset") != "true") {
               currentWidgets.add(realNode.id);
             }
@@ -143,16 +165,28 @@
       </property>
 
 
     </implementation>
   </binding>
 
   <binding id="toolbar-menubar-stub">
     <implementation>
+      <property name="toolbox" readonly="true">
+        <getter><![CDATA[
+          if (this._toolbox)
+            return this._toolbox;
+
+          if (this.parentNode && this.parentNode.localName == "toolbox") {
+            this._toolbox = this.parentNode;
+          }
+
+          return this._toolbox;
+        ]]></getter>
+      </property>
       <property name="currentSet" readonly="true">
         <getter><![CDATA[
           return this.getAttribute("defaultset");
         ]]></getter>
       </property>
       <method name="insertItem">
         <body><![CDATA[
           return null;