Skip to content

Commit 155ae10

Browse files
committed
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.
1 parent d6927d5 commit 155ae10

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

index.bs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9075,7 +9075,8 @@ a reference to the same object that the IDL value represents.
90759075

90769076
1. Let |jsArrayBuffer| be the result of [=converted to a JavaScript value|converting=]
90779077
|arrayBuffer| to a JavaScript value.
9078-
1. Assert: [$IsDetachedBuffer$](|jsArrayBuffer|) is false.
9078+
1. If [$IsDetachedBuffer$](|jsArrayBuffer|) is false, then [=JavaScript/throw=] a
9079+
<l spec=ecmascript>{{TypeError}}</l>.
90799080
1. Let |arrayBufferData| be |jsArrayBuffer|.\[[ArrayBufferData]].
90809081
1. Let |arrayBufferByteLength| be |jsArrayBuffer|.\[[ArrayBufferByteLength]].
90819082
1. Perform [=?=] [$DetachArrayBuffer$](|jsArrayBuffer|).
@@ -9088,7 +9089,8 @@ a reference to the same object that the IDL value represents.
90889089
value of type {{ArrayBuffer}}.
90899090

90909091
<p class="note">This will throw an exception under the same circumstances as
9091-
[=ArrayBuffer/detaching=].
9092+
[=ArrayBuffer/detaching=], and also for {{ArrayBuffer}}s that are already
9093+
[=BufferSource/detached=].
90929094
</div>
90939095

90949096
<h4 id="js-frozen-array" oldids="es-frozen-array">Frozen arrays — FrozenArray&lt;|T|&gt;</h4>

0 commit comments

Comments
 (0)