Skip to content

Commit c5a96d3

Browse files
authored
Merge pull request #41 from gibson042/gh-1-slicetoimmutable-clamping
Normative: Align ArrayBuffer sliceToImmutable length clamping with slice as suggested by @waldemarhorwat. Thanks!
2 parents 1dd81c7 + 9fe3f1f commit c5a96d3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

spec.emu

+1-3
Original file line numberDiff line numberDiff line change
@@ -683,9 +683,7 @@ contributors: Mark S. Miller, Richard Gibson
683683
1. Let _bounds_ be ? ResolveBounds(_len_, _start_, _end_).
684684
1. Let _first_ be _bounds_.[[From]].
685685
1. Let _final_ be _bounds_.[[To]].
686-
1. Let _newLen_ be _final_ - _first_.
687-
1. NOTE: This differs from <emu-xref href="#sec-arraybuffer.prototype.slice" title></emu-xref>, which instead clamps _newLen_ to be non-negative.
688-
1. If _newLen_ &lt; 0, throw a *RangeError* exception.
686+
1. Let _newLen_ be max(_final_ - _first_, 0).
689687
1. NOTE: Side-effects of the above steps may have detached or resized _O_.
690688
1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception.
691689
1. Let _fromBuf_ be _O_.[[ArrayBufferData]].

0 commit comments

Comments
 (0)