diff --git a/streams/readable-streams/from.any.js b/streams/readable-streams/from.any.js index e8c0b0b92d7c2d9..d298fde33a07696 100644 --- a/streams/readable-streams/from.any.js +++ b/streams/readable-streams/from.any.js @@ -226,6 +226,26 @@ promise_test(async t => { }, `ReadableStream.from: stream errors when next() rejects`); +promise_test(async () => { + + const iterable = { + next() { + return new Promise(() => {}); + }, + [Symbol.asyncIterator]: () => iterable + }; + + const rs = ReadableStream.from(iterable); + const reader = rs.getReader(); + + await Promise.race([ + reader.read().then(() => assert_unreached(), () => assert_unreached()), + reader.closed.then(() => assert_unreached(), () => assert_unreached()), + flushAsyncEvents() + ]); + +}, 'ReadableStream.from: stream stalls when next() never settles'); + promise_test(async () => { let nextCalls = 0;