Closed
Bug 1245639
Opened 9 years ago
Closed 9 years ago
Implement chrome.downloads.show()
Categories
(WebExtensions :: Untriaged, defect)
WebExtensions
Untriaged
Tracking
(firefox48 fixed)
RESOLVED
FIXED
mozilla48
Tracking | Status | |
---|---|---|
firefox48 | --- | fixed |
People
(Reporter: aswan, Assigned: TheOne)
References
(Blocks 1 open bug)
Details
(Whiteboard: [downloads][good first bug])
Attachments
(1 file, 3 obsolete files)
2.53 KB,
patch
|
TheOne
:
review+
|
Details | Diff | Splinter Review |
Part of supporting chrome.downloads in WebExtensions
https://developer.chrome.com/extensions/downloads#method-show
Updated•9 years ago
|
Whiteboard: [downloads]
Reporter | ||
Updated•9 years ago
|
Whiteboard: [downloads] → [downloads][good first bug]
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → awagner
Assignee | ||
Updated•9 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8730128 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 2•9 years ago
|
||
I tested this successfully on
* Mac 10.11.3
* Windows 7
* Ubuntu 14.04 LTS
Comment 3•9 years ago
|
||
Comment on attachment 8730128 [details] [diff] [review]
patch v1
Review of attachment 8730128 [details] [diff] [review]:
-----------------------------------------------------------------
::: toolkit/components/extensions/ext-downloads.js
@@ +458,5 @@
> },
>
> + show(downloadId) {
> + DownloadMap.lazyInit().then(() => {
> + let download = DownloadMap.fromId(downloadId);
We need to check whether the extension object is valid, and that the target file exists (and tests that it fails when it doesn't).
We should probably also change this to return a promise, for the cases where it fails.
@@ +460,5 @@
> + show(downloadId) {
> + DownloadMap.lazyInit().then(() => {
> + let download = DownloadMap.fromId(downloadId);
> + let fileobj = new FileUtils.File(download.filename);
> + fileobj.reveal();
We should be using the Download object's `showContainingDirectory` method for this.
Attachment #8730128 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 4•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Attachment #8730128 -
Attachment is obsolete: true
Assignee | ||
Comment 5•9 years ago
|
||
(In reply to Kris Maglione [:kmag] from comment #3)
> Comment on attachment 8730128 [details] [diff] [review]
> patch v1
>
> Review of attachment 8730128 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: toolkit/components/extensions/ext-downloads.js
> @@ +458,5 @@
> > },
> >
> > + show(downloadId) {
> > + DownloadMap.lazyInit().then(() => {
> > + let download = DownloadMap.fromId(downloadId);
>
> We need to check whether the extension object is valid, and that the target
> file exists (and tests that it fails when it doesn't).
`fromId` already checks whether the download object is valid.
`showContainingDirectory` already checks whether the target file exists.
>
> We should probably also change this to return a promise, for the cases where
> it fails.
>
> @@ +460,5 @@
> > + show(downloadId) {
> > + DownloadMap.lazyInit().then(() => {
> > + let download = DownloadMap.fromId(downloadId);
> > + let fileobj = new FileUtils.File(download.filename);
> > + fileobj.reveal();
>
> We should be using the Download object's `showContainingDirectory` method
> for this.
Done.
Assignee | ||
Updated•9 years ago
|
Attachment #8730213 -
Attachment description: Implement chrome.downloads.show → patch v2
Attachment #8730213 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 6•9 years ago
|
||
> > We should be using the Download object's `showContainingDirectory` method
> > for this.
>
> Done.
Wait, `download.showContainingDirectory` does not exist.
Comment 7•9 years ago
|
||
(In reply to Andreas Wagner [:TheOne] from comment #5)
> `fromId` already checks whether the download object is valid.
> `showContainingDirectory` already checks whether the target file exists.
They do, but the errors aren't handled, and are just eventually reported as a
promise that failed to handle rejection. They should be handled and reported
as extension errors.
Comment 8•9 years ago
|
||
(In reply to Andreas Wagner [:TheOne] from comment #6)
> > > We should be using the Download object's `showContainingDirectory` method
> > > for this.
> >
> > Done.
>
> Wait, `download.showContainingDirectory` does not exist.
It should. https://dxr.mozilla.org/mozilla-central/source/toolkit/components/jsdownloads/src/DownloadCore.jsm#729
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8730250 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Updated•9 years ago
|
Attachment #8730213 -
Attachment is obsolete: true
Attachment #8730213 -
Flags: review?(kmaglione+bmo)
Comment 10•9 years ago
|
||
Comment on attachment 8730250 [details] [diff] [review]
patch v3
Review of attachment 8730250 [details] [diff] [review]:
-----------------------------------------------------------------
This needs test coverage for the error states (i.e., the download ID is invalid, the file doesn't exist, or the download isn't complete). Please file a follow-up bug.
Attachment #8730250 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Comment 11•9 years ago
|
||
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 13•9 years ago
|
||
Rebased.
Assignee | ||
Updated•9 years ago
|
Attachment #8730250 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Attachment #8732059 -
Flags: review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 14•9 years ago
|
||
Keywords: checkin-needed
Comment 15•9 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox48:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•