Changeset 35007 in webkit for trunk/JavaScriptCore/kjs/JSObject.h


Ignore:
Timestamp:
Jul 4, 2008, 10:35:09 PM (17 years ago)
Author:
[email protected]
Message:

JavaScriptCore:

2008-07-04 Sam Weinig <[email protected]>

Rubber-stamped by Dan Bernstein.

Split Error and GetterSetter out of JSObject.h.

  • API/JSCallbackObjectFunctions.h:
  • GNUmakefile.am:
  • JavaScriptCore.pri:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • JavaScriptCoreSources.bkl:
  • kjs/AllInOneFile.cpp:
  • kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h.
  • kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp.
  • kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h.
  • kjs/GetterSetter.cpp:
  • kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h.
  • kjs/JSObject.cpp:
  • kjs/JSObject.h:
  • kjs/nodes.h:

JavaScriptGlue:

2008-07-04 Sam Weinig <[email protected]>

Rubber-stamped by Dan Bernstein.

  • JSObject.h: Rename the header guard as it now conflicts with the JSObject in JavaScriptCore.

WebCore:

2008-07-04 Sam Weinig <[email protected]>

Rubber-stamped by Dan Bernstein.

Split Error and GetterSetter out of JSObject.h.

  • ForwardingHeaders/kjs/Error.h: Added.
  • bindings/js/JSCanvasRenderingContext2DCustom.cpp:
  • bindings/js/JSClipboardCustom.cpp:
  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSEventTargetBase.cpp:
  • bindings/js/JSHTMLDocumentCustom.cpp:
  • bindings/js/JSXMLHttpRequestCustom.cpp:
  • bindings/scripts/CodeGeneratorJS.pm:
  • bridge/NP_jsobject.cpp:
  • bridge/jni/jni_instance.cpp:
  • bridge/jni/jni_runtime.cpp:
  • bridge/objc/objc_instance.mm:
  • bridge/objc/objc_runtime.mm:
  • bridge/objc/objc_utility.h:
  • bridge/runtime_array.cpp:
  • bridge/runtime_method.cpp:
  • bridge/runtime_object.cpp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSObject.h

    r34921 r35007  
    1 // -*- c-basic-offset: 2 -*-
    21/*
    32 *  Copyright (C) 1999-2001 Harri Porten ([email protected])
     
    2221 */
    2322
    24 #ifndef KJS_OBJECT_H
    25 #define KJS_OBJECT_H
    26 
     23#ifndef JSObject_h
     24#define JSObject_h
     25
     26#include "ClassInfo.h"
    2727#include "CommonIdentifiers.h"
    2828#include "ExecState.h"
     
    3838  class InternalFunction;
    3939  class PropertyNameArray;
    40 
    4140  struct HashEntry;
    4241  struct HashTable;
     
    5150                   IsGetterSetter = 1 << 5 }; // property is a getter or setter
    5251
    53   /**
    54    * Class Information
    55    */
    56   struct ClassInfo {
    57     /**
    58      * A string denoting the class name. Example: "Window".
    59      */
    60     const char* className;
    61     /**
    62      * Pointer to the class information of the base class.
    63      * 0L if there is none.
    64      */
    65     const ClassInfo* parentClass;
    66     /**
    67      * Static hash-table of properties.
    68      * For classes that can be used from multiple threads, it is accessed via a getter function that would typically return a pointer to thread-specific value.
    69      */
    70     const HashTable* propHashTable(ExecState* exec) const
    71     {
    72         if (classPropHashTableGetterFunction)
    73             return classPropHashTableGetterFunction(exec);
    74         return staticPropHashTable;
    75     }
    76 
    77     const HashTable* staticPropHashTable;
    78     typedef const HashTable* (*ClassPropHashTableGetterFunction)(ExecState*);
    79     const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
    80   };
    81  
    82   // This is an internal value object which stores getter and setter functions
    83   // for a property.
    84   class GetterSetter : public JSCell {
    85   public:
    86     JSType type() const { return GetterSetterType; }
    87      
    88     GetterSetter() : m_getter(0), m_setter(0) { }
    89      
    90     virtual void mark();
    91      
    92     JSObject* getter() const { return m_getter; }
    93     void setGetter(JSObject* getter) { m_getter = getter; }
    94     JSObject* setter() const { return m_setter; }
    95     void setSetter(JSObject* setter) { m_setter = setter; }
    96      
    97   private:
    98     virtual JSValue* toPrimitive(ExecState*, JSType preferred) const;
    99     virtual bool getPrimitiveNumber(ExecState*, double& number, JSValue*& value);
    100     virtual bool toBoolean(ExecState*) const;
    101     virtual double toNumber(ExecState*) const;
    102     virtual UString toString(ExecState*) const;
    103     virtual JSObject* toObject(ExecState*) const;
    104 
    105     JSObject* m_getter;
    106     JSObject* m_setter; 
    107   };
    108  
    10952  class JSObject : public JSCell {
    11053  public:
     
    391334  };
    392335
    393     JSObject* constructEmptyObject(ExecState*);
    394 
    395   /**
    396    * Types of Native Errors available. For custom errors, GeneralError
    397    * should be used.
    398    */
    399   enum ErrorType { GeneralError   = 0,
    400                    EvalError      = 1,
    401                    RangeError     = 2,
    402                    ReferenceError = 3,
    403                    SyntaxError    = 4,
    404                    TypeError      = 5,
    405                    URIError       = 6};
    406 
    407   /**
    408    * @short Factory methods for error objects.
    409    */
    410   class Error {
    411   public:
    412     /**
    413      * Factory method for error objects.
    414      *
    415      * @param exec The current execution state
    416      * @param errtype Type of error.
    417      * @param message Optional error message.
    418      * @param lineNumber Optional line number.
    419      * @param sourceId Optional source id.
    420      * @param sourceURL Optional source URL.
    421      */
    422     static JSObject *create(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
    423     static JSObject *create(ExecState *, ErrorType, const char *message);
    424   };
    425 
    426 JSObject *throwError(ExecState *, ErrorType, const UString &message, int lineNumber, int sourceId, const UString &sourceURL);
    427 JSObject *throwError(ExecState *, ErrorType, const UString &message);
    428 JSObject *throwError(ExecState *, ErrorType, const char *message);
    429 JSObject *throwError(ExecState *, ErrorType);
     336  JSObject* constructEmptyObject(ExecState*);
    430337
    431338inline JSObject::JSObject(JSValue* proto)
     
    644551}
    645552
    646 } // namespace
    647 
    648 #endif // KJS_OBJECT_H
     553} // namespace KJS
     554
     555#endif // JSObject_h
Note: See TracChangeset for help on using the changeset viewer.