chakra-core / chakra-core/ChakraCore

Property enumeration order of String exotic objects is wrong

Open
#5,697 1 comment 0 reactions 0 assignees View on GitHub
Bug Compatibility ECMAScript Spec Severity: 2
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Consider:

```js
let obj = Object('asdf');
obj.a = 1;
console.log(Reflect.ownKeys(obj).map(x => x.toString()).join(','));
```

Per the overload for [`[[OwnPropertyKeys]]` for String exotic objects](https://tc39.github.io/ecma262/#sec-string-exotic-objects-ownpropertykeys), and in accord with every other browser, this should print

```
0,1,2,3,length,a
```

But in fact it prints

```
0,1,2,3,a,length
```

See also [this open spec PR](https://github.com/tc39/ecma262/pull/1242) about very large integer indices and [this related ChakraCore issue](https://github.com/Microsoft/ChakraCore/issues/3396) about enumeration order for classes.

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.