Skip to content

Commit

Permalink
Streams: verify that aborting a pipe with both preventCancel and prev…
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens authored and natechapin committed Aug 23, 2019
1 parent 034a706 commit eec3d01
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions streams/piping/abort.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,21 @@ promise_test(t => {
});
}, 'preventAbort should prevent aborting the readable');

promise_test(t => {
const rs = recordingReadableStream(errorOnPull, hwm0);
const ws = recordingWritableStream();
const abortController = new AbortController();
const signal = abortController.signal;
abortController.abort();
return promise_rejects(t, 'AbortError', rs.pipeTo(ws, { signal, preventCancel: true, preventAbort: true }),
'pipeTo should reject')
.then(() => {
assert_equals(rs.events.length, 0, 'cancel should not be called');
assert_equals(ws.events.length, 0, 'writable should not have been aborted');
return ws.getWriter().ready;
});
}, 'preventCancel and preventAbort should prevent canceling the readable and aborting the readable');

promise_test(t => {
const rs = new ReadableStream({
start(controller) {
Expand Down

0 comments on commit eec3d01

Please sign in to comment.