Bugfix:dataAccessor judge propertybox first.

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I7KABT?from=project-issue

Signed-off-by: yaochaonan <yaochaonan@huawei.com>
Change-Id: Ibdd72fe2448201336615b497bab7df37a1b1b1e5
This commit is contained in:
yaochaonan 2023-07-11 19:06:41 +08:00
parent 0e846f3aa1
commit a919fdcab2
3 changed files with 13 additions and 3 deletions

View File

@ -973,9 +973,12 @@ bool JSObject::OrdinaryGetOwnProperty(JSThread *thread, const JSHandle<JSObject>
op.ToPropertyDescriptor(desc);
if (desc.HasValue() && obj->IsJSGlobalObject()) {
PropertyBox *cell = PropertyBox::Cast(desc.GetValue().GetTaggedValue().GetTaggedObject());
JSHandle<JSTaggedValue> valueHandle(thread, cell->GetValue());
desc.SetValue(valueHandle);
JSTaggedValue val = desc.GetValue().GetTaggedValue();
if (val.IsPropertyBox()) {
PropertyBox *cell = PropertyBox::Cast(val.GetTaggedObject());
JSHandle<JSTaggedValue> valueHandle(thread, cell->GetValue());
desc.SetValue(valueHandle);
}
}
return true;

View File

@ -21,6 +21,12 @@
*/
// CopyDataProperties
this[1024] = 4;
const o = {
...this,
};
print(JSON.stringify(o));
var s = "abc";
var t = {...s};
print(t[1]);

View File

@ -11,4 +11,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
{"1024":4}
b