From 155ae10f60ab8efe6f1753f042ca22eee64274db Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Thu, 18 Jul 2024 10:21:22 +0900 Subject: [PATCH] Throw, instead of assert, for transferring detached ArrayBuffers This makes the algorithm more user-friendly, as this is generally the desired behavior, and the algorithm can already throw for other reasons so callers are expected to handle that. --- index.bs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 44a0001d..e3549ebf 100644 --- a/index.bs +++ b/index.bs @@ -9075,7 +9075,8 @@ a reference to the same object that the IDL value represents. 1. Let |jsArrayBuffer| be the result of [=converted to a JavaScript value|converting=] |arrayBuffer| to a JavaScript value. - 1. Assert: [$IsDetachedBuffer$](|jsArrayBuffer|) is false. + 1. If [$IsDetachedBuffer$](|jsArrayBuffer|) is false, then [=JavaScript/throw=] a + {{TypeError}}. 1. Let |arrayBufferData| be |jsArrayBuffer|.\[[ArrayBufferData]]. 1. Let |arrayBufferByteLength| be |jsArrayBuffer|.\[[ArrayBufferByteLength]]. 1. Perform [=?=] [$DetachArrayBuffer$](|jsArrayBuffer|). @@ -9088,7 +9089,8 @@ a reference to the same object that the IDL value represents. value of type {{ArrayBuffer}}.

This will throw an exception under the same circumstances as - [=ArrayBuffer/detaching=]. + [=ArrayBuffer/detaching=], and also for {{ArrayBuffer}}s that are already + [=BufferSource/detached=].

Frozen arrays — FrozenArray<|T|>