JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); APIEntryShim entryShim(exec); JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); if (!jsThisObject) jsThisObject = exec->globalThisValue(); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(exec, arguments[i])); CallData callData; CallType callType = jsObject->methodTable()->getCallData(jsObject, callData); if (callType == CallTypeNone) return 0; JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList)); if (exec->hadException()) { if (exception) *exception = toRef(exec, exec->exception()); exec->clearException(); result = 0; } return result; }
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); JSLockHolder locker(exec); if (!object) return 0; JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); if (!jsThisObject) jsThisObject = exec->globalThisValue(); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(exec, arguments[i])); CallData callData; CallType callType = jsObject->methodTable()->getCallData(jsObject, callData); if (callType == CallTypeNone) return 0; JSValueRef result = toRef(exec, profiledCall(exec, ProfilingReason::API, jsObject, callType, callData, jsThisObject, argList)); if (handleExceptionIfNeeded(exec, exception) == ExceptionStatus::DidThrow) result = 0; return result; }
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); exec->globalData().heap->registerThread(); JSLock lock(exec); JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); if (!jsThisObject) jsThisObject = exec->globalThisValue(); ArgList argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(arguments[i])); CallData callData; CallType callType = jsObject->getCallData(callData); if (callType == CallTypeNone) return 0; JSValueRef result = toRef(call(exec, jsObject, callType, callData, jsThisObject, argList)); if (exec->hadException()) { if (exception) *exception = toRef(exec->exception()); exec->clearException(); result = 0; } return result; }
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); JSLockHolder locker(exec); if (!object) return 0; JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); if (!jsThisObject) jsThisObject = exec->globalThisValue(); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(exec, arguments[i])); CallData callData; CallType callType = jsObject->methodTable()->getCallData(jsObject, callData); if (callType == CallTypeNone) return 0; JSValueRef result = toRef(exec, call(exec, jsObject, callType, callData, jsThisObject, argList)); if (exec->hadException()) { JSValue exceptionValue = exec->exception(); if (exception) *exception = toRef(exec, exceptionValue); exec->clearException(); #if ENABLE(REMOTE_INSPECTOR) exec->vmEntryGlobalObject()->inspectorController().reportAPIException(exec, exceptionValue); #endif result = 0; } return result; }
JSValueRef JSObjectCallAsFunction(JSContextRef ctx, JSObjectRef object, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { ExecState* exec = toJS(ctx); VM& vm = exec->vm(); JSLockHolder locker(vm); auto scope = DECLARE_CATCH_SCOPE(vm); if (!object) return 0; JSObject* jsObject = toJS(object); JSObject* jsThisObject = toJS(thisObject); if (!jsThisObject) jsThisObject = exec->globalThisValue(); MarkedArgumentBuffer argList; for (size_t i = 0; i < argumentCount; i++) argList.append(toJS(exec, arguments[i])); if (UNLIKELY(argList.hasOverflowed())) { auto throwScope = DECLARE_THROW_SCOPE(vm); throwOutOfMemoryError(exec, throwScope); handleExceptionIfNeeded(scope, exec, exception); return 0; } CallData callData; CallType callType = jsObject->methodTable(vm)->getCallData(jsObject, callData); if (callType == CallType::None) return 0; JSValueRef result = toRef(exec, profiledCall(exec, ProfilingReason::API, jsObject, callType, callData, jsThisObject, argList)); if (handleExceptionIfNeeded(scope, exec, exception) == ExceptionStatus::DidThrow) result = 0; return result; }