Skip to content
Merged
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
17 changes: 5 additions & 12 deletions streams/readable-byte-streams/bad-buffers-and-views.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ promise_test(t => {
async_test(t => {
const stream = new ReadableStream({
pull: t.step_func_done(c => {
// Detach it by reading into it
reader.read(c.byobRequest.view);
c.byobRequest.view.buffer.transfer();

assert_throws_js(TypeError, () => c.byobRequest.respond(1),
'respond() must throw if the corresponding view has become detached');
Expand All @@ -141,9 +140,7 @@ async_test(t => {
const stream = new ReadableStream({
pull: t.step_func_done(c => {
c.close();

// Detach it by reading into it
reader.read(c.byobRequest.view);
c.byobRequest.view.buffer.transfer();

assert_throws_js(TypeError, () => c.byobRequest.respond(0),
'respond() must throw if the corresponding view has become detached');
Expand All @@ -159,9 +156,8 @@ async_test(t => {
async_test(t => {
const stream = new ReadableStream({
pull: t.step_func_done(c => {
// Detach it by reading into it
const view = new Uint8Array([1, 2, 3]);
reader.read(view);
view.buffer.transfer();

assert_throws_js(TypeError, () => c.byobRequest.respondWithNewView(view));
}),
Expand Down Expand Up @@ -364,8 +360,7 @@ async_test(t => {
async_test(t => {
const stream = new ReadableStream({
pull: t.step_func_done(c => {
// Detach it by reading into it
reader.read(c.byobRequest.view);
c.byobRequest.view.buffer.transfer();

assert_throws_js(TypeError, () => c.enqueue(new Uint8Array([1])),
'enqueue() must throw if the BYOB request\'s buffer has become detached');
Expand All @@ -382,9 +377,7 @@ async_test(t => {
const stream = new ReadableStream({
pull: t.step_func_done(c => {
c.close();

// Detach it by reading into it
reader.read(c.byobRequest.view);
c.byobRequest.view.buffer.transfer();

assert_throws_js(TypeError, () => c.enqueue(new Uint8Array([1])),
'enqueue() must throw if the BYOB request\'s buffer has become detached');
Expand Down