[webkit-dev] anonymous functions have a read only .name property (should they?)

Ross Boucher rboucher at gmail.com
Tue Jan 13 22:29:22 PST 2009


In relation to this bug:

https://bugs.webkit.org/show_bug.cgi?id=21262

I've been trying to make Objective-J filenames show up in the Web  
Inspector's debugger name. A proposed solution is to allow the .name  
property on anonymous functions to be changed, which would allow code  
using new Function() to give names to the anonymous functions this  
creates.

Line 43 of InternalFunction.cpp would be have the ReadOnly property  
removed.

     putDirect(globalData->propertyNames->name, jsString(globalData,  
name.ustring()), DontDelete | DontEnum);

I'm posting this here to ask if anyone has reason to believe this  
would cause incompatibility problems with anything. The ECMA spec  
doesn't mention anything one way or the other on the matter. I'd  
appreciate any feedback.

On its own this doesn't solve the actual problem, but its a step in  
the right direction. A separate discussion of appropriate guesses for  
a name, other than "(program)", what's currently displayed now, is  
probably also in order.

I've implemented a solution that looks for the first named function in  
the source code, and if it can't find one, uses the first non empty  
line of code. Any better proposals?

-Ross




More information about the webkit-dev mailing list