Closed Bug 880329 Opened 11 years ago Closed 10 years ago

Drop version-based do-while SyntaxError

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32
Tracking Status
firefox31 --- wontfix
firefox32 --- affected

People

(Reporter: jorendorff, Assigned: cpeterson)

Details

Attachments

(1 file)

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.
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)
Comment on attachment 8409284 [details] [diff] [review]
remove-SyntaxError.patch

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

Thanks.
Attachment #8409284 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/47feb777c154
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.