| Index: content/browser/service_worker/service_worker_database.cc
|
| diff --git a/content/browser/service_worker/service_worker_database.cc b/content/browser/service_worker/service_worker_database.cc
|
| index 21c002e1390467db240ee82ab797df5c3f39b025..d8913f280b4dad56bab3497a08e373dbe9a05073 100644
|
| --- a/content/browser/service_worker/service_worker_database.cc
|
| +++ b/content/browser/service_worker/service_worker_database.cc
|
| @@ -276,11 +276,11 @@ const char* ServiceWorkerDatabase::StatusToString(
|
|
|
| ServiceWorkerDatabase::RegistrationData::RegistrationData()
|
| : registration_id(kInvalidServiceWorkerRegistrationId),
|
| + update_via_cache(blink::WebServiceWorkerUpdateViaCache::kImports),
|
| version_id(kInvalidServiceWorkerVersionId),
|
| is_active(false),
|
| has_fetch_handler(false),
|
| - resources_total_size_bytes(0) {
|
| -}
|
| + resources_total_size_bytes(0) {}
|
|
|
| ServiceWorkerDatabase::RegistrationData::RegistrationData(
|
| const RegistrationData& other) = default;
|
| @@ -1402,6 +1402,17 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ParseRegistrationData(
|
| for (uint32_t feature : data.used_features())
|
| out->used_features.insert(feature);
|
|
|
| + if (data.has_update_via_cache()) {
|
| + auto value = data.update_via_cache();
|
| + if (ServiceWorkerRegistrationData_ServiceWorkerUpdateViaCacheType_IsValid(
|
| + value)) {
|
| + DLOG(ERROR) << "Update via cache mode '" << value << "' is not valid.";
|
| + return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED;
|
| + }
|
| + out->update_via_cache =
|
| + static_cast<blink::WebServiceWorkerUpdateViaCache>(value);
|
| + }
|
| +
|
| return ServiceWorkerDatabase::STATUS_OK;
|
| }
|
|
|
| @@ -1451,6 +1462,11 @@ void ServiceWorkerDatabase::WriteRegistrationDataInBatch(
|
| for (uint32_t feature : registration.used_features)
|
| data.add_used_features(feature);
|
|
|
| + data.set_update_via_cache(
|
| + static_cast<
|
| + ServiceWorkerRegistrationData_ServiceWorkerUpdateViaCacheType>(
|
| + registration.update_via_cache));
|
| +
|
| std::string value;
|
| bool success = data.SerializeToString(&value);
|
| DCHECK(success);
|
|
|