Re: [whatwg/streams] Unified error handling for WritableStream (#721)

tyoshino commented on this pull request.



> -  WritableStreamRejectAbortRequestIfPending(stream);
-  WritableStreamRejectPromisesInReactionToError(stream);
+function WritableStreamFinishError(stream) {
+  assert(stream._state === 'erroring', 'stream._state === erroring');
+  assert(WritableStreamHasOperationMarkedInFlight(stream) === false,
+         'WritableStreamHasOperationMarkedInFlight(stream) === false');
+  stream._state = 'errored';
+  stream._writableStreamController[ErrorSteps]();
+
+  const storedError = stream._storedError;
+  for (const writeRequest of stream._writeRequests) {
+    writeRequest._reject(storedError);
+  }
+  stream._writeRequests = [];
+
+  if (stream._pendingAbortRequest === undefined) {

Could you please update `'controller.error(), writer.abort() while there is an in-flight write, and then finish the write'` test to check that `sink.abort()` is not called for this (error() then abort()) sequence?

controller.error() calls WritableStreamErroring() to change the state to erroring. WritableStreamAbort() skips WritableStreamErroring() when the state is erroring, but it does set _pendingAbortRequest. It should be rejected (right?) when controller.error() happened before writer.abort(), but it looks it would get processed by the code below.


-- 
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/721#pullrequestreview-31018386

Received on Wednesday, 5 April 2017 11:09:04 UTC