Closed Bug 1292995 Opened 3 years ago Closed 3 years ago

Replace in-tree consumer of non-standard Iterator() with Object.{values,entries} in services/

Categories

(Cloud Services :: General, defect)

defect
Not set

Tracking

(firefox51 fixed)

RESOLVED FIXED
Tracking Status
firefox51 --- fixed

People

(Reporter: arai, Assigned: sumi29, Mentored)

References

Details

(Whiteboard: [good first bug] [lang=js])

Attachments

(1 file)

separated from bug 1290637.
see bug 1290637 for the details.

Required code changes are following:
  * Check each usage of non-standard Iterator [1] function,
    and replace it with Object.entries [2] or Object.values [3],
    or something appropriate for the specific usage

Here's the rough list for Iterator() usage (not exhaustive)
https://dxr.mozilla.org/mozilla-central/search?q=%22+Iterator(%22+path%3Aservices%2F&redirect=false

for example:
  for (let [k, v] in Iterator(obj)) {
    ...
  }
can be replaced to:
  for (let [k, v] of Object.entries(obj)) {
    ...
  }

another example:
  for (let [, v] in Iterator(array)) {
    ...
  }
can be replaced to:
  for (let v of array) {
    ...
  }


[1] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Iterator
[2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
[3] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/values
All tests in the services/ folder passed, so hopefully this changeset won't have the same mistakes as the one for bug 1290698.
Assignee: nobody → sumi29
Status: NEW → ASSIGNED
Comment on attachment 8779154 [details]
Bug 1292995 - Replace Iterator() with Object.{values,entries} in services/;

https://reviewboard.mozilla.org/r/70186/#review67512

Thank you for taking this :)

Looks good.
forwarding to gps, as I'm not module owner/peer here.
Attachment #8779154 - Flags: review?(gps)
Attachment #8779154 - Flags: review?(arai.unmht) → feedback+
Comment on attachment 8779154 [details]
Bug 1292995 - Replace Iterator() with Object.{values,entries} in services/;

https://reviewboard.mozilla.org/r/70186/#review67700
Attachment #8779154 - Flags: review?(gps) → review+
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/autoland/rev/7bab284d7910
Replace Iterator() with Object.{values,entries} in services/; r=gps
https://hg.mozilla.org/mozilla-central/rev/7bab284d7910
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.