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 6b2d299664732395b9ca999cf24bbcc5194e6dc6..16d42597b3c127be67c8748fb4ac30487b5117c8 100644 |
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc |
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc |
@@ -88,6 +88,7 @@ bool ServiceWorkerDispatcherHost::OnMessageReceived( |
void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( |
int32 thread_id, |
int32 request_id, |
+ int32 provider_id, |
const GURL& pattern, |
const GURL& script_url) { |
if (!context_ || !context_->IsEnabled()) { |
@@ -111,9 +112,16 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( |
return; |
} |
+ ServiceWorkerProviderHost* provider_host = |
+ context_->GetProviderHost(render_process_id_, provider_id); |
+ if (!provider_host) { |
+ BadMessageReceived(); |
+ return; |
+ } |
kinuko
2014/01/29 09:56:20
Do we need this check?
alecflett
2014/01/30 01:51:13
I guess we don't now! (an earlier iteration needed
|
context_->RegisterServiceWorker( |
pattern, |
script_url, |
+ render_process_id_, |
base::Bind(&ServiceWorkerDispatcherHost::RegistrationComplete, |
this, |
thread_id, |
@@ -123,6 +131,7 @@ void ServiceWorkerDispatcherHost::OnRegisterServiceWorker( |
void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( |
int32 thread_id, |
int32 request_id, |
+ int32 provider_id, |
const GURL& pattern) { |
// TODO(alecflett): This check is insufficient for release. Add a |
// ServiceWorker-specific policy query in |
@@ -136,8 +145,15 @@ void ServiceWorkerDispatcherHost::OnUnregisterServiceWorker( |
return; |
} |
+ ServiceWorkerProviderHost* provider_host = |
+ context_->GetProviderHost(render_process_id_, provider_id); |
+ if (!provider_host) { |
+ BadMessageReceived(); |
+ return; |
+ } |
context_->UnregisterServiceWorker( |
pattern, |
+ render_process_id_, |
base::Bind(&ServiceWorkerDispatcherHost::UnregistrationComplete, |
this, |
thread_id, |