archives

« Bugzilla Issues Index

#3220 — Set/Map/WeakSet/WeakMap needs to call IteratorClose


Set/Map/WeakSet/WeakMap needs to call IteratorClose in case of an abrupt completion:

http://people.mozilla.org/~jorendorff/es6-draft.html#sec-set-iterable

12. Repeat
a. Let next be the result of IteratorStep(iter).
b. ReturnIfAbrupt(next).
c. If next is false, then return set.
d. Let nextValue be IteratorValue(next).
e. ReturnIfAbrupt(nextValue).
f. Let status be the result of calling the [[Call]] internal method of adder with set as thisArgument and a List whose sole element is nextValue as argumentsList.
g. ReturnIfAbrupt(status).

Change to something like:

12. Repeat
a. Let next be the result of IteratorStep(iter).
b. If next is an abrupt completion, then return IteratorClose(iter, next).
c. If next is false, then return set.
d. Let nextValue be IteratorValue(next).
e. If nextValue is an abrupt completion, then return IteratorClose(iter, nextValue).
f. Let status be the result of calling the [[Call]] internal method of adder with set as thisArgument and a List whose sole element is nextValue as argumentsList.
g. If status is an abrupt completion, then return IteratorClose(iter, status).

The change is more or less to replace `ReturnIfAbrupt(x)` with `If x is an abrupt completion, then return IteratorClose(iter, x)`


fixed in rev32 editor's draft


Also fixed Array.from, %TypedArray%.from, Promise.all, and Promise.race


fixed in rev32 draft