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 8c6148f8ac98720d34c635f91236b15317026530..b5477ab9a0195958a0be000ce5961f312dd8f918 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 |
@@ -41,10 +41,16 @@ |
"The script resource is behind a redirect, which is disallowed."; |
const char kServiceWorkerAllowed[] = "Service-Worker-Allowed"; |
+// The net error code used when the job fails the update attempt because the new |
+// script is byte-by-byte identical to the incumbent script. This error is shown |
+// in DevTools and in netlog, so we want something obscure enough that it won't |
+// conflict with a legitimate network error, and not too alarming if seen by |
+// developers. |
+// TODO(falken): Redesign this class so we don't have to fail at the network |
+// stack layer just to cancel the update. |
+const net::Error kIdenticalScriptError = net::ERR_FILE_EXISTS; |
+ |
} // namespace |
- |
-const net::Error ServiceWorkerWriteToCacheJob::kIdenticalScriptError = |
- net::ERR_FILE_EXISTS; |
ServiceWorkerWriteToCacheJob::ServiceWorkerWriteToCacheJob( |
net::URLRequest* request, |
@@ -466,7 +472,8 @@ |
// exists. |
if (status.status() == net::URLRequestStatus::SUCCESS && |
!cache_writer_->did_replace()) { |
- status = net::URLRequestStatus::FromError(kIdenticalScriptError); |
+ result = kIdenticalScriptError; |
+ status = net::URLRequestStatus::FromError(result); |
version_->SetStartWorkerStatusCode(SERVICE_WORKER_ERROR_EXISTS); |
version_->script_cache_map()->NotifyFinishedCaching(url_, size, status, |
std::string()); |
@@ -482,7 +489,7 @@ |
scoped_ptr<ServiceWorkerResponseReader> |
ServiceWorkerWriteToCacheJob::CreateCacheResponseReader() { |
if (incumbent_resource_id_ == kInvalidServiceWorkerResourceId || |
- !version_->pause_after_download()) { |
+ version_->skip_script_comparison()) { |
return nullptr; |
} |
return context_->storage()->CreateResponseReader(incumbent_resource_id_); |