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

Update index.bs #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ An object that includes {{GenericTransformStream}} has an associated <dfn>transf
## Attributes ## {#outgoing-stream-attributes}

: <dfn attribute for="GenericTransformStream">readable</dfn>
:: The `readable` attribute's getter, when invoked, must return this object's transform \[[readable]].
:: The `readable` attribute's getter, when invoked, must return this object's transform \[[readable](https://streams.spec.whatwg.org/#rs-class)].
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't usually link to slots. If we did, I think the link should go to https://streams.spec.whatwg.org/#ts-internal-slots.

Also, since it is a slot, it needs double [[]] square brackets.

: <dfn attribute for="GenericTransformStream">writable</dfn>
:: The `writable` attribute's getter, when invoked, must return this object's transform \[[writable]].
:: The `writable` attribute's getter, when invoked, must return this object's transform \[[writable](https://streams.spec.whatwg.org/#ws-class)].

# Interface `CompressionStream` # {#compression-stream}

Expand All @@ -96,32 +96,32 @@ interface CompressionStream {
CompressionStream includes GenericTransformStream;
</pre>

The {{CompressionStream}}(format) constructor, when invoked, must run these steps:
1. If <dfn for=CompressionStream>format</dfn> is unsupported in CompressionStream, then throw a TypeError.
The {{CompressionStream}} (format) constructor, when invoked, must run these steps:
1. If <dfn for=CompressionStream>format</dfn> is unsupported in CompressionStream, then throw a [TypeError](https://www.ecma-international.org/ecma-262/6.0/#sec-native-error-types-used-in-this-standard-typeerror).
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think Bikeshed can auto-link TypeError if we write it like {{TypeError}}. Also, I think it's probably preferable to import it from WebIDL rather than ECMASCRIPT (at least, that it what the encoding standard does).

1. Let *cs* be a new CompressionStream object.
1. Set *cs*'s *format* to <a for=CompressionStream>format</a>.
1. Let *startAlgorithm* be an algorithm that takes no arguments and returns nothing.
1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the <a>compress and enqueue a chunk</a> algorithm with *cs* and *chunk*.
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with *cs*.
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a>(*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a> (*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you sure we should have a space before ()? The other standards I work on (Streams, Encoding and Fetch do not put a space before the parameters.

1. Set *cs*'s <a>transform</a> to *transform*.
1. Return *cs*.

The <dfn>compress and enqueue a chunk</dfn> algorithm, given a CompressionStream object *cs* and a *chunk*, runs these steps:
1. If *chunk* is not a {{BufferSource}} type, then throw a TypeError.
1. Let *buffer* be the result of compressing *chunk* with *cs*'s *format*. If this throws an exception, then return a promise rejected with that exception.
1. Let *controller* be *cs*'s transform.\[[TransformStreamController]].
1. Let *controller* be *cs*'s transform.\[[TransformStreamController](https://streams.spec.whatwg.org/#ts-default-controller-class)].
1. If *buffer* is empty, return a new promise resolved with undefined.
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a> (*controller*, *array*).
1. Return a new promise resolved with undefined.

The <dfn>compress flush and enqueue</dfn> algorithm, which handles the end of data from the input ReadableStream object, given a CompressionStream object *cs*, runs these steps:

1. Let *buffer* be the result of compressing an empty input with *cs*'s *format*, with the finish flag.
1. If *buffer* is empty, return a new promise resolved with undefined.
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a> (*controller*, *array*).
1. Return a new promise resolved with undefined.


Expand All @@ -135,32 +135,32 @@ interface DecompressionStream {
DecompressionStream includes GenericTransformStream;
</pre>

The {{DecompressionStream}}(format) constructor, when invoked, must run these steps:
The {{DecompressionStream}} (format) constructor, when invoked, must run these steps:
1. If <dfn for=DecompressionStream>format</dfn> is unsupported in DecompressionStream, then throw a TypeError.
1. Let *ds* be a new DecompressionStream object.
1. Set *ds*'s *format* to <a for=DecompressionStream>format</a>.
1. Let *startAlgorithm* be an algorithm that takes no arguments and returns nothing.
1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the <a>decompress and enqueue a chunk</a> algorithm with *ds* and *chunk*.
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>decompress flush and enqueue</a> algorithm with *ds*.
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a>(*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a> (*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
1. Set *ds*'s <a>transform</a> to *transform*.
1. Return *ds*.

The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a DecompressionStream object *ds* and a *chunk*, runs these steps:
1. If *chunk* is not a {{BufferSource}} type, then throw a TypeError.
1. Let *buffer* be the result of decompressing *chunk* with *ds*'s *format*. If this throws an exception, then return a promise rejected with that exception.
1. Let *controller* be *ds*'s transform.\[[TransformStreamController]].
1. Let *controller* be *ds*'s transform.\[[TransformStreamController](https://streams.spec.whatwg.org/#ts-default-controller-class)].
1. If *buffer* is empty, return a new promise resolved with undefined.
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a> (*controller*, *array*).
1. Return a new promise resolved with undefined.

The <dfn>decompress flush and enqueue</dfn> algorithm, which handles the end of data from the input ReadableStream object, given a DecompressionStream object *ds*, runs these steps:

1. Let *buffer* be the result of decompressing an empty input with *ds*'s *format*, with the finish flag.
1. If *buffer* is empty, return a new promise resolved with undefined.
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
1. For each `Uint8Array` *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a> (*controller*, *array*).
1. Return a new promise resolved with undefined.


Expand Down Expand Up @@ -218,4 +218,4 @@ async function DecompressBlob(blob) {
</pre>

# Acknowledgments # {#acknowledgments}
The editors wish to thank Domenic Denicola and Yutaka Hirano, for their support.
The editors wish to thank Domenic Denicola and Yutaka Hirano, for their support.