| 505 | |
| 506 | template <class Parent> |
| 507 | EncodedJSValue JSCallbackObject<Parent>::call(ExecState* exec) |
| 508 | { |
| 509 | VM& vm = exec->vm(); |
| 510 | auto scope = DECLARE_THROW_SCOPE(vm); |
| 511 | |
| 512 | JSContextRef execRef = toRef(exec); |
| 513 | JSObjectRef functionRef = toRef(exec->jsCallee()); |
| 514 | JSObjectRef thisObjRef = toRef(jsCast<JSObject*>(exec->thisValue().toThis(exec, NotStrictMode))); |
| 515 | |
| 516 | for (JSClassRef jsClass = jsCast<JSCallbackObject<Parent>*>(toJS(functionRef))->classRef(); jsClass; jsClass = jsClass->parentClass) { |
| 517 | if (JSObjectCallAsFunctionCallback callAsFunction = jsClass->callAsFunction) { |
| 518 | size_t argumentCount = exec->argumentCount(); |
| 519 | Vector<JSValueRef, 16> arguments; |
| 520 | arguments.reserveInitialCapacity(argumentCount); |
| 521 | for (size_t i = 0; i < argumentCount; ++i) |
| 522 | arguments.uncheckedAppend(toRef(exec, exec->uncheckedArgument(i))); |
| 523 | JSValueRef exception = 0; |
| 524 | JSValue result; |
| 525 | { |
| 526 | JSLock::DropAllLocks dropAllLocks(exec); |
| 527 | result = toJS(exec, callAsFunction(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception)); |
| 528 | } |
| 529 | if (exception) |
| 530 | throwException(exec, scope, toJS(exec, exception)); |
| 531 | return JSValue::encode(result); |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | RELEASE_ASSERT_NOT_REACHED(); // getCallData should prevent us from reaching here |
| 536 | return JSValue::encode(JSValue()); |
| 537 | } |
| 538 | |
| 539 | template <class Parent> |
| 540 | void JSCallbackObject<Parent>::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) |