diff --git a/spec.html b/spec.html index 112a8a8578..1cd2f468c9 100644 --- a/spec.html +++ b/spec.html @@ -3777,6 +3777,22 @@

CanonicalNumericIndexString ( _argument_ )

A canonical numeric string is any String value for which the CanonicalNumericIndexString abstract operation does not return *undefined*.

+ + + +

ToIndex ( _value_ )

+

The abstract operation ToIndex returns _value_ argument converted to a numeric value if it is a valid integer index value. This abstract:

+ + 1. If _value_ is *undefined*, then + 1. Let _index_ be *0*. + 1. Else, + 1. Let _integerIndex_ be ? ToInteger(_value_). + 1. If _integerIndex_ < 0, throw a *RangeError* exception. + 1. Let _index_ be ! ToLength(_integerIndex_). + 1. If SameValueZero(_integerIndex_, _index_) is *false*, throw a *RangeError* exception. + 1. Return _index_. + +
@@ -31685,10 +31701,7 @@

_TypedArray_ ( _length_ )

1. Assert: Type(_length_) is not Object. 1. If NewTarget is *undefined*, throw a *TypeError* exception. - 1. If _length_ is *undefined*, throw a *TypeError* exception. - 1. Let _numberLength_ be ? ToNumber(_length_). - 1. Let _elementLength_ be ToLength(_numberLength_). - 1. If SameValueZero(_numberLength_, _elementLength_) is *false*, throw a *RangeError* exception. + 1. Let _elementLength_ be ? ToIndex(_length_). 1. Let _constructorName_ be the String value of the Constructor Name value specified in for this TypedArray constructor. 1. Return ? AllocateTypedArray(_constructorName_, NewTarget, "%TypedArrayPrototype%", _elementLength_). @@ -31819,7 +31832,7 @@

_TypedArray_ ( _object_ )

_TypedArray_ ( _buffer_ [ , _byteOffset_ [ , _length_ ] ] )

This description applies only if the _TypedArray_ function is called with at least one argument and the Type of the first argument is Object and that object has an [[ArrayBufferData]] internal slot.

-

_TypedArray_ called with arguments _buffer_, _byteOffset_, and _length_ performs the following steps:

+

_TypedArray_ called with at least one argument _buffer_ performs the following steps:

1. Assert: Type(_buffer_) is Object and _buffer_ has an [[ArrayBufferData]] internal slot. 1. If NewTarget is *undefined*, throw a *TypeError* exception. @@ -31827,18 +31840,16 @@

_TypedArray_ ( _buffer_ [ , _byteOffset_ [ , _length_ ] ] )

1. Let _O_ be ? AllocateTypedArray(_constructorName_, NewTarget, "%TypedArrayPrototype%"). 1. Let _constructorName_ be the String value of _O_'s [[TypedArrayName]] internal slot. 1. Let _elementSize_ be the Number value of the Element Size value in for _constructorName_. - 1. Let _offset_ be ? ToInteger(_byteOffset_). - 1. If _offset_ < 0, throw a *RangeError* exception. - 1. If _offset_ is *-0*, let _offset_ be *+0*. + 1. Let _offset_ be ? ToIndex(_byteOffset_). 1. If _offset_ modulo _elementSize_ ≠ 0, throw a *RangeError* exception. 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. 1. Let _bufferByteLength_ be the value of _buffer_'s [[ArrayBufferByteLength]] internal slot. - 1. If _length_ is *undefined*, then + 1. If _length_ is either not present or *undefined*, then 1. If _bufferByteLength_ modulo _elementSize_ ≠ 0, throw a *RangeError* exception. 1. Let _newByteLength_ be _bufferByteLength_ - _offset_. 1. If _newByteLength_ < 0, throw a *RangeError* exception. 1. Else, - 1. Let _newLength_ be ? ToLength(_length_). + 1. Let _newLength_ be ? ToIndex(_length_). 1. Let _newByteLength_ be _newLength_ × _elementSize_. 1. If _offset_+_newByteLength_ > _bufferByteLength_, throw a *RangeError* exception. 1. Set _O_'s [[ViewedArrayBuffer]] internal slot to _buffer_. @@ -33086,13 +33097,11 @@

