MozillaZine

Downloads.jsm not working in seamonkey

Discussion of bugs in Seamonkey
sukhvir13
New Member
 
Posts: 1
Joined: January 23rd, 2015, 11:37 pm

Post Posted January 23rd, 2015, 11:46 pm

Hi All,

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

Philip Chee

User avatar
 
Posts: 6475
Joined: March 1st, 2005, 3:03 pm

Post Posted January 25th, 2015, 10:51 am

We are not using the new jsdownloads API. Our download manager is still using the old C++ nsIDownloadManager. If you want some UI, you'll have to provide your own like the download statusbar extension or DownThemAll.

Phil

Return to SeaMonkey Bugs


Who is online

Users browsing this forum: No registered users and 1 guest