Skip to content

Service worker registration when context doing the registration goes away #1781

Open

Description

@youennf

Let's say a document is starting to register a service worker and is quickly going away before the service worker script is loaded.
Given the document is the fetch request client, it is expected that the service worker script fetch is terminated as the document is aborted. It then follows that the service worker never gets registered.

This can be tested in https://github.com/WebKit/WebKit/blob/main/LayoutTests/http/wpt/service-workers/register-then-reload.html.
Safari follows the spec (or my interpretation of the spec at least), while Chrome and Firefox seem to continue the fetching of the script and the registration of the service worker.

We should try to converge implementations and clarify the specification.

Activity

  1. asutherland commented on Jul 5, 2025

    @asutherland

    Given the document is the fetch request client, it is expected that the service worker script fetch is terminated as the document is aborted.

    Can you elaborate on this? Are you referring to fetch group termination or something else? By my reading fetch only adds a fetch to a fetch group for a client if it's a subresource request, but "serviceworker" is a non-subresource request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions