-
Notifications
You must be signed in to change notification settings - Fork 14
Normative: throw whenever creating TA from OOB TA #72
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -758,12 +758,20 @@ <h1>InitializeTypedArrayFromTypedArray ( _O_, _srcArray_ )</h1> | |
1. Let _bufferConstructor_ be ? SpeciesConstructor(_srcData_, %ArrayBuffer%). | ||
1. Else, | ||
1. Let _bufferConstructor_ be %ArrayBuffer%. | ||
1. <ins>Let _data_ be ? AllocateArrayBuffer(_bufferConstructor_, _byteLength_).</ins> | ||
1. <ins>Let _getSrcBufferByteLength_ be MakeIdempotentArrayBufferByteLengthGetter(~SeqCst~).</ins> | ||
1. <ins>If IsIntegerIndexedObjectOutOfBounds(_srcArray_, _getSrcBufferByteLength_) is *true*, throw a *TypeError* exception.</ins> | ||
1. <ins>Set _elementLength_ to IntegerIndexedObjectLength(_srcArray_, _getSrcBufferByteLength_).</ins> | ||
1. <ins>Set _byteLength_ to _elementSize_ × _elementLength_.</ins> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new byteLength might be greater than the old byteLength. byteLength should only be updated if the buffer was shrunk. Alternatively, you could assign the new byte length to a newByteLength, and pass min(newByteLength, _byteLength) to CopyDataBlockBytes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Persisting the variable I think we can use the new buffer's [[ArrayBufferByteLength]] slot to get the prior value of
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I retract my comment, I missed the operative keyword "new". Using the new buffer's [[ArrayBufferByteLength]]. That works for me. |
||
1. If _elementType_ is the same as _srcType_, then | ||
1. Let _data_ be ? CloneArrayBuffer(_srcData_, _srcByteOffset_, _byteLength_, _bufferConstructor_). | ||
1. <del>Let _data_ be ? CloneArrayBuffer(_srcData_, _srcByteOffset_, _byteLength_, _bufferConstructor_).</del> | ||
1. <ins>Let _srcBlock_ be _srcData_.[[ArrayBufferData]].</ins> | ||
1. <ins>Let _targetBlock_ be _data_.[[ArrayBufferData]].</ins> | ||
1. <ins>Let _count_ be min(_byteLength_, _data_.[[ArrayBufferByteLength]]).</ins> | ||
1. <ins>Perform CopyDataBlockBytes(_targetBlock_, 0, _srcBlock_, _srcByteOffset_, _count_).</ins> | ||
1. Else, | ||
1. Let _data_ be ? AllocateArrayBuffer(_bufferConstructor_, _byteLength_). | ||
1. <del>Let _data_ be ? AllocateArrayBuffer(_bufferConstructor_, _byteLength_).</del> | ||
1. <del>If IsDetachedBuffer(_srcData_) is *true*, throw a *TypeError* exception.</del> | ||
1. <ins>If IsIntegerIndexedObjectOutOfBounds(_srcArray_, _getSrcBufferByteLength_) is *true*, throw a *TypeError* exception.</ins> | ||
1. If _srcArray_.[[ContentType]] ≠ _O_.[[ContentType]], throw a *TypeError* exception. | ||
1. Let _srcByteIndex_ be _srcByteOffset_. | ||
1. Let _targetByteIndex_ be 0. | ||
|
Uh oh!
There was an error while loading. Please reload this page.