Closed
Bug 1217981
Opened 9 years ago
Closed 9 years ago
Remove use of for-each from chrome/, config/ and testing/.
Categories
(Firefox :: General, defect)
Firefox
General
Tracking
()
RESOLVED
FIXED
Firefox 45
People
(Reporter: arai, Assigned: arai)
References
Details
Attachments
(3 files)
836 bytes,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
1.95 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
909 bytes,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
Need to replace non-standard for-each with one of:
* for-of
* for-in
* array.map/array.filter for array-comprehension
as a part of bug 1083470.
converting rules are following:
* for-each
* for each (let x in array) { ... }
-> for (let x of array) { ... }
* for each (let x in object) { ... }
-> for (let key in object) { let x = object[key]; ... }
* for each (let [key, value] in Iterator(object)) { ... }
-> for (let key in object) { let value = object[key]; ... }
* for each (let x in array) { ... }
where array can be null or undefined
-> if (array) { for (let x of array) { ... } }
* legacy array comprehension with for-each
(newer array comprehension is now also a non-standard feature, I'd like to go with map/filter)
* [EXPR for each (x in array)]
-> array.map(x => EXPR)
* [EXPR for each (x in array) if (COND)]
-> array.filter(x => COND).map(x => EXPR)
* [x for each (x in array) if (COND)]
-> array.filter(x => COND)
* [EXPR for each ([i, x] in Iterator(array)) if (g(x, i)]
-> array.filter((x, i) => g(x, i)).map((x => EXPR)
* [EXPR for each (x in arraylike)]
-> Array.from(arraylike).map(x => EXPR)
* [EXPR for each (x in string)]
-> Array.prototype.slice.call(string).map(x => EXPR)
// Array.from behaves differently for surrogate-pair
Assignee | ||
Comment 1•9 years ago
|
||
Almost green on try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=77c5563839da
Attachment #8678314 -
Flags: review?(benjamin)
Assignee | ||
Comment 2•9 years ago
|
||
Attachment #8678316 -
Flags: review?(benjamin)
Assignee | ||
Comment 3•9 years ago
|
||
Attachment #8678317 -
Flags: review?(benjamin)
Updated•9 years ago
|
Attachment #8678314 -
Flags: review?(benjamin) → review+
Comment 4•9 years ago
|
||
Comment on attachment 8678316 [details] [diff] [review]
Part 2: Remove for-each from config/.
realistically this code should be removed, but whatever for now
Attachment #8678316 -
Flags: review?(benjamin) → review+
Updated•9 years ago
|
Attachment #8678317 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 5•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/c64e2afccc7d64f5beef20d8ce21778cc0a015c4
Bug 1217981 - Part 1: Remove for-each from chrome/. r=bsmedberg
https://hg.mozilla.org/integration/mozilla-inbound/rev/8b024fc7d91b6daeb4f44d2189c8787899f97fd9
Bug 1217981 - Part 2: Remove for-each from config/. r=bsmedberg
https://hg.mozilla.org/integration/mozilla-inbound/rev/a1a2ce2eafa9d6a325a384e47fda68e564ff0b00
Bug 1217981 - Part 3: Remove for-each from testing/. r=bsmedberg
Comment 6•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c64e2afccc7d
https://hg.mozilla.org/mozilla-central/rev/8b024fc7d91b
https://hg.mozilla.org/mozilla-central/rev/a1a2ce2eafa9
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox45:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 45
Comment 7•9 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/c64e2afccc7d
https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/8b024fc7d91b
https://hg.mozilla.org/releases/mozilla-b2g44_v2_5/rev/a1a2ce2eafa9
status-b2g-v2.5:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•