You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cache.addAll() is not consistent in aborting outstanding requests on error #1543
The spec periodically cancels outstanding requests with text like:
Terminate all the ongoing fetches initiated by requests with the aborted flag set.
However, it does not appear to do this if the fetch() rejects instead of resolving a promise. It also does not do this if a resolved Response has ok() return false, status code is 206, etc.
Also, does this kind of termination cause the associated Request.signal to expose the abort status? I'm having a hard time understanding that from the spec. @jakearchibald do you know?
I guess if cache.addAll() aborts internally it is not exposed to the script's AbortSignal. It seems the Request constructor always creates a new AbortSignal which then follows the original signal. This means the signal flows into the new Request, but if we abort the new Request signal internally the info does not flow back out to the script.
So I'm not sure if its really possible to test if outstanding requests are cancelled when one request in addAll() fails.
Another inconsistency in the same loop: in step 5 of addAll, each request is constructed and its fetch is started before the next one is processed. If a later entry fails at step 5.2 (non-HTTP(S) scheme), earlier fetches are aborted, but if it fails at step 5.1 (the Request constructor throws, e.g. cache.addAll(['/valid', 'http://[invalid'])), the promise is rejected and the fetches already started are neither aborted nor awaited. Read literally, the earlier requests still go out on the wire.
Browsers don't do this: they construct and validate the whole list before starting any fetch (Chromium, Firefox). So in both, addAll([valid, invalid]) rejects without sending any request.
Would it make sense to split step 5 into two loops, one that constructs and validates every request (steps 5.1–5.4) and one that starts the fetches, to match implementations? That would also make the "abort fetchControllers" substep in 5.2 unnecessary.
For context, undici (Node.js's fetch and Cache implementation) is adopting the browser behavior in nodejs/undici#6254, after we found that the current interleaving can leave the early fetch's promise rejected with nothing handling it.
Activity
wanderview commentedon Sep 28, 2020
I'd like to write some cache.addAll() abort WPT tests and being able to test abort status on the signal would make things a lot easier.
wanderview commentedon Sep 29, 2020
I guess if cache.addAll() aborts internally it is not exposed to the script's AbortSignal. It seems the Request constructor always creates a new AbortSignal which then follows the original signal. This means the signal flows into the new Request, but if we abort the new Request signal internally the info does not flow back out to the script.
So I'm not sure if its really possible to test if outstanding requests are cancelled when one request in addAll() fails.
CacheStorage: Abort outstanding addAll() requests on error.
monica-ch commentedon Oct 23, 2026
[Bug triage] Issue still exists, needs editorial fixes. Understand what browsers are doing from the test https://github.com/web-platform-tests/wpt/blob/master/service-workers/cache-storage/cache-add.https.any.js and update spec accordingly
mcollina commentedon Nov 24, 2026
Another inconsistency in the same loop: in step 5 of
addAll, each request is constructed and its fetch is started before the next one is processed. If a later entry fails at step 5.2 (non-HTTP(S) scheme), earlier fetches are aborted, but if it fails at step 5.1 (theRequestconstructor throws, e.g.cache.addAll(['/valid', 'http://[invalid'])), the promise is rejected and the fetches already started are neither aborted nor awaited. Read literally, the earlier requests still go out on the wire.Browsers don't do this: they construct and validate the whole list before starting any fetch (Chromium, Firefox). So in both,
addAll([valid, invalid])rejects without sending any request.Would it make sense to split step 5 into two loops, one that constructs and validates every request (steps 5.1–5.4) and one that starts the fetches, to match implementations? That would also make the "abort fetchControllers" substep in 5.2 unnecessary.
For context, undici (Node.js's fetch and Cache implementation) is adopting the browser behavior in nodejs/undici#6254, after we found that the current interleaving can leave the early fetch's promise rejected with nothing handling it.