author | Brian Nicholson <bnicholson@mozilla.com> |
Tue, 05 Feb 2013 16:08:10 -0800 | |
changeset 120973 | 27d51d9f749589b8e9013ad8f2e960815068dac7 |
parent 120972 | 9ba2e7dc2951a006fefa09c0be442cebecaf40c0 |
child 120974 | 7a9887e1f55e443dace71a032f9d334de2165843 |
push id | 24269 |
push user | emorley@mozilla.com |
push date | Wed, 06 Feb 2013 14:27:17 +0000 |
treeherder | mozilla-central@04e13fc9dbff [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | wesj |
bugs | 777639 |
milestone | 21.0a1 |
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
|
--- a/mobile/android/chrome/content/aboutDownloads.js +++ b/mobile/android/chrome/content/aboutDownloads.js @@ -134,16 +134,17 @@ let Downloads = { this._normalList.addEventListener("click", onClick, false); this._privateList.addEventListener("click", onClick, false); this._dlmgr = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); this._dlmgr.addPrivacyAwareListener(this); Services.obs.addObserver(this, "last-pb-context-exited", false); + Services.obs.addObserver(this, "download-manager-remove-download-guid", false); // If we have private downloads, show them all immediately. If we were to // add them asynchronously, there's a small chance we could get a // "last-pb-context-exited" notification before downloads are added to the // list, meaning we'd show private downloads without any private tabs open. let privateEntries = this.getDownloads({ isPrivate: true }); this._stepAddEntries(privateEntries, this._privateList, privateEntries.length); @@ -160,16 +161,17 @@ let Downloads = { contextmenus.remove(this.pauseMenuItem); contextmenus.remove(this.resumeMenuItem); contextmenus.remove(this.retryMenuItem); contextmenus.remove(this.cancelMenuItem); contextmenus.remove(this.deleteAllMenuItem); this._dlmgr.removeListener(this); Services.obs.removeObserver(this, "last-pb-context-exited"); + Services.obs.removeObserver(this, "download-manager-remove-download-guid"); }, onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress, aDownload) { }, onDownloadStateChange: function(aState, aDownload) { switch (aDownload.state) { case Ci.nsIDownloadManager.DOWNLOAD_FAILED: case Ci.nsIDownloadManager.DOWNLOAD_CANCELED: @@ -189,19 +191,27 @@ let Downloads = { else this._insertDownloadRow(aDownload); break; } }, onStateChange: function(aWebProgress, aRequest, aState, aStatus, aDownload) { }, onSecurityChange: function(aWebProgress, aRequest, aState, aDownload) { }, - // Called when last private window is closed observe: function (aSubject, aTopic, aData) { - this._privateList.innerHTML = ""; + switch (aTopic) { + case "last-pb-context-exited": + this._privateList.innerHTML = ""; + break; + case "download-manager-remove-download-guid": { + let guid = aSubject.QueryInterface(Ci.nsISupportsCString).data; + this._removeItem(this._getElementForDownload(guid)); + break; + } + } }, _moveDownloadAfterActive: function dl_moveDownloadAfterActive(aItem) { // Move downloads that just reached a "completed" state below any active try { // Iterate down until we find a non-active download let next = aItem.nextElementSibling; while (next && this._inProgress(next.getAttribute("state"))) @@ -454,17 +464,16 @@ let Downloads = { } aDownload.remove(); try { if (f) f.remove(false); } catch (ex) { this.logError("removeDownload() " + ex, aDownload); } }.bind(this)); - aItem.parentNode.removeChild(aItem); }, removeAll: function dl_removeAll() { let title = gStrings.GetStringFromName("downloadAction.deleteAll"); let messageForm = gStrings.GetStringFromName("downloadMessage.deleteAll"); let elements = document.body.querySelectorAll("li[state='" + this._dlmgr.DOWNLOAD_FINISHED + "']," + "li[state='" + this._dlmgr.DOWNLOAD_CANCELED + "']," + "li[state='" + this._dlmgr.DOWNLOAD_FAILED + "']");