[streams] [Reader] Should resolve readyPromise on getReader() call? (#258)

@yutakahirano pointed out that `readableStream.getReader()` must resolve the current promise stored in `[[readyPromise]]` and replace it with a new pending promise.

After `getReader()` call, the `ready` getter starts masking (starts returning `[[lockReleased]]`). But if `[[readyPromise]]` is already obtained like the following example, it stays to be working as `[[readyPromise]]` (i.e. receives and delivers resolution signal to `[[readyPromise]]`).

```
readableStream.ready.then( ... );
reader = readableStream.getReader();
```

It should be ok even if it gets resolved while the reader is active as we just see `readableStream.state` being `"waiting"` and get `[[lockReleased]]`.

If it doesn't get resolved while the reader is active, then, we cannot get notified of release of the lock. But I think in such a case, one who was watching the stream is not interested in release of lock but transition to readable/closed. So, this case is also not a problem?

Do you think this needs to be taken care of? @yutakahirano's suggestion was to resolve it on `getReader()` call.

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/258

Received on Tuesday, 6 January 2015 04:54:47 UTC