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

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

Issue 1710903002: Revert of service worker: use 200 OK for update requests even in the no update case (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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_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_);

Powered by Google App Engine
This is Rietveld 408576698