1promise_test(async t => { 2 const error = new Error('cannot proceed'); 3 const rs = new ReadableStream({ 4 type: 'bytes', 5 pull: t.step_func((controller) => { 6 const buffer = controller.byobRequest.view.buffer; 7 // Detach the buffer. 8 postMessage(buffer, '*', [buffer]); 9 10 // Try to enqueue with a new buffer. 11 assert_throws_js(TypeError, () => controller.enqueue(new Uint8Array([42]))); 12 13 // If we got here the test passed. 14 controller.error(error); 15 }) 16 }); 17 const reader = rs.getReader({ mode: 'byob' }); 18 await promise_rejects_exactly(t, error, reader.read(new Uint8Array(1))); 19}, 'enqueue after detaching byobRequest.view.buffer should throw'); 20