Bug 519186 - drag & drop in bookmarks menu does not correctly update the view, r=mano
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 05 Oct 2009 12:12:46 +0200
changeset 33459 c2906e26f75af2ed5c218fe81d679f87fb22add2
parent 33458 98a42087c07b45665e946623db59a0cd1ee493cb
child 33460 77e5bfb0ef739effa5fc9d215677cd6309f32f8e
push idunknown
push userunknown
push dateunknown
reviewersmano
bugs519186, 498130
milestone1.9.3a1pre
Bug 519186 - drag & drop in bookmarks menu does not correctly update the view, r=mano This is a regression from bug 498130.
browser/components/places/content/menu.xml
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -720,18 +720,17 @@
           if (!parentElt._built)
             return;
 
           // parentElt is the <menu> element for the container,
           // we need the <menupopup>
           let popup = parentElt.firstChild;
 
           let index = popup._startMarker + 1 + aIndex;
-          let before = popup.childNodes[index] || null;
-          this._self.insertNewItem(aNode, popup, before);
+          this._self.insertNewItem(aNode, popup, popup.childNodes[index]);
           if (popup._emptyMenuItem)
             popup._emptyMenuItem.hidden = true;
         },
 
         nodeRemoved: function PMV_nodeRemoved(aParentNode, aNode, aIndex) {
           let parentElt = aParentNode._DOMElement;
           NS_ASSERT(parentElt, "parent node must have _DOMElement set");
 
@@ -772,18 +771,19 @@
 
           // If our root node is a folder, it might be moved. There's nothing
           // we need to do in that case.
           if (nodeElt == this._self.parentNode)
             return;
 
           // Move the node.
           let popup = nodeElt.parentNode;
+          let index = popup._startMarker + 1 + aNewIndex;
           popup.removeChild(nodeElt);
-          popup.insertBefore(nodeElt, popup.childNodes[aNewIndex]);
+          popup.insertBefore(nodeElt, popup.childNodes[index]);
         },
 
         nodeTitleChanged: function PMV__nodeTitleChanged(aNode, aNewTitle) {
           let nodeElt = aNode._DOMElement;
           NS_ASSERT(nodeElt, "node must have _DOMElement set");
 
           // There's no UI representation for the root node, thus there's
           // nothing to be done when the title changes.