chakra-core / chakra-core/ChakraCore

Enumeration order incorrect with deletes

Open
#4,486 2 comments 0 reactions 0 assignees View on GitHub
Bug ES Spec Conformance Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

```
let obj = {x: 1, y: 2};
obj.p1 = 1;
obj.p2 = 2;
delete obj.p1;
obj.p1 = 1;

let str = '';
for (prop in obj) {
str += '<' + prop + '> ';
}

print(str);

┌─────────────────────┬───────────────────┐
│ Chakra │ │
├─────────────────────┼───────────────────┤
│ JavaScriptCore │ │
│ SpiderMonkey │ │
│ V8 │ │
└─────────────────────┴───────────────────┘
```

JSC, SM, and V8 have the proper behavior here. The spec requires that own properties are enumerated in order of creation. In the example above, p1 is the last property created and so should be last (the fact that it existed before is not relevant).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.