From ae9cc707337b92b5971c91e04a84409d0140f282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=99=BA=E6=9D=B0?= Date: Mon, 25 Aug 2025 21:06:31 +0800 Subject: [PATCH] Add property in error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/ICUMWD?from=project-issue Signed-off-by: 刘智杰 Change-Id: Id4183b9440d6e304e37684465c0a202760db0755 --- ecmascript/compiler/stub_builder.cpp | 43 +++++++--- ecmascript/compiler/stub_builder.h | 1 + ecmascript/js_object.cpp | 25 +++++- ecmascript/js_object.h | 1 + ecmascript/message_string.h | 9 +- ecmascript/object_fast_operator-inl.h | 15 +++- ecmascript/stubs/runtime_stub_list.h | 1 + ecmascript/stubs/runtime_stubs.cpp | 24 ++++++ test/sharedtest/check/expect_output.txt | 8 +- test/sharedtest/sendable/expect_output.txt | 14 +++- test/sharedtest/sendable/sendable.ts | 83 +++++++++++++++++++ test/sharedtest/sharedarray/expect_output.txt | 14 ++-- test/sharedtest/sharedmap/expect_output.txt | 4 +- test/sharedtest/sharedset/expect_output.txt | 4 +- .../sharedset_extern/expect_output.txt | 4 +- .../sharedtypedarray/expect_output.txt | 4 +- 16 files changed, 219 insertions(+), 35 deletions(-) diff --git a/ecmascript/compiler/stub_builder.cpp b/ecmascript/compiler/stub_builder.cpp index 2f3bdd3aef..d2559c6c0e 100644 --- a/ecmascript/compiler/stub_builder.cpp +++ b/ecmascript/compiler/stub_builder.cpp @@ -4998,8 +4998,8 @@ GateRef StubBuilder::SetPropertyByIndex(GateRef glue, GateRef receiver, GateRef Bind(&throwNotExtensible); { if (mayThrow) { - GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible)); - CallRuntime(glue, RTSTUB_ID(ThrowTypeError), {IntToTaggedInt(taggedId)}); + GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensibleByIndex)); + CallRuntime(glue, RTSTUB_ID(ThrowTypeErrorWithParam), {IntToTaggedInt(taggedId), IntToTaggedInt(index)}); returnValue = Exception(); } else { returnValue = TaggedFalse(); @@ -5170,8 +5170,8 @@ GateRef StubBuilder::DefinePropertyByIndex(GateRef glue, GateRef receiver, GateR } Bind(&throwNotExtensible); { - GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible)); - CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) }); + GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensibleByIndex)); + CallRuntime(glue, RTSTUB_ID(ThrowTypeErrorWithParam), {IntToTaggedInt(taggedId), IntToTaggedInt(index)}); returnValue = Exception(); Jump(&exit); } @@ -5181,6 +5181,33 @@ GateRef StubBuilder::DefinePropertyByIndex(GateRef glue, GateRef receiver, GateR return ret; } +GateRef StubBuilder::ThrowTypeErrorInextensiableAddProperty(GateRef glue, GateRef key) +{ + auto env = GetEnvironment(); + Label subEntry(env); + env->SubCfgEntry(&subEntry); + Label exit(env); + Label isString(env); + Label notString(env); + BRANCH(TaggedIsString(glue, key), &isString, ¬String); + Bind(&isString); + { + GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensibleByName)); + CallRuntime(glue, RTSTUB_ID(ThrowTypeErrorWithParam), {IntToTaggedInt(taggedId), key}); + Jump(&exit); + } + Bind(¬String); + { + GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible)); + CallRuntime(glue, RTSTUB_ID(ThrowTypeError), {IntToTaggedInt(taggedId)}); + Jump(&exit); + } + Bind(&exit); + auto ret = Exception(); + env->SubCfgExit(); + return ret; +} + GateRef StubBuilder::SetPropertyByName(GateRef glue, GateRef receiver, GateRef key, @@ -5540,9 +5567,7 @@ GateRef StubBuilder::SetPropertyByName(GateRef glue, Bind(&inextensible); { if (mayThrow) { - GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible)); - CallRuntime(glue, RTSTUB_ID(ThrowTypeError), {IntToTaggedInt(taggedId)}); - result = Exception(); + result = ThrowTypeErrorInextensiableAddProperty(glue, key); } else { result = TaggedFalse(); } @@ -5837,9 +5862,7 @@ GateRef StubBuilder::DefinePropertyByName(GateRef glue, GateRef receiver, GateRe BRANCH(IsExtensible(glue, receiver), &extensible, &inextensible); Bind(&inextensible); { - GateRef taggedId = Int32(GET_MESSAGE_STRING_ID(SetPropertyWhenNotExtensible)); - CallRuntime(glue, RTSTUB_ID(ThrowTypeError), { IntToTaggedInt(taggedId) }); - result = Exception(); + result = ThrowTypeErrorInextensiableAddProperty(glue, key); Jump(&exit); } Bind(&extensible); diff --git a/ecmascript/compiler/stub_builder.h b/ecmascript/compiler/stub_builder.h index e8c38aa53c..859a205a52 100644 --- a/ecmascript/compiler/stub_builder.h +++ b/ecmascript/compiler/stub_builder.h @@ -882,6 +882,7 @@ public: bool canUseIsInternal = false, bool defineSemantics = false, bool mayThrow = true); // Crawl prototype chain + GateRef ThrowTypeErrorInextensiableAddProperty(GateRef glue, GateRef key); GateRef DefinePropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef isInternal, GateRef SCheckModelIsCHECK, ProfileOperation callback = ProfileOperation()); diff --git a/ecmascript/js_object.cpp b/ecmascript/js_object.cpp index bc0f2ac9ca..2df5b227c3 100644 --- a/ecmascript/js_object.cpp +++ b/ecmascript/js_object.cpp @@ -1032,6 +1032,29 @@ bool JSObject::SetPropertyForDataDescriptorProxy(JSThread *thread, ObjectOperato return CreateDataProperty(thread, JSHandle(receiver), key, value); } +bool JSObject::ThrowTypeErrorInextensiableAddProperty(ObjectOperator *op) +{ + JSThread *thread = op->GetThread(); + if (!op->IsElement()) { + JSHandle keyHandle = op->GetKey(); + if (keyHandle->IsString()) { + CString keyStr = ConvertToString(thread, EcmaString::Cast(keyHandle.GetTaggedValue())); + THROW_TYPE_ERROR_AND_RETURN( + thread, + GET_MESSAGE_STRING_WITH_PARAM(SetPropertyWhenNotExtensibleByName, keyStr.c_str()), + false); + } else { + THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetPropertyWhenNotExtensible), false); + } + } else { + uint32_t index = op->GetIndex(); + THROW_TYPE_ERROR_AND_RETURN( + thread, + GET_MESSAGE_STRING_WITH_PARAM(SetPropertyWhenNotExtensibleByIndex, index), + false); + } +} + bool JSObject::SetPropertyForDataDescriptor(ObjectOperator *op, JSHandle value, JSHandle &receiver, bool mayThrow, bool isInternalAccessor) { @@ -1106,7 +1129,7 @@ bool JSObject::SetPropertyForDataDescriptor(ObjectOperator *op, JSHandleIsExtensible(thread) && !(receiver->IsJSSharedArray() && op->IsElement())) { if (mayThrow) { - THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetPropertyWhenNotExtensible), false); + return ThrowTypeErrorInextensiableAddProperty(op); } return false; } diff --git a/ecmascript/js_object.h b/ecmascript/js_object.h index d05d1c9906..78e52ef616 100644 --- a/ecmascript/js_object.h +++ b/ecmascript/js_object.h @@ -862,6 +862,7 @@ private: static bool SetPropertyForDataDescriptorProxy(JSThread *thread, ObjectOperator *op, const JSHandle &value, JSHandle &receiver); + static bool ThrowTypeErrorInextensiableAddProperty(ObjectOperator *op); }; } // namespace ecmascript } // namespace panda diff --git a/ecmascript/message_string.h b/ecmascript/message_string.h index f8820ab3e7..cd7bf4bd33 100644 --- a/ecmascript/message_string.h +++ b/ecmascript/message_string.h @@ -17,7 +17,7 @@ #define ECMASCRIPT_MESSAGE_STRING_H #include - +#include "common_components/base/c_string.h" #include "ecmascript/compiler/common_stub_csigns.h" #include "ecmascript/compiler/interpreter_stub.h" @@ -33,6 +33,8 @@ namespace panda::ecmascript { V(NotSendableSubClass, "The subclass of sendable class must be a sendable class") \ V(FunctionCallNotConstructor, "class constructor cannot call") \ V(SetPropertyWhenNotExtensible, "Cannot add property in prevent extensions") \ + V(SetPropertyWhenNotExtensibleByIndex, "Cannot add property \"%d\" in prevent extensions") \ + V(SetPropertyWhenNotExtensibleByName, "Cannot add property \"%s\" in prevent extensions") \ V(GetPropertyOutOfBounds, "Get Property index out-of-bounds") \ V(CanNotSetPropertyOnContainer, "Cannot set property on Container") \ V(NonCallable, "CallObj is NonCallable") \ @@ -147,5 +149,10 @@ public: // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define GET_MESSAGE_STRING_ID(name) static_cast((MessageString::MessageId::Message_##name)) #define GET_MESSAGE_STRING(name) MessageString::GetMessageString(GET_MESSAGE_STRING_ID(name)).c_str() +#define GET_MESSAGE_STRING_WITH_PARAM(name, ...) \ + common::CString::FormatString( \ + MessageString::GetMessageString(GET_MESSAGE_STRING_ID(name)).c_str(), \ + __VA_ARGS__ \ + ).Str() } // namespace panda::ecmascript #endif // ECMASCRIPT_MESSAGE_STRING_H diff --git a/ecmascript/object_fast_operator-inl.h b/ecmascript/object_fast_operator-inl.h index f5d103dba5..9ca4faf4a8 100644 --- a/ecmascript/object_fast_operator-inl.h +++ b/ecmascript/object_fast_operator-inl.h @@ -624,8 +624,17 @@ JSTaggedValue ObjectFastOperator::SetPropertyByName(JSThread *thread, JSTaggedVa JSHandle valueHandle(thread, value); if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible())) { - THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetPropertyWhenNotExtensible), - JSTaggedValue::Exception()); + if (keyHandle->IsString()) { + CString keyStr = ConvertToString(thread, EcmaString::Cast(key)); + THROW_TYPE_ERROR_AND_RETURN( + thread, + GET_MESSAGE_STRING_WITH_PARAM(SetPropertyWhenNotExtensibleByName, keyStr.c_str()), + JSTaggedValue::Exception() + ); + } else { + THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetPropertyWhenNotExtensible), + JSTaggedValue::Exception()); + } } ASSERT(!receiver.IsJSShared()); PropertyAttributes attr = PropertyAttributes::Default(); @@ -1300,7 +1309,7 @@ JSTaggedValue ObjectFastOperator::AddPropertyByIndex(JSThread *thread, JSTaggedV [[maybe_unused]] EcmaHandleScope handleScope(thread); // fixme(hzzhouzebin) this makes SharedArray's frozen no sense. if (UNLIKELY(!JSObject::Cast(receiver)->IsExtensible()) && !receiver.IsJSSharedArray()) { - THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING(SetPropertyWhenNotExtensible), + THROW_TYPE_ERROR_AND_RETURN(thread, GET_MESSAGE_STRING_WITH_PARAM(SetPropertyWhenNotExtensibleByIndex, index), JSTaggedValue::Exception()); } diff --git a/ecmascript/stubs/runtime_stub_list.h b/ecmascript/stubs/runtime_stub_list.h index b51b764fdd..f9dcd9c4f0 100644 --- a/ecmascript/stubs/runtime_stub_list.h +++ b/ecmascript/stubs/runtime_stub_list.h @@ -243,6 +243,7 @@ namespace panda::ecmascript { V(CallJSObjDeletePrototype) \ V(ToPropertyKey) \ V(ThrowTypeError) \ + V(ThrowTypeErrorWithParam) \ V(MismatchError) \ V(NotifyArrayPrototypeChanged) \ V(NumberToString) \ diff --git a/ecmascript/stubs/runtime_stubs.cpp b/ecmascript/stubs/runtime_stubs.cpp index 9b13b9f3df..3f29022164 100644 --- a/ecmascript/stubs/runtime_stubs.cpp +++ b/ecmascript/stubs/runtime_stubs.cpp @@ -2197,6 +2197,30 @@ DEF_RUNTIME_STUBS(ThrowTypeError) THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData()); } +DEF_RUNTIME_STUBS(ThrowTypeErrorWithParam) +{ + RUNTIME_STUBS_HEADER(ThrowTypeError); + JSTaggedValue argMessageStringId = GetArg(argv, argc, 0); // 0: means the zeroth parameter + JSTaggedValue argParam = GetArg(argv, argc, 1); // 1: means the first parameter + std::string message = ""; + if (argParam.IsInt()) { // number + message = common::CString::FormatString( + MessageString::GetMessageString(argMessageStringId.GetInt()).c_str(), + argParam.GetInt() + ).Str(); + } else { // string + ASSERT(argParam.IsString()); + CString keyStr = ConvertToString(thread, EcmaString::Cast(argParam)); + message = common::CString::FormatString( + MessageString::GetMessageString(argMessageStringId.GetInt()).c_str(), + keyStr.c_str() + ).Str(); + } + ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSHandle error = factory->GetJSError(ErrorType::TYPE_ERROR, message.c_str(), StackCheck::NO); + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), JSTaggedValue::Hole().GetRawData()); +} + DEF_RUNTIME_STUBS(MismatchError) { RUNTIME_STUBS_HEADER(MismatchError); diff --git a/test/sharedtest/check/expect_output.txt b/test/sharedtest/check/expect_output.txt index e416357d85..3c396db90a 100644 --- a/test/sharedtest/check/expect_output.txt +++ b/test/sharedtest/check/expect_output.txt @@ -50,8 +50,8 @@ Fail to set prop through accessor with mismatched type. err: TypeError: Cannot s Start testUpdateInstanceFunction Fail to replace instance's func. err: TypeError: Cannot assign to read only property Start testUpdatePrototype -Fail to update prototype. err: TypeError: Cannot add property in prevent extensions -Fail to extend prop to constructor's prototype. err: TypeError: Cannot add property in prevent extensions +Fail to update prototype. err: TypeError: Cannot add property "staticSubClassPropString" in prevent extensions +Fail to extend prop to constructor's prototype. err: TypeError: Cannot add property "tmpProp" in prevent extensions I'm propString Fail to change constructor of instance's prototype. err: TypeError: Cannot assign to read only property Fail to replace instance's prototype. err: TypeError: Cannot set proto with sendable object @@ -65,10 +65,10 @@ Start testExtend Fail to extend prop with defineProperty. err: TypeError: Cannot define property Fail to extend prop1 with defineProperty. err: TypeError: Cannot define property Fail to extend prop2 with defineProperties. err: TypeError: Cannot define property -Fail to extend prop3 with stobjbyname. err: TypeError: Cannot add property in prevent extensions +Fail to extend prop3 with stobjbyname. err: TypeError: Cannot add property "prop3" in prevent extensions Start testObjectProtoFunc Start testObjectAssign -Fail to call Object.assign to extend target. err: TypeError: Cannot add property in prevent extensions +Fail to call Object.assign to extend target. err: TypeError: Cannot add property "a" in prevent extensions Fail to call Object.assign to update propString with mismatched type. err: TypeError: Cannot set sendable property with mismatched type Success to call Object.assign to update propString Start testObjectCreate diff --git a/test/sharedtest/sendable/expect_output.txt b/test/sharedtest/sendable/expect_output.txt index 810a721bf7..c5dbb5151b 100644 --- a/test/sharedtest/sendable/expect_output.txt +++ b/test/sharedtest/sendable/expect_output.txt @@ -22,7 +22,19 @@ sendable contain static non-sendable failed. err: TypeError: Cannot set sendable sendable contain undefined succeed. sendable contain lexenv succeed. sendable with concurrent decorator succeed. -sendable add property failed. err: TypeError: Cannot add property in prevent extensions, code: undefined +sendable add property failed. err: TypeError: Cannot add property "age" in prevent extensions, code: undefined sendable change property failed. err: TypeError: Cannot set sendable property with mismatched type, code: undefined sendable delete property failed. err: TypeError: Cannot delete property, code: undefined sendable can not change attr. err: TypeError: shared obj does not support changing or deleting attributes +TypeError: Cannot add property in prevent extensions +TypeError: Cannot add property "1" in prevent extensions +TypeError: Cannot add property "1" in prevent extensions +TypeError: Cannot add property "undefined" in prevent extensions +TypeError: Cannot add property "null" in prevent extensions +TypeError: Cannot add property "address" in prevent extensions +TypeError: Cannot add property in prevent extensions +TypeError: Cannot add property "address" in prevent extensions +TypeError: Cannot add property "1" in prevent extensions +TypeError: Cannot add property "1" in prevent extensions +TypeError: Cannot add property in prevent extensions +TypeError: Cannot add property "address" in prevent extensions diff --git a/test/sharedtest/sendable/sendable.ts b/test/sharedtest/sendable/sendable.ts index 1e48499166..9d415049f7 100644 --- a/test/sharedtest/sendable/sendable.ts +++ b/test/sharedtest/sendable/sendable.ts @@ -269,3 +269,86 @@ try { } catch (e) { print("sendable can not change attr. err: " + e); } + +const idSymbol = Symbol('id'); +let userString = '{"name":"lifei", "age":20, "1":"huawei"}' +class User { + constructor() { + "use sendable"; + } + name: string = ''; + age: number = 0; +} +let user = new User(); +let array = new SendableArray('ARK'); +try { + user[idSymbol] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property in prevent extensions +} + +try { + user[1] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "1" in prevent extensions +} + +try { + user["1"] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "1" in prevent extensions +} + +try { + user[undefined] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "undefined" in prevent extensions +} + +try { + user[null] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "null" in prevent extensions +} + +try { + user["address"] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "address" in prevent extensions +} + +try { + Object.assign(user, {[idSymbol]: ""}); +} catch (err) { + print(err); // TypeError: Cannot add property in prevent extensions +} + +try { + Object.assign(user, {"address": ""}); +} catch (err) { + print(err); // TypeError: Cannot add property "address" in prevent extensions +} + +try { + Object.assign(user, {1: ""}); +} catch (err) { + print(err); // TypeError: Cannot add property "1" in prevent extensions +} + +try { + Object.assign(user, {"1": ""}); +} catch (err) { + print(err); // TypeError: Cannot add property "1" in prevent extensions +} + +try { + array[idSymbol] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property in prevent extensions +} + +try { + array["address"] = ""; +} catch (err) { + print(err); // TypeError: Cannot add property "address" in prevent extensions +} \ No newline at end of file diff --git a/test/sharedtest/sharedarray/expect_output.txt b/test/sharedtest/sharedarray/expect_output.txt index 817aa63b89..76706cd71f 100644 --- a/test/sharedtest/sharedarray/expect_output.txt +++ b/test/sharedtest/sharedarray/expect_output.txt @@ -71,8 +71,8 @@ Start Test pop 60 Start Test randomUpdate 30 -add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined -add element by index access failed. err: TypeError: Cannot add property in prevent extensions, code: undefined +add element by index access failed. err: TypeError: Cannot add property "null" in prevent extensions, code: undefined +add element by index access failed. err: TypeError: Cannot add property "undefined" in prevent extensions, code: undefined add element by index access failed. err: BusinessError: The value of index is out of range., code: 10200001 Start Test randomGet 5,12,8,130,44 @@ -253,28 +253,28 @@ Start Test testStringForIC [IC] String Index access write out of range failed. err: BusinessError: The value of index is out of range., code: 10200001 Start Test arrayFrozenTest arrayFrozenTest [new] single string. arr: ARK -Add prop to array failed. err: TypeError: Cannot add property in prevent extensions +Add prop to array failed. err: TypeError: Cannot add property "notExistProp" in prevent extensions defineNotExistProp to array failed. err: TypeError: Cannot define property Update function [at] failed. err: TypeError: Cannot assign to read only property Update function [at] by defineProperty failed. err: TypeError: Cannot define property arrayFrozenTest [new]. arr: A,R,K -Add prop to array failed. err: TypeError: Cannot add property in prevent extensions +Add prop to array failed. err: TypeError: Cannot add property "notExistProp" in prevent extensions defineNotExistProp to array failed. err: TypeError: Cannot define property Update function [at] failed. err: TypeError: Cannot assign to read only property Update function [at] by defineProperty failed. err: TypeError: Cannot define property arrayFrozenTest static [from]. arr: A,R,K -Add prop to array failed. err: TypeError: Cannot add property in prevent extensions +Add prop to array failed. err: TypeError: Cannot add property "notExistProp" in prevent extensions defineNotExistProp to array failed. err: TypeError: Cannot define property Update function [at] failed. err: TypeError: Cannot assign to read only property Update function [at] by defineProperty failed. err: TypeError: Cannot define property arrayFrozenTest static [create]. arr: A,A,A -Add prop to array failed. err: TypeError: Cannot add property in prevent extensions +Add prop to array failed. err: TypeError: Cannot add property "notExistProp" in prevent extensions defineNotExistProp to array failed. err: TypeError: Cannot define property Update function [at] failed. err: TypeError: Cannot assign to read only property Update function [at] by defineProperty failed. err: TypeError: Cannot define property Start Test sharedArrayFrozenTest sharedArrayFrozenTest [new]. arr: A,R,K -Add prop to array failed. err: TypeError: Cannot add property in prevent extensions +Add prop to array failed. err: TypeError: Cannot add property "notExistProp" in prevent extensions defineNotExistProp to array failed. err: TypeError: Cannot define property Update function [at] failed. err: TypeError: Cannot assign to read only property Update function [at] by defineProperty failed. err: TypeError: Cannot define property diff --git a/test/sharedtest/sharedmap/expect_output.txt b/test/sharedtest/sharedmap/expect_output.txt index 2b8b5b2bfb..1e590ba6ed 100755 --- a/test/sharedtest/sharedmap/expect_output.txt +++ b/test/sharedtest/sharedmap/expect_output.txt @@ -91,8 +91,8 @@ sharedMap set[unshared]: BusinessError: Parameter error. Only accept sendable va ===Class inheritance test begin === true 1 -add extension(.): TypeError: Cannot add property in prevent extensions -add extension([]): TypeError: Cannot add property in prevent extensions +add extension(.): TypeError: Cannot add property "extension" in prevent extensions +add extension([]): TypeError: Cannot add property "extension" in prevent extensions SubSendableMap set[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 3 SubSendableMap [key, value][for-of]: [1, one] diff --git a/test/sharedtest/sharedset/expect_output.txt b/test/sharedtest/sharedset/expect_output.txt index 84bd2127aa..3887cf2b03 100755 --- a/test/sharedtest/sharedset/expect_output.txt +++ b/test/sharedtest/sharedset/expect_output.txt @@ -49,8 +49,8 @@ true false true true -add extension(.): TypeError: Cannot add property in prevent extensions -add extension([]): TypeError: Cannot add property in prevent extensions +add extension(.): TypeError: Cannot add property "extension" in prevent extensions +add extension([]): TypeError: Cannot add property "extension" in prevent extensions ===Basic test end=== ===Concurrent modification during iteration Test(iterator) begin=== set size is 5 diff --git a/test/sharedtest/sharedset_extern/expect_output.txt b/test/sharedtest/sharedset_extern/expect_output.txt index 7dab9c4864..a77e353c47 100755 --- a/test/sharedtest/sharedset_extern/expect_output.txt +++ b/test/sharedtest/sharedset_extern/expect_output.txt @@ -28,8 +28,8 @@ true true true 3 -add extension(.): TypeError: Cannot add property in prevent extensions -add extension([]): TypeError: Cannot add property in prevent extensions +add extension(.): TypeError: Cannot add property "extension" in prevent extensions +add extension([]): TypeError: Cannot add property "extension" in prevent extensions SubSubSendableSet add[unshared]: BusinessError: Parameter error. Only accept sendable value., errCode: 401 SubSubSendableSet Delete Scenario[forEach]: BusinessError: Concurrent modification exception, errCode: 10200201 ===Class inheritance test end === diff --git a/test/sharedtest/sharedtypedarray/expect_output.txt b/test/sharedtest/sharedtypedarray/expect_output.txt index bf9c4ad73b..76f70bbdec 100755 --- a/test/sharedtest/sharedtypedarray/expect_output.txt +++ b/test/sharedtest/sharedtypedarray/expect_output.txt @@ -659,8 +659,8 @@ true, array: [1,2,3] Object.freeze error: TypeError: Cannot define property Object.freeze freeze empty array success Object.defineProperty error: TypeError: Cannot define property -Add nonExistProp error: TypeError: Cannot add property in prevent extensions -Add nonExistProp error: TypeError: Cannot add property in prevent extensions +Add nonExistProp error: TypeError: Cannot add property "nonExistProp" in prevent extensions +Add nonExistProp error: TypeError: Cannot add property "nonExistProp" in prevent extensions ================Test Inheritance================ array: [1,4,3,2,5], sorted: [1,2,3,4,5] length: 5, byteLength: 20 -- Gitee