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

@MattiasBuelens commented on this pull request.



> -        1.  Set |jsArrayBuffer| to |jsBufferSource|.\[[ViewedArrayBuffer]].
-        1.  Set |offset| to |jsBufferSource|.\[[ByteOffset]].
-        1.  Set |length| to |jsBufferSource|.\[[ByteLength]].
-    1.  Otherwise:
-        1.  Assert: |jsBufferSource| is an {{ArrayBuffer}} or
-            {{SharedArrayBuffer}} object.
-        1.  Set |length| to |jsBufferSource|.\[[ArrayBufferByteLength]].
-    1.  If [$IsDetachedBuffer$](|jsArrayBuffer|) is true, then return the empty
-        [=byte sequence=].
+    1.  If |bufferSource| is a [=buffer view type=] instance:
+        1.  Set |arrayBuffer| to |bufferSource|'s [=BufferSource/underlying buffer=].
+        1.  Set |offset| to |bufferSource|'s [=ArrayBufferView/byte offset=].
+    1.  If |length| is 0, then return the empty [=byte sequence=].
+
+        <p class="note">This step is not strictly necessary, since [=the range=] below is empty
+        when |length| is 0. It is spelled out as a fast path for implementations.

With the changes from #1632, this should no longer be a *necessary* step. I'll bring the note back.

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

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

Received on Monday, 31 August 2026 08:26:32 UTC