Closed
Bug 697854
Opened 13 years ago
Closed 8 years ago
eval string to function throw exception "function statement requires a name"
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: aquilax, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Build ID: 20110928134238 Steps to reproduce: eval a string to a function: var func1=eval("function(){alert('Hello World');}"); var func2=eval("function(text){alert(text);}"); Actual results: The eval function throw the following exception: "function statement requires a name" Expected results: The eval function should return a function.
This bug prevent me to upgrade to FF 7 because some user scripts and an intranet uses this method. This is working is FF 6, so please fix this bug.
Comment 2•11 years ago
|
||
Aquila, can you still reproduce when using a current version?
Flags: needinfo?(aquilax)
I see it in Fx44b8. I see throw an error in Chrome 47 & IE11. It may be an illegal statement for JavaScript standard.
Component: General → JavaScript Engine
Product: Firefox → Core
Comment 4•8 years ago
|
||
(In reply to YF (Yang) from comment #3) > It may be an illegal statement for JavaScript standard. It is, yes. function(){alert('Hello World');} isn't valid, and trying to run it in an eval call doesn't change that. I'm guessing that content that used to rely on this working has long gone, so we should be able to safely close this.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•