JSValue ScriptFunctionCall::call(bool& hadException) { JSObject* thisObject = m_thisObject.jsObject(); VM& vm = m_exec->vm(); JSLockHolder lock(vm); auto scope = DECLARE_THROW_SCOPE(vm); JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name)); if (UNLIKELY(scope.exception())) { hadException = true; return { }; } CallData callData; CallType callType = getCallData(function, callData); if (callType == CallType::None) return { }; JSValue result; NakedPtr<Exception> exception; if (m_callHandler) result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments, exception); else result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments, exception); if (exception) { // Do not treat a terminated execution exception as having an exception. Just treat it as an empty result. hadException = !isTerminatedExecutionException(exception); return { }; } return result; }
Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException) { JSObject* thisObject = m_thisObject.jsObject(); JSLockHolder lock(m_exec); JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name)); if (m_exec->hadException()) { hadException = true; return Deprecated::ScriptValue(); } CallData callData; CallType callType = getCallData(function, callData); if (callType == CallTypeNone) return Deprecated::ScriptValue(); JSValue result; NakedPtr<Exception> exception; if (m_callHandler) result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments, exception); else result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments, exception); if (exception) { hadException = true; return Deprecated::ScriptValue(); } return Deprecated::ScriptValue(m_exec->vm(), result); }