Changeset 9795 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
Jul 15, 2005, 9:58:57 AM (20 years ago)
Author:
ggaren
Message:

-rolled in KDE fixes for http://bugzilla.opendarwin.org/show_bug.cgi?id=3601
Error instance type info

Reviewed by mjs.

  • kjs/error_object.cpp:
  • Created ErrorInstanceImp class for Error() objects.
  • Changed parent object for Native Errors to "Function" (matches ECMA spec). (ErrorInstanceImp::ErrorInstanceImp): (ErrorProtoFuncImp::call): (ErrorObjectImp::construct): (NativeErrorImp::construct):
  • kjs/error_object.h: (KJS::ErrorInstanceImp::classInfo):
  • kjs/object.h: made comment more informative about ClassInfo
  • tests/mozilla/expected.html:
Location:
trunk/JavaScriptCore/kjs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/error_object.cpp

    r9768 r9795  
    3030
    3131using namespace KJS;
     32
     33// ------------------------------ ErrorInstanceImp ----------------------------
     34
     35const ClassInfo ErrorInstanceImp::info = {"Error", 0, 0, 0};
     36
     37ErrorInstanceImp::ErrorInstanceImp(ObjectImp *proto)
     38: ObjectImp(proto)
     39{
     40}
    3241
    3342// ------------------------------ ErrorPrototypeImp ----------------------------
     
    6574{
    6675  // toString()
    67   UString s;
     76  UString s = "Error";
    6877
    6978  Value v = thisObj.get(exec, namePropertyName);
    7079  if (v.type() != UndefinedType) {
    71     s += v.toString(exec);
     80    s = v.toString(exec);
    7281  }
    7382
    7483  v = thisObj.get(exec, messagePropertyName);
    7584  if (v.type() != UndefinedType) {
    76     s += " : " + v.toString(exec); // Mozilla compatible format
     85    s += ": " + v.toString(exec); // Mozilla compatible format
    7786  }
    7887
     
    101110{
    102111  Object proto = Object::dynamicCast(exec->lexicalInterpreter()->builtinErrorPrototype());
    103   ObjectImp *imp = new ObjectImp(proto);
     112  ObjectImp *imp = new ErrorInstanceImp(proto.imp());
    104113  Object obj(imp);
    105114
     
    137146// ------------------------------ NativeErrorImp -------------------------------
    138147
    139 const ClassInfo NativeErrorImp::info = {"Error", &InternalFunctionImp::info, 0, 0};
     148const ClassInfo NativeErrorImp::info = {"Function", &InternalFunctionImp::info, 0, 0};
    140149
    141150NativeErrorImp::NativeErrorImp(ExecState *exec, FunctionPrototypeImp *funcProto,
     
    157166Object NativeErrorImp::construct(ExecState *exec, const List &args)
    158167{
    159   ObjectImp *imp = new ObjectImp(proto);
     168  ObjectImp *imp = new ErrorInstanceImp(proto);
    160169  Object obj(imp);
    161170  if (args[0].type() != UndefinedType)
  • trunk/JavaScriptCore/kjs/error_object.h

    r9768 r9795  
    2828namespace KJS {
    2929
     30  class ErrorInstanceImp : public ObjectImp {
     31  public:
     32    ErrorInstanceImp(ObjectImp *proto);
     33   
     34    virtual const ClassInfo *classInfo() const { return &info; }
     35    static const ClassInfo info;
     36  };
     37 
    3038  class ErrorPrototypeImp : public ObjectImp {
    3139  public:
     
    5361    virtual Value call(ExecState *exec, Object &thisObj, const List &args);
    5462  };
    55 
    56 
    57 
    58 
    5963
    6064  class NativeErrorPrototypeImp : public ObjectImp {
  • trunk/JavaScriptCore/kjs/object.h

    r9768 r9795  
    437437     *
    438438     * \code
    439      *   const ClassInfo BarImp::info = {0, 0, 0}; // no parent class
    440      *   const ClassInfo FooImp::info = {&BarImp::info, 0, 0};
     439     *   const ClassInfo BarImp::info = {"Bar", 0, 0, 0}; // no parent class
     440     *   const ClassInfo FooImp::info = {"Foo", &BarImp::info, 0, 0};
    441441     * \endcode
    442442     *
Note: See TracChangeset for help on using the changeset viewer.