JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Jan 2008 08:54:25 +0000 (08:54 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 27 Jan 2008 08:54:25 +0000 (08:54 +0000)
commit23a9e453d8c5e36f78206fce662ef30b24230578
tree9f46e0fa80becf11881de9a971be0a292e283173
parent9ef7637bb9f858494e24efccb3e47a2ce2d2c58b
JavaScriptCore:

        Reviewed by Oliver.

        - fix http://bugs.webkit.org/show_bug.cgi?id=16498
          ''.constructor.toString() gives [function]

        Test: fast/js/function-names.html

        * kjs/array_object.cpp:
        (KJS::ArrayObjectImp::ArrayObjectImp): Use the class name as the constructor's function name.
        * kjs/bool_object.cpp:
        (KJS::BooleanObjectImp::BooleanObjectImp): Ditto.
        * kjs/date_object.cpp:
        (KJS::DateObjectImp::DateObjectImp): Ditto.
        * kjs/error_object.cpp:
        (KJS::ErrorPrototype::ErrorPrototype): Make the error object be an Error.
        (KJS::ErrorObjectImp::ErrorObjectImp): Use the class name as the constructor's function name.
        (KJS::NativeErrorPrototype::NativeErrorPrototype): Take const UString&.
        (KJS::NativeErrorImp::NativeErrorImp): Use the prototype's name as the constructor's function
        name.
        * kjs/error_object.h: Change ErrorPrototype to inherit from ErrorInstance. Change the
        NativeErrorImp constructor to take a NativeErrorPrototype pointer for its prototype.
        * kjs/function.h: Removed unneeded constructor for internal functions without names.
        We want to avoid those!
        * kjs/function_object.cpp:
        (KJS::functionProtoFuncToString): Removed code that writes out just [function] for functions
        that have no names. There's no reason to do that.
        (KJS::FunctionObjectImp::FunctionObjectImp): Use the class name as the constructor's
        function name.
        * kjs/internal.cpp: Removed the unused constructor.
        * kjs/number_object.cpp:
        (KJS::fractionalPartToString): Marked static for internal linkage.
        (KJS::exponentialPartToString): Ditto.
        (KJS::numberProtoFuncToPrecision): Removed an unneeded else.
        (KJS::NumberObjectImp::NumberObjectImp): Use the class name as the constructor's
        function name.
        (KJS::NumberObjectImp::getValueProperty): Tweaked formatting.
        * kjs/object_object.cpp:
        (KJS::ObjectObjectImp::ObjectObjectImp): Use "Object" for the function name.
        * kjs/regexp_object.cpp:
        (KJS::RegExpObjectImp::RegExpObjectImp): Use "RegExp" for the function name.
        * kjs/string_object.cpp:
        (KJS::StringObjectImp::StringObjectImp): Use the class name as the constructor's
        function name.

LayoutTests:

        Reviewed by Oliver.

        - test for http://bugs.webkit.org/show_bug.cgi?id=16498
          ''.constructor.toString() gives [function]

        * fast/js/function-names-expected.txt: Updated for new tests.
        * fast/js/kde/resources/function.js: Updated test to expect the format that Gecko uses
        for native code, which we now match character for character.
        * fast/js/resources/function-names.js: Added tests for the names of all the constructors.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29817 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/kjs/array_object.cpp
JavaScriptCore/kjs/bool_object.cpp
JavaScriptCore/kjs/date_object.cpp
JavaScriptCore/kjs/error_object.cpp
JavaScriptCore/kjs/error_object.h
JavaScriptCore/kjs/function.h
JavaScriptCore/kjs/function_object.cpp
JavaScriptCore/kjs/internal.cpp
JavaScriptCore/kjs/number_object.cpp
JavaScriptCore/kjs/object_object.cpp
JavaScriptCore/kjs/regexp_object.cpp
JavaScriptCore/kjs/string_object.cpp
LayoutTests/ChangeLog
LayoutTests/fast/js/function-names-expected.txt
LayoutTests/fast/js/kde/resources/function.js
LayoutTests/fast/js/resources/function-names.js