What data is exposed to JavaScript when a Chrome fetch is cancelled mid-download?
0 reputation · 30 Apr 2025, 06:04 UTC
0 reputation · 30 Apr 2025, 06:04 UTC
When a fetch request is cancelled mid-download using AbortController, Chrome may terminate the TCP connection but can still deliver partially received data to the JavaScript application. The exact amount of data exposed and the specific error type propagated to the rejection handler varies between Chrome stable, beta, and dev releases, creating inconsistent cancellation semantics for developers who need to handle partial payloads.
The AbortController API provides a clean interface for programmatic cancellation, yet its interaction with underlying network streams and response bodies is only partially documented. Chrome's network request lifecycle emits CANCEL and TIMEOUT events, but the timing and propagation to JavaScript APIs remains ambiguous, particularly when cancellation occurs during active body consumption.
Enterprise policies can also modify timeout values, further complicating the predictability of when cancellation occurs. This creates uncertainty for applications that must reliably detect whether a request was fully cancelled or if partial data was received before termination.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.