Chromium Code Reviews| Index: content/browser/service_worker/service_worker_storage.cc |
| diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc |
| index c8a11c39fb3e805332083e5430795a8724fa698e..ef5740ce4a9ebf90579b94b512f4b143d3540b7b 100644 |
| --- a/content/browser/service_worker/service_worker_storage.cc |
| +++ b/content/browser/service_worker/service_worker_storage.cc |
| @@ -539,6 +539,11 @@ void ServiceWorkerStorage::StoreRegistration( |
| ResourceList resources; |
| version->script_cache_map()->GetResources(&resources); |
| + if (resources.empty()) { |
|
michaeln
2015/05/14 03:27:59
thnx!
|
| + RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); |
| + return; |
| + } |
| + |
| uint64 resources_total_size_bytes = 0; |
| for (const auto& resource : resources) { |
| resources_total_size_bytes += resource.size_bytes; |
| @@ -1094,6 +1099,12 @@ void ServiceWorkerStorage::ReturnFoundRegistration( |
| const FindRegistrationCallback& callback, |
| const ServiceWorkerDatabase::RegistrationData& data, |
| const ResourceList& resources) { |
| + if (resources.empty()) { |
|
michaeln
2015/05/14 03:27:59
Is this code reachable with your changes to servic
horo
2015/05/14 03:46:50
Ah, yes.
It should be DCHECK(!resources.empty());
|
| + ScheduleDeleteAndStartOver(); |
| + callback.Run(SERVICE_WORKER_ERROR_FAILED, |
| + scoped_refptr<ServiceWorkerRegistration>()); |
| + return; |
| + } |
| scoped_refptr<ServiceWorkerRegistration> registration = |
| GetOrCreateRegistration(data, resources); |
| CompleteFindNow(registration, SERVICE_WORKER_OK, callback); |