Skip to content

Commit

Permalink
Reapply "Reapply "ReadableStream should be cancelled on aborting fetc…
Browse files Browse the repository at this point in the history
…h streaming upload""

This reverts commit 826c3cab0db8660bf355979664daa9475d855cef.

This CL reapplies the CL fixing the ci test failure:
https://ci.chromium.org/ui/p/chromium/builders/ci/Linux%20Tests%20(dbg)(1)/119114/test-results?sortby=&groupby=
(see the diff from Patchset#1)

TEST: third_party/blink/tools/run_wpt_tests.py --release -p chrome external/wpt/webdriver/tests/bidi/network/

Fixed: 40071725
Change-Id: I021c29e016bef9f3ef7c980fa038a13bdd9a0369
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5363997
Commit-Queue: Yoichi Osato <[email protected]>
Reviewed-by: Adam Rice <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1272576}
  • Loading branch information
Yoichi Osato authored and chromium-wpt-export-bot committed Mar 14, 2024
1 parent 65929ad commit 5abfea3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions fetch/api/basic/request-upload.h2.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,26 @@ promise_test(async (t) => {
await promise_rejects_js(t, TypeError, fetch(url, { method, body, duplex }));
}, "Streaming upload should fail on a 401 response");

promise_test(async (t) => {
const abortMessage = 'foo abort';
let streamCancelPromise = new Promise(async res => {
var stream = new ReadableStream({
cancel: function(reason) {
res(reason);
}
});
let abortController = new AbortController();
let fetchPromise = promise_rejects_exactly(t, abortMessage, fetch('', {
method: 'POST',
body: stream,
duplex: 'half',
signal: abortController.signal
}));
abortController.abort(abortMessage);
await fetchPromise;
});

let cancelReason = await streamCancelPromise;
assert_equals(
cancelReason, abortMessage, 'ReadableStream.cancel should be called.');
}, 'ReadbleStream should be closed on signal.abort');

0 comments on commit 5abfea3

Please sign in to comment.