Re: [whatwg/streams] Rigorously specify and test pipeTo (#512)

isonmad requested changes on this pull request.



> @@ -60,6 +60,17 @@ class WritableStream {
 
 exports.WritableStream = WritableStream;
 
+Object.assign(exports, {
+  AcquireWritableStreamDefaultWriter,
+  IsWritableStream,
+  WritableStream,
+  WritableStreamAbort,
+  WritableStreamDefaultWriterClose,

Why is WritableStreamDefaultWriterClose exported? readable-stream.js doesn't import it.

> @@ -60,6 +60,17 @@ class WritableStream {
 
 exports.WritableStream = WritableStream;

Is this redundant with the below assignment of WritableStream now?

> -            return _allWrites;
-          },
-          reason => {
-            releaseWriter();
-            finishWithRejection(reason);
-          }
-        ).then(
-          () => {
-            releaseWriter();
-            finishWithFulfillment();
-          }
-        );
-        _state = 'closingDest';
+      // Closing must be propagated backward
+      writer._closedPromise.then(() => {
+        const destClosed = new TypeError('the destination writable stream closed before all data could be piped to it');

Since this can only happen if running pipeTo on a destination that was already closed beforehand, maybe this error should be more specific and say that's what happened? This can't possibly happen in the middle of piping, can it?

-- 
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/512#pullrequestreview-4377323

Received on Saturday, 15 October 2016 18:53:49 UTC