The ArrayBuffer Constructor

-

ArrayBuffer ( _length_ )

-

ArrayBuffer called with argument _length_ performs the following steps:

+

ArrayBuffer ( [ _length_ ] )

+

When the `ArrayBuffer` function is called with optional argument _length_, the following steps are taken:

1. If NewTarget is *undefined*, throw a *TypeError* exception. - 1. Let _numberLength_ be ? ToNumber(_length_). - 1. Let _byteLength_ be ToLength(_numberLength_). - 1. If SameValueZero(_numberLength_, _byteLength_) is *false*, throw a *RangeError* exception. + 1. Let _byteLength_ be ? ToIndex(_length_). 1. Return ? AllocateArrayBuffer(NewTarget, _byteLength_).
@@ -33223,9 +33232,7 @@

GetViewValue ( _view_, _requestIndex_, _isLittleEndian_, _type_ )

1. If Type(_view_) is not Object, throw a *TypeError* exception. 1. If _view_ does not have a [[DataView]] internal slot, throw a *TypeError* exception. 1. Assert: _view_ has a [[ViewedArrayBuffer]] internal slot. - 1. Let _numberIndex_ be ? ToNumber(_requestIndex_). - 1. Let _getIndex_ be ToInteger(_numberIndex_). - 1. If _numberIndex_ ≠ _getIndex_ or _getIndex_ < 0, throw a *RangeError* exception. + 1. Let _getIndex_ be ? ToIndex(_requestIndex_). 1. Let _isLittleEndian_ be ToBoolean(_isLittleEndian_). 1. Let _buffer_ be the value of _view_'s [[ViewedArrayBuffer]] internal slot. 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. @@ -33246,9 +33253,7 @@

SetViewValue ( _view_, _requestIndex_, _isLittleEndian_, _type_, _value_ )The DataView Constructor

-

DataView (_buffer_, _byteOffset_, _byteLength_ )

-

`DataView` called with arguments _buffer_, _byteOffset_, and _byteLength_ performs the following steps:

+

DataView ( _buffer_ [ , _byteOffset_ [ , _byteLength_ ] ] )

+

When the `DataView` is called with at least one argument _buffer_, the following steps are taken:

1. If NewTarget is *undefined*, throw a *TypeError* exception. 1. If Type(_buffer_) is not Object, throw a *TypeError* exception. 1. If _buffer_ does not have an [[ArrayBufferData]] internal slot, throw a *TypeError* exception. - 1. Let _numberOffset_ be ? ToNumber(_byteOffset_). - 1. Let _offset_ be ToInteger(_numberOffset_). - 1. If _numberOffset_ ≠ _offset_ or _offset_ < 0, throw a *RangeError* exception. + 1. Let _offset_ be ? ToIndex(_byteOffset_). 1. If IsDetachedBuffer(_buffer_) is *true*, throw a *TypeError* exception. 1. Let _bufferByteLength_ be the value of _buffer_'s [[ArrayBufferByteLength]] internal slot. 1. If _offset_ > _bufferByteLength_, throw a *RangeError* exception. - 1. If _byteLength_ is *undefined*, then + 1. If _byteLength_ is either not present or *undefined*, then 1. Let _viewByteLength_ be _bufferByteLength_ - _offset_. 1. Else, - 1. Let _viewByteLength_ be ? ToLength(_byteLength_). + 1. Let _viewByteLength_ be ? ToIndex(_byteLength_). 1. If _offset_+_viewByteLength_ > _bufferByteLength_, throw a *RangeError* exception. 1. Let _O_ be ? OrdinaryCreateFromConstructor(NewTarget, `"%DataViewPrototype%"`, « [[DataView]], [[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]] »). 1. Set _O_'s [[DataView]] internal slot to *true*.