Closed
Bug 514576
Opened 14 years ago
Closed 14 years ago
ES5 strict mode: no 'with' statements permitted in strict mode code
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: jimb, Assigned: jimb)
References
(Blocks 1 open bug)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file, 2 obsolete files)
3.09 KB,
patch
|
Details | Diff | Splinter Review |
From ES5 Annex C: Strict mode code may not include a WithStatement. The occurrence of a WithStatement in such a context is an SyntaxError (12.10).
Assignee | ||
Comment 1•14 years ago
|
||
Hmm. Back in bug 322430, we decided that warnings about 'with' statements were misguided with JSOPTION_STRICT enabled. ES5 strict mode forbids 'with' statements. How should a unified strictness regime behave?
Comment 2•14 years ago
|
||
Sorry, my memory fails me, but can you remind me of the separate bit somewhere that indicates ES5 strict mode (a static property of JSScript, presumably a new bitfield). That plus JSOPTION_STRICT could enable the warning, whereas just JSOPTION_STRICT would not. Then you pick your poison with option-setting and/or "use strict". /be
Assignee | ||
Comment 3•14 years ago
|
||
Assignee: general → jim
Attachment #404910 -
Flags: review?(mrbkap)
Comment 4•14 years ago
|
||
Comment on attachment 404910 [details] [diff] [review] Forbid 'with' statements in strict mode code. I like this patch so much, I'm going to give it 2 +s. However, I do have a nitpick: >+ return NULL; >+ } > pn = NewParseNode(PN_BINARY, tc); Please add a newline before this assignment.
Attachment #404910 -
Flags: review?(mrbkap)
Attachment #404910 -
Flags: review+
Assignee | ||
Comment 5•14 years ago
|
||
(In reply to comment #4) > (From update of attachment 404910 [details] [diff] [review]) > I like this patch so much, I'm going to give it 2 +s. :) > However, I do have a > nitpick: > >+ return NULL; > >+ } > > pn = NewParseNode(PN_BINARY, tc); > > Please add a newline before this assignment. Fixed --- thanks!
Assignee | ||
Comment 6•14 years ago
|
||
Code unchanged; just added tests.
Attachment #404910 -
Attachment is obsolete: true
Attachment #406582 -
Flags: review?(mrbkap)
Updated•14 years ago
|
Attachment #406582 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 7•14 years ago
|
||
Revised tests per jorendorff's and waldo's comments.
Attachment #406582 -
Attachment is obsolete: true
Assignee | ||
Comment 8•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/80bdd2d441d1
Status: NEW → ASSIGNED
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Updated•14 years ago
|
Flags: in-testsuite+
Comment 9•14 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/80bdd2d441d1
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•