Changeset 97381 in webkit for trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
- Timestamp:
- Oct 13, 2011, 12:24:53 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r97292 r97381 480 480 481 481 template <class Parent> 482 double JSCallbackObject<Parent>::toNumber(ExecState* exec) const483 {484 // We need this check to guard against the case where this object is rhs of485 // a binary expression where lhs threw an exception in its conversion to486 // primitive487 if (exec->hadException())488 return std::numeric_limits<double>::quiet_NaN();489 JSContextRef ctx = toRef(exec);490 JSObjectRef thisRef = toRef(this);491 492 for (JSClassRef jsClass = classRef(); jsClass; jsClass = jsClass->parentClass)493 if (JSObjectConvertToTypeCallback convertToType = jsClass->convertToType) {494 JSValueRef exception = 0;495 JSValueRef value;496 {497 APICallbackShim callbackShim(exec);498 value = convertToType(ctx, thisRef, kJSTypeNumber, &exception);499 }500 if (exception) {501 throwError(exec, toJS(exec, exception));502 return 0;503 }504 if (!value)505 continue;506 507 JSValue jsValue = toJS(exec, value);508 if (!jsValue.isNumber())509 return std::numeric_limits<double>::quiet_NaN();510 return jsValue.asNumber();511 }512 513 return Parent::toNumber(exec);514 }515 516 template <class Parent>517 482 void JSCallbackObject<Parent>::setPrivate(void* data) 518 483 {
Note:
See TracChangeset
for help on using the changeset viewer.