From 9fe3f1f6df1c9ad1173725cb75ec257f4e4a6849 Mon Sep 17 00:00:00 2001 From: Richard Gibson Date: Tue, 18 Feb 2025 19:02:15 -0500 Subject: [PATCH] Normative: Align ArrayBuffer sliceToImmutable length clamping with slice Ref https://github.com/tc39/proposal-immutable-arraybuffer/issues/1#issuecomment-2666956203 --- spec.emu | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spec.emu b/spec.emu index 17c13a8..dc71b7f 100644 --- a/spec.emu +++ b/spec.emu @@ -683,9 +683,7 @@ contributors: Mark S. Miller, Richard Gibson 1. Let _bounds_ be ? ResolveBounds(_len_, _start_, _end_). 1. Let _first_ be _bounds_.[[From]]. 1. Let _final_ be _bounds_.[[To]]. - 1. Let _newLen_ be _final_ - _first_. - 1. NOTE: This differs from , which instead clamps _newLen_ to be non-negative. - 1. If _newLen_ < 0, throw a *RangeError* exception. + 1. Let _newLen_ be max(_final_ - _first_, 0). 1. NOTE: Side-effects of the above steps may have detached or resized _O_. 1. If IsDetachedBuffer(_O_) is *true*, throw a *TypeError* exception. 1. Let _fromBuf_ be _O_.[[ArrayBufferData]].