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); |