[whatwg/streams] Mark promise rejections for "state promises" as handled (#607)

This fixes #547, by marking the state promises (reader.closed, writer.closed, and writer.ready) as handled whenever they are rejected. It also overhauls the tests to handle all rejections, as apparently this will be enforced by testharness.js soon: see https://github.com/w3c/testharness.js/commit/7716e2581a86dfd9405a9c00547a7504f0c7fe94.

In the process, this adds additional test coverage for many rejections: since we have to handle them anyway, we might as well test them with promise_rejects. It also led to a fix to the completely-broken test "WritableStream should call underlying sink's close if no abort is supplied" in aborting.js. Finally, it uncovered an issue where ongoing write() calls would reject if abort() is called subsequently, even if the ongoing write succeeds according to the underlying sink.

---

This is not yet ready to merge as a test is still failing, for the write() + abort() case. It is the test "Aborting a WritableStream prevents further writes after any that are in progress", which I have updated to expect that the write() fulfills, but currently it fails with the aborted TypeError.

The problem is essentially that abort() synchronously rejects all pending write requests, whereas WritableStreamDefaultControllerProcessWrite does not unshift the pending write request until the underlying sink's write() call succeeds, which happens asynchronously.

We should instead unshift the pending write request the moment the underlying sink write() call is made, I think. This matches better the idea that once the underlying sink write() has started, it is entirely up to the underlying sink whether the writer.write() call should fulfill or reject. But a quick attempt to do that leads to lots of test timeouts and other failures. I would appreciate help investigating ways of making the test pass.
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/streams/pull/607

-- Commit Summary --

  * Mark promise rejections for "state promises" as handled

-- File Changes --

    M reference-implementation/lib/readable-stream.js (6)
    M reference-implementation/lib/writable-stream.js (10)
    M reference-implementation/run-web-platform-tests.js (24)
    M reference-implementation/to-upstream-wpts/piping/error-propagation-backward.js (36)
    M reference-implementation/to-upstream-wpts/writable-streams/aborting.js (69)
    M reference-implementation/to-upstream-wpts/writable-streams/close.js (3)
    M reference-implementation/to-upstream-wpts/writable-streams/constructor.js (24)

-- Patch Links --

https://github.com/whatwg/streams/pull/607.patch
https://github.com/whatwg/streams/pull/607.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/607

Received on Thursday, 10 November 2016 00:39:36 UTC