Closed Bug 1578955 Opened Last month Closed Last month

downloads API: Allow extensions a way to download ignoring HTTP errors


(WebExtensions :: General, enhancement)

Not set


(firefox71 fixed)

Tracking Status
firefox71 --- fixed


(Reporter: nmaier, Assigned: nmaier)



(Keywords: dev-doc-needed)


(2 files)

Bug #1576333 will bring Firefox to parity with Chrome in regards to handling HTTP errors and cancelling downloads on HTTP errors.

A concern arose that some extensions might in fact want to continue with downloads even though the server returned an error such as 404 Not Found.

This is currently unsupported in Chrome, and implementing this in Firefox would be a new feature.

I therefore propose the following changes:

  1. Add a new, optional boolean flag allowHttpErrorsto the options of, which defaults to false.
  2. When the flag is false (the default) in calls to, then there should be no change in behavior, and downloads should continue to be cancelled upon encountering HTTP errors.
  3. When the flag is true in calls to, then upon encountering errors the download should be allowed to proceed regardless, but DownloadItem.error should be set to the appropriate InterruptReason, such as SERVER_BAD_CONTENT, as usual, and special care should be taken that any .onChanged listeners are notified of the changed DownloadItem.error value.
  4. When the flag is true in calls to, when the download finishes and changes its state to complete, the DownloadItem.error should still reflect the InterruptReason corresponding to HTTP error code encountered earlier.
  5. When the flag is true in calls to and there is a later error, such as writing the file to disk failed, then the DownloadItem.error should reflect the InterruptReason of this later error.

Preliminary patch, demonstrating the idea, tho I am not married to the details and open to suggestions.

It is supposed to stack on the patches from bug 1576333 of course.

Attachment #9091002 - Attachment description: Bug 1578955 - Add allowHttpErrors feature to downloads API r?zombie → Bug 1578955 - Add allowHttpErrors feature to downloads API r?robwu
Flags: qe-verify-
Flags: in-testsuite+
Keywords: checkin-needed

Pushed by
Add allowHttpErrors feature to downloads API r=robwu

Keywords: checkin-needed
Closed: Last month
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
You need to log in before you can comment on or make changes to this bug.