diff --git a/index.html b/index.html index 55f5047..bc42b7a 100644 --- a/index.html +++ b/index.html @@ -854,9 +854,12 @@

writable attribute

  • If [=this=].{{SerialPort/[[state]]}} is not `"opened"`, return `null`.
  • If [=this=].{{SerialPort/[[writeFatal]]}} is `true`, return `null`.
  • Let |stream:WritableStream| be a [=new=] {{WritableStream}}. -
  • Let |writeAlgorithm| be the following steps, given |chunk|: +
  • Let |signal:AbortSignal| be |stream|'s [=WritableStream/signal=]. +
  • + Let |writeAlgorithm| be the following steps, given |chunk|:
    1. Let |promise:Promise| be [=a new promise=]. +
    2. Assert: |signal| is not [=AbortSignal/aborted=].
    3. If |chunk| cannot be [=converted to an IDL value=] of type {{BufferSource}}, reject |promise| with a {{TypeError}} and return @@ -909,6 +912,9 @@

      writable attribute

      Invoke the steps to [=handle closing the writable stream=].
    +
  • + If |signal| is [=AbortSignal/aborted=], [=reject=] |promise| + with |signal|'s [=AbortSignal/abort reason=].
  • Return |promise|. @@ -935,18 +941,6 @@

    writable attribute

  • Return |promise|. -
    - [[STREAMS]] specifies that |abortAlgorithm| will only be invoked after - the {{Promise}} returned by a previous invocation of |writeAlgorithm| - (if any) has resolved. This blocks abort on completion of the most - recent write operation. This could be fixed by passing an - {{AbortSignal}} to |writeAlgorithm|. - -

    - This enhancement is tracked in - whatwg/streams#1015. -

    -
  • Let |closeAlgorithm| be the following steps:
      @@ -963,12 +957,14 @@

      writable attribute

      1. Invoke the steps to [=handle closing the writable stream=]. -
      2. [=Resolve=] |promise| with `undefined`. +
      3. + If |signal| is [=AbortSignal/aborted=], [=reject=] |promise| + with |signal|'s [=AbortSignal/abort reason=]. +
      4. Otherwise, [=resolve=] |promise| with `undefined`.
  • Return |promise|. -
  • [=WritableStream/Set up=] |stream| with writeAlgorithm @@ -981,6 +977,14 @@

    writable attribute

    set to [=this=].{{SerialPort/[[bufferSize]]}}, and sizeAlgorithm set to a byte-counting size algorithm. +
  • + [=AbortSignal/Add=] the following abort steps to |signal|: +
      +
    1. + Cause any invocation of the operating system to write to the + port to return as soon as possible no matter how much data has + been written. +
  • Set [=this=].{{SerialPort/[[writable]]}} to |stream|.
  • Return |stream|.