diff --git a/API/hermes/hermes.cpp b/API/hermes/hermes.cpp index f7d4791c306..fb9eecf8d39 100644 --- a/API/hermes/hermes.cpp +++ b/API/hermes/hermes.cpp @@ -29,6 +29,8 @@ #include "hermes/VM/JSArrayBuffer.h" #include "hermes/VM/JSLib.h" #include "hermes/VM/JSLib/RuntimeJSONUtils.h" +#include "hermes/VM/JSObject.h" +#include "hermes/VM/JSProxy.h" #include "hermes/VM/NativeState.h" #include "hermes/VM/Operations.h" #include "hermes/VM/Profiler/CodeCoverageProfiler.h" @@ -1996,7 +1998,20 @@ void HermesRuntimeImpl::setPropertyValue( } bool HermesRuntimeImpl::isArray(const jsi::Object &obj) const { - return vm::vmisa(phv(obj)); + vm::JSObject *jsobj = static_cast(phv(obj).getPointer()); + while (true) { + if (vm::vmisa(jsobj)) { + return true; + } + if (LLVM_LIKELY(!jsobj->isProxyObject())) { + return false; + } + if (vm::JSProxy::isRevoked(jsobj, runtime_)) { + return false; + } + jsobj = vm::JSProxy::getTarget(jsobj, runtime_).get(); + assert(jsobj && "target of non-revoked Proxy is null"); + } } bool HermesRuntimeImpl::isArrayBuffer(const jsi::Object &obj) const {