- JSLock::DropAllLocks dropAllLocks;
- return toJS(m_callback(execRef, thisRef, thisObjRef, argumentCount, arguments.data(), toRef(exec->exceptionSlot())));
+ JSValueRef exception = 0;
+ JSValueRef result;
+ {
+ APICallbackShim callbackShim(exec);
+ result = jsCast<JSCallbackFunction*>(toJS(functionRef))->m_callback(execRef, functionRef, thisObjRef, argumentCount, arguments.data(), &exception);
+ }
+ if (exception)
+ throwError(exec, toJS(exec, exception));
+
+ // result must be a valid JSValue.
+ if (!result)
+ return JSValue::encode(jsUndefined());
+
+ return JSValue::encode(toJS(exec, result));
+}
+
+CallType JSCallbackFunction::getCallData(JSCell*, CallData& callData)
+{
+ callData.native.function = call;
+ return CallTypeHost;