diff --git a/encoding.bs b/encoding.bs index fe69752..684c72d 100644 --- a/encoding.bs +++ b/encoding.bs @@ -1851,23 +1851,41 @@ constructor steps are:
  • If encoding is failure or replacement, then throw a {{RangeError}}. -

  • Set this's encoding to encoding. +

  • Let errorMode be "fatal" if + options["{{TextDecoderOptions/fatal}}"] is true; otherwise "replacement". -

  • If options["{{TextDecoderOptions/fatal}}"] is true, then set this's - error mode to "fatal". +

  • Set up a text decoder stream with this, encoding, + errorMode, and options["{{TextDecoderOptions/ignoreBOM}}"]. + + -

  • Set this's ignore BOM to - options["{{TextDecoderOptions/ignoreBOM}}"]. +

    +

    To set up a text decoder stream given a {{TextDecoderStream}} object +stream, an optional [=/encoding=] encoding (default UTF-8), an optional +error mode errorMode (default "replacement"), and an optional +boolean ignoreBOM (default false), run these steps: -

  • Set this's decoder to a new instance of this's - encoding's decoder, and set this's - I/O queue to a new I/O queue. +

      +
    1. Assert: encoding is not replacement. + +

    2. Set stream's encoding to encoding. + +

    3. Set stream's error mode to errorMode. + +

    4. Set stream's ignore BOM to ignoreBOM. + +

    5. Set stream's decoder to a new instance of + encoding's decoder. + +

    6. Set stream's I/O queue to a new I/O + queue.

    7. Let transformAlgorithm be an algorithm which takes a chunk argument - and runs the decode and enqueue a chunk algorithm with this and chunk. + and runs the decode and enqueue a chunk algorithm with stream and + chunk. -

    8. Let flushAlgorithm be an algorithm which takes no arguments and runs the - flush and enqueue algorithm with this. +

    9. Let flushAlgorithm be an algorithm which takes no arguments and runs the flush + and enqueue algorithm with stream.

    10. Let transformStream be a [=new=] {{TransformStream}}. @@ -1877,7 +1895,8 @@ constructor steps are: flushAlgorithm set to flushAlgorithm. -

    11. Set this's transform to transformStream. +

    12. Set stream's transform to + transformStream.