Even with the rebuilt style.css, three caching paths could still serve the
old file:
- the server sent Cache-Control: no-cache only for index.html/sw.js, so
browsers could heuristically cache style.css;
- the SW install precached with addAll(), which re-uses HTTP-cached copies,
so a new SW version could precache the stale file;
- the fetch handler is cache-first (fine once the cache is fresh).
Now every static shell file is served with Cache-Control: no-cache plus
Last-Modified and cheap 304 revalidation, and the SW install fetches each
precache URL with cache: 'reload' (CACHE simple-v304). A test pins the
install behaviour.
661 frontend / 504 Python green; version 3.6.31.
Note: the public demo simple.atroshin.ru is still v3.6.20 with the old
stylesheet - it needs a deploy of the current frontend/.
When a navigation fetch failed and the cache had no entry for the exact
URL (e.g. '/' while only 'index.html' is precached, common while the
local server restarts), the fetch handler resolved respondWith() to
undefined, producing 'TypeError: Failed to convert value to Response'.
The navigate fallback now chains caches.match(request) -> cached
index.html -> an explicit 503 offline Response. sw.js requests are
network-only with the same offline Response (previously they fell into
the navigate branch), and a new unit test loads sw.js in a VM sandbox
covering navigate/cache/asset/api paths. SW cache v97 -> v98.