Index: content/browser/service_worker/service_worker_write_to_cache_job.cc |
diff --git a/content/browser/service_worker/service_worker_write_to_cache_job.cc b/content/browser/service_worker/service_worker_write_to_cache_job.cc |
index 781a65257b61f1371eb8eaa703cdae73565c3dd0..a5cd2002fd0b6166ee0ba859a06630ce8b44f3d6 100644 |
--- a/content/browser/service_worker/service_worker_write_to_cache_job.cc |
+++ b/content/browser/service_worker/service_worker_write_to_cache_job.cc |
@@ -623,6 +623,13 @@ void ServiceWorkerWriteToCacheJob::OnBeforeNetworkStart( |
void ServiceWorkerWriteToCacheJob::OnResponseStarted( |
net::URLRequest* request) { |
DCHECK_EQ(net_request_, request); |
+ if (!context_) { |
+ AsyncNotifyDoneHelper( |
+ net::URLRequestStatus(net::URLRequestStatus::FAILED, net::ERR_FAILED), |
+ kFetchScriptError); |
+ return; |
+ } |
+ |
if (!request->status().is_success()) { |
AsyncNotifyDoneHelper(request->status(), kFetchScriptError); |
return; |
@@ -637,6 +644,18 @@ void ServiceWorkerWriteToCacheJob::OnResponseStarted( |
// response to our consumer, just don't cache it? |
return; |
} |
+ |
+ // Update |last_update_check| only when the request bypassed the browser |
+ // cache. |
+ if (request->response_info().network_accessed) { |
michaeln
2015/09/11 18:59:26
I'm not sure this matters, but...
I don't think n
jungkees
2015/09/22 01:23:40
Sorry for getting back late.
You are right. What
|
+ ServiceWorkerRegistration* registration = |
+ context_->GetLiveRegistration(version_->registration_id()); |
+ DCHECK(registration); // We're registering or updating so must be there. |
+ |
+ registration->set_last_update_check(base::Time::Now()); |
michaeln
2015/09/10 20:26:45
I think this logic that applies to the register/up
jungkees
2015/09/11 04:28:14
I see. The reason I put this code here is to updat
|
+ context_->storage()->UpdateLastUpdateCheckTime(registration); |
michaeln
2015/09/10 20:26:45
I'm not sure i understand this change?
1) The wri
jungkees
2015/09/11 04:28:14
This is expected behavior as per the current spec
michaeln
2015/09/11 18:59:26
Seems odd to update the time even if the job is ab
jungkees
2015/09/22 01:23:40
Indeed.
|
+ } |
+ |
// OnSSLCertificateError is not called when the HTTPS connection is reused. |
// So we check cert_status here. |
if (net::IsCertStatusError(request->ssl_info().cert_status)) { |