Skip to content

[web] ServiceWorker "installing" may be null right after calling "update()" #101459

@ditman

Description

@ditman

In certain (unknown) cases, a service worker registration object may return a null serviceworker in installing state, right after calling update() on the service worker registration object.

The below initialization code (shared by many flutter web apps) is affected:

  • } else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
    // When the app updates the serviceWorkerVersion changes, so we
    // need to ask the service worker to update.
    console.log('New service worker available.');
    reg.update();
    waitForActivation(reg.installing);
    } else {

(reg.installing is null, when it shouldn't.)

Steps to Reproduce

@yjbanov managed to get his Chrome browser (v100, gLinux) in this state and immediately reported the issue, but I couldn't repro. The only way we've had to reproduce the issue was to eliminate forking in the code at this point, and force the code through that specific branch.

Expected results: An app running

Actual results: A variation of this error:

Screen Shot 2022-04-06 at 3 49 58 PM

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listplatform-webWeb applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions