Re: [streams] Make .ready fulfill-only (#248)

> +    abort() {
> +      t.fail('Unexpected abort call');
> +      t.end();
> +    }
> +  });
> +
> +  // Wait for ws to start.
> +  setTimeout(() => {
> +    ws.write('a');
> +    t.equal(ws.state, 'waiting', 'state must become waiting synchronously on write call');
> +
> +    ws.close();
> +    t.equal(ws.state, 'closing', 'state must become closing synchronously on close call');
> +
> +    ws.ready.then(v => {
> +      t.equal(ws.state, 'closing', 'state must still be closing when ready fulfills');

I mainly added this because it's well-defined and so we should test it. The sequence is:

- "waiting" to "closing" => fulfill .ready (and thus enqueue a microtask to call the fulfill handler)
- create immediately-fulfilled promise out of close() result => enqueue microtask to do "closing" to "closed".

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/248/files#r21103942

Received on Monday, 1 December 2014 17:33:13 UTC