Re: [whatwg/webidl] Fix `BufferSource` algorithms for shared and resizable buffers (PR #1529)

MattiasBuelens left a comment (whatwg/webidl#1529)

I ran the new tests from https://github.com/web-platform-tests/wpt/pull/62301 against stable Chromium and Firefox, and there were already a few issues. 😅 

Chromium currently rejects `SharedArrayBuffer`s and `DataView`s on `WebAssembly` methods. see https://github.com/web-platform-tests/wpt/pull/62301#issuecomment-5476246270. Definitely a bug, since the Web IDL standard *as published today* already requires this to work. I filed [#555029264](https://issues.chromium.org/issues/555029264) on their end.

However, when Chromium decides to fix this bug, we'll need to decide what behavior they should be implementing for `DataView`s, specifically for **out-of-bounds DataViews**.
* The published Web IDL standard would read a stale `[[ByteLength]]` field - definitely wrong.
* Gecko (in Firefox 154) treats this as if the DataView were *empty*, matching the behavior for an out-of-bounds typed array. This appears to be the more "natural" behavior, as browsers can treat typed arrays and `DataView`s more or less the same.
* With this PR, browsers would need to *throw* instead. This aligns with [ECMAScript's `DataView.prototype.byteLength`](https://tc39.es/ecma262/multipage/structured-data.html#sec-get-dataview.prototype.bytelength), but requires browsers to have separate paths for typed arrays and `DataView`s instead of a single `ArrayBufferView` path.

Note that I haven't tested WebKit yet, since I don't have a macOS device. It might be interesting to know how they handle out-of-bounds `DataView`s, so we can better assess the impact of this change.

@bakkot Are we still happy with this change [as discussed earlier](https://github.com/whatwg/webidl/pull/1529#discussion_r2663169745)? If yes, I'll make sure to get implementer's interest from the Gecko folks, since this *will* change observable behavior in their implementation.

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

Message ID: <whatwg/webidl/pull/1529/c5476722427@github.com>

Received on Monday, 31 August 2026 09:57:46 UTC