| Index: content/child/service_worker/web_service_worker_provider_impl.cc
|
| diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc
|
| index 5b6edbff80fa45c45105718a9d3b62e1a9ddf50d..c416440b052bbc1b55e44a600d505b5c168ddb40 100644
|
| --- a/content/child/service_worker/web_service_worker_provider_impl.cc
|
| +++ b/content/child/service_worker/web_service_worker_provider_impl.cc
|
| @@ -10,7 +10,9 @@
|
| #include "content/child/service_worker/service_worker_dispatcher.h"
|
| #include "content/child/service_worker/service_worker_handle_reference.h"
|
| #include "content/child/service_worker/service_worker_provider_context.h"
|
| +#include "content/child/service_worker/service_worker_registration_handle_reference.h"
|
| #include "content/child/service_worker/web_service_worker_impl.h"
|
| +#include "content/child/service_worker/web_service_worker_registration_impl.h"
|
| #include "content/child/thread_safe_sender.h"
|
| #include "content/common/service_worker/service_worker_messages.h"
|
| #include "third_party/WebKit/public/platform/WebServiceWorkerProviderClient.h"
|
| @@ -47,6 +49,30 @@ void WebServiceWorkerProviderImpl::setClient(
|
| // for more context)
|
| GetDispatcher()->AddScriptClient(provider_id_, client);
|
|
|
| + if (!context_->registration()) {
|
| + // This provider is not associated with any registration.
|
| + return;
|
| + }
|
| +
|
| + // Set .ready if the associated registration has the active service worker.
|
| + if (context_->active_handle_id() != kInvalidServiceWorkerHandleId) {
|
| + WebServiceWorkerRegistrationImpl* registration =
|
| + GetDispatcher()->FindServiceWorkerRegistration(
|
| + context_->registration()->info(), false);
|
| + if (!registration) {
|
| + registration = GetDispatcher()->CreateServiceWorkerRegistration(
|
| + context_->registration()->info(), false);
|
| + ServiceWorkerVersionAttributes attrs = context_->GetVersionAttributes();
|
| + registration->SetInstalling(
|
| + GetDispatcher()->GetServiceWorker(attrs.installing, false));
|
| + registration->SetWaiting(
|
| + GetDispatcher()->GetServiceWorker(attrs.waiting, false));
|
| + registration->SetActive(
|
| + GetDispatcher()->GetServiceWorker(attrs.active, false));
|
| + }
|
| + client->setReadyRegistration(registration);
|
| + }
|
| +
|
| if (context_->controller_handle_id() != kInvalidServiceWorkerHandleId) {
|
| client->setController(GetDispatcher()->GetServiceWorker(
|
| context_->controller()->info(), false));
|
|
|