Editorial: separate TextDecoderStream constructor to two algos#364
Open
noamr wants to merge 3 commits into
Open
Editorial: separate TextDecoderStream constructor to two algos#364noamr wants to merge 3 commits into
TextDecoderStream constructor to two algos#364noamr wants to merge 3 commits into
Conversation
One algo (the constructor) is used by JS, and the "set up" steps is to be used by other specs. See whatwg/fetch#1862 (review)
TextDecoderStream constructor to two algos
5 tasks
Co-authored-by: Mattias Buelens <649348+MattiasBuelens@users.noreply.github.com>
MattiasBuelens
approved these changes
May 19, 2026
annevk
reviewed
May 19, 2026
Member
annevk
left a comment
There was a problem hiding this comment.
Looks good, but I have a bunch of nits.
| <li><p>If <var>encoding</var> is failure or <a>replacement</a>, then <a>throw</a> a {{RangeError}}. | ||
|
|
||
| <li><p>Set <a>this</a>'s <a for=TextDecoderCommon>encoding</a> to <var>encoding</var>. | ||
| <li><p>Let <var>errorMode</var> be <code>fatal</code> if <var>options</var>["{{TextDecoderOptions/fatal}}"] is true; otherwise <code>replacement</code>. |
Member
There was a problem hiding this comment.
fatal and replacement here need quotes.
| <a for=TextDecoderCommon>encoding</a>'s <a for=/>decoder</a>, and set <a>this</a>'s | ||
| <a for=TextDecoderCommon>I/O queue</a> to a new <a for=/>I/O queue</a>. | ||
| <div algorithm> | ||
| <p>To <dfn export>set up a text decoder stream</dfn> <var>stream</var>, given an optional [=/encoding=] <var>encoding</var> (default <a>UTF-8</a>), |
Member
There was a problem hiding this comment.
Let's also type stream while we're here. Maybe rephrased as:
To set up a text decoder stream, given a TYPE stream, optional encoding encoding, ...
| <p>To <dfn export>set up a text decoder stream</dfn> <var>stream</var>, given an optional [=/encoding=] <var>encoding</var> (default <a>UTF-8</a>), | ||
| an optional <a for=/>error mode</a> <var>errorMode</var> (default <code>replacement</code>), and an optional boolean <var>ignoreBOM</var> (default false), run these steps: | ||
|
|
||
| <ol> |
Member
There was a problem hiding this comment.
Let's assert that encoding is not replacement.
| <li><p>Set <a>this</a>'s <a for=GenericTransformStream>transform</a> to <var>transformStream</var>. | ||
| <li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>decoder</a> to a new instance of <var>encoding</var>'s <a for=/>decoder</a>. | ||
|
|
||
| <li><p>Set <var>stream</var>'s <a for=TextDecoderCommon>I/O queue</a> to a new <a for=/>I/O queue</a>. |
Member
There was a problem hiding this comment.
Any reason to move these two steps further down? Making them separate steps makes sense, but it would be nicer for the diff if they are in the same place still.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One algo (the constructor) is used by JS, and the "set up" steps is to be used by other specs.
See whatwg/fetch#1862 (review)
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff