Skip to content

Commit c1040ff

Browse files
sygljharb
authored andcommitted
Normative: Return false in [[PreventExtensions]] for variable length TypedArrays (#3453)
Fixes #3385
1 parent 35af909 commit c1040ff

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

spec.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14708,7 +14708,20 @@ <h1>
1470814708
<h1>TypedArray Exotic Objects</h1>
1470914709
<p>A TypedArray is an exotic object that performs special handling of integer index property keys.</p>
1471014710
<p>TypedArrays have the same internal slots as ordinary objects and additionally [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], [[ContentType]], and [[TypedArrayName]] internal slots.</p>
14711-
<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>
14711+
<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>
14712+
14713+
<emu-clause id="sec-typedarray-preventextensions" type="internal method">
14714+
<h1>[[PreventExtensions]] ( ): a normal completion containing a Boolean</h1>
14715+
<dl class="header">
14716+
<dt>for</dt>
14717+
<dd>a TypedArray _O_</dd>
14718+
</dl>
14719+
<emu-alg>
14720+
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.
14721+
1. If IsTypedArrayFixedLength(_O_) is *false*, return *false*.
14722+
1. Return OrdinaryPreventExtensions(_O_).
14723+
</emu-alg>
14724+
</emu-clause>
1471214725

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

15032+
<emu-clause id="sec-istypedarrayfixedlength" type="abstract operation">
15033+
<h1>
15034+
IsTypedArrayFixedLength (
15035+
_O_: a TypedArray,
15036+
): a Boolean
15037+
</h1>
15038+
<dl class="header">
15039+
</dl>
15040+
<emu-alg>
15041+
1. If _O_.[[ArrayLength]] is ~auto~, return *false*.
15042+
1. Let _buffer_ be _O_.[[ViewedArrayBuffer]].
15043+
1. If IsFixedLengthArrayBuffer(_buffer_) is *false* and IsSharedArrayBuffer(_buffer_) is *false*, return *false*.
15044+
1. Return *true*.
15045+
</emu-alg>
15046+
</emu-clause>
15047+
1501815048
<emu-clause id="sec-isvalidintegerindex" type="abstract operation">
1501915049
<h1>
1502015050
IsValidIntegerIndex (

0 commit comments

Comments
 (0)