Skip to content

Commit

Permalink
Normative: Return false in [[PreventExtensions]] for variable length …
Browse files Browse the repository at this point in the history
…TypedArrays (#3453)

Fixes #3385
  • Loading branch information
syg authored and ljharb committed Nov 21, 2024
1 parent 35af909 commit c1040ff
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -14708,7 +14708,20 @@ <h1>
<h1>TypedArray Exotic Objects</h1>
<p>A TypedArray is an exotic object that performs special handling of integer index property keys.</p>
<p>TypedArrays have the same internal slots as ordinary objects and additionally [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], [[ContentType]], and [[TypedArrayName]] internal slots.</p>
<p>An object is a <dfn id="typedarray" oldids="integer-indexed-exotic-object" variants="TypedArrays">TypedArray</dfn> if its [[GetOwnProperty]], [[HasProperty]], [[DefineOwnProperty]], [[Get]], [[Set]], [[Delete]], and [[OwnPropertyKeys]] internal methods use the definitions in this section, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots"></emu-xref>. These methods are installed by TypedArrayCreate.</p>
<p>An object is a <dfn id="typedarray" oldids="integer-indexed-exotic-object" variants="TypedArrays">TypedArray</dfn> if its [[PreventExtensions]], [[GetOwnProperty]], [[HasProperty]], [[DefineOwnProperty]], [[Get]], [[Set]], [[Delete]], and [[OwnPropertyKeys]], internal methods use the definitions in this section, and its other essential internal methods use the definitions found in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots"></emu-xref>. These methods are installed by TypedArrayCreate.</p>

<emu-clause id="sec-typedarray-preventextensions" type="internal method">
<h1>[[PreventExtensions]] ( ): a normal completion containing a Boolean</h1>
<dl class="header">
<dt>for</dt>
<dd>a TypedArray _O_</dd>
</dl>
<emu-alg>
1. NOTE: The extensibility-related invariants specified in <emu-xref href="#sec-invariants-of-the-essential-internal-methods"></emu-xref> do not allow this method to return *true* when _O_ can gain (or lose and then regain) properties, which might occur for properties with integer index names when its underlying buffer is resized.
1. If IsTypedArrayFixedLength(_O_) is *false*, return *false*.
1. Return OrdinaryPreventExtensions(_O_).
</emu-alg>
</emu-clause>

<emu-clause id="sec-typedarray-getownproperty" oldids="sec-integer-indexed-exotic-objects-getownproperty-p" type="internal method">
<h1>
Expand Down Expand Up @@ -14936,6 +14949,7 @@ <h1>
<emu-alg>
1. Let _internalSlotsList_ be « [[Prototype]], [[Extensible]], [[ViewedArrayBuffer]], [[TypedArrayName]], [[ContentType]], [[ByteLength]], [[ByteOffset]], [[ArrayLength]] ».
1. Let _A_ be MakeBasicObject(_internalSlotsList_).
1. Set _A_.[[PreventExtensions]] as specified in <emu-xref href="#sec-typedarray-preventextensions"></emu-xref>.
1. Set _A_.[[GetOwnProperty]] as specified in <emu-xref href="#sec-typedarray-getownproperty"></emu-xref>.
1. Set _A_.[[HasProperty]] as specified in <emu-xref href="#sec-typedarray-hasproperty"></emu-xref>.
1. Set _A_.[[DefineOwnProperty]] as specified in <emu-xref href="#sec-typedarray-defineownproperty"></emu-xref>.
Expand Down Expand Up @@ -15015,6 +15029,22 @@ <h1>
</emu-alg>
</emu-clause>

<emu-clause id="sec-istypedarrayfixedlength" type="abstract operation">
<h1>
IsTypedArrayFixedLength (
_O_: a TypedArray,
): a Boolean
</h1>
<dl class="header">
</dl>
<emu-alg>
1. If _O_.[[ArrayLength]] is ~auto~, return *false*.
1. Let _buffer_ be _O_.[[ViewedArrayBuffer]].
1. If IsFixedLengthArrayBuffer(_buffer_) is *false* and IsSharedArrayBuffer(_buffer_) is *false*, return *false*.
1. Return *true*.
</emu-alg>
</emu-clause>

<emu-clause id="sec-isvalidintegerindex" type="abstract operation">
<h1>
IsValidIntegerIndex (
Expand Down

0 comments on commit c1040ff

Please sign in to comment.