Bug 602571 - "Downloads added after showing list once are added at wrong position" [r=mark.finkle]
--- a/mobile/chrome/content/downloads.js
+++ b/mobile/chrome/content/downloads.js
@@ -269,19 +269,20 @@ var DownloadsView = {
maxBytes: aDownload.size
};
// Remove the "no downloads" item, if visible
let emptyItem = document.getElementById("dl-empty-message");
if (emptyItem)
this._list.removeChild(emptyItem);
- // Make the item and add it to the beginning
+ // Make the item and add it to the beginning (but before the header)
+ let header = document.getElementById("downloads-list-header");
let item = this._createItem(attrs);
- this._list.insertBefore(item, this._list.firstChild);
+ this._list.insertBefore(item, header.nextSibling);
},
downloadCompleted: function dv_downloadCompleted(aDownload) {
// Move the download below active
let element = this.getElementForDownload(aDownload.id);
// Iterate down until we find a non-active download
let next = element.nextSibling;