Drop version-based do-while SyntaxError

RESOLVED FIXED in mozilla32

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: jorendorff, Assigned: cpeterson)

Tracking

unspecified
mozilla32
Points:
---

Firefox Tracking Flags

(firefox31 wontfix, firefox32 affected)

Details

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
We have code that specially treats 

    do {} while (0) alert("OK");

as a syntax error if the version is JSVERSION_ECMA_3.

LOL!

TC39 just specified this wrong in ES3 and ES5; the semicolon is optional, at least since 2005 (see bug 238945). ES6 fixes the bug, changing the spec to match de facto reality.  Keeping around a legacy SyntaxError-me-harder mode is pointless.

There's 1JS, y'all.
(Assignee)

Comment 1

4 years ago
Created attachment 8409284 [details] [diff] [review]
remove-SyntaxError.patch

Remove ES3-only SyntaxError for do-while without semicolon.

AFAICT, web content can't even opt into JSVERSION_ECMA_3 if it wanted to because Gecko's <script> element parser rounds up older JS version numbers to JSVERSION_DEFAULT:

https://hg.mozilla.org/mozilla-central/file/582b2d81ebe1/content/base/src/nsContentUtils.cpp#l829
Assignee: general → cpeterson
Status: NEW → ASSIGNED
Attachment #8409284 - Flags: review?(jorendorff)
(Reporter)

Comment 2

4 years ago
Comment on attachment 8409284 [details] [diff] [review]
remove-SyntaxError.patch

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

Thanks.
Attachment #8409284 - Flags: review?(jorendorff) → review+
(Assignee)

Comment 3

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/47feb777c154
status-firefox31: --- → wontfix
status-firefox32: --- → affected
https://hg.mozilla.org/mozilla-central/rev/47feb777c154
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.