[whatwg/streams] Meta: implement `TransferArrayBuffer` correctly in reference implementation (PR #1353)

Previously, the reference implementation did not implement the `TransferArrayBuffer` abstract op correctly, because we didn't have a way of doing that synchronously in user-land code. Today, we can use `ArrayBuffer.prototype.transfer()` for that.

I also updated the `TransferArrayBuffer` abstract op definition to use the ECMAScript [`ArrayBufferCopyAndDetach`](https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffercopyanddetach) abstract op, which is how [`transfer()`](https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer.prototype.transfer) and [`transferToFixedLength()`](https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybuffer.prototype.transfertofixedlength) are implemented. This should be entirely equivalent to the previous definition, but maybe we still want to flag this as an "editorial" change?

- [ ] At least two implementers are interested (and none opposed):
   * …
   * …
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * https://github.com/web-platform-tests/wpt/pull/54350
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chromium: …
   * Gecko: …
   * WebKit: …
   * Deno: …
   * Node.js: …
- [ ] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: …
- [ ] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use. <!-- If you created this PR from a single commit, Github copied its message. Otherwise, you need to add a commit message yourself. -->

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/streams/1353.html" title="Last updated on Aug 15, 2025, 10:59 AM UTC (852ded4)">Preview</a> | <a href="https://whatpr.org/streams/1353/4f2a2c1...852ded4.html" title="Last updated on Aug 15, 2025, 10:59 AM UTC (852ded4)">Diff</a>
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * Implement `TransferArrayBuffer` correctly in reference implementation
  * Fix `PullInto()` reading stale `byteLength` after transferring
  * Use `ArrayBufferCopyAndDetach` for `TransferArrayBuffer`
  * Roll WPT

-- File Changes --

    M index.bs (7)
    M reference-implementation/lib/abstract-ops/ecmascript.js (21)
    M reference-implementation/lib/abstract-ops/readable-streams.js (6)
    M reference-implementation/web-platform-tests (2)

-- Patch Links --

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

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

Message ID: <whatwg/streams/pull/1353@github.com>

Received on Friday, 15 August 2025 10:59:57 UTC