diff options
Diffstat (limited to 'Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp')
-rw-r--r-- | Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp | 49 |
1 files changed, 20 insertions, 29 deletions
diff --git a/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp b/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp index f2647da29..18d07df7e 100644 --- a/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp +++ b/Source/JavaScriptCore/bindings/ScriptFunctionCall.cpp @@ -32,6 +32,7 @@ #include "config.h" #include "ScriptFunctionCall.h" +#include "JSCInlines.h" #include "JSLock.h" #include "ScriptValue.h" #include <wtf/text/WTFString.h> @@ -40,20 +41,6 @@ using namespace JSC; namespace Deprecated { -void ScriptCallArgumentHandler::appendArgument(const Deprecated::ScriptObject& argument) -{ - if (argument.scriptState() != m_exec) { - ASSERT_NOT_REACHED(); - return; - } - m_arguments.append(argument.jsObject()); -} - -void ScriptCallArgumentHandler::appendArgument(const Deprecated::ScriptValue& argument) -{ - m_arguments.append(argument.jsValue()); -} - void ScriptCallArgumentHandler::appendArgument(const String& argument) { JSLockHolder lock(m_exec); @@ -114,40 +101,44 @@ ScriptFunctionCall::ScriptFunctionCall(const Deprecated::ScriptObject& thisObjec { } -Deprecated::ScriptValue ScriptFunctionCall::call(bool& hadException) +JSValue ScriptFunctionCall::call(bool& hadException) { JSObject* thisObject = m_thisObject.jsObject(); - JSLockHolder lock(m_exec); + VM& vm = m_exec->vm(); + JSLockHolder lock(vm); + auto scope = DECLARE_THROW_SCOPE(vm); - JSValue function = thisObject->get(m_exec, Identifier(m_exec, m_name)); - if (m_exec->hadException()) { + JSValue function = thisObject->get(m_exec, Identifier::fromString(m_exec, m_name)); + if (UNLIKELY(scope.exception())) { hadException = true; - return Deprecated::ScriptValue(); + return { }; } CallData callData; CallType callType = getCallData(function, callData); - if (callType == CallTypeNone) - return Deprecated::ScriptValue(); + if (callType == CallType::None) + return { }; JSValue result; + NakedPtr<Exception> exception; if (m_callHandler) - result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments); + result = m_callHandler(m_exec, function, callType, callData, thisObject, m_arguments, exception); else - result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments); + result = JSC::call(m_exec, function, callType, callData, thisObject, m_arguments, exception); - if (m_exec->hadException()) { - hadException = true; - return Deprecated::ScriptValue(); + if (exception) { + // Do not treat a terminated execution exception as having an exception. Just treat it as an empty result. + hadException = !isTerminatedExecutionException(vm, exception); + return { }; } - return Deprecated::ScriptValue(m_exec->vm(), result); + return result; } -Deprecated::ScriptValue ScriptFunctionCall::call() +JSC::JSValue ScriptFunctionCall::call() { - bool hadException = false; + bool hadException; return call(hadException); } |