While working on addon for seamonkey, I wanted to upgrade my old downloading methods to newer once https://developer.mozilla.org/en-US/doc ... nloads.jsm
I used below example:
Code: Select all
Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/osfile.jsm")
Components.utils.import("resource://gre/modules/Task.jsm");
Task.spawn(function () {
let list = yield Downloads.getList(Downloads.ALL);
let view = {
onDownloadAdded: download => console.log("Added", download),
onDownloadChanged: download => console.log("Changed", download),
onDownloadRemoved: download => console.log("Removed", download)
};
yield list.addView(view);
try {
let download = yield Downloads.createDownload({
source: "http://www.mozilla.org/",
target: OS.Path.join(OS.Constants.Path.tmpDir, "example-download.html"),
});
list.add(download);
try {
download.start();
alert("Now monitoring all downloads. Close the message to stop.");
} finally {
yield list.remove(download);
yield download.finalize(true);
}
} finally {
yield list.removeView(view);
}
}).then(null, Components.utils.reportError);
It downloads the file properly, however it does not display downloading progress in seamonkey's default download manager.
Can someone help me out.
Please note that I have already tried my addon with new profile, but no luck. I am testing my addon in Seamonkey version 2.32
Thanks,
Sukhvir