Question

I am trying to create a mozilla firefox add-on in which I am trying to get the Downloading Info of the browser .... As I am new to it that's why don't know how to do it? any link would be appreciated........

Was it helpful?

Solution

Firefox uses Downloads.jsm these days. Note that this is a Promise based async API for the most part, so you really want to consider using Task.jsm.

Example:

Components.utils.import("resource://gre/modules/Downloads.jsm");
Components.utils.import("resource://gre/modules/Task.jsm");

Task.spawn(function logDownloads() {
  try {
    let list = yield Downloads.getList(Downloads.ALL);
    let downloads = yield list.getAll();
    for (let d of downloads) {
      console.log(d.source.url + " -> " + d.target.path);
    }
  }
  catch (ex) {
    console.error(ex);
  }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top