#54955: test: wait for service worker activation before stopping it
Description of Change
Fixes intermittent failures in two ServiceWorkerMain specs:
startWorkerForScope() starts previously stopped worker
("expected undefined not to be undefined") and
ipc handle(channel) works after restarting worker
("Failed to start service worker.").
Both specs stopped the worker as soon as it reported running.
A newly registered worker is already running while its install event is in flight.
A stop at that point aborts the install, so Chromium marks the version redundant and deletes the new registration.
After that, the stopped event has no ServiceWorkerMain to return,
and startWorkerForScope() has no registration to start.
Delaying the install event in the fixture makes both failures reproduce every time.
The specs now wait in the page until the registration's worker is activated before stopping it.
If the worker becomes redundant instead, the wait fails immediately.
A stop after activation cannot fail the registration.
starts previously stopped worker also checks that the stopped and restarted worker is the original ServiceWorkerMain.
works after restarting worker checks that startWorkerForScope() restarted that same worker.
🤖 Generated with Claude Code
Checklist
- I have built and tested this change
- I have filled out the PR description
- I have reviewed and verified the changes
- tests are changed or added
Release Notes
Notes: none
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron