Index: content/browser/service_worker/service_worker_register_job.cc |
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc |
index 0a28dc1ccab0af6b23f99e53b9b04f4f851599e6..d3487a15cef1d226c7444ab5c6242ddb1222e107 100644 |
--- a/content/browser/service_worker/service_worker_register_job.cc |
+++ b/content/browser/service_worker/service_worker_register_job.cc |
@@ -260,7 +260,7 @@ void ServiceWorkerRegisterJob::RegisterAndContinue() { |
set_registration(new ServiceWorkerRegistration( |
pattern_, context_->storage()->NewRegistrationId(), context_)); |
- AssociateProviderHostsToRegistration(registration()); |
+ AddRegistrationToMatchingProviderHosts(registration()); |
UpdateAndContinue(); |
} |
@@ -547,18 +547,19 @@ void ServiceWorkerRegisterJob::OnCompareScriptResourcesComplete( |
new_version()->embedded_worker()->RemoveListener(this); |
} |
-void ServiceWorkerRegisterJob::AssociateProviderHostsToRegistration( |
+void ServiceWorkerRegisterJob::AddRegistrationToMatchingProviderHosts( |
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->CanAssociateRegistration(registration)) |
- host->AssociateRegistration(registration); |
- } |
+ if (host->IsHostToRunningServiceWorker()) |
+ continue; |
+ if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(), |
+ host->document_url())) |
+ continue; |
+ host->AddMatchingRegistration(registration); |
} |
} |