Skip to content

Commit

Permalink
[JSC] Add some missing exception checks to arrayProtoFuncIncludes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=288416
rdar://145514228

Reviewed by Yijia Huang and Michael Saboff.

Need to keep the exception check verifier happy.

* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/290995@main
  • Loading branch information
dhecht committed Feb 25, 2025
1 parent 36a8f48 commit 5f23c78
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Source/JavaScriptCore/runtime/ArrayPrototype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2157,14 +2157,18 @@ JSC_DEFINE_HOST_FUNCTION(arrayProtoFuncIncludes, (JSGlobalObject* globalObject,

if (LIKELY(isJSArray(thisObject))) {
JSArray* thisArray = jsCast<JSArray*>(thisObject);
if (auto fastResult = thisArray->fastIncludes(globalObject, searchElement, index, length))
auto fastResult = thisArray->fastIncludes(globalObject, searchElement, index, length);
RETURN_IF_EXCEPTION(scope, { });
if (fastResult)
return JSValue::encode(jsBoolean(fastResult.value()));
}

for (; index < length; ++index) {
auto currentElement = thisObject->getIndex(globalObject, index);
RETURN_IF_EXCEPTION(scope, { });
if (sameValueZero(globalObject, searchElement, currentElement))
bool isEqual = sameValueZero(globalObject, searchElement, currentElement);
RETURN_IF_EXCEPTION(scope, { });
if (isEqual)
return JSValue::encode(jsBoolean(true));
}

Expand Down

0 comments on commit 5f23c78

Please sign in to comment.