[whatwg/streams] Reference impl: Use arrow functions for `size` functions (#1142)

The reference implementation uses `function` expressions to create the `size()` functions for `CountQueuingStrategy` and `ByteLengthQueuingStrategy`, which results in them being constructible and have `prototype` properties. This PR changes to using arrow functions to better conform to the spec; see original discussion below:

> Printing
> 
> ```js
> new ByteLengthQueuingStrategy({ highWaterMark: 100 }).size.prototype
> ```
>
> gives undefined in Chrome and Firefox. The Streams spec calls CreateBuiltinFunction without calling MakeConstructor, which is the abstract op that adds the `prototype` property. So it would appear that we should in fact use arrow functions after all
>
> _Originally posted by @TimothyGu in https://github.com/jsdom/jsdom/pull/3200#discussion_r661008480_
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/1142

-- Commit Summary --

  * Use arrow functions for size functions

-- File Changes --

    M reference-implementation/lib/ByteLengthQueuingStrategy-impl.js (7)
    M reference-implementation/lib/CountQueuingStrategy-impl.js (7)

-- Patch Links --

https://github.com/whatwg/streams/pull/1142.patch
https://github.com/whatwg/streams/pull/1142.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/1142

Received on Wednesday, 30 June 2021 21:04:37 UTC