Open
Bug 1695209
Opened 4 years ago
Add a worker list and unregister for PWA (and other workers)
Categories
(DevTools :: Debugger, defect, P3)
DevTools
Debugger
Tracking
(Not tracked)
NEW
People
(Reporter: Honza, Unassigned)
References
(Blocks 1 open bug)
Details
Adding an easy way to clear workers would help a lot in testing PWA. I know unregisterging is available from the workers pages but it only works when the list is short. Searching throught it and checking which one applies to the page you are developing is time consuming.
So. This is a code that lets you unregister all instances of a Service worker for current site/page.
navigator.serviceWorker.getRegistrations().then(function(registrations) {
for (var index = 0; index < registrations.length; index++) {
var registration = registrations[index];
registration.unregister();
}
});
The list and option to unregister could be added to the Data tab (were we can already clear caches
object). On the workers list the values could be:
- Scope (
registration.scope
) - Script URL (
registration.active.scriptURL
). Asactive
can be null that would have to be something like:registration.active ? registration.active.scriptURL : ''
- State (
registration.active.state
). And again asactive
can be null that would have to be something like:registration.active ? registration.active.state : 'inactive'
.
See also:
https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration
You need to log in
before you can comment on or make changes to this bug.
Description
•