Skip to content

Commit 35c4297

Browse files
close receiver on argument validation failure (#19)
1 parent ea2f1cf commit 35c4297

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

spec.emu

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ copyright: false
1515
<emu-alg>
1616
1. Let _O_ be the *this* value.
1717
1. If _O_ is not an Object, throw a *TypeError* exception.
18-
1. If _chunkSize_ is not an integral Number in the inclusive interval from *1*<sub>𝔽</sub> to 𝔽(2<sup>32</sup> - 1), throw a *RangeError* exception.
19-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
18+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
19+
1. If _chunkSize_ is not an integral Number in the inclusive interval from *1*<sub>𝔽</sub> to 𝔽(2<sup>32</sup> - 1), then
20+
1. Let _error_ be ThrowCompletion(a newly created *RangeError* object).
21+
1. Return ? IteratorClose(_iterated_, _error_).
22+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
2023
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _chunkSize_ and performs the following steps when called:
2124
1. Let _buffer_ be a new empty List.
2225
1. Repeat,
@@ -42,8 +45,11 @@ copyright: false
4245
<emu-alg>
4346
1. Let _O_ be the *this* value.
4447
1. If _O_ is not an Object, throw a *TypeError* exception.
45-
1. If _windowSize_ is not an integral Number in the inclusive interval from *1*<sub>𝔽</sub> to 𝔽(2<sup>32</sup> - 1), throw a *RangeError* exception.
46-
1. Let _iterated_ be ? GetIteratorDirect(_O_).
48+
1. Let _iterated_ be the Iterator Record { [[Iterator]]: _O_, [[NextMethod]]: *undefined*, [[Done]]: *false* }.
49+
1. If _windowSize_ is not an integral Number in the inclusive interval from *1*<sub>𝔽</sub> to 𝔽(2<sup>32</sup> - 1), then
50+
1. Let _error_ be ThrowCompletion(a newly created *RangeError* object).
51+
1. Return ? IteratorClose(_iterated_, _error_).
52+
1. Set _iterated_ to ? GetIteratorDirect(_O_).
4753
1. Let _closure_ be a new Abstract Closure with no parameters that captures _iterated_ and _windowSize_ and performs the following steps when called:
4854
1. Let _buffer_ be a new empty List.
4955
1. Repeat,

0 commit comments

Comments
 (0)