In section 2.2.2, Observable.from iteration functions assume that their observer argument is in fact a native subscription observer, when a subclass constructor could choose to pass it any value, including a primitive. Instead, it should do three things:
In the first step, a TypeError if Type(observer) is not Object.
In step 5.e, use ? ToBoolean(? GetV(observer, "closed")) instead of SubscriptionClosed(subscription) to determine closure status. It should also be determined prior to sending the value.
When invoking observer methods, use ? instead of !, since it's not invariant.
Also, as a couple drive-by issues, the GetIterator call should use iterator, not items, and the last step in the loop should return undefined rather than the iterator result, for consistency.
The fixed body would read like this:
Let iterable be the value of the [[Iterable]] internal slot of F.
Let iteratorMethod be the value of the [[IteratorMethod]] internal slot of F.
Let iterator be ? GetIterator(iterable, iteratorMethod).
Repeat
If ? ToBoolean(? GetV(observer, "closed")) is true, then
In section 2.2.2,
Observable.from
iteration functions assume that their observer argument is in fact a native subscription observer, when a subclass constructor could choose to pass it any value, including a primitive. Instead, it should do three things:TypeError
if Type(observer) is not Object."closed"
)) instead of SubscriptionClosed(subscription) to determine closure status. It should also be determined prior to sending the value.Also, as a couple drive-by issues, the GetIterator call should use iterator, not items, and the last step in the loop should return
undefined
rather than the iterator result, for consistency.The fixed body would read like this:
"closed"
)) istrue
, thenundefined
).undefined
.false
, thenundefined
."next"
, « nextValue »).In JS, this would roughly be the following callback: