Ignore:
Timestamp:
Apr 13, 2009, 11:24:43 PM (16 years ago)
Author:
[email protected]
Message:

BUG 25171: It should be possible to manually set the name of an anonymous function
<https://bugs.webkit.org/show_bug.cgi?id=25171>

Submitted by Francisco Tolmasky <[email protected]>
Reviewed by Oliver Hunt.

This change adds the displayName property to functions, which when set overrides the
normal name when appearing in the console.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/InternalFunction.cpp

    r38440 r42478  
    4949}
    5050
     51const UString& InternalFunction::displayName(JSGlobalData* globalData)
     52{
     53    JSValuePtr displayName = getDirect(globalData->propertyNames->displayName);
     54   
     55    if (displayName)
     56        return asString(displayName)->value();
     57   
     58    return UString::null();
     59}
     60
     61const UString& InternalFunction::calculatedDisplayName(JSGlobalData* globalData)
     62{
     63    const UString& explicitName = displayName(globalData);
     64   
     65    if (!explicitName.isEmpty())
     66        return explicitName;
     67   
     68    return name(globalData);
     69}
     70
    5171} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.