w3c / w3c/ServiceWorker

active service worker should be reset for same-origin redirects during navigation

Open
#1,735 1 comment 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

During navigation requests, the active service worker is set in https://w3c.github.io/ServiceWorker/#handle-fetch when there is a ServiceWorker to control the Document, but it is not changed when there are no such ServiceWorker, leaving the obsolete active service worker set in previous redirect legs.

Example scenario: a navigation to https://example.com/redirect.html (controlled by a SW sw.js) is redirected to index.html (not controlled by SWs).
Current spec: the active service worker is set to sw.js during HandleFetch for redirect.html, and remains the same even after redirected to index.html, causing the index.html Document subresources controlled by sw.js.
Expected behavior: the active service worker is null after redirected to index.html.

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 HandleFetch algorithm in the Service Worker specification and the navigation parameters algorithm at the linked HTML specification step. Trace how the active service worker is carried across same-origin redirect legs. Done means a navigation redirected to an uncontrolled same-origin document leaves the active service worker null.

Written by the indexing model from the issue text.

Assessment

Domain
web-dev
Issue type
Bug
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.