Closed Bug 671528 Opened 13 years ago Closed 10 years ago

consider adding aReason argument to nsIHelperAppLauncher.js so extensions can make use of it

Categories

(Toolkit :: Downloads API, defect)

All
Other
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla33

People

(Reporter: P.Kern1, Assigned: kernp25)

Details

Attachments

(1 file, 3 obsolete files)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:5.0) Gecko/20100101 Firefox/5.0
Build ID: 20110615151330
Attached patch patch (obsolete) — Splinter Review
Attachment #545882 - Flags: review?(paolo.mozmail)
Assignee: nobody → P.Kern1
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment on attachment 545882 [details] [diff] [review]
patch

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

Thank you for the patch! I've set the r+ flag, meaning that overall it looks OK to me.

I'd recommend two changes though, please look at the review below. You should attach a new patch for final check-in. Also, since I'm not a peer of this module, you'll need to set the "review" flag on the new patch to "?", and indicate Shawn (:sdwilsh) as requestee, for final approval.

::: toolkit/mozapps/downloads/nsHelperAppDlg.js
@@ +57,5 @@
>  function nsUnknownContentTypeDialog() {
>      // Initialize data properties.
>      this.mLauncher = null;
>      this.mContext  = null;
> +    this.mReason   = 0;

I'd set this.mReason to null here to indicate that the field hasn't been initialized. Zero indicates Ci.nsIHelperAppLauncherDialog.REASON_CANTHANDLE instead.

@@ +90,5 @@
>      //       one of those is via that route).
>      show: function(aLauncher, aContext, aReason)  {
>        this.mLauncher = aLauncher;
>        this.mContext  = aContext;
> +      this.mReason   = aReason;

I'd add a comment saying that we set this field for use by add-ons. This ensures that it's not accidentally removed in the future (however, please remember that it could be intentionally removed in case we refactor the code to work differently; this is not an external API).

Our prevailing comment style here is leading uppercase letter and trailing dot.
Attachment #545882 - Flags: review?(paolo.mozmail) → review+
Attached patch 671528.patch (obsolete) — Splinter Review
yes
I think, this can be useful for extensions, that are integrated into the download dialog.
So, they can find out why the dialog is shown.
This is really useful information.
Attachment #8441343 - Flags: review?(paolo.mozmail)
(In reply to :Paolo Amadini from comment #2)
> Comment on attachment 545882 [details] [diff] [review]
> patch
> 
> Review of attachment 545882 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Thank you for the patch! I've set the r+ flag, meaning that overall it looks
> OK to me.
> 
> I'd recommend two changes though, please look at the review below. You
> should attach a new patch for final check-in. Also, since I'm not a peer of
> this module, you'll need to set the "review" flag on the new patch to "?",
> and indicate Shawn (:sdwilsh) as requestee, for final approval.
> 
> ::: toolkit/mozapps/downloads/nsHelperAppDlg.js
> @@ +57,5 @@
> >  function nsUnknownContentTypeDialog() {
> >      // Initialize data properties.
> >      this.mLauncher = null;
> >      this.mContext  = null;
> > +    this.mReason   = 0;
> 
> I'd set this.mReason to null here to indicate that the field hasn't been
> initialized. Zero indicates Ci.nsIHelperAppLauncherDialog.REASON_CANTHANDLE
> instead.
>
Or maybe to -1? this.mReason   = -1;?
What you think?
 
> @@ +90,5 @@
> >      //       one of those is via that route).
> >      show: function(aLauncher, aContext, aReason)  {
> >        this.mLauncher = aLauncher;
> >        this.mContext  = aContext;
> > +      this.mReason   = aReason;
> 
> I'd add a comment saying that we set this field for use by add-ons. This
> ensures that it's not accidentally removed in the future (however, please
> remember that it could be intentionally removed in case we refactor the code
> to work differently; this is not an external API).
> 
Is this comment here needed?
Can we just add this tiny mReason param to http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/nsHelperAppDlg.js?
And why it can be removed?
I don't think that this tiny reason param here hurts someone.
Comment on attachment 8441343 [details] [diff] [review]
671528.patch

Thank you for reviving this old patch!

Just one note, I've noticed a difference in an empty line, this may indicate a mismatch in line endings (CRLF versus LF). Please check that you're using Unix line endings in your text editor, and attach a fixed patch if this is the case.
Attachment #8441343 - Flags: review?(paolo.mozmail) → review+
Shawn Wilsher is still on bugzilla?
(In reply to kernp25 from comment #5)
> Or maybe to -1? this.mReason   = -1;?
> What you think?

I think null is fine, you can use the === to check, but generally extension code will be invoked after the value has been set anyways.

> > I'd add a comment saying that we set this field for use by add-ons. This
> > ensures that it's not accidentally removed in the future (however, please
> > remember that it could be intentionally removed in case we refactor the code
> > to work differently; this is not an external API).
> > 
> Is this comment here needed?

It can be useful for the reasons explained, but is not mandatory.

> And why it can be removed?
> I don't think that this tiny reason param here hurts someone.

I agree, at present the reason parameter is useful. But since there is no documented interface to extend this dialog, nor automated tests for it, this is more likely to change in the future (not only the parameter, but the dialog in general).
(In reply to kernp25 from comment #7)
> Shawn Wilsher is still on bugzilla?

I don't think he's been active recently, but I'm now a peer of the module so my review is enough.
Thank you for your time!!!
I will create another patch.
Attached patch 671528.patch (obsolete) — Splinter Review
Attachment #8441343 - Attachment is obsolete: true
Attachment #8441357 - Flags: review?(paolo.mozmail)
Comment on attachment 8441357 [details] [diff] [review]
671528.patch

Looks good to me!
Attachment #8441357 - Flags: review?(paolo.mozmail) → review+
When this will be added to http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/nsHelperAppDlg.js?

When it will be available?
Is this bug now fixed?
But i really think we should add this useful information to http://dxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/nsHelperAppDlg.js
(In reply to kernp25 from comment #14)
> Is this bug now fixed?

I've requested automated tests to be run on your patch, you can see the results here:

https://tbpl.mozilla.org/?tree=Try&rev=47bd5cdc000d

Initially the letters on the right side are gray, then they become green when the tests pass. We must wait until all the letters are green (note that we can ignore some orange letters), then we can set the checkin-needed keyword on the bug:

https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch#Getting_the_patch_checked_into_the_tree
Attachment #545882 - Attachment is obsolete: true
Attachment #8441357 - Attachment is obsolete: true
> Initially the letters on the right side are gray, then they become green when the tests pass. We must > wait until all the letters are green (note that we can ignore some orange letters), then we can set
> the checkin-needed keyword on the bug:
How long does this take?
But, i can see many green letters :)
Did the test passed?
But again, thank you for taking your time to fix this and also thank you for creating a new patch for the testing.
But what are these red letters?
It says it's burning?
> Windows XP Opt B
> Windows XP Debug B
> Windows 2012 x64 Opt B
> Windows 2012 x64 Debug B
Can we also ignore this?
(In reply to kernp25 from comment #19)
> Can we also ignore this?

At the current time, I don't see any red letters, and I see only one orange (OS X 10.6 Debug bc1) that is a known intermittent failure, thus it can be ignored.

I think you can go ahead and set the "checkin-needed" keyword on the bug.
Assignee: P.Kern1 → kernp25
Keywords: checkin-needed
I have found this:
https://bugzilla.mozilla.org/show_bug.cgi?id=285517

and this one:
https://bugzilla.mozilla.org/show_bug.cgi?id=285976
It looks like the same bug

Paolo what you think?
https://hg.mozilla.org/mozilla-central/rev/4eb625761ecb
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
(In reply to kernp25 from comment #22)
> I have found this:
> https://bugzilla.mozilla.org/show_bug.cgi?id=285517
> 
> and this one:
> https://bugzilla.mozilla.org/show_bug.cgi?id=285976
> It looks like the same bug
> 
> Paolo what you think?

I don't think those are the same bug as this one, but thank you a lot for searching for duplicates! It's very helpful.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: