Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TextEncoderStream and TextDecoderStream transform streams #149

Merged
merged 18 commits into from Aug 29, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion encoding.bs
Expand Up @@ -1486,7 +1486,7 @@ byteReadable

<li><p><a>Push</a> a <a lt="get a copy of the buffer source">copy of</a> <var>bufferSource</var> to

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In 6a65ad5, we explicitly checked for IsDetachedBuffer(arrayBuffer) and returned a rejected promise if the buffer was detached. However, none of the three algorithms that make up convert to a BufferSource check for detached buffers.

When get a copy of the buffer source encounters a detached buffer, it throws a TypeError in step 7. This is not what we want: we want to return a rejected promise instead!

I think the easiest fix would be to add the following line to this step, similar to the previous step:

If this throws an exception, then return a promise rejected with that exception.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch, thanks.

I did what you proposed. This has the added benefit that we are always in sync with the checks and behaviour provided by WebIDL.

<var>dec</var>'s <a for=TextDecoderStream>stream</a>. If this throws an exception, then return a
promise rejected with that exception
promise rejected with that exception.

<li><p>Let <var>controller</var> be <var>dec</var>'s
<a for=GenericTransformStream>transform</a>.\[[transformStreamController]].
Expand Down