[Firefox viewer] Stop using FirefoxCom.requestAsync
in the DownloadManager
After the changes in https://bugzilla.mozilla.org/show_bug.cgi?id=1757771, that simplified the MOZCENTRAL downloading code, the `ChromeActions.download`-method will no longer invoke the `sendResponse`-callback. Hence it should no longer be necessary for the `DownloadManager`, in the MOZCENTRAL viewer, to use `FirefoxCom.requestAsync` since no response is ever provided.[1] For the allocated BlobURLs, they should (hopefully) be released when navigating away from the viewer. --- [1] Note that that was *already* the case, for one of the previous code-paths in the `ChromeActions.download`-method.
This commit is contained in:
parent
4f1cd6a9c2
commit
8a349801dc
@ -116,13 +116,11 @@ class DownloadManager {
|
||||
new Blob([data], { type: contentType })
|
||||
);
|
||||
|
||||
FirefoxCom.requestAsync("download", {
|
||||
FirefoxCom.request("download", {
|
||||
blobUrl,
|
||||
originalUrl: blobUrl,
|
||||
filename,
|
||||
isAttachment: true,
|
||||
}).then(error => {
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
}
|
||||
|
||||
@ -161,17 +159,10 @@ class DownloadManager {
|
||||
download(blob, url, filename) {
|
||||
const blobUrl = URL.createObjectURL(blob);
|
||||
|
||||
FirefoxCom.requestAsync("download", {
|
||||
FirefoxCom.request("download", {
|
||||
blobUrl,
|
||||
originalUrl: url,
|
||||
filename,
|
||||
}).then(error => {
|
||||
if (error) {
|
||||
// If downloading failed in `PdfStreamConverter.jsm` it's very unlikely
|
||||
// that attempting to fallback and re-download would be helpful here.
|
||||
console.error("`ChromeActions.download` failed.");
|
||||
}
|
||||
URL.revokeObjectURL(blobUrl);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user