Closed
Bug 1232618
Opened 9 years ago
Closed 7 years ago
Remove array comprehensions from browser
Categories
(Firefox :: General, defect)
Firefox
General
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.
Assignee | ||
Updated•9 years ago
|
Component: Untriaged → General
Whiteboard: [lang=js]
Version: 41 Branch → Trunk
Updated•9 years ago
|
Updated•9 years ago
|
Assignee: nobody → bmanojkumar24
Assignee | ||
Comment 1•9 years ago
|
||
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 2•9 years ago
|
||
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+
Assignee | ||
Comment 3•9 years ago
|
||
Hi can you please review the patch.Thank you :)
Attachment #8708313 -
Attachment is obsolete: true
Attachment #8708331 -
Flags: review?(dtownsend)
Comment 4•9 years ago
|
||
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-
Assignee | ||
Comment 5•9 years ago
|
||
Review commit: https://reviewboard.mozilla.org/r/31175/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/31175/
Assignee | ||
Updated•9 years ago
|
Attachment #8708890 -
Flags: review?(dtownsend)
Updated•9 years ago
|
Attachment #8708890 -
Flags: review?(dtownsend) → review+
Comment 6•9 years ago
|
||
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
Assignee | ||
Comment 7•9 years ago
|
||
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/
Comment 8•7 years ago
|
||
Looks like this was fixed by https://hg.mozilla.org/mozilla-central/diff/71e5015934c2/browser/base/content/newtab/grid.js and https://hg.mozilla.org/mozilla-central/diff/ba78fb79365f/browser/components/downloads/content/allDownloadsViewOverlay.js#l1.24
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•