Closed Bug 931777 Opened 11 years ago Closed 11 years ago

Use Downloads.jsm functions to get download directories in Firefox for Metro

Categories

(Firefox for Metro Graveyard :: Downloads, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 28

People

(Reporter: Paolo, Assigned: marcos)

References

Details

Attachments

(1 file, 4 obsolete files)

Attached patch Patch by Raymond Lee (obsolete) — Splinter Review
In bug 875731, we updated several code paths in Toolkit to use the new
JavaScript API to get the download directories. The final directory is
the same, but obtained using a different code path.

To keep consistency, we should update the remaining code paths to use the
new JavaScript API, as prototyped in the attached patch (that should however
use promptForSaveToFileAsync).
marina would be a good reviewer for this, she's worked on most of our download code. cc'ing bbondy as well since he implemented the file picker in metro.
Assignee: nobody → marcos
Attachment #823328 - Attachment is obsolete: true
Attached patch v1 (obsolete) — Splinter Review
Implemented the promptForSaveToFileAsync() but since I haven't setup metro environment for testing.  Please kindly help to test this patch.
Attachment #823765 - Flags: feedback?(netzen)
Attachment #823765 - Attachment description: bug-931777.diff → v1
Comment on attachment 823765 [details] [diff] [review]
v1

Marina would you mind reviewing this, I'd like to move to the 2 reviews for you in the meantime.
Attachment #823765 - Flags: feedback?(netzen) → review?(msamuel)
(In reply to Brian R. Bondy [:bbondy] from comment #4)
> Marina would you mind reviewing this, I'd like to move to the 2 reviews for
> you in the meantime.

This needs some simple local testing as well, since we don't have a Metro environment.
Comment on attachment 823765 [details] [diff] [review]
v1

Review of attachment 823765 [details] [diff] [review]:
-----------------------------------------------------------------

::: browser/metro/components/HelperAppDialog.js
@@ +216,2 @@
>  
> +      if (picker.show() == Ci.nsIFilePicker.returnCancel) {

It looks like this code was already broken, but we need to update this to the non-deprecated open() call insstead. show won't work in Metro because it is sync and metro only support an async filepicker.
Attachment #823765 - Flags: review?(msamuel)
Attached patch v2 (obsolete) — Splinter Review
(In reply to Brian R. Bondy [:bbondy] from comment #6)
> Comment on attachment 823765 [details] [diff] [review]
> v1
> 
> Review of attachment 823765 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: browser/metro/components/HelperAppDialog.js
> @@ +216,2 @@
> >  
> > +      if (picker.show() == Ci.nsIFilePicker.returnCancel) {
> 
> It looks like this code was already broken, but we need to update this to
> the non-deprecated open() call insstead. show won't work in Metro because it
> is sync and metro only support an async filepicker.

Switched to use open.
Attachment #823762 - Attachment is obsolete: true
Attachment #823765 - Attachment is obsolete: true
Attachment #825610 - Flags: review?(msamuel)
Comment on attachment 825610 [details] [diff] [review]
v2

Review of attachment 825610 [details] [diff] [review]:
-----------------------------------------------------------------

Other than the one comment, looks good overall. Downloads are working as expected and passed mochitest locally. It's cool toggling the filepicker as a pref too! sfoster, did you still want to give this another look?

::: browser/metro/components/HelperAppDialog.js
@@ +240,5 @@
> +          file = this.validateLeafName(newDir, file.leafName, null);
> +        }
> +        aLauncher.saveDestinationAvailable(file);
> +      }.bind(this));
> +    });

Please add .bind(this) at the end of this function too.
Attachment #825610 - Flags: review?(sfoster)
Attachment #825610 - Flags: review?(msamuel)
Attachment #825610 - Flags: feedback+
Comment on attachment 825610 [details] [diff] [review]
v2

Nothing further to add to Mariana's catch of the extra bind() needed. Thanks for doing this, it looks good and works well.
Attachment #825610 - Flags: review?(sfoster) → feedback+
Attached patch v3Splinter Review
(In reply to Marina Samuel [:emtwo] from comment #8)
> Comment on attachment 825610 [details] [diff] [review]
> v2
> 
> Review of attachment 825610 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Other than the one comment, looks good overall. Downloads are working as
> expected and passed mochitest locally. It's cool toggling the filepicker as
> a pref too! sfoster, did you still want to give this another look?
> 
> ::: browser/metro/components/HelperAppDialog.js
> @@ +240,5 @@
> > +          file = this.validateLeafName(newDir, file.leafName, null);
> > +        }
> > +        aLauncher.saveDestinationAvailable(file);
> > +      }.bind(this));
> > +    });
> 
> Please add .bind(this) at the end of this function too.

Have added that.

Pushed to try and waiting for results
https://tbpl.mozilla.org/?tree=Try&rev=e60c84f2a09b
Attachment #826011 - Flags: review?(msamuel)
Attachment #825610 - Attachment is obsolete: true
Comment on attachment 826011 [details] [diff] [review]
v3

Review of attachment 826011 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with the try build working.
Attachment #826011 - Flags: review?(msamuel) → review+
https://hg.mozilla.org/mozilla-central/rev/ba892a5d8085
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 28
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: