Bug 837117 (follow-up) - Downloaded items change position in the downloads view if Clear List is selected
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 12 Feb 2013 23:50:37 +0100
changeset 127505 c1426b24daa791c4b2b944b9868bcfa3e6af00ff
parent 127504 91ab892b64b51c8f6bdb569ef9bd656519f44536
child 127506 94c2049e7483bc71414666f9efafc1750b270981
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs837117
milestone20.0a2
Bug 837117 (follow-up) - Downloaded items change position in the downloads view if Clear List is selected r=mconley a=gavin
browser/components/downloads/content/allDownloadsViewOverlay.js
--- a/browser/components/downloads/content/allDownloadsViewOverlay.js
+++ b/browser/components/downloads/content/allDownloadsViewOverlay.js
@@ -991,16 +991,20 @@ DownloadsPlacesView.prototype = {
     // If the element was selected exclusively, select its next
     // sibling first, if any.
     if (aElement.nextSibling &&
         this._richlistbox.selectedItems &&
         this._richlistbox.selectedItems.length > 0 &&
         this._richlistbox.selectedItems[0] == aElement) {
       this._richlistbox.selectItem(aElement.nextSibling);
     }
+
+    if (this._lastSessionDownloadElement == aElement)
+      this._lastSessionDownloadElement = aElement.previousSibling;
+
     this._richlistbox.removeChild(aElement);
     this._ensureVisibleElementsAreActive();
     goUpdateCommand("downloadsCmd_clearDownloads");
   },
 
   _removeHistoryDownloadFromView:
   function DPV__removeHistoryDownloadFromView(aPlacesNode) {
     let downloadURI = aPlacesNode.uri;