@@ -454,20 +454,22 @@ contributors: Mark S. Miller, Richard Gibson
454
454
1. Let _newByteLength_ be ? ToIndex(_newLength_).
455
455
1. If IsDetachedBuffer(_arrayBuffer_) is *true*, throw a *TypeError* exception.
456
456
1. <ins>If IsImmutableBuffer(_arrayBuffer_) is *true*, throw a *TypeError* exception.</ins>
457
+ 1. <ins>If _arrayBuffer_.[[ArrayBufferDetachKey]] is not *undefined*, throw a *TypeError* exception.</ins>
457
458
1. <ins>Let _copyLength_ be min(_newByteLength_, _arrayBuffer_.[[ArrayBufferByteLength]]).</ins>
458
459
1. <ins>If _preserveResizability_ is ~immutable~, then</ins>
459
- 1. <ins>Return ? AllocateImmutableArrayBuffer(%ArrayBuffer%, _newByteLength_, _arrayBuffer_.[[ArrayBufferData]], 0, _copyLength_).</ins>
460
- 1. If _preserveResizability_ is ~preserve-resizability~ and IsFixedLengthArrayBuffer(_arrayBuffer_) is *false*, then
461
- 1. Let _newMaxByteLength_ be _arrayBuffer_.[[ArrayBufferMaxByteLength]].
462
- 1. Else,
463
- 1. Let _newMaxByteLength_ be ~empty~.
464
- 1. If _arrayBuffer_.[[ArrayBufferDetachKey]] is not *undefined*, throw a *TypeError* exception.
465
- 1. Let _newBuffer_ be ? <emu-meta suppress-effects="user-code">AllocateArrayBuffer(%ArrayBuffer%, _newByteLength_, _newMaxByteLength_)</emu-meta>.
466
- 1. <del>Let _copyLength_ be min(_newByteLength_, _arrayBuffer_.[[ArrayBufferByteLength]]).</del>
467
- 1. Let _fromBlock_ be _arrayBuffer_.[[ArrayBufferData]].
468
- 1. Let _toBlock_ be _newBuffer_.[[ArrayBufferData]].
469
- 1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, 0, _copyLength_).
470
- 1. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a `realloc`.
460
+ 1. <ins>Let _newBuffer_ be ? <emu-meta suppress-effects="user-code">AllocateImmutableArrayBuffer(%ArrayBuffer%, _newByteLength_, _arrayBuffer_.[[ArrayBufferData]], 0, _copyLength_)</emu-meta>.</ins>
461
+ 1. <ins>Else,</ins>
462
+ 1. If _preserveResizability_ is ~preserve-resizability~ and IsFixedLengthArrayBuffer(_arrayBuffer_) is *false*, then
463
+ 1. Let _newMaxByteLength_ be _arrayBuffer_.[[ArrayBufferMaxByteLength]].
464
+ 1. Else,
465
+ 1. Let _newMaxByteLength_ be ~empty~.
466
+ 1. <del>If _arrayBuffer_.[[ArrayBufferDetachKey]] is not *undefined*, throw a *TypeError* exception.</del>
467
+ 1. Let _newBuffer_ be ? <emu-meta suppress-effects="user-code">AllocateArrayBuffer(%ArrayBuffer%, _newByteLength_, _newMaxByteLength_)</emu-meta>.
468
+ 1. <del>Let _copyLength_ be min(_newByteLength_, _arrayBuffer_.[[ArrayBufferByteLength]]).</del>
469
+ 1. Let _fromBlock_ be _arrayBuffer_.[[ArrayBufferData]].
470
+ 1. Let _toBlock_ be _newBuffer_.[[ArrayBufferData]].
471
+ 1. Perform CopyDataBlockBytes(_toBlock_, 0, _fromBlock_, 0, _copyLength_).
472
+ 1. NOTE: Neither creation of the new Data Block nor copying from the old Data Block are observable. Implementations may implement this method as a zero-copy move or a `realloc`.
471
473
1. Perform ! DetachArrayBuffer(_arrayBuffer_).
472
474
1. Return _newBuffer_.
473
475
</emu-alg>
0 commit comments