summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/downloads/content/downloads.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-29 12:41:33 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-29 12:41:33 +0200
commitbeeede618586155d0f3fcb8e9313e076eef3e6e5 (patch)
treefb58542b59d8a7573a79a14f9ed5d1ae0456efe8 /application/palemoon/components/downloads/content/downloads.js
parent761b6eb255109a07d7cbcaaef6891cb14c961dbc (diff)
downloadUXP-beeede618586155d0f3fcb8e9313e076eef3e6e5.tar
UXP-beeede618586155d0f3fcb8e9313e076eef3e6e5.tar.gz
UXP-beeede618586155d0f3fcb8e9313e076eef3e6e5.tar.lz
UXP-beeede618586155d0f3fcb8e9313e076eef3e6e5.tar.xz
UXP-beeede618586155d0f3fcb8e9313e076eef3e6e5.zip
[PALEMOON] Bug 1127867 - Use the new back-end property to get the size of downloads asynchronously
Diffstat (limited to 'application/palemoon/components/downloads/content/downloads.js')
-rw-r--r--application/palemoon/components/downloads/content/downloads.js33
1 files changed, 1 insertions, 32 deletions
diff --git a/application/palemoon/components/downloads/content/downloads.js b/application/palemoon/components/downloads/content/downloads.js
index 01682d325..199324b6b 100644
--- a/application/palemoon/components/downloads/content/downloads.js
+++ b/application/palemoon/components/downloads/content/downloads.js
@@ -555,7 +555,7 @@ const DownloadsPanel = {
// do these checks on a background thread, and don't prevent the panel to
// be displayed while these checks are being performed.
for (let viewItem of DownloadsView._visibleViewItems.values()) {
- viewItem.verifyTargetExists();
+ viewItem.download.refresh().catch(Cu.reportError);
}
if (aAnchor) {
@@ -1063,7 +1063,6 @@ function DownloadsViewItem(download, aElement) {
this.element.classList.add("download-state");
this._updateState();
- this.verifyTargetExists();
}
DownloadsViewItem.prototype = {
@@ -1078,41 +1077,11 @@ DownloadsViewItem.prototype = {
this.element.setAttribute("image", this.image);
this.element.setAttribute("state",
DownloadsCommon.stateOfDownload(this.download));
-
- if (this.download.succeeded) {
- // We assume the existence of the target of a download that just completed
- // successfully, without checking the condition in the background. If the
- // panel is already open, this will take effect immediately. If the panel
- // is opened later, a new background existence check will be performed.
- this.element.setAttribute("exists", "true");
- }
},
onChanged() {
this._updateProgress();
},
-
- /**
- * Starts checking whether the target file of a finished download is still
- * available on disk, and sets an attribute that controls how the item is
- * presented visually.
- *
- * The existence check is executed on a background thread.
- */
- verifyTargetExists: function DVI_verifyTargetExists() {
- // We don't need to check if the download is not finished successfully.
- if (!this.download.succeeded) {
- return;
- }
-
- OS.File.exists(this.download.target.path).then(aExists => {
- if (aExists) {
- this.element.setAttribute("exists", "true");
- } else {
- this.element.removeAttribute("exists");
- }
- }).catch(Cu.reportError);
- },
};
////////////////////////////////////////////////////////////////////////////////