I'm using nsIDownloadManager in combination with nsIWebBrowserPersist to download a file and show the download manager (code below). When I add an nsIDownloadProgressListener ( https://developer.mozilla.org/en/nsIDownloadProgressListener) via addListener to the download manager, the listener is used by all downloads when I only want it to be used by the particular download that is being processed. Any way to do that?
Note I need to use the listener to get access to the nsIDownload ( https://developer.mozilla.org/en/nsIDownload) object during download to get information about the file. ---------------- var browserPersist = Components.classes['@ mozilla.org/embedding/browser/nsWebBrowserPersist;1'].createInstance(Components.interfaces.nsIWebBrowserPersist) ; var dlMgr =Components.classes['@ mozilla.org/download-manager;1'].getService(Components.interfaces.nsIDownloadManager) ; browserPersist.persistFlags = nsIWBP.PERSIST_FLAGS_NO_CONVERSION | nsIWBP.PERSIST_FLAGS_REPLACE_EXISTING_FILES | nsIWBP.PERSIST_FLAGS_CLEANUP_ON_FAILURE; /** * Add the download to the downloader window */ var ret = dlMgr.addDownload(0, source, target, name, null, null, null, null, browserPersist); dlMgr.addListener(myDownloadListener); // This is the listener that is global for all downloads, but I only want it for this one. browserPersist.progressListener = ret; browserPersist.saveURI(.... ---------------- - Brian
_______________________________________________ Project_owners mailing list [email protected] https://www.mozdev.org/mailman/listinfo/project_owners
