[BackgroundSync] Handle storage failure
This CL introduces proper failure handling in case the storage backend fails.
Changes:
1. If the ServiceWorker is unregistered - Remove the sync registrations from memory
2. If the ServiceWorkerStorage is wiped - Reinit the BackgroundSyncManager
3. If reading or writing from ServiceWorkerStorage fails (SERVICE_WORKER_ERROR_FAILURE) - Delete everything and disable the BackgroundSyncManager until browser restart.
Added unittests for above cases. I had to change the unittest to register serviceworkers via the ServiceWorkerContext instead of directly in Storage so that the ServiceWorkerContextObserver receives updates.
BUG=449443
Review URL: https://codereview.chromium.org/1048053002
Cr-Commit-Position: refs/heads/master@{#323756}
6 files changed