Closed Bug 1105406 Opened 5 years ago Closed 5 years ago

Remove deprecated for-each-in array comprehension in about:newtab

Categories

(Firefox :: New Tab Page, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 37

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

Bug 1083467 will log console warnings for JavaScript 1.6's deprecated for-each-in loops (including JavaScript 1.7's legacy for-each-in array comprehensions). This patch replaces a for-each-in array comprehension in about:newtab code with an ES7 for-of array comprehension.

This patch also initializes _cells to [] instead of null. for-each-in array comprehensions handle null by returning [], but for-of throws a TypeError on null.
Attachment #8529177 - Flags: review?(adw)
Comment on attachment 8529177 [details] [diff] [review]
1083467_fix-newtab.patch

Review of attachment 8529177 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks.

I wondered whether anything depends on _cells starting out as null, but a search on mxr doesn't reveal anything, not even in tests.  All consumers expect cells to be an array.  So that part of this patch looks OK.

[for (cell of this.cells || []) cell.site] would be the safest thing to do since it wouldn't change the current behavior at all, but given what I just said about consumers, plus my opinion that it makes sense anyway for _cells to always be an array, I don't think that's necessary.
Attachment #8529177 - Flags: review?(adw) → review+
https://hg.mozilla.org/mozilla-central/rev/8e681c8b554d
Assignee: nobody → cpeterson
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 37
Can I pick up this bug for QA? If so, can someone update the QA steps?
You need to log in before you can comment on or make changes to this bug.