[whatwg/webidl] "byte length of a buffer source type" needs updating for resizable buffers (Issue #1385)

### What is the issue with the Web IDL Standard?

As of [this proposal](https://github.com/tc39/proposal-resizablearraybuffer) / [PR](https://github.com/tc39/ecma262/pull/3116), the `[[ByteLength]]` slot on TypedArrays and DataViews can be `~auto~` instead of an integer. Consumers of [the "byte length of a buffer source" operation](https://webidl.spec.whatwg.org/#buffersource-byte-length) (like [`encodeInto`](https://encoding.spec.whatwg.org/#dom-textencoder-encodeinto)) probably want [TypedArrayByteLength](https://tc39.es/ecma262/multipage/ordinary-and-exotic-objects-behaviours.html#sec-typedarraybytelength) or [GetViewByteLength](https://tc39.es/ecma262/multipage/structured-data.html#sec-getviewbytelength) instead of the raw value of the `[[ByteLength]]` slot.

Also, when getting the length of an ArrayBuffer, this should probably use the [ArrayBufferByteLength](https://tc39.es/ecma262/multipage/structured-data.html#sec-arraybufferbytelength) abstract operation, not raw access of the slot.

There's some other raw uses of the `[[ByteLength]]` slot, like in ["write a byte sequence bytes into an ArrayBufferView"](https://webidl.spec.whatwg.org/#arraybufferview-write), which should probably also be updated.

cc @syg

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

Message ID: <whatwg/webidl/issues/1385@github.com>

Received on Sunday, 21 January 2024 02:07:50 UTC