Closed
Bug 1293205
Opened 8 years ago
Closed 8 years ago
Warn about non-standard for-each regardless of JS version number
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla51
Tracking | Status | |
---|---|---|
firefox51 | --- | fixed |
People
(Reporter: arai, Assigned: arai)
References
Details
(Keywords: dev-doc-complete, site-compat)
Attachments
(2 files)
5.17 KB,
patch
|
evilpie
:
review+
|
Details | Diff | Splinter Review |
1.68 KB,
patch
|
fs
:
review+
|
Details | Diff | Splinter Review |
derived from bug 1083470.
now for-each is warning in parser depending on js version number
https://dxr.mozilla.org/mozilla-central/rev/763fe887c37cee5fcfe0f00e94fdffc84a41ea1c/js/src/frontend/Parser.cpp#6134
> if (versionNumber() < JSVERSION_LATEST) {
> if (!report(ParseWarning, pc->sc->strict(), null(), JSMSG_DEPRECATED_FOR_EACH))
> return null();
> }
we should warn regardless of the version number.
that will help add-on developers to migrate to standard syntax.
Updated•8 years ago
|
Keywords: dev-doc-needed,
site-compat
Assignee | ||
Comment 1•8 years ago
|
||
Removed versionNumber() check, and changed unused strict argument to false.
Also, made it warn-only-once, just like expression closure, to avoid flooding console.
Updated•8 years ago
|
Attachment #8787291 -
Flags: review?(evilpies) → review+
Comment 2•8 years ago
|
||
It would be useful to add [Learn more] to the warning and then explain what the standardized alternatives to for-each are.
To do that, a new page needs to be written here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors and "JSMSG_DEPRECATED_FOR_EACH" and the URL needs to be added to https://dxr.mozilla.org/mozilla-central/source/devtools/server/actors/errordocs.js
Assignee | ||
Comment 3•8 years ago
|
||
Good idea :)
Added
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/For-each-in_loops_are_deprecated
will post errordocs.js patch shortly.
Assignee | ||
Comment 4•8 years ago
|
||
Added link to For-each-in_loops_are_deprecated page.
Attachment #8787585 -
Flags: review?(fscholz)
Comment 5•8 years ago
|
||
Comment on attachment 8787585 [details] [diff] [review]
Part 2: Link to MDN documentation from for-each warning.
Awesome, thank you!
Attachment #8787585 -
Flags: review?(fscholz) → review+
Assignee | ||
Comment 6•8 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/4ab9576d4c6280d6f7dbbc75ea100d133ace1aad
Bug 1293205 - Part 1: Warn about non-standard for-each regardless of JS version number. r=evilpie
https://hg.mozilla.org/integration/mozilla-inbound/rev/3613d167d065e344e81fa6aab23492f71dd996d1
Bug 1293205 - Part 2: Link to MDN documentation from for-each warning. r=fscholz
Comment 7•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4ab9576d4c62
https://hg.mozilla.org/mozilla-central/rev/3613d167d065
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Comment 8•8 years ago
|
||
Added a note to the site compatibility doc: https://www.fxsitecompat.com/en-CA/docs/2015/for-each-in-loop-support-will-be-removed/
Comment 9•8 years ago
|
||
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/For-each-in_loops_are_deprecated
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for_each...in
https://developer.mozilla.org/en-US/Firefox/Releases/51#JavaScript
Keywords: dev-doc-needed → dev-doc-complete
You need to log in
before you can comment on or make changes to this bug.
Description
•