Open Bug 1240454 Opened 6 years ago Updated 6 years ago

Remove array comprehensions from toolkit

Categories

(Firefox :: General, defect)

defect
Not set
normal

Tracking

()

People

(Reporter: bmanojkumar24, Assigned: bmanojkumar24)

Details

Attachments

(1 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
Depends on: 1220564
No longer depends on: 1220564
Assignee: nobody → bmanojkumar24
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #8708961 - Flags: review?(dtownsend)
Comment on attachment 8708961 [details]
MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit

https://reviewboard.mozilla.org/r/31191/#review28167

::: toolkit/components/passwordmgr/LoginManagerContent.jsm:1359
(Diff revision 1)
> -      let classText = [for (className of aElement.classList) "." + className].join("");
> +      let classText = aElement.classList.map(className => "." + className).join("");

classList is a DOMTokenList not an array and so doesn't have a map function.
Attachment #8708961 - Flags: review?(dtownsend)
Comment on attachment 8708961 [details]
MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31191/diff/1-2/
Attachment #8708961 - Attachment description: MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit .r=:mossop → MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit
Attachment #8708961 - Flags: review?(dtownsend)
Attachment #8708961 - Flags: review?(dtownsend) → review+
Comment on attachment 8708961 [details]
MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit

https://reviewboard.mozilla.org/r/31191/#review28339

::: toolkit/components/passwordmgr/LoginManagerContent.jsm:1372
(Diff revision 2)
> -              cleansedValue = [for (element of value) prettyElementOutput(element)];
> +              cleansedValue = value.map(element => prettyElementOutput(element));

You can just use value.map(prettyElementOutput) here.
Comment on attachment 8708961 [details]
MozReview Request: Bug 1240454 - Remove array comprehensions from toolkit

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/31191/diff/2-3/
You need to log in before you can comment on or make changes to this bug.