Closed
Bug 301698
Opened 20 years ago
Closed 20 years ago
anonymous javascript function causes a syntax error / FFX >= 1.0.5 Mozilla >= 1.7.10
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 301693
People
(Reporter: mailto.neubert, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
The following three lines of javscript code caused no issues in earlier releases
new Function("", "alert(1);");
function() { alert(1); }
7;
Since FFX 1.0.5 and Mozilla 1.7.10 line number 2 causes a javascript syntax error.
Question 1) Why? OK, it doesn't make sense because there is no context but IMHO
the syntax is correct. that's why I think Javascript Console should show a
Warning instead of a Error.
Question 2) Why is line 1 still working?
Reproducible: Always
Comment 1•20 years ago
|
||
Why shouldn't line 1 work? Throwing away the result of an expression isn't
forbidden.
*** This bug has been marked as a duplicate of 301693 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
Yeah - completely understandable...
...but "function() { alert(1); }" could be either a FunctionDeclaration or a
FunctionExpression (ECMA 262 chapter 13) and as you just said: "Throwing away
the result of an expression isn't forbidden" ;)
You need to log in
before you can comment on or make changes to this bug.
Description
•