whatwg / whatwg/fetch

consider allowing `only-if-cached` with mode `navigate`

Open
#1,237 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

topic: api
Dominant language
HTML
Stars
2.3k
Forks
403
Avg merge
21h 16m
Merged PRs (30d)
4

Description

In chromium we have a bug about devtools triggering requests with only-if-cached which are then intercepted by service workers. In some site service worker scripts that do something like new Request(evt.request) this blows up because of step 21 here:

https://fetch.spec.whatwg.org/#dom-request

In this case mode is navigate instead of same-origin. Requests with mode navigate, however, must be same-origin to the current context. Could we relax this check to allow only-if-cached if the mode is same-origin or navigate?

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 the Fetch Standard's Request constructor, specifically step 21 of the DOM Request section linked in the issue. Examine how only-if-cached is currently restricted and how navigate requests must be same-origin. Done means the proposed combination is resolved and the standard behavior is specified consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.