@@ -9036,9 +9036,10 @@ a reference to the same object that the IDL value represents.
9036
9036
|arrayBuffer| to a JavaScript value.
9037
9037
1. Perform [=?=] [$DetachArrayBuffer$](|jsArrayBuffer|).
9038
9038
9039
- <p class="note">This will throw an exception if |jsArrayBuffer| has an \[[ArrayBufferDetachKey]]
9040
- that is not undefined, such as is the case with the value of {{Memory|WebAssembly.Memory}}'s
9041
- {{Memory/buffer}} attribute. [[WASM-JS-API-1]]
9039
+ <p class="note" id="note-ArrayBuffer-detach-exceptions">This will throw an exception if
9040
+ |jsArrayBuffer| has an \[[ArrayBufferDetachKey]] that is not undefined, such as is the case
9041
+ with the value of {{Memory|WebAssembly.Memory}}'s {{Memory/buffer}} attribute.
9042
+ [[WASM-JS-API-1]]
9042
9043
9043
9044
<p class="note">Detaching a buffer that is already [=BufferSource/detached=] is a no-op.
9044
9045
</div>
@@ -9081,16 +9082,26 @@ a reference to the same object that the IDL value represents.
9081
9082
1. Let |arrayBufferByteLength| be |jsArrayBuffer|.\[[ArrayBufferByteLength]].
9082
9083
1. Perform [=?=] [$DetachArrayBuffer$](|jsArrayBuffer|).
9083
9084
1. If |targetRealm| is not given, let |targetRealm| be the [=current realm=].
9084
- 1. Let |jsTransferred| be [=! =]
9085
+ 1. Let |jsTransferred| be [=? =]
9085
9086
[$AllocateArrayBuffer$](|targetRealm|.\[[Intrinsics]].[[{{%ArrayBuffer%}}]], 0).
9086
9087
1. Set |jsTransferred|.\[[ArrayBufferData]] to |arrayBufferData|.
9087
9088
1. Set |jsTransferred|.\[[ArrayBufferByteLength]] to |arrayBufferByteLength|.
9088
9089
1. Return the result of [=converted to an IDL value|converting=] |jsTransferred| to an IDL
9089
9090
value of type {{ArrayBuffer}}.
9090
9091
9091
- <p class="note">This will throw an exception under the same circumstances as
9092
- [=ArrayBuffer/detaching=], and also for {{ArrayBuffer}}s that are already
9093
- [=BufferSource/detached=].
9092
+ <div class="note" id="note-ArrayBuffer-transfer-exceptions">
9093
+ This will throw an exception under any of the following circumstances:
9094
+
9095
+ * |arrayBuffer| cannot be [=BufferSource/detached=], for the reasons
9096
+ <a href="#note-ArrayBuffer-detach-exceptions">explained in that algorithm's
9097
+ definition</a>;
9098
+ * |arrayBuffer| is already [=BufferSource/detached=];
9099
+ * Sufficient memory cannot be allocated in |realm|. Generally this will only be the case
9100
+ if |realm| is in a different [=agent cluster=] than the one in which |arrayBuffer| was
9101
+ allocated. If they are in the same [=agent cluster=], then implementations will just
9102
+ change the backing pointers to get the same observable results with better performance
9103
+ and no allocations.
9104
+ </div>
9094
9105
</div>
9095
9106
9096
9107
<h4 id="js-frozen-array" oldids="es-frozen-array">Frozen arrays — FrozenArray<|T|></h4>
0 commit comments