whatwg / streams

Streams Standard
https://streams.spec.whatwg.org/
Other
1.34k stars 159 forks source link

ReadableStreamAddReadRequest() should assert state is readable #454

Closed wanderview closed 8 years ago

wanderview commented 8 years ago

Currently ReadableStreamAddReadRequest() appends to the readers's readRequests list. The ReadableStreamClose() function iterates this same list resolving its promises. It would be nice to assert that we don't re-enter code that appends more items to this same list we are iterating.

I think the easiest way to do this is to add a state assertion in ReadableStreamAddReadRequest().

tyoshino commented 8 years ago

Created PR: https://github.com/whatwg/streams/pull/458

As we're just resolving promises, there's no risk of reentry, I think, but it's not bad to add asserts there.

BYOB side condition depends on how we resolve https://github.com/whatwg/streams/issues/455