Ignore:
Timestamp:
Jul 14, 2006, 9:10:31 PM (19 years ago)
Author:
ggaren
Message:

Reviewed by Maciej.


  • Finalized exception handling in the API.


setProperty can throw because it throws for built-in arrays. getProperty
and deleteProperty can throw because setProperty can throw and we want
to be consistent, and also because they seem like "actions." callAsFunction,
callAsConstructor, and hasInstance can throw, because they caan throw for
all built-ins.


toBoolean can't throw because it's defined that way in the spec.


  • Documented that toBoolean and toObject can't be overridden by custom objects because they're defined that way in the spec.
File:
1 edited

Legend:

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

    r15400 r15443  
    9090        // optional optimization to bypass getProperty in cases when we only need to know if the property exists
    9191        if (JSObjectHasPropertyCallback hasProperty = jsClass->callbacks.hasProperty) {
    92             if (hasProperty(context, thisRef, propertyNameRef, toRef(exec->exceptionSlot()))) {
     92            if (hasProperty(context, thisRef, propertyNameRef)) {
    9393                slot.setCustom(this, callbackGetter);
    9494                return true;
     
    322322}
    323323
    324 bool JSCallbackObject::toBoolean(ExecState* exec) const
    325 {
    326     JSContextRef context = toRef(exec);
    327     JSObjectRef thisRef = toRef(this);
    328 
    329     for (JSClassRef jsClass = m_class; jsClass; jsClass = jsClass->parent)
    330         if (JSObjectConvertToTypeCallback convertToType = jsClass->callbacks.convertToType)
    331             if (JSValueRef value = convertToType(context, thisRef, kJSTypeBoolean, toRef(exec->exceptionSlot())))
    332                 return toJS(value)->getBoolean();
    333 
    334     return JSObject::toBoolean(exec);
    335 }
    336 
    337324double JSCallbackObject::toNumber(ExecState* exec) const
    338325{
Note: See TracChangeset for help on using the changeset viewer.