Bug 295485
| Summary: | [JSC] Fix order of function's special properties returned by Object.keys` / `Object.entries` | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Sosuke Suzuki <aosukeke> |
| Component: | JavaScriptCore | Assignee: | Sosuke Suzuki <aosukeke> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Sosuke Suzuki
According to the specification, `OrdinaryOwnPropertyKeys` called by
`Object.keys` or `Object.entries` on function objects should return
properties in ascending chronological order[1]. This order should not
be affected by `Object.defineProperty`. Therefore, when the `length`
and `name` properties of function objects are enumerable, they should
always come first.
However, in the current JSC implementation, they come last. This patch
fixes this behavior.
Note that the `prototype` property doesn't need to be considered here
as it is not configurable[2].
[1]: https://tc39.es/ecma262/#sec-ordinaryownpropertykeys
[2]: https://tc39.es/ecma262/#sec-function-instances
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Sosuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/47626
EWS
Committed 297260@main (1f495933fd51): <https://commits.webkit.org/297260@main>
Reviewed commits have been landed. Closing PR #47626 and removing active labels.
Radar WebKit Bug Importer
<rdar://problem/155607661>