w3c / w3c/ServiceWorker

Should update() always reject if there is an installing worker?

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

Currently, section 3.2.6 (step 4) of the spec mandates that calling update() rejects immediately if the context object’s relevant settings object's global object globalObject is a ServiceWorkerGlobalScope object, and globalObject's associated service worker's state is installing (i.e. calling update() inside the install handler rejects, compare WPT).

Updating if there is a worker in installing state doesn't really make sense and most likely indicates that sites call update() too often. It may be cleaner to change the spec to always reject if there is an installing worker and not only from within the installing worker.

Given that Firefox doesn't follow the spec here and already reject updates immediately (https://bugzilla.mozilla.org/show_bug.cgi?id=1488792) and Chrome only very recently implemented the current spec (when fixing a bug that prevented updating if there was an installing worker, https://crbug.com/895845), this change shouldn't cause sites to break.

What do people think? @aliams @asutherland @jakearchibald @mattto @wanderview @youennf

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

Read section 3.2.6, step 4 of the Service Worker update algorithm and compare it with the linked WPT test and browser behavior described here. Confirm whether the proposed broader rejection rule has consensus, then identify the specification and test changes needed to define and verify the accepted behavior.

Written by the indexing model from the issue text.

Assessment

Domain
api, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.