w3c / w3c/ServiceWorker

should prefetch loads trigger FetchEvents?

Open
#1,302 5 comments 0 reactions 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

Lately I noticed some odd additional FetchEvents in chrome on https://fetch-event-echo.glitch.me:

https://bugs.chromium.org/p/chromium/issues/detail?id=832105

I think these might be prefetch loads.

This got me wondering, should prefetch trigger a FetchEvent? What is the clientId? What is the resultingClientId?

On the one hand, prefetch seems to be defined for a document via the tag:

https://w3c.github.io/resource-hints/#prefetch

However, does it really make sense to "prefetch" a resource through the service worker? I was under the impression that prefetch was really there to optimize loading resources over the network. Does dispatching a FetchEvent for these loads just slow down the network optimization for no reason?

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 by reproducing the additional FetchEvents at fetch-event-echo.glitch.me and reviewing the linked Chromium issue and Resource Hints prefetch definition. Compare the observed clientId and resultingClientId behavior with the Service Worker FetchEvent model; done means reaching and documenting a clear specification decision about whether prefetch should dispatch FetchEvent and how those IDs are set.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, javascript
Domain
web-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.