diff --git a/runtime/builtins/builtins_array.cpp b/runtime/builtins/builtins_array.cpp index e3bdb9ee59282a00640a218104658ccd92cfa916..c57ac6c205c2b0c888554f24c0bd7732c3762f9e 100644 --- a/runtime/builtins/builtins_array.cpp +++ b/runtime/builtins/builtins_array.cpp @@ -1026,8 +1026,8 @@ JSTaggedValue BuiltinsArray::Filter(EcmaRuntimeCallInfo *argv) arguments->MakeArgv(kValue, key, thisObjVal); JSTaggedValue callResult = JSFunction::Call(thread, callbackFnHandle, thisArgHandle, 3, arguments->GetArgv()); // 3: three args - bool boolResult = callResult.ToBoolean(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + bool boolResult = callResult.ToBoolean(); if (boolResult) { toIndexHandle.Update(JSTaggedValue(toIndex)); JSObject::CreateDataPropertyOrThrow(thread, newArrayHandle, toIndexHandle, kValue); @@ -1150,8 +1150,8 @@ JSTaggedValue BuiltinsArray::FindIndex(EcmaRuntimeCallInfo *argv) arguments->MakeArgv(kValue, key, thisObjVal); JSTaggedValue callResult = JSFunction::Call(thread, callbackFnHandle, thisArgHandle, 3, arguments->GetArgv()); // 3: three args - bool boolResult = callResult.ToBoolean(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + bool boolResult = callResult.ToBoolean(); if (boolResult) { return GetTaggedDouble(k); } @@ -2322,8 +2322,8 @@ JSTaggedValue BuiltinsArray::Some(EcmaRuntimeCallInfo *argv) arguments->MakeArgv(kValue, key, thisObjVal); JSTaggedValue callResult = JSFunction::Call(thread, callbackFnHandle, thisArgHandle, 3, arguments->GetArgv()); // 3: three args - bool boolResult = callResult.ToBoolean(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + bool boolResult = callResult.ToBoolean(); if (boolResult) { return GetTaggedBoolean(true); } diff --git a/runtime/builtins/builtins_typedarray.cpp b/runtime/builtins/builtins_typedarray.cpp index 8479cf25bc3425ffb537434a5910e8364787a6af..e0bde4cc7d2962404f79db1eb466bf25bf45202b 100644 --- a/runtime/builtins/builtins_typedarray.cpp +++ b/runtime/builtins/builtins_typedarray.cpp @@ -569,8 +569,8 @@ JSTaggedValue BuiltinsTypedArray::Filter(EcmaRuntimeCallInfo *argv) arguments->MakeArgv(kValue, tKey, thisHandle); JSTaggedValue callResult = JSFunction::Call(thread, callbackFnHandle, thisArgHandle, 3, arguments->GetArgv()); // 3: three args - bool testResult = callResult.ToBoolean(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + bool testResult = callResult.ToBoolean(); if (testResult) { kept->Set(thread, captured, kValue); captured++; diff --git a/runtime/js_proxy.cpp b/runtime/js_proxy.cpp index f70d83b25c345298847ccf0d108435a4dceb59ca..9b48817a4f405a8e1dc283d894fb72eed4ea6a91 100644 --- a/runtime/js_proxy.cpp +++ b/runtime/js_proxy.cpp @@ -143,6 +143,7 @@ bool JSProxy::SetPrototype(JSThread *thread, const JSHandle &proxy, con // 9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, V»)). // If booleanTrapResult is false, return false + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); bool booleanTrapResult = trapResult.ToBoolean(); if (!booleanTrapResult) { return false; @@ -198,11 +199,11 @@ bool JSProxy::IsExtensible(JSThread *thread, const JSHandle &proxy) InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(targetHandle); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 1, arguments->GetArgv()); - - bool booleanTrapResult = trapResult.ToBoolean(); // 9. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + bool booleanTrapResult = trapResult.ToBoolean(); + // 10. Let targetResult be target.[[IsExtensible]](). // 11. ReturnIfAbrupt(targetResult). // 12. If SameValue(booleanTrapResult, targetResult) is false, throw a TypeError exception. @@ -245,10 +246,10 @@ bool JSProxy::PreventExtensions(JSThread *thread, const JSHandle &proxy InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(targetHandle); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 1, arguments->GetArgv()); - - bool booleanTrapResult = trapResult.ToBoolean(); // 9. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + bool booleanTrapResult = trapResult.ToBoolean(); // 10. If booleanTrapResult is true, then // a. Let targetIsExtensible be target.[[IsExtensible]](). // b. ReturnIfAbrupt(targetIsExtensible). @@ -393,10 +394,10 @@ bool JSProxy::DefineOwnProperty(JSThread *thread, const JSHandle &proxy arguments->MakeArgv(targetHandle, propKey, descObj); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 3, arguments->GetArgv()); // 3: target, key and desc - - bool booleanTrapResult = trapResult.ToBoolean(); // 11. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + bool booleanTrapResult = trapResult.ToBoolean(); if (!booleanTrapResult) { return false; } @@ -479,11 +480,11 @@ bool JSProxy::HasProperty(JSThread *thread, const JSHandle &proxy, cons arguments->MakeArgv(targetHandle, propKey); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 2, arguments->GetArgv()); // 2: target and key - - bool booleanTrapResult = trapResult.ToBoolean(); // 10. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + bool booleanTrapResult = trapResult.ToBoolean(); + // 11. If booleanTrapResult is false, then if (!booleanTrapResult) { // a. Let targetDesc be target.[[GetOwnProperty]](P). @@ -606,10 +607,10 @@ bool JSProxy::SetProperty(JSThread *thread, const JSHandle &proxy, cons arguments->MakeArgv(targetHandle, propKey, value, receiver); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 4, arguments->GetArgv()); // 4: «target, P, V, Receiver» - - bool booleanTrapResult = trapResult.ToBoolean(); // 11. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + bool booleanTrapResult = trapResult.ToBoolean(); if (!booleanTrapResult) { return false; } @@ -662,10 +663,10 @@ bool JSProxy::DeleteProperty(JSThread *thread, const JSHandle &proxy, c arguments->MakeArgv(targetHandle, key); JSTaggedValue trapResult = JSFunction::Call(thread, trap, handlerTag, 2, arguments->GetArgv()); // 2: target and key - - bool booleanTrapResult = trapResult.ToBoolean(); // 11. ReturnIfAbrupt(booleanTrapResult). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + bool booleanTrapResult = trapResult.ToBoolean(); if (!booleanTrapResult) { return false; }