Bug 186691 - [[OwnPropertyKeys]] order with large integer index keys up to 2 ** 53 - 1
Summary: [[OwnPropertyKeys]] order with large integer index keys up to 2 ** 53 - 1
Status: RESOLVED CONFIGURATION CHANGED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 13:40 PDT by Leo Balter
Modified: 2020-11-29 11:51 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Balter 2018-06-15 13:40:36 PDT
From https://tc39.github.io/ecma262/#sec-object-type

> An integer index is a String-valued property key that is a canonical numeric String (see 7.1.16) and whose numeric value is either +0 or a positive integer ≤ 2**53-1. An array index is an integer index whose numeric value i is in the range +0 ≤ i < 2**32-1.

https://github.com/tc39/test262/pull/1580

Current behavior is not taking values from 2 ** 32 and up as integer index.

```
var o1 = {
  12345678900: true,
  b: true,
  1: true,
  a: true,
  [Number.MAX_SAFE_INTEGER]: true,
  12345678901: true,
};

var result = Object.getOwnPropertyNames(o1);

result.forEach(k => console.log(k));
```


prints:

```
"1"
"12345678900"
"b"
"a"
"9007199254740991"
"12345678901"
```

It should print:

```
"1"
"12345678900"
"12345678901"
"9007199254740991"
"b"
"a"
```
Comment 1 Alexey Shvayka 2020-11-29 11:51:19 PST
(In reply to Leo Balter from comment #0)
> https://github.com/tc39/test262/pull/1580
> 
> Current behavior is not taking values from 2 ** 32 and up as integer index.

https://github.com/tc39/ecma262/pull/1242 replaced "integer index" with "array index", aligning the spec with web reality.

(In reply to Leo Balter from comment #0)
> "1"
> "12345678900"
> "b"
> "a"
> "9007199254740991"
> "12345678901"

is now printed by JSC, V8, and SpiderMonkey as per updated spec.