[w3c/ServiceWorker] Validate Cache.addAll() requests before fetching (PR #1865)

`Cache.addAll()` currently starts fetching while it is still constructing and validating later requests. If a later URL is malformed or uses a non-HTTP(S) scheme, the batch can reject after an earlier request has already been sent.

This change constructs and validates the whole batch before starting any fetch. A `Request` constructor exception or an unsupported scheme now rejects the batch without starting a fetch, so the invalid-scheme path no longer needs to abort earlier fetches.

This matches the validation order in [Chromium](https://github.com/chromium/chromium/blob/f6fe6d70e57323a833140991c3a0f57128505458/third_party/blink/renderer/modules/cache_storage/cache.cc#L1116-L1154), [Gecko](https://github.com/mozilla-firefox/firefox/blob/9f5927296df3d987dbbc64de0488b9bba3392eea/dom/cache/Cache.cpp#L314-L357), and [WebKit](https://github.com/WebKit/WebKit/blob/87ed7fa3078722a960c856277b37e0f3e722bc70/Source/WebCore/Modules/cache/DOMCache.cpp#L285-L321). In local checks with all three engines, a valid URL followed by either a malformed URL or a `data:` URL rejected with `TypeError`, and the server did not receive the request for the valid URL. No Web Platform Tests are included in this PR.

This addresses the validation-order case discussed in #1543. It does not change response handling or cancellation after fetching starts, where engines still differ.

<!-- For editorial changes, delete the rest of this template. -->

The following tasks have been completed:

- [ ] Modified Web platform tests (link)

Implementation commitment:

- [ ] WebKit (link to issue)
- [ ] Chromium (link to issue)
- [ ] Gecko (link to issue)


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://pr-preview.w3.org/mcollina/ServiceWorker/pull/1865.html" title="Last updated on Nov 26, 2026, 9:14 AM UTC (eb0bf1f)">Preview</a> | <a href="https://pr-preview.w3.org/w3c/ServiceWorker/1865/05701db...mcollina:eb0bf1f.html" title="Last updated on Nov 26, 2026, 9:14 AM UTC (eb0bf1f)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/ServiceWorker/pull/1865

-- Commit Summary --

  * Validate Cache.addAll() requests before fetching

-- File Changes --

    M index.bs (11)

-- Patch Links --

https://github.com/w3c/ServiceWorker/pull/1865.patch
https://github.com/w3c/ServiceWorker/pull/1865.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1865
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/ServiceWorker/pull/1865@github.com>

Received on Thursday, 26 November 2026 09:15:25 UTC