Backed out changeset 2b76c3b079d9 (bug 1392081) for failing browser/components/places/tests/browser/browser_toolbar_overflow.js. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 05 Sep 2017 23:12:13 +0200
changeset 428543 aae17c1a570cdc89c1d97e748311d88181d9d69e
parent 428542 294c5bf9ffea5c0110c88656bad9f55db89da1f1
child 428544 0f3a0442c2adff8805bac300b570883add78df29
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1392081
milestone57.0a1
backs out2b76c3b079d9cbfb89a165fec3c5cf2796bbfe06
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 2b76c3b079d9 (bug 1392081) for failing browser/components/places/tests/browser/browser_toolbar_overflow.js. r=backout
browser/components/places/content/browserPlacesViews.js
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -278,22 +278,21 @@ PlacesViewBase.prototype = {
       return;
     }
 
     this._cleanPopup(aPopup);
 
     let cc = resultNode.childCount;
     if (cc > 0) {
       this._setEmptyPopupStatus(aPopup, false);
-      let fragment = document.createDocumentFragment();
+
       for (let i = 0; i < cc; ++i) {
         let child = resultNode.getChild(i);
-        this._insertNewItemToPopup(child, fragment);
+        this._insertNewItemToPopup(child, aPopup, null);
       }
-      aPopup.insertBefore(fragment, aPopup._endMarker);
     } else {
       this._setEmptyPopupStatus(aPopup, true);
     }
     aPopup._built = true;
   },
 
   _removeChild: function PVB__removeChild(aChild) {
     // If document.popupNode pointed to this child, null it out,
@@ -400,25 +399,26 @@ PlacesViewBase.prototype = {
     element._placesNode = aPlacesNode;
     if (!this._domNodes.has(aPlacesNode))
       this._domNodes.set(aPlacesNode, element);
 
     return element;
   },
 
   _insertNewItemToPopup:
-  function PVB__insertNewItemToPopup(aNewChild, aInsertionNode, aBefore = null) {
+  function PVB__insertNewItemToPopup(aNewChild, aPopup, aBefore) {
     let element = this._createDOMNodeForPlacesNode(aNewChild);
+    let before = aBefore || aPopup._endMarker;
 
     if (element.localName == "menuitem" || element.localName == "menu") {
       if (typeof this.options.extraClasses.entry == "string")
         element.classList.add(this.options.extraClasses.entry);
     }
 
-    aInsertionNode.insertBefore(element, aBefore);
+    aPopup.insertBefore(element, before);
     return element;
   },
 
   _setLivemarkSiteURIMenuItem:
   function PVB__setLivemarkSiteURIMenuItem(aPopup) {
     let livemarkInfo = this.controller.getCachedLivemarkInfo(aPopup._placesNode);
     let siteUrl = livemarkInfo && livemarkInfo.siteURI ?
                   livemarkInfo.siteURI.spec : null;
@@ -630,17 +630,17 @@ PlacesViewBase.prototype = {
   function PVB_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (!parentElt._built)
       return;
 
     let index = Array.prototype.indexOf.call(parentElt.childNodes, parentElt._startMarker) +
                 aIndex + 1;
     this._insertNewItemToPopup(aPlacesNode, parentElt,
-                               parentElt.childNodes[index] || parentElt._endMarker);
+                               parentElt.childNodes[index]);
     this._setEmptyPopupStatus(parentElt, false);
   },
 
   nodeMoved:
   function PBV_nodeMoved(aPlacesNode,
                          aOldParentPlacesNode, aOldIndex,
                          aNewParentPlacesNode, aNewIndex) {
     // Note: the current implementation of moveItem does not actually
@@ -1031,33 +1031,31 @@ PlacesToolbar.prototype = {
     if (this._overFolder.elt)
       this._clearOverFolder();
 
     this._openedMenuButton = null;
     while (this._rootElt.hasChildNodes()) {
       this._rootElt.firstChild.remove();
     }
 
-    let fragment = document.createDocumentFragment();
     let cc = this._resultNode.childCount;
     for (let i = 0; i < cc; ++i) {
-      this._insertNewItem(this._resultNode.getChild(i), fragment);
+      this._insertNewItem(this._resultNode.getChild(i), null);
     }
-    this._rootElt.appendChild(fragment);
 
     if (this._chevronPopup.hasAttribute("type")) {
       // Chevron has already been initialized, but since we are forcing
       // a rebuild of the toolbar, it has to be rebuilt.
       // Otherwise, it will be initialized when the toolbar overflows.
       this._chevronPopup.place = this.place;
     }
   },
 
   _insertNewItem:
-  function PT__insertNewItem(aChild, aInsertionNode, aBefore = null) {
+  function PT__insertNewItem(aChild, aBefore) {
     this._domNodes.delete(aChild);
 
     let type = aChild.type;
     let button;
     if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
       button = document.createElement("toolbarseparator");
     } else {
       button = document.createElement("toolbarbutton");
@@ -1096,19 +1094,19 @@ PlacesToolbar.prototype = {
       }
     }
 
     button._placesNode = aChild;
     if (!this._domNodes.has(aChild))
       this._domNodes.set(aChild, button);
 
     if (aBefore)
-      aInsertionNode.insertBefore(button, aBefore);
+      this._rootElt.insertBefore(button, aBefore);
     else
-      aInsertionNode.appendChild(button);
+      this._rootElt.appendChild(button);
   },
 
   _updateChevronPopupNodesVisibility:
   function PT__updateChevronPopupNodesVisibility() {
     for (let i = 0, node = this._chevronPopup._startMarker.nextSibling;
          node != this._chevronPopup._endMarker;
          i++, node = node.nextSibling) {
       node.hidden = this._rootElt.childNodes[i].style.visibility != "hidden";
@@ -1250,17 +1248,17 @@ PlacesToolbar.prototype = {
       this._updateChevronPopupNodesVisibility();
   },
 
   nodeInserted:
   function PT_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (parentElt == this._rootElt) {
       let children = this._rootElt.childNodes;
-      this._insertNewItem(aPlacesNode, this._rootElt,
+      this._insertNewItem(aPlacesNode,
         aIndex < children.length ? children[aIndex] : null);
       this.updateChevron();
       return;
     }
 
     PlacesViewBase.prototype.nodeInserted.apply(this, arguments);
   },
 
@@ -1874,17 +1872,17 @@ PlacesPanelMenuView.prototype = {
     return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
   },
 
   uninit: function PAMV_uninit() {
     PlacesViewBase.prototype.uninit.apply(this, arguments);
   },
 
   _insertNewItem:
-  function PAMV__insertNewItem(aChild, aInsertionNode, aBefore = null) {
+  function PAMV__insertNewItem(aChild, aBefore) {
     this._domNodes.delete(aChild);
 
     let type = aChild.type;
     let button;
     if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
       button = document.createElement("toolbarseparator");
       button.setAttribute("class", "small-separator");
     } else {
@@ -1916,27 +1914,27 @@ PlacesPanelMenuView.prototype = {
                             PlacesUIUtils.guessUrlSchemeForUI(aChild.uri));
       }
     }
 
     button._placesNode = aChild;
     if (!this._domNodes.has(aChild))
       this._domNodes.set(aChild, button);
 
-    aInsertionNode.insertBefore(button, aBefore);
+    this._rootElt.insertBefore(button, aBefore);
   },
 
   nodeInserted:
   function PAMV_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (parentElt != this._rootElt)
       return;
 
     let children = this._rootElt.childNodes;
-    this._insertNewItem(aPlacesNode, this._rootElt,
+    this._insertNewItem(aPlacesNode,
       aIndex < children.length ? children[aIndex] : null);
   },
 
   nodeRemoved:
   function PAMV_nodeRemoved(aParentPlacesNode, aPlacesNode, aIndex) {
     let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
     if (parentElt != this._rootElt)
       return;
@@ -1995,21 +1993,19 @@ PlacesPanelMenuView.prototype = {
     if (elt != this._rootElt)
       return;
 
     // Container is the toolbar itself.
     while (this._rootElt.hasChildNodes()) {
       this._rootElt.firstChild.remove();
     }
 
-    let fragment = document.createDocumentFragment();
     for (let i = 0; i < this._resultNode.childCount; ++i) {
-      this._insertNewItem(this._resultNode.getChild(i), fragment);
+      this._insertNewItem(this._resultNode.getChild(i), null);
     }
-    this._rootElt.appendChild(fragment);
   }
 };
 
 this.PlacesPanelview = class extends PlacesViewBase {
   constructor(container, panelview, place, options = {}) {
     options.rootElt = container;
     options.viewElt = panelview;
     super(place, options);