Closed Bug 1232618 Opened 9 years ago Closed 7 years ago

Remove array comprehensions from browser

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: bmanojkumar24, Assigned: bmanojkumar24)

References

Details

Attachments

(2 files, 1 obsolete file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 Build ID: 20151016093648 Expected results: Array comprehensions are non-standard, we should stop using them and replace existing usage with .map, .from, .filter or other array methods, depending on the code.
Component: Untriaged → General
Whiteboard: [lang=js]
Version: 41 Branch → Trunk
Blocks: 1220564
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [lang=js]
Assignee: nobody → bmanojkumar24
Attached patch 1232618.patch (obsolete) (deleted) — Splinter Review
Hi, please review the patch. I have used the following regex to search for references : "\[\s*for\s\(" , the regex doesnt match any results : "regexp:\[[^\]]+\s*for\s\( path:browser/"
Attachment #8708313 - Flags: review?(arai.unmht)
Comment on attachment 8708313 [details] [diff] [review] 1232618.patch Review of attachment 8708313 [details] [diff] [review]: ----------------------------------------------------------------- Thank you for your patch :) Please address following comments, then ask review from Firefox module owner/peer. ::: browser/components/downloads/content/allDownloadsViewOverlay.js @@ +995,5 @@ > return val; > }, > > get selectedNodes() { > + return this._richlistbox.selectedItems.filter(element => element._placesNode).map(element => element._placesNode); please wrap this into 80 chars. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Line_Length @@ +1222,5 @@ > return false; > }, > > _copySelectedDownloadsToClipboard() { > + let urls = this._richlistbox.selectedItems.map(element => element._shell.download.source.url); here too. ::: browser/extensions/loop/content/modules/MozLoopAPI.jsm @@ +1348,5 @@ > destroy: function() { > if (!gPageListeners) { > return; > } > + gPageListeners.map(listener => listener.destroy()); the return value is not used, so forEach would be better. or, simply "for" statement.
Attachment #8708313 - Flags: review?(arai.unmht) → feedback+
Attached patch 1232618.patch (deleted) — Splinter Review
Hi can you please review the patch.Thank you :)
Attachment #8708313 - Attachment is obsolete: true
Attachment #8708331 - Flags: review?(dtownsend)
Comment on attachment 8708331 [details] [diff] [review] 1232618.patch Review of attachment 8708331 [details] [diff] [review]: ----------------------------------------------------------------- Please also update this patch to the latest mozilla-central code, some files have moved recently. ::: browser/components/downloads/content/allDownloadsViewOverlay.js @@ +997,5 @@ > > get selectedNodes() { > + return this._richlistbox.selectedItems > + .filter(element => element._placesNode) > + .map(element => element._placesNode); richlistbox.selectedItems is not an array so you can't use filter or map on it directly. You will need to use Array.from or similar first. @@ +1225,5 @@ > }, > > _copySelectedDownloadsToClipboard() { > + let urls = this._richlistbox.selectedItems > + .map(element => element._shell.download.source.url); Ditto.
Attachment #8708331 - Flags: review?(dtownsend) → review-
Attachment #8708890 - Flags: review?(dtownsend)
Attachment #8708890 - Flags: review?(dtownsend) → review+
Comment on attachment 8708890 [details] MozReview Request: Bug 1232618 - Remove array comprehensions from browser https://reviewboard.mozilla.org/r/31175/#review28161 ::: browser/components/downloads/content/allDownloadsViewOverlay.js:1001 (Diff revision 1) > - element._placesNode]; > + .map(element => element._placesNode); Please line up the . with the lines above ::: browser/components/downloads/content/allDownloadsViewOverlay.js:1229 (Diff revision 1) > - element._shell.download.source.url]; > + .map(element => element._shell.download.source.url); Same here
Comment on attachment 8708890 [details] MozReview Request: Bug 1232618 - Remove array comprehensions from browser Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31175/diff/1-2/
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: