Ignore:
Timestamp:
Jul 7, 2006, 7:02:47 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


More API action.


  • Headerdoc finished

Semantic Changes:

  • Added a JSContextRef argument to many functions, because you need a JSContextRef for doing virtually anything. I expect to add this argument to even more functions in a future patch.


  • Removed the globalObjectPrototype argument to JSContextCreate because you can't create an object until you have a context, so it's impossible to pass a prototype object to JSContextCreate. That's OK because (1) there's no reason to give the global object a prototype and (2) if you really want to, you can just use a separate call to JSObjectSetPrototype.


  • Removed the JSClassRef argument to JSClassCreate because it was unnecessary, and you need to be able to make the global object's class before you've created a JSContext.


  • Added an optional exception parameter to JSFunctionMakeWithBody because anything less would be uncivilized.


  • Made the return value parameter to JSObjectGetProperty optional to match all other return value parameters in the API.


  • Made JSObjectSetPrivate/JSObjectGetPrivate work on JSCallbackFunctions and JSCallbackConstructors. You could use an abstract base class or strategic placement of m_privateData in the class structure to implement this, but the former seemed like overkill, and the latter seemed too dangerous.


  • Fixed a bug where JSPropertyEnumeratorGetNext would skip the first property.

Cosmetic Changes:

  • Reversed the logic of the JSChar #ifdef to avoid confusing headerdoc


  • Removed function names from @function declarations because headeroc can parse them automatically, and I wanted to rule out manual mismatch.
  • Changed Error::create to take a const UString& instead of a UString* because it was looking at me funny.


  • Renamed JSStringBufferCreateWithCFString to JSStringBufferCreateCF because the latter is more concise and it matches JSStringBufferCreateUTF8.


  • API/JSCallbackObject.cpp: (KJS::JSCallbackObject::getOwnPropertySlot): (KJS::JSCallbackObject::put): (KJS::JSCallbackObject::deleteProperty): (KJS::JSCallbackObject::getPropertyList): (KJS::JSCallbackObject::toBoolean): (KJS::JSCallbackObject::toNumber): (KJS::JSCallbackObject::toString):
  • API/JSClassRef.cpp: (JSClassCreate):
  • API/JSContextRef.cpp: (JSContextCreate): (JSContextSetException):
  • API/JSContextRef.h:
  • API/JSNode.c: (JSNodePrototype_class): (JSNode_class):
  • API/JSNodeList.c: (JSNodeListPrototype_class): (JSNodeList_class):
  • API/JSObjectRef.cpp: (JSObjectGetProperty): (JSObjectGetPrivate): (JSObjectSetPrivate): (JSObjectCallAsFunction): (JSObjectCallAsConstructor): (JSPropertyEnumeratorGetNext):
  • API/JSObjectRef.h:
  • API/JSStringBufferRef.cpp: (JSStringBufferCreateCF):
  • API/JSStringBufferRef.h:
  • API/JSValueRef.cpp: (JSValueIsInstanceOf):
  • API/JSValueRef.h:
  • API/minidom.c: (main):
  • API/minidom.js:
  • API/testapi.c: (MyObject_hasProperty): (MyObject_setProperty): (MyObject_deleteProperty): (MyObject_getPropertyList): (MyObject_convertToType): (MyObject_class): (main):
  • JavaScriptCore.exp:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSObjectRef.h

    r15168 r15224  
    3535#endif
    3636
     37/*!
     38@enum JSPropertyAttribute
     39@constant kJSPropertyAttributeNone         Specifies that a property has no special attributes.
     40@constant kJSPropertyAttributeReadOnly     Specifies that a property is read-only.
     41@constant kJSPropertyAttributeDontEnum     Specifies that a property should not be enumerated by JSPropertyEnumerators and JavaScript for...in loops.
     42@constant kJSPropertyAttributeDontDelete   Specifies that the delete operation should fail on a property.
     43*/
    3744enum {
    3845    kJSPropertyAttributeNone         = 0,
     
    4148    kJSPropertyAttributeDontDelete   = 1 << 3
    4249};
     50
     51/*!
     52@typedef JSPropertyAttributes
     53@abstract A set of JSPropertyAttributes. Combine multiple attributes by logically ORing them together.
     54*/
    4355typedef unsigned JSPropertyAttributes;
    4456
     57/*!
     58@typedef JSInitializeCallback
     59@abstract The callback invoked when an object is first created.
     60@param object The JSObject being created.
     61@discussion If you named your function Initialize, you would declare it like this:
     62
     63void Initialize(JSObjectRef object);
     64*/
     65
     66// FIXME: Needs to take a context argument, but can't because no context exists when we're creating the global object
    4567typedef void
    4668(*JSInitializeCallback)         (JSObjectRef object);
    4769
     70/*!
     71@typedef JSFinalizeCallback
     72@abstract The callback invoked when an object is finalized (prepared for garbage collection).
     73@param object The JSObject being finalized.
     74@discussion If you named your function Finalize, you would declare it like this:
     75
     76void Finalize(JSObjectRef object);
     77*/
    4878typedef void           
    4979(*JSFinalizeCallback)           (JSObjectRef object);
    5080
     81/*!
     82@typedef JSHasPropertyCallback
     83@abstract The callback invoked when determining whether an object has a given property.
     84@param context The current execution context.
     85@param object The JSObject to search for the property.
     86@param propertyName A JSStringBuffer containing the name of the property look up.
     87@result true if object has the property, otherwise false.
     88@discussion If you named your function HasProperty, you would declare it like this:
     89
     90bool HasProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
     91
     92This callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive. If this callback is NULL, the getProperty callback will be used to service hasProperty calls.
     93*/
    5194typedef bool
    52 (*JSHasPropertyCallback)        (JSObjectRef object, JSStringBufferRef propertyName);
    53 
     95(*JSHasPropertyCallback)        (JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
     96
     97/*!
     98@typedef JSGetPropertyCallback
     99@abstract The callback invoked when getting a property from an object.
     100@param context The current execution context.
     101@param object The JSObject to search for the property.
     102@param propertyName A JSStringBuffer containing the name of the property to get.
     103@param returnValue A pointer to a JSValue in which to store the property's value.
     104@result true if object has the property in question, otherwise false. If this function returns true, returnValue is assumed to contain a valid JSValue.
     105@discussion If you named your function GetProperty, you would declare it like this:
     106
     107bool GetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue);
     108
     109If this function returns false, the get request forwards to object's static property table, then its parent class chain (which includes the default object class), then its prototype chain.
     110*/
    54111typedef bool
    55112(*JSGetPropertyCallback)        (JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* returnValue);
    56113
     114/*!
     115@typedef JSSetPropertyCallback
     116@abstract The callback invoked when setting the value of a given property.
     117@param context The current execution context.
     118@param object The JSObject on which to set the property's value.
     119@param propertyName A JSStringBuffer containing the name of the property to set.
     120@param value A JSValue to use as the property's value.
     121@result true if the property was successfully set, otherwise false.
     122@discussion If you named your function SetProperty, you would declare it like this:
     123
     124bool SetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value);
     125
     126If this function returns false, the set request forwards to object's static property table, then its parent class chain (which includes the default object class).
     127*/
    57128typedef bool
    58 (*JSSetPropertyCallback)        (JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value);
    59 
     129(*JSSetPropertyCallback)        (JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value);
     130
     131/*!
     132@typedef JSDeletePropertyCallback
     133@abstract The callback invoked when deleting a given property.
     134@param context The current execution context.
     135@param object The JSObject in which to delete the property.
     136@param propertyName A JSStringBuffer containing the name of the property to delete.
     137@result true if propertyName was successfully deleted, otherwise false.
     138@discussion If you named your function DeleteProperty, you would declare it like this:
     139
     140bool DeleteProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
     141
     142If this function returns false, the delete request forwards to object's static property table, then its parent class chain (which includes the default object class).
     143*/
    60144typedef bool
    61 (*JSDeletePropertyCallback)     (JSObjectRef object, JSStringBufferRef propertyName);
    62 
     145(*JSDeletePropertyCallback)     (JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
     146
     147/*!
     148@typedef JSGetPropertyListCallback
     149@abstract The callback invoked when adding an object's properties to a property list.
     150@param context The current execution context.
     151@param object The JSObject whose properties need to be added to propertyList.
     152@param propertyList A JavaScript property list that will be used to enumerate object's properties.
     153@discussion If you named your function GetPropertyList, you would declare it like this:
     154
     155void GetPropertyList(JSContextRef context, JSObjectRef object, JSPropertyListRef propertyList);
     156
     157Use JSPropertyListAdd to add properties to propertyList.
     158
     159Property lists are used by JSPropertyEnumerators and JavaScript for...in loops.
     160*/
    63161typedef void
    64 (*JSGetPropertyListCallback)    (JSObjectRef object, JSPropertyListRef propertyList);
    65 
     162(*JSGetPropertyListCallback)    (JSContextRef context, JSObjectRef object, JSPropertyListRef propertyList);
     163
     164/*!
     165@typedef JSCallAsFunctionCallback
     166@abstract The callback invoked when an object is called as a function.
     167@param context The current execution context.
     168@param function A JSObject that is the function being called.
     169@param thisObject A JSObject that is the 'this' variable in the function's scope.
     170@param argc An integer count of the number of arguments in argv.
     171@param argv A JSValue array of the  arguments passed to the function.
     172@result A JSValue that is the function's return value.
     173@discussion If you named your function CallAsFunction, you would declare it like this:
     174
     175JSValueRef CallAsFunction(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[]);
     176
     177If your callback were invoked by the JavaScript expression 'myObject.myMemberFunction()', function would be set to myMemberFunction, and thisObject would be set to myObject.
     178
     179If this callback is NULL, calling your object as a function will throw an exception.
     180*/
    66181typedef JSValueRef
    67 (*JSCallAsFunctionCallback)     (JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[]);
    68 
     182(*JSCallAsFunctionCallback)     (JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argc, JSValueRef argv[]);
     183
     184/*!
     185@typedef JSCallAsConstructorCallback
     186@abstract The callback invoked when an object is used as a constructor in a 'new' statement.
     187@param context The current execution context.
     188@param constructor A JSObject that is the constructor being called.
     189@param argc An integer count of the number of arguments in argv.
     190@param argv A JSValue array of the  arguments passed to the function.
     191@result A JSObject that is the constructor's return value.
     192@discussion If you named your function CallAsConstructor, you would declare it like this:
     193
     194JSObjectRef CallAsConstructor(JSContextRef context, JSObjectRef constructor, size_t argc, JSValueRef argv[]);
     195
     196If your callback were invoked by the JavaScript expression 'new myConstructorFunction()', constructor would be set to myConstructorFunction.
     197
     198If this callback is NULL, using your object as a constructor in a 'new' statement will throw an exception.
     199*/
    69200typedef JSObjectRef
    70 (*JSCallAsConstructorCallback)  (JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[]);
    71 
     201(*JSCallAsConstructorCallback)  (JSContextRef context, JSObjectRef constructor, size_t argc, JSValueRef argv[]);
     202
     203/*!
     204@typedef JSConvertToTypeCallback
     205@abstract The callback invoked when converting an object to a particular JavaScript type.
     206@param context The current execution context.
     207@param object The JSObject to convert.
     208@param typeCode A JSTypeCode specifying the JavaScript type to convert to.
     209@param returnValue A pointer to a JSValue in which to store the converted value.
     210@result true if the value was converted, otherwise false. If this function returns true, returnValue is assumed to contain a valid JSValue.
     211@discussion If you named your function ConvertToType, you would declare it like this:
     212
     213bool ConvertToType(JSContextRef context, JSObjectRef object, JSTypeCode typeCode, JSValueRef* returnValue);
     214
     215If this function returns false, the conversion request forwards to object's parent class chain (which includes the default object class).
     216*/
    72217typedef bool
    73 (*JSConvertToTypeCallback)      (JSObjectRef object, JSTypeCode typeCode, JSValueRef* returnValue);
    74 
    75 typedef struct __JSObjectCallbacks {
     218(*JSConvertToTypeCallback)      (JSContextRef context, JSObjectRef object, JSTypeCode typeCode, JSValueRef* returnValue);
     219
     220/*!
     221@struct JSObjectCallbacks
     222@abstract This structure contains optional callbacks for supplementing default object behavior. Any callback field can be NULL.
     223@field version The version number of this structure. The current version is 0.
     224@field initialize The callback invoked when an object is first created. Use this callback in conjunction with JSObjectSetPrivate to initialize private data in your object.
     225@field finalize The callback invoked when an object is finalized (prepared for garbage collection). Use this callback to release resources allocated for your object, and perform other cleanup.
     226@field hasProperty The callback invoked when determining whether an object has a given property. If this field is NULL, getProperty will be called instead. The hasProperty callback enables optimization in cases where only a property's existence needs to be known, not its value, and computing its value would be expensive.
     227@field getProperty The callback invoked when getting the value of a given property.
     228@field setProperty The callback invoked when setting the value of a given property.
     229@field deleteProperty The callback invoked when deleting a given property.
     230@field getPropertyList The callback invoked when adding an object's properties to a property list.
     231@field callAsFunction The callback invoked when an object is called as a function.
     232@field callAsConstructor The callback invoked when an object is used as a constructor in a 'new' statement.
     233@field convertToType The callback invoked when converting an object to a particular JavaScript type.
     234*/
     235typedef struct {
    76236    int                         version; // current (and only) version is 0
    77237    JSInitializeCallback        initialize;
     
    87247} JSObjectCallbacks;
    88248
     249/*!
     250@const kJSObjectCallbacksNone
     251@abstract A JSObjectCallbacks structure of the current version, filled with NULL callbacks.
     252@discussion Use this constant as a convenience when creating callback structures. For example, to create a callback structure that has only a finalize method:
     253
     254JSObjectCallbacks callbacks = kJSObjectCallbacksNone;
     255
     256callbacks.finalize = Finalize;
     257*/
    89258extern const JSObjectCallbacks kJSObjectCallbacksNone;
    90259
     260/*!
     261@struct JSStaticValue
     262@abstract This structure describes a static value property.
     263@field name A UTF8 buffer containing the property's name.
     264@field getProperty A JSGetPropertyCallback to invoke when getting the property's value.
     265@field setProperty A JSSetPropertyCallback to invoke when setting the property's value.
     266@field attributes A logically ORed set of JSPropertyAttributes to give to the property.
     267*/
    91268typedef struct {
    92269    const char* const name; // FIXME: convert UTF8
     
    96273} JSStaticValue;
    97274
     275/*!
     276@struct JSStaticFunction
     277@abstract This structure describes a static function property.
     278@field name A UTF8 buffer containing the property's name.
     279@field callAsFunction A JSCallAsFunctionCallback to invoke when the property is called as a function.
     280@field attributes A logically ORed set of JSPropertyAttributes to give to the property.
     281*/
    98282typedef struct {
    99283    const char* const name; // FIXME: convert UTF8
     
    102286} JSStaticFunction;
    103287
    104 JSClassRef JSClassCreate(JSContextRef context, JSStaticValue* staticValues, JSStaticFunction* staticFunctions, const JSObjectCallbacks* callbacks, JSClassRef parentClass);
     288/*!
     289@function
     290@abstract Creates a JavaScript class suitable for use with JSObjectMake. Ownership follows the create rule.
     291@param staticValues A JSStaticValue array representing the class's static value properties. Pass NULL to specify no static value properties. The array must be terminated by a JSStaticValue whose name field is NULL.
     292@param staticFunctions A JSStaticFunction array representing the class's static function properties. Pass NULL to specify no static function properties. The array must be terminated by a JSStaticFunction whose name field is NULL.
     293@param callbacks A pointer to a JSObjectCallbacks structure holding custom callbacks for supplementing default object behavior. Pass NULL to specify no custom behavior.
     294@param parentClass A JSClass to set as the class's parent class. Pass NULL use the default object class.
     295@discussion The simplest and most efficient way to add custom properties to a class is by specifying static values and functions. Standard JavaScript practice calls for functions to be placed in prototype objects, so that they can be shared among objects.
     296*/
     297JSClassRef JSClassCreate(JSStaticValue* staticValues, JSStaticFunction* staticFunctions, const JSObjectCallbacks* callbacks, JSClassRef parentClass);
     298/*!
     299@function
     300@abstract Retains a JavaScript class.
     301@param jsClass The JSClass to retain.
     302@result A JSClass that is the same as jsClass.
     303*/
     304JSClassRef JSClassRetain(JSClassRef jsClass);
     305/*!
     306@function
     307@abstract Releases a JavaScript class.
     308@param jsClass The JSClass to release.
     309*/
    105310void JSClassRelease(JSClassRef jsClass);
    106 JSClassRef JSClassRetain(JSClassRef jsClass);
    107 
    108 // pass NULL as prototype to get the built-in object prototype
     311
     312/*!
     313@function
     314@abstract Creates a JavaScript object with a given class and prototype.
     315@param context The execution context to use.
     316@param jsClass The JSClass to assign to the object. Pass NULL to use the default object class.
     317@param prototype The prototype to assign to the object. Pass NULL to use the default object prototype.
     318@result A JSObject with the given class and prototype.
     319*/
    109320JSObjectRef JSObjectMake(JSContextRef context, JSClassRef jsClass, JSObjectRef prototype);
    110321
    111 // Will be assigned the built-in function prototype
     322/*!
     323@function
     324@abstract Convenience method for creating a JavaScript function with a given callback as its implementation.
     325@param context The execution context to use.
     326@param callAsFunction The JSCallAsFunctionCallback to invoke when the function is called.
     327@result A JSObject that is an anonymous function. The object's prototype will be the default function prototype.
     328*/
    112329JSObjectRef JSFunctionMake(JSContextRef context, JSCallAsFunctionCallback callAsFunction);
    113 // Will be assigned the built-in object prototype
     330/*!
     331@function
     332@abstract Convenience method for creating a JavaScript constructor with a given callback as its implementation.
     333@param context The execution context to use.
     334@param callAsConstructor The JSCallAsConstructorCallback to invoke when the constructor is used in a 'new' statement.
     335@result A JSObject that is a constructor. The object's prototype will be the default object prototype.
     336*/
    114337JSObjectRef JSConstructorMake(JSContextRef context, JSCallAsConstructorCallback callAsConstructor);
    115338
    116 // returns NULL if functionBody has a syntax error
    117 JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSStringBufferRef body, JSStringBufferRef sourceURL, int startingLineNumber);
    118 
     339/*!
     340@function
     341@abstract Creates a function with a given script as its body.
     342@param context The execution context to use.
     343@param body A JSStringBuffer containing the script to use as the function's body.
     344@param sourceURL A JSStringBuffer containing a URL for the script's source file. This is only used when reporting exceptions. Pass NULL if you do not care to include source file information in exceptions.
     345@param startingLineNumber An integer value specifying the script's starting line number in the file located at sourceURL. This is only used when reporting exceptions.
     346@param exception A pointer to a JSValueRef in which to store a syntax error exception, if any. Pass NULL if you do not care to store a syntax error exception.
     347@result A JSObject that is an anonymous function, or NULL if body contains a syntax error. The returned object's prototype will be the default function prototype.
     348@discussion Use this method when you want to execute a script repeatedly, to avoid the cost of re-parsing the script before each execution.
     349*/
     350JSObjectRef JSFunctionMakeWithBody(JSContextRef context, JSStringBufferRef body, JSStringBufferRef sourceURL, int startingLineNumber, JSValueRef* exception);
     351
     352/*!
     353@function
     354@abstract Gets a short description of a JavaScript object.
     355@param context The execution context to use.
     356@param object The object whose description you want to get.
     357@result A JSStringBuffer containing the object's description. This is usually the object's class name.
     358*/
    119359JSStringBufferRef JSObjectGetDescription(JSObjectRef object);
    120360
     361/*!
     362@function
     363@abstract Gets an object's prototype.
     364@param object A JSObject whose prototype you want to get.
     365@result A JSValue containing the object's prototype.
     366*/
    121367JSValueRef JSObjectGetPrototype(JSObjectRef object);
     368/*!
     369@function
     370@abstract Sets an object's prototype.
     371@param object The JSObject whose prototype you want to set.
     372@param value A JSValue to set as the object's prototype.
     373*/
    122374void JSObjectSetPrototype(JSObjectRef object, JSValueRef value);
    123375
     376/*!
     377@function
     378@abstract Tests whether an object has a certain property.
     379@param object The JSObject to test.
     380@param propertyName A JSStringBuffer containing the property's name.
     381@result true if the object has a property whose name matches propertyName, otherwise false.
     382*/
    124383bool JSObjectHasProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
     384/*!
     385@function
     386@abstract Gets a property from an object.
     387@param context The execution context to use.
     388@param object The JSObject whose property you want to get.
     389@param propertyName A JSStringBuffer containing the property's name.
     390@param value A pointer to a JSValueRef in which to store the property's value. On return, value will contain the property's value. Pass NULL if you do not care to store the property's value.
     391@result true if the object has a property whose name matches propertyName, otherwise false. If this function returns false, the contents of value will be unmodified.
     392*/
    125393bool JSObjectGetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef* value);
     394/*!
     395@function
     396@abstract Sets a property on an object.
     397@param context The execution context to use.
     398@param object The JSObject whose property you want to set.
     399@param propertyName A JSStringBuffer containing the property's name.
     400@param value A JSValue to use as the property's value.
     401@param attributes A logically ORed set of JSPropertyAttributes to give to the property.
     402@result true if the set operation succeeds, otherwise false (for example, if the object already has a property of the given name with the kJSPropertyAttributeReadOnly attribute set).
     403*/
    126404bool JSObjectSetProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName, JSValueRef value, JSPropertyAttributes attributes);
     405/*!
     406@function
     407@abstract Deletes a property from an object.
     408@param context The execution context to use.
     409@param object The JSObject whose property you want to delete.
     410@param propertyName A JSStringBuffer containing the property's name.
     411@result true if the delete operation succeeds, otherwise false (for example, if the property has the kJSPropertyAttributeDontDelete attribute set).
     412*/
    127413bool JSObjectDeleteProperty(JSContextRef context, JSObjectRef object, JSStringBufferRef propertyName);
    128414
    129 // Only works with objects created by JSObjectMake
     415/*!
     416@function
     417@abstract Gets a pointer to private data from an object.
     418@param object A JSObject whose private data you want to get.
     419@result A void* that points to the object's private data, or NULL if the object has no private data.
     420@discussion JSObjectGetPrivate and JSObjectSetPrivate only work on custom objects created by JSObjectMake, JSFunctionMake, and JSConstructorMake.
     421*/
    130422void* JSObjectGetPrivate(JSObjectRef object);
     423/*!
     424@function
     425@abstract Sets a pointer to private data on an object.
     426@param object A JSObject whose private data you want to set.
     427@param data A void* that points to the object's private data.
     428@result true if the set operation succeeds, otherwise false.
     429@discussion JSObjectGetPrivate and JSObjectSetPrivate only work on custom objects created by JSObjectMake, JSFunctionMake, and JSConstructorMake.
     430*/
    131431bool JSObjectSetPrivate(JSObjectRef object, void* data);
    132432
     433/*!
     434@function
     435@abstract Tests whether an object is a function.
     436@param object The JSObject to test.
     437@result true if the object is a function, otherwise false.
     438*/
    133439bool JSObjectIsFunction(JSObjectRef object);
     440/*!
     441@function
     442@abstract Calls an object as a function.
     443@param context The execution context to use.
     444@param object The JSObject to call as a function.
     445@param thisObject The JSObject to use as 'this' in the function call.
     446@param argc An integer count of the number of arguments in argv.
     447@param argv A JSValue array of the  arguments to pass to the function.
     448@param exception A pointer to a JSValueRef in which to store an uncaught exception, if any. Pass NULL if you do not care to store an uncaught exception.
     449@result The JSValue that results from calling object as a function, or NULL if an uncaught exception is thrown or object is not a function.
     450*/
    134451JSValueRef JSObjectCallAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef thisObject, size_t argc, JSValueRef argv[], JSValueRef* exception);
     452/*!
     453@function
     454@abstract Tests whether an object is a constructor.
     455@param object The JSObject to test.
     456@result true if the object is a constructor, otherwise false.
     457*/
    135458bool JSObjectIsConstructor(JSObjectRef object);
     459/*!
     460@function
     461@abstract Calls an object as a constructor.
     462@param context The execution context to use.
     463@param object The JSObject to call as a constructor.
     464@param argc An integer count of the number of arguments in argv.
     465@param argv A JSValue array of the  arguments to pass to the function.
     466@param exception A pointer to a JSValueRef in which to store an uncaught exception, if any. Pass NULL if you do not care to store an uncaught exception.
     467@result The JSObject that results from calling object as a constructor, or NULL if an uncaught exception is thrown or object is not a constructor.
     468*/
    136469JSObjectRef JSObjectCallAsConstructor(JSContextRef context, JSObjectRef object, size_t argc, JSValueRef argv[], JSValueRef* exception);
    137470
    138 // Used for enumerating the names of an object's properties like a for...in loop would
     471/*!
     472@function
     473@abstract Creates an enumerator for an object's properties.
     474@param context The execution context to use.
     475@param object The object whose properties you want to enumerate.
     476@result A JSPropertyEnumerator with a list of object's properties. Ownership follows the create rule.
     477*/
    139478JSPropertyEnumeratorRef JSObjectCreatePropertyEnumerator(JSContextRef context, JSObjectRef object);
     479/*!
     480@function
     481@abstract Retains a property enumerator.
     482@param enumerator The JSPropertyEnumerator to retain.
     483@result A JSPropertyEnumerator that is the same as enumerator.
     484*/
    140485JSPropertyEnumeratorRef JSPropertyEnumeratorRetain(JSPropertyEnumeratorRef enumerator);
     486/*!
     487@function
     488@abstract Releases a property enumerator.
     489@param enumerator The JSPropertyEnumerator to release.
     490*/
    141491void JSPropertyEnumeratorRelease(JSPropertyEnumeratorRef enumerator);
     492/*!
     493@function
     494@abstract Gets a property enumerator's next property.
     495@param context The execution context to use.
     496@param enumerator The JSPropertyEnumerator whose next property you want to get.
     497@result A JSStringBuffer containing the property's name, or NULL if all properties have been enumerated.
     498*/
    142499JSStringBufferRef JSPropertyEnumeratorGetNext(JSContextRef context, JSPropertyEnumeratorRef enumerator);
    143500
    144 // Used for adding property names to a for...in enumeration
     501/*!
     502@function
     503@abstract Adds a property to a property list.
     504@discussion Use this method inside a JSGetPropertyListCallback to add a custom property to an object's property list.
     505@param propertyList The JSPropertyList to which you want to add a property.
     506@param thisObject The JSObject to which the property belongs.
     507@param propertyName A JSStringBuffer specifying the property's name.
     508*/
    145509void JSPropertyListAdd(JSPropertyListRef propertyList, JSObjectRef thisObject, JSStringBufferRef propertyName);
    146510
Note: See TracChangeset for help on using the changeset viewer.