Re: [whatwg/streams] Define WritableStreamDefaultController.signal (#1132)

@domenic commented on this pull request.



>  
 <dl class="domintro non-normative">
+ <dt><code><var ignore>controller</var>.signal</code>

```suggestion
 <dt><code><var ignore>controller</var>.{{WritableStreamDefaultController/signal}}</code>
```

> @@ -4252,6 +4268,10 @@ The following abstract operations operate on {{WritableStream}} instances at a h
  id="writable-stream-abort">WritableStreamAbort(|stream|, |reason|)</dfn> performs the following
  steps:
 
+ 1. If |stream|.[=WritableStream/[[state]]=] is "`closed`" or "`errored`", return
+    [=a promise resolved with=] undefined.
+ 1. [=Signal abort=] on
+    |stream|.[=WritableStream/[[controller]]=].[=WritableStreamDefaultController/[[signal]]=].
  1. Let |state| be |stream|.[=WritableStream/[[state]]=].
  1. If |state| is "`closed`" or "`errored`", return [=a promise resolved with=] undefined.

Maybe add a note explaining that we need to re-check after signaling abort because author code might have closed or errored the stream.

> @@ -4421,7 +4441,8 @@ the {{WritableStream}}'s public API.
  1. [=Reject=] |stream|.[=WritableStream/[[inFlightCloseRequest]]=] with |error|.
  1. Set |stream|.[=WritableStream/[[inFlightCloseRequest]]=] to undefined.
  1. Assert: |stream|.[=WritableStream/[[state]]=] is "`writable`" or "`erroring`".
- 1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined,
+ 1. If |stream|.[=WritableStream/[[pendingAbortRequest]]=] is not undefined and |error| is not an

This kind of switching on error type is a bit unusual. What is the intention here? What kind of test would pass with this change that would fail without 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/1132#pullrequestreview-676250480

Received on Friday, 4 June 2021 12:55:29 UTC