- From: ikram1201 <notifications@github.com>
- Date: Thu, 12 Nov 2026 18:32:07 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1859@github.com>
# Static routing: continue to the next cache when a cache lacks the request
Closes #1853
## Summary
In Handle Fetch, the `"cache"` router source iterates the storage key's name to cache map. As written, when one cache has no match, the step `If |requestResponses| is an empty list, return |timingInfo|` exits the loop. The request then goes to the network even if a later cache has a response.
This changes that step to `continue`, so the lookup checks each cache in order and uses the first match. When no cache matches, the existing `Return |timingInfo|` step after the loop still sends the request to the network. With `source: {cacheName}`, the earlier `continue` already skips every other cache, so that case is unchanged.
This matches `caches.match()`, and what @bcardarella reported for Chromium and WebKit in #1853. It also matches the `race-network-and-cache` cache lookup proposed in #1764, which already uses `continue` here. Thanks to @bcardarella for the report, the implementation references and the suggested change.
The `Else:` that follows is now redundant, since `continue` leaves the iteration. I kept it to keep the diff to one line. Happy to drop it and dedent if you prefer.
The following tasks have been completed:
* [x] Confirmed there are no ReSpec/BikeShed errors or warnings. Bikeshed 7.2.1, before and after.
* [ ] Modified Web platform tests: companion WPT PR to follow
The companion WPT adds `service-workers/service-worker/static-router-multiple-caches.https.html`, with five cases:
- a response stored only in the second cache
- the first match in cache order wins
- a `cacheName` rule finds the response in the named cache
- a `cacheName` rule doesn't search other caches
- the network fallback when no cache matches
Headless Chrome 156.0.8078.47 passes all five, and all 12 static-router test files (64/64 subtests). Firefox 159.0.1 fails them all, including the existing static-router tests, because it doesn't implement static routing yet (https://bugzil.la/1855580).
Implementation commitment:
* [ ] WebKit: no commitment requested; not run locally. The issue reports that WebKit already searches every cache.
* [ ] Chromium: no commitment requested; the new tests pass locally in Chrome 156.0.8078.47.
* [ ] Gecko: static routing isn't implemented yet (bug 1855580).
These are local observations, not implementation commitments. No implementation code is changed.
<!--
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/ikram1201/ServiceWorker/pull/1859.html" title="Last updated on Nov 13, 2026, 2:31 AM UTC (5d6efd3)">Preview</a> | <a href="https://pr-preview.w3.org/w3c/ServiceWorker/1859/57dfd24...ikram1201:5d6efd3.html" title="Last updated on Nov 13, 2026, 2:31 AM UTC (5d6efd3)">Diff</a>
You can view, comment on, or merge this pull request online at:
https://github.com/w3c/ServiceWorker/pull/1859
-- Commit Summary --
* Static routing: continue to the next cache when a cache lacks the request
-- File Changes --
M index.bs (2)
-- Patch Links --
https://github.com/w3c/ServiceWorker/pull/1859.patch
https://github.com/w3c/ServiceWorker/pull/1859.diff
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1859
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/ServiceWorker/pull/1859@github.com>
Received on Friday, 13 November 2026 02:32:11 UTC