Re: [whatwg/webidl] [immutable-arraybuffer] add support for immutable array buffer (PR #1598)

@annevk commented on this pull request.



>  
     1.  Let |jsArrayBuffer| be [=?=]
         [$AllocateArrayBuffer$](|realm|.\[[Intrinsics]].\[[{{%ArrayBuffer%}}]], |bytes|'s
         [=byte sequence/length=]).
     1.  Let |arrayBuffer| be the result of [=converted to an IDL value|converting=] |jsArrayBuffer|
         to an IDL value of type {{ArrayBuffer}}.
     1.  [=ArrayBuffer/Write=] |bytes| into |arrayBuffer|.
+    1.  If |immutable| is <emu-val>true</emu-val>, then:
+        1.  Set |jsArrayBuffer| to [=?=]
+            [$AllocateImmutableArrayBuffer$](|realm|.\[[Intrinsics]].\[[{{%ArrayBuffer%}}]],
+            |bytes|'s [=byte sequence/length=], |jsArrayBuffer|.\[[ArrayBufferData]], 0,
+            |bytes|'s [=byte sequence/length=]).
+        1.  Set |arrayBuffer| to the result of [=converted to an IDL value|converting=]
+            |jsArrayBuffer| to an IDL value of type {{ArrayBuffer}}.

Now the immutable branch ends up doing a bunch of work twice. I think this can be structured a bit better.

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

Message ID: <whatwg/webidl/pull/1598/review/4252513640@github.com>

Received on Friday, 8 May 2026 13:20:30 UTC