summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/downloads/DownloadsCommon.jsm
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/components/downloads/DownloadsCommon.jsm')
-rw-r--r--application/palemoon/components/downloads/DownloadsCommon.jsm21
1 files changed, 15 insertions, 6 deletions
diff --git a/application/palemoon/components/downloads/DownloadsCommon.jsm b/application/palemoon/components/downloads/DownloadsCommon.jsm
index 73467e813..efe31ce05 100644
--- a/application/palemoon/components/downloads/DownloadsCommon.jsm
+++ b/application/palemoon/components/downloads/DownloadsCommon.jsm
@@ -373,6 +373,17 @@ this.DownloadsCommon = {
},
/**
+ * Helper function required because the Downloads Panel and the Downloads View
+ * don't share the controller yet.
+ */
+ removeAndFinalizeDownload(download) {
+ Downloads.getList(Downloads.ALL)
+ .then(list => list.remove(download))
+ .then(() => download.finalize(true))
+ .catch(Cu.reportError);
+ },
+
+ /**
* Given an iterable collection of Download objects, generates and returns
* statistics about that collection.
*
@@ -383,7 +394,6 @@ this.DownloadsCommon = {
*
* numActive : The total number of downloads.
* numPaused : The total number of paused downloads.
- * numScanning : The total number of downloads being scanned.
* numDownloading : The total number of downloads being downloaded.
* totalSize : The total size of all downloads once completed.
* totalTransferred: The total amount of transferred data for these
@@ -397,7 +407,6 @@ this.DownloadsCommon = {
let summary = {
numActive: 0,
numPaused: 0,
- numScanning: 0,
numDownloading: 0,
totalSize: 0,
totalTransferred: 0,
@@ -677,7 +686,7 @@ DownloadsDataCtor.prototype = {
*/
get canRemoveFinished()
{
- for (let download of this.oldDownloadStates.keys()) {
+ for (let download of this.downloads) {
// Stopped, paused, and failed downloads with partial data are removed.
if (download.stopped && !(download.canceled && download.hasPartialData)) {
return true;
@@ -832,7 +841,7 @@ DownloadsDataCtor.prototype = {
//let loadedItemsArray = [dataItem
// for each (dataItem in this.dataItems)
// if (dataItem)];
- let downloadsArray = [...this.oldDownloadStates.keys()];
+ let downloadsArray = [...this.downloads];
downloadsArray.sort((a, b) => b.startTime - a.startTime);
downloadsArray.forEach(download => aView.onDownloadAdded(download, false));
@@ -1659,7 +1668,7 @@ DownloadsIndicatorDataCtor.prototype = {
* to generate statistics about the downloads we care about - in this case,
* it's all active downloads.
*/
- _activeDownloads: function* () {
+ * _activeDownloads() {
let downloads = this._isPrivate ? PrivateDownloadsData.downloads
: DownloadsData.downloads;
for (let download of downloads) {
@@ -1865,7 +1874,7 @@ DownloadsSummaryData.prototype = {
* it's the downloads in this._downloads after the first few to exclude,
* which was set when constructing this DownloadsSummaryData instance.
*/
- _downloadsForSummary: function* () {
+ * _downloadsForSummary() {
if (this._downloads.length > 0) {
for (let i = this._numToExclude; i < this._downloads.length; ++i) {
yield this._downloads[i];