You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Normative: Always report assignment failure to canonical numeric string properties of immutable-backed TypedArray instances
Note that this includes non-integer-index but still canonical numeric
properties such as "-0", "-1", "1.2", and String(2**53) =
"9007199254740992", but does not include non-canonical-numeric
properties such as "1.20", "1e3", and "0x20".
Ideally, TypedArrays would restrict special treatment of canonical
numeric string properties to the strict subset that are integer indices
(aligning with similar treatment in String), but that is out of scope
for this commit.
Copy file name to clipboardExpand all lines: spec.emu
+5-3
Original file line number
Diff line number
Diff line change
@@ -131,8 +131,9 @@ contributors: Mark S. Miller, Richard Gibson
131
131
1. If _P_ is a String, then
132
132
1. Let _numericIndex_ be CanonicalNumericIndexString(_P_).
133
133
1. If _numericIndex_ is not *undefined*, then
134
+
1. <ins>NOTE: TypedArray instances restrict own and inherited canonical numeric string properties to integer indices valid for their backing buffers, but assignment failures for canonical numeric string properties are only reported when the buffer is immutable.</ins>
135
+
1. <ins>If IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, return *false*.</ins>
134
136
1. If SameValue(_O_, _Receiver_) is *true*, then
135
-
1. <ins>IsValidIntegerIndex(_O_, _numericIndex_) is *true* and IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *true*, return *false*.</ins>
1. If IsValidIntegerIndex(_O_, _numericIndex_) is *false*, return *true*.
@@ -151,9 +152,10 @@ contributors: Mark S. Miller, Richard Gibson
151
152
<dl class="header">
152
153
</dl>
153
154
<emu-alg>
155
+
1. <ins>Assert: IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *false*.</ins>
154
156
1. If _O_.[[ContentType]] is ~bigint~, let _numValue_ be ? ToBigInt(_value_).
155
157
1. Otherwise, let _numValue_ be ? ToNumber(_value_).
156
-
1. If IsValidIntegerIndex(_O_, _index_) is *true* <ins>and IsImmutableBuffer(_O_.[[ViewedArrayBuffer]]) is *false*</ins>, then
158
+
1. If IsValidIntegerIndex(_O_, _index_) is *true*, then
157
159
1. Let _offset_ be _O_.[[ByteOffset]].
158
160
1. Let _elementSize_ be TypedArrayElementSize(_O_).
159
161
1. Let _byteIndexInBuffer_ be (ℝ(_index_) × _elementSize_) + _offset_.
@@ -162,7 +164,7 @@ contributors: Mark S. Miller, Richard Gibson
162
164
1. Return ~unused~.
163
165
</emu-alg>
164
166
<emu-note>
165
-
<p>This operation always appears to succeed, but it has no effect when attempting to write past the end of a TypedArray or to a TypedArray which is backed by a detached <ins>or immutable</ins> ArrayBuffer.</p>
167
+
<p>This operation always appears to succeed, but it has no effect when attempting to write past the end of a TypedArray or to a TypedArray which is backed by a detached ArrayBuffer.</p>
0 commit comments