You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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`.
@@ -717,19 +717,20 @@ contributors: Mark S. Miller, Richard Gibson
1. If IsSharedArrayBuffer(_O_) is *true*, throw a *TypeError* exception.
720
-
1. TODO: Confirm inclusion of this redundant check.
721
720
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
722
721
1. Let _len_ be _O_.[[ArrayBufferByteLength]].
723
722
1. Let _bounds_ be ? ResolveBounds(_len_, _start_, _end_).
724
723
1. Let _first_ be _bounds_.[[From]].
725
724
1. Let _final_ be _bounds_.[[To]].
726
-
1. TODO: Confirm this strictness vs. the conventional `max(_final_ - _first_, 0)`.
727
725
1. Let _newLen_ be _final_ - _first_.
726
+
1. TODO: Confirm this strictness vs. `slice` (rejecting negative _newLen_ rather than clamping to 0).
728
727
1. If _newLen_ < 0, throw a *RangeError* exception.
729
-
1. Let _copyLen_ be min(_newLen_, _len_).
730
-
1. NOTE: Side-effects of the above steps may have detached or resized _O_. This algorithm proceeds only when _O_ is not detached, even if _newLen_ is 0.
728
+
1. NOTE: Side-effects of the above steps may have detached or resized _O_.
731
729
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
732
-
1. Let _newBuffer_ be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, _newLen_, _O_.[[ArrayBufferData]], _first_, _copyLen_).
730
+
1. Let _fromBuf_ be _O_.[[ArrayBufferData]].
731
+
1. Let _currentLen_ be _O_.[[ArrayBufferByteLength]].
732
+
1. If _currentLen_ < _final_, throw a *RangeError* exception.
733
+
1. Let _newBuffer_ be ? AllocateImmutableArrayBuffer(%ArrayBuffer%, _newLen_, _fromBuf_, _first_, _newLen_).
0 commit comments