Closed
Bug 759446
Opened 12 years ago
Closed 12 years ago
Use rest arguments where possible
Categories
(Toolkit :: Add-ons Manager, defect)
Toolkit
Add-ons Manager
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: mossop, Assigned: duelistone)
References
()
Details
(Whiteboard: [good first bug][mentor=bmcbride@mozilla.com][lang=js])
Attachments
(1 file, 1 obsolete file)
11.74 KB,
patch
|
Unfocused
:
review+
|
Details | Diff | Splinter Review |
We use functions that take variable numbers of arguments a fair bit in the add-ons manager code and currently use the arguments pseudo-array to handle them. JS just got full support though in the form of rest arguments (see the URL) so we should look at switching to that. A quick list of places that might benefit from this: http://bit.ly/JyPQAd
Updated•12 years ago
|
Whiteboard: [good first bug] → [good first bug][mentor=bmcbride@mozilla.com][lang=js]
Can I be of any help? This is my first time trying to contribute here, and I thought this would be a good chance for me to learn how the process of fixing a bug works. I created a patch which changed all the uses of "Array.slice(arguments" given in an earlier comment. Let me know if I should attach it to this bug. (In reply to Dave Townsend (:Mossop) from comment #0) > We use functions that take variable numbers of arguments a fair bit in the > add-ons manager code and currently use the arguments pseudo-array to handle > them. JS just got full support though in the form of rest arguments (see the > URL) so we should look at switching to that. > > A quick list of places that might benefit from this: http://bit.ly/JyPQAd
Comment 2•12 years ago
|
||
(In reply to duelistone from comment #1) [...] > I created a patch which changed all the uses of "Array.slice(arguments" > given in an earlier comment. Let me know if I should attach it to this bug. [...] Short answer: Yes. You should also ASSIGN the bug to yourself, then get someone to review your patch (normally an owner or peer of the concerned module). Long answer: See https://developer.mozilla.org/En/Developer_Guide/How_to_Submit_a_Patch
Comment 4•12 years ago
|
||
Comment on attachment 633858 [details] [diff] [review] Patch replacing some uses of the arguments pseudo-array with rest arguments Great, thanks :) Will look at this later today.
Attachment #633858 -
Flags: review?(bmcbride)
Updated•12 years ago
|
Assignee: nobody → duelistone
Status: NEW → ASSIGNED
Comment 5•12 years ago
|
||
Comment on attachment 633858 [details] [diff] [review] Patch replacing some uses of the arguments pseudo-array with rest arguments Review of attachment 633858 [details] [diff] [review]: ----------------------------------------------------------------- Looking good :) I noticed there are a few other cases where we use 'arguments', but without Array.slice(): * Using Array.splice() instead: http://is.gd/bIjR4E * In callInstallListeners() and callAddonListeners() here: http://is.gd/R8rAAg (Might have to remove aMethod from the argument list - it's nice to have, but only there for self-documentation purposes). Also, this isn't necessary, but bonus points if you rename the 'args' variables to 'aArgs', to match with the style of prefixing function arguments with 'a'. ::: toolkit/mozapps/extensions/test/browser/head.js @@ +375,2 @@ > var bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/extensions.properties"); > if (arguments.length == 1) This should be args.length now.
Attachment #633858 -
Flags: review?(bmcbride) → review-
Updated•12 years ago
|
Attachment #633858 -
Attachment is obsolete: true
Comment 8•12 years ago
|
||
Comment on attachment 634163 [details] [diff] [review] rest_arguments_patch When you attach a new patch, you can set older patches to be "obsolete" (makes it clear which patches are now old), and also set the review flag to "?" and enter the email of who should review it (to make sure that person knows, otherwise it's easy to miss).
Attachment #634163 -
Flags: review?(bmcbride)
Comment 9•12 years ago
|
||
Comment on attachment 634163 [details] [diff] [review] rest_arguments_patch Review of attachment 634163 [details] [diff] [review]: ----------------------------------------------------------------- Excellent - thanks :) I'll get this landed for you.
Attachment #634163 -
Flags: review?(bmcbride) → review+
Assignee | ||
Comment 10•12 years ago
|
||
I'll keep your tips in mind for next time I submit a patch. Glad I could be of help.
Comment 11•12 years ago
|
||
Oh, before I land your patch, what name would you like to be used as the patch author?
Assignee | ||
Comment 12•12 years ago
|
||
The name which shows up as my username now (namely "Luis Ares").
Comment 13•12 years ago
|
||
Landed on the fx-team branch, which gets merged into mozilla-central roughly every day: https://hg.mozilla.org/integration/fx-team/rev/92d3a40382aa
Whiteboard: [good first bug][mentor=bmcbride@mozilla.com][lang=js] → [good first bug][mentor=bmcbride@mozilla.com][lang=js][fixed-in-fx-team]
Target Milestone: --- → mozilla16
Comment 14•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/92d3a40382aa
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [good first bug][mentor=bmcbride@mozilla.com][lang=js][fixed-in-fx-team] → [good first bug][mentor=bmcbride@mozilla.com][lang=js]
You need to log in
before you can comment on or make changes to this bug.
Description
•