Closed Bug 1083467 Opened 5 years ago Closed 5 years ago

Add console warnings for E4X for-each

Categories

(Core :: JavaScript Engine, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

(Keywords: dev-doc-complete)

Attachments

(1 file)

Blocks: 824289
Blocks: 867615
Blocks: 925989
Log console warnings for JavaScript 1.6's deprecated for-each-in loops. As seen in Beta 34 telemetry, fewer than 250 for-each-in loops were reported web content (though for-each-in loops are popular in Firefox chrome code):

http://telemetry.mozilla.org/#filter=beta%2F34%2FJS_DEPRECATED_LANGUAGE_EXTENSIONS_IN_CONTENT&aggregates=multiselect-all!Submissions&evoOver=Time&locked=true&sanitize=true&renderhistogram=Table

1. This patch logs the same warning for JavaScript 1.6's for-each-in loops and JavaScript 1.7's for-each-in array comprehensions. The preferred fix for these legacy array comprehensions is to use ES7 array comprehensions or something like Array.map(). Is it counterproductive to warn developers about for-each-in in legacy array comprehensions instead of telling them to not use legacy array comprehensions?

2. To reduce console noise, this patch only warns for JS code that is *not* JSVERSION_LATEST (i.e. JS 1.8.5, the default chrome JS version). I have only found a few instances of Firefox code using for-each-in with JS version 1.7 or 1.8. Later we can restrict for-each-in to just chrome JS.
Assignee: nobody → cpeterson
Status: NEW → ASSIGNED
Attachment #8528885 - Flags: review?(jorendorff)
Depends on: 1105393
Depends on: 1105404
Depends on: 1105406
Depends on: 1105408
Attachment #8528885 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/7d0b5801159a
https://hg.mozilla.org/mozilla-central/rev/7a3e8ce41a29
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
You need to log in before you can comment on or make changes to this bug.