@@ -203,6 +203,38 @@ async_test(t => {
203
203
} , 'ReadableStream with byte source: respondWithNewView() throws if the supplied view is zero-length on a ' +
204
204
'non-zero-length buffer (in the readable state)' ) ;
205
205
206
+ async_test ( t => {
207
+ const stream = new ReadableStream ( {
208
+ pull : t . step_func_done ( c => {
209
+ const view = c . byobRequest . view . subarray ( 1 , 2 ) ;
210
+
211
+ assert_throws_js ( RangeError , ( ) => c . byobRequest . respondWithNewView ( view ) ) ;
212
+ } ) ,
213
+ type : 'bytes'
214
+ } ) ;
215
+ const reader = stream . getReader ( { mode : 'byob' } ) ;
216
+
217
+ reader . read ( new Uint8Array ( [ 4 , 5 , 6 ] ) ) ;
218
+ } , 'ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset ' +
219
+ '(in the readable state)' ) ;
220
+
221
+ async_test ( t => {
222
+ const stream = new ReadableStream ( {
223
+ pull : t . step_func_done ( c => {
224
+ c . close ( ) ;
225
+
226
+ const view = c . byobRequest . view . subarray ( 1 , 1 ) ;
227
+
228
+ assert_throws_js ( RangeError , ( ) => c . byobRequest . respondWithNewView ( view ) ) ;
229
+ } ) ,
230
+ type : 'bytes'
231
+ } ) ;
232
+ const reader = stream . getReader ( { mode : 'byob' } ) ;
233
+
234
+ reader . read ( new Uint8Array ( [ 4 , 5 , 6 ] ) ) ;
235
+ } , 'ReadableStream with byte source: respondWithNewView() throws if the supplied view has a different offset ' +
236
+ '(in the closed state)' ) ;
237
+
206
238
async_test ( t => {
207
239
const stream = new ReadableStream ( {
208
240
pull : t . step_func_done ( c => {
0 commit comments