Re: [heycam/webidl] Normative: Match ECMA‑262 function property enumeration order (#914)

`Reflect.ownKeys(Blob)`:

- Chrome: ["length", "name", "arguments", "caller", "prototype"]
- Firefox: [ "length", "name", "prototype", Symbol("Symbol.hasInstance") ]
- Safari: ["prototype", "name", "length"]

So, Chrome has additional `arguments` and `caller` properties, which surprises me. (They appear to be non-functional, at least - `(function f(){ new Blob([], { get type(){ console.log(Blob.caller, Blob.arguments) } }) })()` prints `null` twice.)

But Chrome does match the enumeration order for the `length` and `name` properties, which I _think_ is the only change actually implied by this PR. In particular, ecma262 specifically refrains from specifying the full enumeration order, including of `prototype`; it only specifies that `length` appears before `name`. (The [test262 tests](https://github.com/EB-Forks/test262/blob/7fc0484aafa601cc411c2434cfac062559a136fe/test/built-ins/Function/property-order.js) for the corresponding [ecma262 PR](https://github.com/tc39/ecma262/pull/2116) are much more permissive than the WPT linked above.)

So, possibly the WPT is just over-zealous for the actual change implied by this PR, and could be changed to match the ecma262 PR. Then both Chrome and Firefox would pass.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/pull/914#issuecomment-912666522

Received on Friday, 3 September 2021 16:34:44 UTC