On Mar 3, 2009, at 2:39 PM, Maciej Stachowiak wrote:

Surprising though it may be, it seems that (new Function).name === "anonymous" may be relevant to Web compatibility. We changed JavaScriptCore to match SpiderMonkey on this as a result of this bug:

http://bugzilla.opendarwin.org/show_bug.cgi?id=7726

I can't reach that hostname, but https://bugs.webkit.org/show_bug.cgi?id=7726 works.

BTW, the ability to write a program whose entire source is "function () {}" is an old, pre-ES3 feature of SpiderMonkey that people *still* depend on, especially when using eval (not new Function) to generate a lambda from source.

Per ES3 this should be a syntax error as Darin Adler pointed out in the bugs.webkit.org bug, but we have had to keep compatibility with what came before ES3 on this point. There's an API option (JSOPTION_ANONFUNFIX) to make this case an error per spec.


I strongly suspect code also depends on (function(){}).name==="" but I don't have a clear-cut example handy.

I voiced the same suspicion. I didn't know any web site depending on Function().name == "anonymous", though. What a world!

/be
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to