Bug 90678 - JavaScript: Drop the “escaped reserved words as identifiers” compatibility measure
: JavaScript: Drop the “escaped reserved words as identifiers” compatibility me...
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore
: 528+ (Nightly build)
: Unspecified Unspecified
: P2 Normal
Assigned To: Oliver Hunt
: InRadar
Depends on:
  Show dependency treegraph
Reported: 2012-07-06 05:44 PDT by Mathias Bynens
Modified: 2014-05-11 11:01 PDT (History)
10 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Bynens 2012-07-06 05:44:25 PDT
For example, `var var;` throws a syntax error, but e.g. `var v\u0061r;` works fine, currently. This is a violation of the ECMAScript 5.1 spec, and used to be a compatibility requirement: http://mathias.html5.org/specs/javascript/#escaped-reserved-words One year ago, all browsers except IE fulfilled this.

Half a year ago Firefox dropped this non-standard addition (https://bugzilla.mozilla.org/show_bug.cgi?id=694360) and hasn’t seen any compatibility issues since.

Please align with Firefox and IE by removing this non-standard extension.
Comment 1 Mathias Bynens 2012-07-06 05:49:28 PDT
I’ve filed the same bug here:

* Opera/Carakan: https://bugs.opera.com/browse/DSK-369398
* Chrome/V8: http://code.google.com/p/v8/issues/detail?id=2222
Comment 2 Radar WebKit Bug Importer 2012-07-06 19:30:50 PDT
Comment 3 Alexey Proskuryakov 2012-07-07 01:19:16 PDT
See also: bug 42471.
Comment 4 Mathias Bynens 2012-07-07 10:15:08 PDT
(In reply to comment #3)
> See also: bug 42471.

Note that bug 42471 deals with IdentifierNames, while this bug (90678) is about Identifiers. Identifiers are IdentifierNames that are not reserved words.
Comment 5 Mathias Bynens 2012-07-09 02:04:09 PDT
See also: https://bugs.ecmascript.org/show_bug.cgi?id=277
Comment 6 Mathias Bynens 2013-09-18 00:30:14 PDT
FWIW, https://bugs.ecmascript.org/show_bug.cgi?id=277 is accepted, and Allen says he will make it clear (in ES6) that escaped reserved words are not allowed. The same goes for escaped regular expression flags.

Now would be a good time to drop this non-standard behavior that is apparently not a backwards compatibility concern.
Comment 7 Mathias Bynens 2013-12-12 04:13:52 PST
Confirmed: ES6 drops the “escaped reserved words as identifiers” compatibility measure.

This will be fixed in v8: https://code.google.com/p/v8/issues/detail?id=2222#c4
SpiderMonkey already has ES6-compliant behavior: https://bugzilla.mozilla.org/show_bug.cgi?id=744784
Comment 8 Mark S. Miller 2014-05-11 11:01:47 PDT
What is the status of this? It is security significant for systems that pre-filter or translate code in order to enforce restrictions.