Bug 1645337 - downloads.download should not unconditionally swallow all errors from the internal Download API. r=robwu
authorharsh <aroraharsh010@gmail.com>
Mon, 06 Jul 2020 13:49:14 +0000
changeset 538912 407d85a8cdc04924e80489c40f5e7b88b2578bb8
parent 538911 bb12d0328ce9de9cb63f3da5f695f4bc6f7925be
child 538913 9e9dd54bc629f1ad0e77e8d8b823a00365a2f640
push id120809
push userdluca@mozilla.com
push dateMon, 06 Jul 2020 14:27:44 +0000
treeherderautoland@407d85a8cdc0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobwu
bugs1645337
milestone80.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1645337 - downloads.download should not unconditionally swallow all errors from the internal Download API. r=robwu Differential Revision: https://phabricator.services.mozilla.com/D82271
toolkit/components/extensions/parent/ext-downloads.js
--- a/toolkit/components/extensions/parent/ext-downloads.js
+++ b/toolkit/components/extensions/parent/ext-downloads.js
@@ -855,17 +855,21 @@ this.downloads = class extends Extension
 
               // This is necessary to make pause/resume work.
               download.tryToKeepPartialData = true;
 
               // Do not handle errors.
               // Extensions will use listeners to be informed about errors.
               // Just ignore any errors from |start()| to avoid spamming the
               // error console.
-              download.start().catch(() => {});
+              download.start().catch(e => {
+                if (e.name !== "DownloadError") {
+                  Cu.reportError(e);
+                }
+              });
 
               return item.id;
             });
         },
 
         removeFile(id) {
           return DownloadMap.lazyInit().then(() => {
             let item;