JSC looses a pair of parenthesis when performing toString on a function, so that function f(){ ({}).x; } f.toString() produces function f(){ {}.x; } which is invalid. This was found by jsfunfuzz
I have a one line fix for this
This is a regression from shipping Safari.
toSource and uneval have to put parens around functions, but toString doesn't have to. JSC's current behavior matches Spidermonkey.
Never mind, I misread the bug.
this also occurs with function expressions
I was wrong, it looks like our current funciton expression behaviour is sufficient
Created attachment 18697 [details] Patch to fix the bug
Comment on attachment 18697 [details] Patch to fix the bug r=me But is this a bug fix or not?
Comment on attachment 18697 [details] Patch to fix the bug This is a bug fix -- the current code means Function.toString can produce incorrect code. Maciej suggested an approach that would not use unnecessary ()'s for object literals.
Created attachment 18699 [details] New version of fix No longer introduce unnecessary ()'s
Comment on attachment 18699 [details] New version of fix r=me
Landed r29802