Index: content/browser/service_worker/service_worker_registration.cc |
diff --git a/content/browser/service_worker/service_worker_registration.cc b/content/browser/service_worker/service_worker_registration.cc |
index ce5686381e8009f90565288ad05e72d0f52d0433..ec8b257575552cde2e3d4582ba698fb1316eed3e 100644 |
--- a/content/browser/service_worker/service_worker_registration.cc |
+++ b/content/browser/service_worker/service_worker_registration.cc |
@@ -157,15 +157,17 @@ void ServiceWorkerRegistration::ClearWhenReady() { |
id(), |
script_url().GetOrigin(), |
base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); |
- |
if (!active_version() || !active_version()->HasControllee()) |
Clear(); |
} |
-void ServiceWorkerRegistration::AbortPendingClear() { |
+void ServiceWorkerRegistration::AbortPendingClear( |
+ const StatusCallback& callback) { |
DCHECK(context_); |
- if (!is_uninstalling()) |
+ if (!is_uninstalling()) { |
+ callback.Run(SERVICE_WORKER_OK); |
return; |
+ } |
is_uninstalling_ = false; |
context_->storage()->NotifyDoneUninstallingRegistration(this); |
@@ -176,8 +178,9 @@ void ServiceWorkerRegistration::AbortPendingClear() { |
context_->storage()->StoreRegistration( |
this, |
most_recent_version, |
- base::Bind(&ServiceWorkerRegistration::OnStoreFinished, |
+ base::Bind(&ServiceWorkerRegistration::OnRestoreFinished, |
this, |
+ callback, |
most_recent_version)); |
} |
@@ -273,7 +276,9 @@ void ServiceWorkerRegistration::OnDeleteFinished( |
} |
void ServiceWorkerRegistration::Clear() { |
- context_->storage()->NotifyDoneUninstallingRegistration(this); |
+ is_uninstalling_ = false; |
+ if (context_) |
+ context_->storage()->NotifyDoneUninstallingRegistration(this); |
ChangedVersionAttributesMask mask; |
if (installing_version_) { |
@@ -297,15 +302,22 @@ void ServiceWorkerRegistration::Clear() { |
FOR_EACH_OBSERVER(Listener, listeners_, |
OnVersionAttributesChanged(this, mask, info)); |
} |
+ |
+ FOR_EACH_OBSERVER( |
+ Listener, listeners_, OnRegistrationFinishedUninstalling(this)); |
} |
-void ServiceWorkerRegistration::OnStoreFinished( |
+void ServiceWorkerRegistration::OnRestoreFinished( |
+ const StatusCallback& callback, |
scoped_refptr<ServiceWorkerVersion> version, |
ServiceWorkerStatusCode status) { |
- if (!context_) |
+ if (!context_) { |
+ callback.Run(ServiceWorkerStatusCode::SERVICE_WORKER_ERROR_ABORT); |
return; |
+ } |
context_->storage()->NotifyDoneInstallingRegistration( |
this, version.get(), status); |
+ callback.Run(status); |
} |
} // namespace content |