From 6d031e314a69312311f5324df6a7229794e51ab6 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Sat, 15 Feb 2025 13:40:09 -0500 Subject: [PATCH] Validate mutability in DetachArrayBuffer Ref #30 --- spec.emu | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/spec.emu b/spec.emu index 0026413..6eb0ff4 100644 --- a/spec.emu +++ b/spec.emu @@ -492,6 +492,31 @@ contributors: Mark S. Miller, Richard Gibson + +

+ DetachArrayBuffer ( + _arrayBuffer_: an ArrayBuffer, + optional _key_: anything, + ): either a normal completion containing ~unused~ or a throw completion +

+
+
skip global checks
+
true
+
+ + 1. Assert: IsSharedArrayBuffer(_arrayBuffer_) is *false*. + 1. If _key_ is not present, set _key_ to *undefined*. + 1. If _arrayBuffer_.[[ArrayBufferDetachKey]] is not _key_, throw a *TypeError* exception. + 1. If IsImmutableBuffer(_arrayBuffer_) is *true*, throw a *TypeError* exception. + 1. Set _arrayBuffer_.[[ArrayBufferData]] to *null*. + 1. Set _arrayBuffer_.[[ArrayBufferByteLength]] to 0. + 1. Return ~unused~. + + +

Detaching an ArrayBuffer instance disassociates the Data Block used as its backing store from the instance and sets the byte length of the buffer to 0.

+
+
+

SetValueInBuffer (