On Jun 1, 2009, at 8:29 AM, Jack Wootton wrote:
It seems some casting is required for this though? JSValueRef JSObjectCallAsFunction(
[snip]
The above function accepts a JSObjectRef object. However JSValueRef JSObjectGetProperty(
[snip]
returns JSValueRef
Setting aside the actual typedefs (which are our attempt to trick the C type system), JavaScript has objects and some primitive values that are not objects. So every object is a kind of value, but not all values are objects.
JSObjectGetProperty retrieves a property from an object, and it can't guarantee whether the result will be an object or a primitive, so it returns JSValueRef. If you can be certain the value is in fact an object (functions are a kind of object), you can just downcast. If you are not certain (for example the property can be defined or altered by script), you can use JSValueIsObject to check before casting.
Regards, Maciej _______________________________________________ webkit-dev mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

