Closed Bug 1557244 Opened 1 year ago Closed 1 year ago

Service worker registrations should not be resurrected after being unregistered

Categories

(Core :: DOM: Service Workers, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: jaffathecake, Assigned: perry)

References

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

Steps to reproduce:

As agreed at TPAC 2018.

Spec change https://github.com/w3c/ServiceWorker/pull/1415
Tests https://github.com/web-platform-tests/wpt/pull/17139

Type: defect → enhancement
Component: Untriaged → DOM: Service Workers
Product: Firefox → Core

Thanks for filing the bug! This is something we plan to do in the near term.

Priority: -- → P2
Assignee: nobody → perry
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Duplicate of this bug: 1548643
Blocks: 1490546
  • Remove ServiceWorkerRegistrations' pending uninstall flag.

  • Rename ServiceWorkerRegistrationListener's RegistrationRemoved method to
    RegistrationCleared; registrations are no longer necessarily consider
    invalid when they are removed from the "scope to registration map", but rather
    when they're both removed from the map and not controlling clients (at which
    point Clear is called).

  • Maintain the invariant that no ServiceWorkerRegistrationInfo in
    ServiceWorkerManager::RegistrationDataPerPrincipal::mInfos (i.e. the "scope
    to registration map") is in the unregistered state. Assertions check this in
    ServiceWorkerManager::AddScopeAndRegistration and
    ServiceWorkerRegistrationInfo::SetUnregistered.

  • Fix some incorrect web platform tests.

postMessage('claim') followed by waitForControlled(win) was used instead of
calling clients.claim() in a Service Worker's activate event handler; this
invocation of the event handler was not reliable due to resurrection
(resurrected active workers won't receive an activate event). This is no
longer necessary with resurrection removed.

Depends on D38686

Pushed by pjiang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c64a2a56070e
Disallow resurrection of unregistered ServiceWorkerRegistrations r=asuth
https://hg.mozilla.org/integration/autoland/rev/7509af276a01
Inherit controllers for blob URL workers in child-intercept mode r=asuth
https://hg.mozilla.org/integration/autoland/rev/5d821918d5c5
Inherit controllers in parent-intercept mode r=asuth
https://hg.mozilla.org/integration/autoland/rev/d8bcac69e89b
Remove `waitForControlled(win)` testing utility r=asuth
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/18117 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
You need to log in before you can comment on or make changes to this bug.