w3c / w3c/ServiceWorker

spec says cache should return responses with immutable headers, but no browser does that

Open
#1,456 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Bikeshed
Stars
3.6k
Forks
324
Avg merge
14d 22h
Merged PRs (30d)
1

Description

While working on a glitch for a chrome-specific issue, I noticed a weird behavior in all browsers. The spec says that the responses returned from the Cache API should be immutable. See step 5.4.2.1 here:

https://w3c.github.io/ServiceWorker/#cache-matchall

This glitch overwrites a header in a cache-returned response, though:

https://code-cache-mime-type.glitch.me/

And it appears to work in chrome, firefox, and safari. I hit some issue in edge which prevented the service worker from installing for some reason, but I couldn't figure out why.

Given that all browsers are shipping this behavior, should we change the spec? There is some risk of implementation now that sites could break if we start making these immutable now.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cache API matchAll step 5.4.2.1 in the linked Service Worker specification, then reproduce the header overwrite using the linked glitch across the reported browsers. Compare the observed behavior with the normative text and document whether the specification should change; done requires a decided direction and the corresponding specification update if approved.

Written by the indexing model from the issue text.

Assessment

Domain
documentation, web-dev
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.