summaryrefslogtreecommitdiffstats
path: root/application/palemoon/components/downloads/content/downloads.js
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-29 13:12:21 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-07-29 13:12:21 +0200
commit551c6ff0463b555d32c51d22163318b7204c5388 (patch)
tree739505628857b3be705e8de4a9f47baf34b28f5d /application/palemoon/components/downloads/content/downloads.js
parent0b15a2b89e6615c5e68f75c2515fe0cdf49178e4 (diff)
downloadUXP-551c6ff0463b555d32c51d22163318b7204c5388.tar
UXP-551c6ff0463b555d32c51d22163318b7204c5388.tar.gz
UXP-551c6ff0463b555d32c51d22163318b7204c5388.tar.lz
UXP-551c6ff0463b555d32c51d22163318b7204c5388.tar.xz
UXP-551c6ff0463b555d32c51d22163318b7204c5388.zip
[PALEMOON] Bug 1129896 - Part 2 of 2 - Convert the shared front-end code to a JavaScript code module
Diffstat (limited to 'application/palemoon/components/downloads/content/downloads.js')
-rw-r--r--application/palemoon/components/downloads/content/downloads.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/application/palemoon/components/downloads/content/downloads.js b/application/palemoon/components/downloads/content/downloads.js
index 199324b6b..b36b9d0fe 100644
--- a/application/palemoon/components/downloads/content/downloads.js
+++ b/application/palemoon/components/downloads/content/downloads.js
@@ -4,6 +4,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
+var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+XPCOMUtils.defineLazyModuleGetter(this, "DownloadsCommon",
+ "resource:///modules/DownloadsCommon.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "DownloadsViewUI",
+ "resource:///modules/DownloadsViewUI.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
+ "resource://gre/modules/FileUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
+ "resource://gre/modules/NetUtil.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+ "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Services",
+ "resource://gre/modules/Services.jsm");
+
/**
* Handles the Downloads panel user interface for each browser window.
*
@@ -1066,7 +1081,7 @@ function DownloadsViewItem(download, aElement) {
}
DownloadsViewItem.prototype = {
- __proto__: DownloadElementShell.prototype,
+ __proto__: DownloadsViewUI.DownloadElementShell.prototype,
/**
* The XUL element corresponding to the associated richlistbox item.
@@ -1253,10 +1268,7 @@ DownloadsViewItemController.prototype = {
commands: {
cmd_delete: function DVIC_cmd_delete()
{
- Downloads.getList(Downloads.ALL)
- .then(list => list.remove(this.download))
- .then(() => this.download.finalize(true))
- .catch(Cu.reportError);
+ DownloadsCommon.removeAndFinalizeDownload(this.download);
PlacesUtils.bhistory.removePage(
NetUtil.newURI(this.download.source.url));
},