Skip to content

Commit 2875529

Browse files
committed
Add notes clarifying the extra detach checks
1 parent a0c64c3 commit 2875529

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

spec.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38109,6 +38109,7 @@ <h1>AtomicReadModifyWrite ( _typedArray_, _index_, _value_, _op_ )</h1>
3810938109
1. If _typedArray_.[[ContentType]] is ~BigInt~, let _v_ be ? ToBigInt(_value_).
3811038110
1. Otherwise, let _v_ be ? ToInteger(_value_).
3811138111
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
38112+
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
3811238113
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3811338114
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3811438115
1. Let _offset_ be _typedArray_.[[ByteOffset]].
@@ -38124,6 +38125,7 @@ <h1>AtomicLoad ( _typedArray_, _index_ )</h1>
3812438125
1. Let _buffer_ be ? ValidateIntegerTypedArray(_typedArray_).
3812538126
1. Let _i_ be ? ValidateAtomicAccess(_typedArray_, _index_).
3812638127
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
38128+
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ValidateAtomicAccess on the preceding line can have arbitrary side effects, which could cause the buffer to become detached.
3812738129
1. Let _arrayTypeName_ be _typedArray_.[[TypedArrayName]].
3812838130
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3812938131
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
@@ -38209,6 +38211,7 @@ <h1>Atomics.compareExchange ( _typedArray_, _index_, _expectedValue_, _replaceme
3820938211
1. Let _expected_ be ? ToInteger(_expectedValue_).
3821038212
1. Let _replacement_ be ? ToInteger(_replacementValue_).
3821138213
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
38214+
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
3821238215
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3821338216
1. Let _isLittleEndian_ be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record.
3821438217
1. Let _expectedBytes_ be NumericToRawBytes(_elementType_, _expected_, _isLittleEndian_).
@@ -38278,6 +38281,7 @@ <h1>Atomics.store ( _typedArray_, _index_, _value_ )</h1>
3827838281
1. If _arrayTypeName_ is *"BigUint64Array"* or *"BigInt64Array"*, let _v_ be ? ToBigInt(_value_).
3827938282
1. Otherwise, let _v_ be ? ToInteger(_value_).
3828038283
1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception.
38284+
1. NOTE: The above check is not redundant with the check in ValidateIntegerTypedArray because the call to ToBigInt or ToInteger on the preceding lines can have arbitrary side effects, which could cause the buffer to become detached.
3828138285
1. Let _elementSize_ be the Element Size value specified in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3828238286
1. Let _elementType_ be the Element Type value in <emu-xref href="#table-the-typedarray-constructors"></emu-xref> for _arrayTypeName_.
3828338287
1. Let _offset_ be _typedArray_.[[ByteOffset]].

0 commit comments

Comments
 (0)