You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The {{GenericTransformStream}} interface mixin represents the concept of a transform stream in IDL. It is not a TransformStream, though it has the same interface and it delegates to one.
98
-
99
-
<pre class="idl">
100
-
interface mixin GenericTransformStream {
101
-
readonly attribute ReadableStream readable;
102
-
readonly attribute WritableStream writable;
103
-
};
104
-
</pre>
105
-
106
-
An object that includes {{GenericTransformStream}} has an associated <dfn>transform</dfn> of type TransformStream.
@@ -124,33 +104,26 @@ CompressionStream includes GenericTransformStream;
124
104
125
105
A {{CompressionStream}} has an associated <dfn for=CompressionStream>format</dfn> and <a>compression context</a><dfn for=CompressionStream>context</dfn>.
126
106
127
-
The {{CompressionStream}}(*format*) constructor, when invoked, must run these steps:
128
-
1. If *format* is unsupported in CompressionStream, then throw a TypeError.
129
-
1. Let *cs* be a new CompressionStream object.
130
-
1. Set *cs*'s <a for=CompressionStream>format</a> to *format*.
131
-
1. Let *startAlgorithm* be an algorithm that takes no arguments and returns nothing.
132
-
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*.
133
-
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with *cs*.
134
-
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a>(*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
135
-
1. Set *cs*'s <a>transform</a> to *transform*.
136
-
1. Return *cs*.
137
-
138
-
The <dfn>compress and enqueue a chunk</dfn> algorithm, given a CompressionStream object *cs* and a *chunk*, runs these steps:
139
-
1. If *chunk* is not a {{BufferSource}} type, then return <a>a promise rejected with</a> a TypeError.
107
+
The <dfn constructor for=CompressionStream lt="CompressionStream(format)"><code>new CompressionStream(|format|)</code></dfn> steps are:
108
+
1. If *format* is unsupported in {{CompressionStream}}, then throw a {{TypeError}}.
109
+
1. Set [=this=]'s <a for=CompressionStream>format</a> to *format*.
110
+
1. Let *transformAlgorithm* be an algorithm which takes a *chunk* argument and runs the <a>compress and enqueue a chunk</a> algorithm with [=this=] and *chunk*.
111
+
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>compress flush and enqueue</a> algorithm with [=this=].
112
+
1. Set [=this=]'s [=GenericTransformStream/transform=] to the result of [=TransformStream/creating=] a {{TransformStream}} with <a for=TransformStream/create><var ignore>transformAlgorithm</var></a> set to *transformAlgorithm* and <a for=TransformStream/create><var ignore>flushAlgorithm</var></a> set to *flushAlgorithm*.
113
+
114
+
The <dfn>compress and enqueue a chunk</dfn> algorithm, given a {{CompressionStream}} object *cs* and a *chunk*, runs these steps:
115
+
1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
140
116
1. Let *buffer* be the result of compressing *chunk* with *cs*'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>.
141
-
1. Let *controller* be *cs*'s transform.\[[TransformStreamController]].
142
-
1. If *buffer* is empty, return <a>a promise resolved with</a> undefined.
143
-
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
144
-
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
119
+
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *cs*'s [=GenericTransformStream/transform=].
146
120
147
-
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:
121
+
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:
148
122
149
123
1. Let *buffer* be the result of compressing an empty input with *cs*'s <a for=CompressionStream>format</a> and <a for=CompressionStream>context</a>, with the finish flag.
150
-
1. If *buffer* is empty, return <a>a promise resolved with</a> undefined.
151
-
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
152
-
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
@@ -165,34 +138,27 @@ DecompressionStream includes GenericTransformStream;
165
138
166
139
A {{DecompressionStream}} has an associated <dfn for=DecompressionStream>format</dfn> and <a>compression context</a><dfn for=DecompressionStream>context</dfn>.
167
140
168
-
The {{DecompressionStream}}(*format*) constructor, when invoked, must run these steps:
169
-
1. If *format* is unsupported in DecompressionStream, then throw a TypeError.
170
-
1. Let *ds* be a new DecompressionStream object.
171
-
1. Set *ds*'s <a for=DecompressionStream>format</a> to *format*.
172
-
1. Let *startAlgorithm* be an algorithm that takes no arguments and returns nothing.
141
+
The <dfn constructor for=DecompressionStream lt="DecompressionStream(format)"><code>new DecompressionStream(|format|)</code></dfn> steps are:
142
+
1. If *format* is unsupported in {{DecompressionStream}}, then throw a {{TypeError}}.
143
+
1. Set [=this=]'s <a for=DecompressionStream>format</a> to *format*.
173
144
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*.
174
145
1. Let *flushAlgorithm* be an algorithm which takes no argument and runs the <a>decompress flush and enqueue</a> algorithm with *ds*.
175
-
1. Let *transform* be the result of calling <a abstract-op>CreateTransformStream</a>(*startAlgorithm*, *transformAlgorithm*, *flushAlgorithm*).
176
-
1. Set *ds*'s <a>transform</a> to *transform*.
177
-
1. Return *ds*.
146
+
1. Set [=this=]'s [=GenericTransformStream/transform=] to the result of [=TransformStream/creating=] a {{TransformStream}} with <a for=TransformStream/create><var ignore>transformAlgorithm</var></a> set to *transformAlgorithm* and <a for=TransformStream/create><var ignore>flushAlgorithm</var></a> set to *flushAlgorithm*.
178
147
179
-
The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a DecompressionStream object *ds* and a *chunk*, runs these steps:
180
-
1. If *chunk* is not a {{BufferSource}} type, then return <a>a promise rejected with</a> a TypeError.
181
-
1. Let *buffer* be the result of decompressing *chunk* with *ds*'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>. If this results in an error, then return <a>a promise rejected with</a> a TypeError.
182
-
1. Let *controller* be *ds*'s <a>transform</a>.\[[TransformStreamController]].
183
-
1. If *buffer* is empty, return <a>a promise resolved with</a> undefined.
184
-
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
185
-
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
The <dfn>decompress and enqueue a chunk</dfn> algorithm, given a {{DecompressionStream}} object *ds* and a *chunk*, runs these steps:
149
+
1. If *chunk* is not a {{BufferSource}} type, then throw a {{TypeError}}.
150
+
1. Let *buffer* be the result of decompressing *chunk* with *ds*'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>. If this results in an error, then throw a {{TypeError}}.
151
+
1. If *buffer* is empty, return.
152
+
1. Split *buffer* into one or more non-empty pieces and convert them into {{Uint8Array}}s.
153
+
1. For each {{Uint8Array}} *array*, [=TransformStream/enqueue=] *array* in *ds*'s [=GenericTransformStream/transform=].
187
154
188
-
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:
155
+
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:
189
156
190
157
1. Let *buffer* be the result of decompressing an empty input with *ds*'s <a for=DecompressionStream>format</a> and <a for=DecompressionStream>context</a>, with the finish flag.
191
-
1. If the end of the compressed input has not been reached, return <a>a promise rejected with</a> a TypeError.
192
-
1. If *buffer* is empty, return <a>a promise resolved with</a> undefined.
193
-
1. Split *buffer* into one or more non-empty pieces and convert them into Uint8Arrays.
194
-
1. For each Uint8Array *array*, call <a abstract-op>TransformStreamDefaultControllerEnqueue</a>(*controller*, *array*).
0 commit comments