Closed Bug 1245600 Opened 8 years ago Closed 8 years ago

Implement chrome.downloads.onChanged

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox47 fixed)

RESOLVED FIXED
mozilla47
Iteration:
47.3 - Mar 7
Tracking Status
firefox47 --- fixed

People

(Reporter: aswan, Assigned: aswan)

References

(Blocks 1 open bug)

Details

(Whiteboard: [downloads])

Attachments

(1 file)

Part of supporting chrome.downloads in WebExtensions

https://developer.chrome.com/extensions/downloads#event-onChanged
Blocks: 1213445
Whiteboard: [downloads]
Iteration: --- → 47.3 - Mar 7
Assignee: nobody → aswan
I played around with this in Chrome a bit and encountered some quirks I want to document.
The fields that are documented as being possibly referenced in a change event are:
url, filename, danger, mime, startTime, endTime, state, canResume, paused, error, totalBytes, fileSize, exists

Of these, I can't see how url, mime, or startTime can ever change once a download begins (and we don't get a change event for a brand new download, onCreated exists for that).

I did see a change event for exists going from true->false after I deleted a downloaded file from the downloads directory, but the event came many minutes after the file was deleted (I think it happened at the time I started a new unrelated download)

In some simple testing (doing a download and letting it finish, pausing and restarting a download, canceling a download), I never saw change events for totalBytes, fileSize, or a false->true change for exists.

I think that by far the biggest benefit will get from this is the in_progress->completed change on the state field, so I'd like to just start with that and defer the rest to a subsequent bug.
Comment on attachment 8726982 [details]
MozReview Request: Bug 1245600 - Implement chrome.downloads.onChanged for state r?kmag

https://reviewboard.mozilla.org/r/38347/#review34891

::: toolkit/components/extensions/ext-downloads.js:23
(Diff revision 1)
> +  runSafeSync,

Please sort property names.

::: toolkit/components/extensions/ext-downloads.js:138
(Diff revision 1)
> +  events: new EventEmitter(),

We generally use `EventEmitter.decorate` instead.
Attachment #8726982 - Flags: review?(kmaglione+bmo) → review+
Comment on attachment 8726982 [details]
MozReview Request: Bug 1245600 - Implement chrome.downloads.onChanged for state r?kmag

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/38347/diff/1-2/
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/0c220ff8ce85
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.