Closed Bug 1613558 Opened 4 years ago Closed 4 years ago

[wpt-sync] Sync PR 21620 - Service workers continue to control clients after Clear-Site-Data

Categories

(Core :: DOM: Service Workers, task, P4)

task

Tracking

()

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: mozilla.org, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 21620 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/21620
Details from upstream follow.

Steve Becker <stevebe@microsoft.com> wrote:

Service workers continue to control clients after Clear-Site-Data

Adds an immediate flag to unregister jobs for service worker
registrations. When set, the immediate flag enables unregister jobs to
run the "Clear Registration" algorithm immediately without waiting for
the active worker's controllees to unload. After an immediate clear,
the registration's controllees become uncontrolled. The controllees
receive the 'controllerchange' event when the
navigator.serviceWorker.controller is set to null.

This change updates ServiceWorkerContextCore::DeleteForOrigin() to set
the immediate unregister job flag to true. All other callers set the
immediate flag to false. The storage quota manager uses
ServiceWorkerContextCore::DeleteForOrigin() when clearing data for the
origin. In addition to evicting origins to free up storage quota, this
code path is used by scenarios like the Clear-Site-Data network
header and the "clear browsing data" privacy UI setting.

The change adds a new function to the ServiceWorkerRegistration class,
DeleteAndClearImmediately(), which is used by ServiceWorkerUnregisterJob
when the immediate flag is true. DeleteAndClearImmediately() is very
similar to the existing function, ClearWhenReady(), but it does not wait
to clear the registration when the active worker has controllees.

ServiceWorkerContextCore::DeleteForOrigin() is also updated to call
DeleteAndClearImmediately() on the origin's uninstalling registrations.
Registrations stuck in the uninstalling state are waiting for the active
worker's controllees to unload. ServiceWorkerContextCore::DeleteForOrigin()
must stop waiting and clear the registration immediately.
GetUninstallingRegistrationsForOrigin() is added to the
ServiceWorkerRegistry to enable ServiceWorkerContextCore:: DeleteForOrigin()
to find the uninstalling registrations it needs to clear.

For testing, the change adds a new unit test that sets the immediate flag to
true in ServiceWorkerJobTest. The change also adds a new service worker WPT
test, unregister-immediately.https.html. The new WPT test uses the
Clear-Site-Data network header to unregister service workers with the
immediate flag set to true. The WPT test adds a test case for each service
worker state. For example, one test case uses Clear-Site-Data to clear a
registration with a service worker in the 'parsing' state. Other test
cases cover the other service worker states like 'installing',
'installed', 'activating' and 'activated'. Additional test cases
verify controllee state, which includes verifying what happens to
pending fetch events when the controller clears.

Bug: 1014114
Change-Id: I3baee1117e6dbd349ec4c98c796d4e1b2bddde96

Reviewed-on: https://chromium-review.googlesource.com/2040533
WPT-Export-Revision: eb43c35dc126839e4567dd586b50e33d32cbcbba

Component: web-platform-tests → DOM: Service Workers
Product: Testing → Core

CI Results

Ran 13 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 48 tests

Status Summary

Firefox

PASS : 5[GitHub] 44[Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-asan-opt, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt]
FAIL : 1
TIMEOUT: 6[Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-asan-opt, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt] 8[GitHub]
NOTRUN : 4

Chrome

OK : 1
PASS : 11
FAIL : 1
TIMEOUT: 6
NOTRUN : 1

Safari

PASS : 3
FAIL : 3
TIMEOUT: 8
NOTRUN : 4

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

/service-workers/service-worker/unregister-immediately-before-installed.https.html: TIMEOUT (Chrome: OK, Safari: TIMEOUT)
Clear-Site-Data must abort service worker registration.: TIMEOUT (Chrome: PASS, Safari: TIMEOUT)
Clear-Site-Data must unregister a registration with a worker in the "installing" state.: NOTRUN (Chrome: PASS, Safari: NOTRUN)
/clear-site-data/storage.https.html: SKIP [Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-asan-opt, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt], TIMEOUT [GitHub] (Chrome: TIMEOUT, Safari: TIMEOUT)
Service worker no longer responds to requests: FAIL (Chrome: FAIL, Safari: FAIL)
controllerchange event fires and client no longer has controller: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
Clear-Site-Data must fail pending subresource fetch events.: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
/service-workers/service-worker/unregister-immediately.https.html: TIMEOUT (Chrome: TIMEOUT, Safari: TIMEOUT)
Clear-Site-Data must unregister an activated registration with controlled clients.: NOTRUN (Chrome: TIMEOUT, Safari: NOTRUN)
Clear-Site-Data must unregister an activated registration with an update waiting.: NOTRUN (Chrome: PASS, Safari: NOTRUN)
Clear-Site-Data must unregister a registration with a worker in the "activating" state.: TIMEOUT (Chrome: PASS, Safari: TIMEOUT)
Clear-Site-Data must clear an unregistered registration waiting for controlled clients to unload.: NOTRUN (Chrome: NOTRUN, Safari: NOTRUN)

Tests Disabled in Gecko Infrastructure

/clear-site-data/storage.https.html: SKIP [Gecko-android-em-7.0-x86_64-debug-geckoview, Gecko-android-em-7.0-x86_64-opt-geckoview, Gecko-linux1804-64-asan-opt, Gecko-linux1804-64-debug, Gecko-linux1804-64-opt, Gecko-linux1804-64-qr-debug, Gecko-linux1804-64-qr-opt, Gecko-windows10-64-debug, Gecko-windows10-64-opt, Gecko-windows10-64-qr-debug, Gecko-windows10-64-qr-opt, Gecko-windows7-32-debug, Gecko-windows7-32-opt], TIMEOUT [GitHub] (Chrome: TIMEOUT, Safari: TIMEOUT)

Pushed by wptsync@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/31ea829480a6
[wpt PR 21620] - Clear-Site-Data must uncontrol affected service worker clients, a=testonly
https://hg.mozilla.org/integration/autoland/rev/37f89f8f5224
[wpt PR 21620] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.