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)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(2 files)

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.
Blocks: 1293305
Blocks: 1234048
Removed versionNumber() check, and changed unused strict argument to false. Also, made it warn-only-once, just like expression closure, to avoid flooding console.
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Attachment #8787291 - Flags: review?(evilpies)
Attachment #8787291 - Flags: review?(evilpies) → review+
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
Added link to For-each-in_loops_are_deprecated page.
Attachment #8787585 - Flags: review?(fscholz)
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+
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
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: