Chromium Code Reviews| Index: content/browser/service_worker/service_worker_dispatcher_host.cc |
| diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| index a60f8bb3e936befb84b226ca651ac1e316f8ea87..bab772259d901a67ce9611b10f78481a010623b7 100644 |
| --- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
| +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
| @@ -4,11 +4,15 @@ |
| #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| +#include "base/strings/utf_string_conversions.h" |
| #include "content/browser/service_worker/service_worker_context.h" |
| #include "content/common/service_worker_messages.h" |
| #include "ipc/ipc_message_macros.h" |
| +#include "third_party/WebKit/public/platform/WebServiceWorkerError.h" |
| #include "url/gurl.h" |
| +using WebKit::WebServiceWorkerError; |
| + |
| namespace content { |
| ServiceWorkerDispatcherHost::ServiceWorkerDispatcherHost( |
| @@ -56,6 +60,15 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( |
| if (scope.GetOrigin() != script_url.GetOrigin()) |
|
michaeln
2013/10/25 21:41:25
this can use the error return path now and probabl
michaeln
2013/10/26 00:57:39
was wondering what happened to this one... i guess
alecflett
2013/10/28 17:03:14
oops, just an oversight. Done. (Add added a fairly
|
| return; |
| + if (!context_->enabled()) { |
| + Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
| + thread_id, |
| + request_id, |
| + WebKit::WebServiceWorkerError::DisabledError, |
| + ASCIIToUTF16("ServiceWorker is disabled"))); |
| + return; |
| + } |
| + |
| Send(new ServiceWorkerMsg_ServiceWorkerRegistered( |
| thread_id, request_id, NextWorkerId())); |
| } |
| @@ -66,6 +79,15 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker(int32 thread_id, |
| // TODO(alecflett): add a ServiceWorker-specific policy query in |
| // ChildProcessSecurityImpl. See http://crbug.com/311631. |
| + if (!context_->enabled()) { |
| + Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError( |
| + thread_id, |
| + request_id, |
| + WebServiceWorkerError::DisabledError, |
| + ASCIIToUTF16("ServiceWorker is disabled"))); |
| + return; |
| + } |
| + |
| Send(new ServiceWorkerMsg_ServiceWorkerUnregistered( |
| thread_id, request_id)); |
| } |