Closed
Bug 350268
Opened 18 years ago
Closed 18 years ago
"}" in "new Function" should cause syntax error instead of making the rest be ignored
Categories
(Core :: JavaScript Engine, defect, P3)
Core
JavaScript Engine
Tracking
()
VERIFIED
FIXED
mozilla1.9alpha1
People
(Reporter: jruderman, Assigned: brendan)
References
Details
(Keywords: testcase)
Attachments
(1 file)
1.55 KB,
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
> new Function("}")
function anonymous() { }
> new Function("}}}}}")
function anonymous() { }
> new Function("alert(6); } alert(5);")
function anonymous() { alert(6); }
> new Function("} {")
function anonymous() { }
I think these should all trigger syntax errors.
Assignee | ||
Comment 1•18 years ago
|
||
The old "forgot to check for unconsumed tokens" gotcha.
/be
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #235536 -
Flags: superreview?(shaver)
Attachment #235536 -
Flags: review?(mrbkap)
Assignee | ||
Updated•18 years ago
|
OS: Mac OS X 10.4 → All
Priority: -- → P3
Hardware: Macintosh → All
Target Milestone: --- → mozilla1.8.1
Updated•18 years ago
|
Attachment #235536 -
Flags: review?(mrbkap) → review+
Assignee | ||
Comment 2•18 years ago
|
||
Comment on attachment 235536 [details] [diff] [review]
fix
Simple and safe fix, which matches the same error case for top-level scripts. I didn't attach a diff -w, but you can see that the main change is really only four lines of added error checking and reporting, and the rest is due to existing code being indented in an else block.
/be
Attachment #235536 -
Flags: superreview?(shaver) → approval1.8.1?
Assignee | ||
Comment 3•18 years ago
|
||
Fixed on trunk.
/be
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Comment 4•18 years ago
|
||
I'm a little worried about checking this in on the 1.8 branch; if there's Mozilla/Netscape-only content out there this could bite it badly, and we sorta promised Gecko compat between 1.8 and 1.8.1. As an example, this broke our Tinderbox startup test, because the onload handler had a trailing '}'.
Assignee | ||
Comment 5•18 years ago
|
||
Comment on attachment 235536 [details] [diff] [review]
fix
We can not worry and leave this in the trunk for 1.9 only, for sure.
As bz's comment implied, and as gavin pointed out, IE silently fails on trailing junk, so cross-platform web content won't care.
/be
Attachment #235536 -
Flags: approval1.8.1?
Assignee | ||
Updated•18 years ago
|
Target Milestone: mozilla1.8.1 → mozilla1.9alpha
Comment 6•18 years ago
|
||
Checking in regress-350268.js;
/cvsroot/mozilla/js/tests/js1_5/Regress/regress-350268.js,v <-- regress-350268.js
initial revision: 1.1
Updated•18 years ago
|
Flags: in-testsuite+
Reporter | ||
Comment 7•18 years ago
|
||
See also bug 350429, trailing "}" fails to log syntax error in some cases.
You need to log in
before you can comment on or make changes to this bug.
Description
•