Ignore:
Timestamp:
Jul 16, 2006, 7:00:40 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Change getProperty* to return undefined, rather than NULL, for missing properties, since that's what the spec says. Also added exception out parameters to the *Index functions, because they can call through to the regular functions, which can throw for custom objects.
  • API/JSObjectRef.cpp: (JSObjectGetProperty): (JSObjectGetPropertyAtIndex): (JSObjectSetPropertyAtIndex):
  • API/JSObjectRef.h:
  • API/testapi.c: (main):
File:
1 edited

Legend:

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

    r15469 r15474  
    149149
    150150    JSValue* jsValue = jsObject->get(exec, Identifier(nameRep));
    151     if (jsValue->isUndefined())
    152         jsValue = 0;
    153151    if (exec->hadException()) {
    154152        if (exception)
     
    175173}
    176174
    177 JSValueRef JSObjectGetPropertyAtIndex(JSContextRef context, JSObjectRef object, unsigned propertyIndex)
     175JSValueRef JSObjectGetPropertyAtIndex(JSContextRef context, JSObjectRef object, unsigned propertyIndex, JSValueRef* exception)
    178176{
    179177    JSLock lock;
     
    182180
    183181    JSValue* jsValue = jsObject->get(exec, propertyIndex);
    184     if (jsValue->isUndefined())
    185         return 0;
     182    if (exec->hadException()) {
     183        if (exception)
     184            *exception = toRef(exec->exception());
     185        exec->clearException();
     186    }
    186187    return toRef(jsValue);
    187188}
    188189
    189190
    190 void JSObjectSetPropertyAtIndex(JSContextRef context, JSObjectRef object, unsigned propertyIndex, JSValueRef value)
     191void JSObjectSetPropertyAtIndex(JSContextRef context, JSObjectRef object, unsigned propertyIndex, JSValueRef value, JSValueRef* exception)
    191192{
    192193    JSLock lock;
     
    196197   
    197198    jsObject->put(exec, propertyIndex, jsValue);
     199    if (exec->hadException()) {
     200        if (exception)
     201            *exception = toRef(exec->exception());
     202        exec->clearException();
     203    }
    198204}
    199205
Note: See TracChangeset for help on using the changeset viewer.