Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: content/browser/service_worker/service_worker_unregister_job.cc

Issue 477593007: ServiceWorker: Make '.ready' return a promise to be resolved with ServiceWorkerRegistration (2/3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_unregister_job.cc
diff --git a/content/browser/service_worker/service_worker_unregister_job.cc b/content/browser/service_worker/service_worker_unregister_job.cc
index 4b15f7df6e80cf31d94d01e6688e47e167f264ba..3806c91c91d85933298143f19b6810bea63b04ac 100644
--- a/content/browser/service_worker/service_worker_unregister_job.cc
+++ b/content/browser/service_worker/service_worker_unregister_job.cc
@@ -74,6 +74,7 @@ void ServiceWorkerUnregisterJob::OnRegistrationFound(
registration->ClearWhenReady();
+ UnassociateProviderHostsFromRegistration(registration);
Complete(SERVICE_WORKER_OK);
}
@@ -99,4 +100,19 @@ void ServiceWorkerUnregisterJob::ResolvePromise(
}
}
+void ServiceWorkerUnregisterJob::UnassociateProviderHostsFromRegistration(
+ ServiceWorkerRegistration* registration) {
+ DCHECK(registration);
+ for (scoped_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
+ context_->GetProviderHostIterator();
+ !it->IsAtEnd(); it->Advance()) {
+ ServiceWorkerProviderHost* host = it->GetProviderHost();
+ if (ServiceWorkerUtils::ScopeMatches(registration->pattern(),
+ host->document_url())) {
+ if (host->associated_registration()->id() == registration->id())
+ host->UnassociateRegistration();
michaeln 2014/09/04 00:27:23 This does not look right? The unreg doesn't reall
nhiroki 2014/09/08 15:55:51 Ah, yes. This is not correct. Removed.
+ }
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698