Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /streams/writable-streams/byte-length-queuing-strategy.any.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.serviceworker.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.shadowrealm-in-dedicatedworker.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.shadowrealm-in-shadowrealm.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.shadowrealm-in-sharedworker.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.shadowrealm-in-window.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.sharedworker.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.any.worker.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.https.any.shadowrealm-in-audioworklet.html - WPT Dashboard Interop Dashboard
- /streams/writable-streams/byte-length-queuing-strategy.https.any.shadowrealm-in-serviceworker.html - WPT Dashboard Interop Dashboard
// META: global=window,worker,shadowrealm
'use strict';
promise_test(t => {
let isDone = false;
const ws = new WritableStream(
{
write() {
return new Promise(resolve => {
t.step_timeout(() => {
isDone = true;
resolve();
}, 200);
});
},
close() {
assert_true(isDone, 'close is only called once the promise has been resolved');
}
},
new ByteLengthQueuingStrategy({ highWaterMark: 1024 * 16 })
);
const writer = ws.getWriter();
writer.write({ byteLength: 1024 });
return writer.close();
}, 'Closing a writable stream with in-flight writes below the high water mark delays the close call properly');