Add console warnings for E4X for-each

RESOLVED FIXED in mozilla37

Status

()

Core
JavaScript Engine
P4
normal
RESOLVED FIXED
3 years ago
2 years ago

People

(Reporter: cpeterson, Assigned: cpeterson)

Tracking

({dev-doc-complete})

unspecified
mozilla37
dev-doc-complete
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
Console warning should point readers to MDN:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of
(Assignee)

Updated

3 years ago
Blocks: 824289
(Assignee)

Updated

3 years ago
Blocks: 867615
(Assignee)

Updated

3 years ago
Blocks: 925989
(Assignee)

Comment 1

3 years ago
Created attachment 8528885 [details] [diff] [review]
log-warnings.patch

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)
(Assignee)

Updated

3 years ago
Depends on: 1105393
(Assignee)

Updated

3 years ago
Depends on: 1105404
(Assignee)

Updated

3 years ago
Depends on: 1105406
(Assignee)

Updated

3 years ago
Depends on: 1105408
Attachment #8528885 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 2

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/7d0b5801159a
https://hg.mozilla.org/integration/mozilla-inbound/rev/7a3e8ce41a29
https://hg.mozilla.org/mozilla-central/rev/7d0b5801159a
https://hg.mozilla.org/mozilla-central/rev/7a3e8ce41a29
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Added to the compat doc: https://developer.mozilla.org/en-US/Firefox/Releases/37/Site_Compatibility
Keywords: dev-doc-complete

Updated

2 years ago
Blocks: 1083470
You need to log in before you can comment on or make changes to this bug.