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

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

Issue 798883005: Add a context_ null check needed in case of DeleteAndStartOver. (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_script_cache_map.cc
diff --git a/content/browser/service_worker/service_worker_script_cache_map.cc b/content/browser/service_worker/service_worker_script_cache_map.cc
index 062ae159a2aee50174aaf09143449de6bee269f6..a0f648b2738e641a14affd3058903ea706a791f1 100644
--- a/content/browser/service_worker/service_worker_script_cache_map.cc
+++ b/content/browser/service_worker/service_worker_script_cache_map.cc
@@ -41,6 +41,8 @@ void ServiceWorkerScriptCacheMap::NotifyStartedCaching(
DCHECK_EQ(kInvalidServiceWorkerResponseId, LookupResourceId(url));
DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
owner_->status() == ServiceWorkerVersion::INSTALLING);
+ if (!context_)
+ return; // Our storage has been wiped via DeleteAndStartOver.
resource_map_[url] =
ServiceWorkerDatabase::ResourceRecord(resource_id, url, -1);
context_->storage()->StoreUncommittedResponseId(resource_id);
@@ -53,6 +55,8 @@ void ServiceWorkerScriptCacheMap::NotifyFinishedCaching(
DCHECK_NE(kInvalidServiceWorkerResponseId, LookupResourceId(url));
DCHECK(owner_->status() == ServiceWorkerVersion::NEW ||
owner_->status() == ServiceWorkerVersion::INSTALLING);
+ if (!context_)
+ return; // Our storage has been wiped via DeleteAndStartOver.
if (!status.is_success()) {
context_->storage()->DoomUncommittedResponse(LookupResourceId(url));
resource_map_.erase(url);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698