fix obj is proxy when getproperty

issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I8TXZQ

Signed-off-by: maojunwei <maojunwei1@huawei.com>
Change-Id: I4250da1cdf0fa908cfb7838451563c261b9071c6
This commit is contained in:
maojunwei 2024-01-05 16:43:21 +08:00
parent 39916b66b6
commit 50c4b2f2f4
4 changed files with 13 additions and 3 deletions

View File

@ -300,13 +300,13 @@ JSTaggedValue BuiltinsMap::AddEntriesFromIterable(JSThread *thread, const JSHand
return ret;
}
// Let k be Get(nextItem, "0").
JSHandle<JSTaggedValue> key = JSObject::GetProperty(thread, nextValue, keyIndex).GetValue();
JSHandle<JSTaggedValue> key = JSTaggedValue::GetProperty(thread, nextValue, keyIndex).GetValue();
// If k is an abrupt completion, return IteratorClose(iter, k).
if (thread->HasPendingException()) {
return JSIterator::IteratorCloseAndReturn(thread, iter);
}
// Let v be Get(nextItem, "1").
JSHandle<JSTaggedValue> value = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue();
JSHandle<JSTaggedValue> value = JSTaggedValue::GetProperty(thread, nextValue, valueIndex).GetValue();
// If v is an abrupt completion, return IteratorClose(iter, v).
if (thread->HasPendingException()) {
return JSIterator::IteratorCloseAndReturn(thread, iter);

View File

@ -86,7 +86,7 @@ JSTaggedValue BuiltinsSet::SetConstructor(EcmaRuntimeCallInfo *argv)
RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, nextValue.GetTaggedValue());
info->SetCallArg(nextValue.GetTaggedValue());
if (nextValue->IsArray(thread)) {
auto prop = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue();
auto prop = JSTaggedValue::GetProperty(thread, nextValue, valueIndex).GetValue();
info->SetCallArg(prop.GetTaggedValue());
}
JSFunction::Call(info);

View File

@ -22,3 +22,4 @@ name
1,2,3,4
undefined
constructor is fail
TypeError

View File

@ -80,3 +80,12 @@ try {
} catch (e) {
print("constructor is fail");
}
const v3 = new Uint8ClampedArray(WeakMap);
const o3 = {
};
const v6 = new Proxy(v3, o3);
try {
new WeakMap([v6]);
} catch (error) {
print(error.name);
}