Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1776)

Unified Diff: content/browser/service_worker/service_worker_database.cc

Issue 846443005: ServiceWorker: ReadRegistration should return NOT_FOUND when the database is not initialized (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 cf89aa8b8ca64e08637bab5f7bc4ad74a1f92f48..b6eaeeb7afb9f695c6b49165dc0539769a662d27 100644
--- a/content/browser/service_worker/service_worker_database.cc
+++ b/content/browser/service_worker/service_worker_database.cc
@@ -505,7 +505,9 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ReadRegistration(
DCHECK(resources);
Status status = LazyOpen(false);
- if (IsNewOrNonexistentDatabase(status) || status != STATUS_OK)
+ if (IsNewOrNonexistentDatabase(status))
+ return STATUS_ERROR_NOT_FOUND;
+ if (status != STATUS_OK)
return status;
RegistrationData value;
@@ -708,7 +710,9 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::ReadUserData(
DCHECK(user_data);
Status status = LazyOpen(false);
- if (IsNewOrNonexistentDatabase(status) || status != STATUS_OK)
+ if (IsNewOrNonexistentDatabase(status))
+ return STATUS_ERROR_NOT_FOUND;
+ if (status != STATUS_OK)
return status;
const std::string key = CreateUserDataKey(registration_id, user_data_name);
@@ -729,7 +733,9 @@ ServiceWorkerDatabase::Status ServiceWorkerDatabase::WriteUserData(
DCHECK(!user_data_name.empty());
Status status = LazyOpen(false);
- if (IsNewOrNonexistentDatabase(status) || status != STATUS_OK)
+ if (IsNewOrNonexistentDatabase(status))
+ return STATUS_ERROR_NOT_FOUND;
+ if (status != STATUS_OK)
return status;
// There should be the registration specified by |registration_id|.

Powered by Google App Engine
This is Rietveld 408576698