@@ -123,8 +123,7 @@ promise_test(t => {
123123async_test ( t => {
124124 const stream = new ReadableStream ( {
125125 pull : t . step_func_done ( c => {
126- // Detach it by reading into it
127- reader . read ( c . byobRequest . view ) ;
126+ c . byobRequest . view . buffer . transfer ( ) ;
128127
129128 assert_throws_js ( TypeError , ( ) => c . byobRequest . respond ( 1 ) ,
130129 'respond() must throw if the corresponding view has become detached' ) ;
@@ -141,9 +140,7 @@ async_test(t => {
141140 const stream = new ReadableStream ( {
142141 pull : t . step_func_done ( c => {
143142 c . close ( ) ;
144-
145- // Detach it by reading into it
146- reader . read ( c . byobRequest . view ) ;
143+ c . byobRequest . view . buffer . transfer ( ) ;
147144
148145 assert_throws_js ( TypeError , ( ) => c . byobRequest . respond ( 0 ) ,
149146 'respond() must throw if the corresponding view has become detached' ) ;
@@ -159,9 +156,8 @@ async_test(t => {
159156async_test ( t => {
160157 const stream = new ReadableStream ( {
161158 pull : t . step_func_done ( c => {
162- // Detach it by reading into it
163159 const view = new Uint8Array ( [ 1 , 2 , 3 ] ) ;
164- reader . read ( view ) ;
160+ view . buffer . transfer ( ) ;
165161
166162 assert_throws_js ( TypeError , ( ) => c . byobRequest . respondWithNewView ( view ) ) ;
167163 } ) ,
@@ -364,8 +360,7 @@ async_test(t => {
364360async_test ( t => {
365361 const stream = new ReadableStream ( {
366362 pull : t . step_func_done ( c => {
367- // Detach it by reading into it
368- reader . read ( c . byobRequest . view ) ;
363+ c . byobRequest . view . buffer . transfer ( ) ;
369364
370365 assert_throws_js ( TypeError , ( ) => c . enqueue ( new Uint8Array ( [ 1 ] ) ) ,
371366 'enqueue() must throw if the BYOB request\'s buffer has become detached' ) ;
@@ -382,9 +377,7 @@ async_test(t => {
382377 const stream = new ReadableStream ( {
383378 pull : t . step_func_done ( c => {
384379 c . close ( ) ;
385-
386- // Detach it by reading into it
387- reader . read ( c . byobRequest . view ) ;
380+ c . byobRequest . view . buffer . transfer ( ) ;
388381
389382 assert_throws_js ( TypeError , ( ) => c . enqueue ( new Uint8Array ( [ 1 ] ) ) ,
390383 'enqueue() must throw if the BYOB request\'s buffer has become detached' ) ;
0 commit comments