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

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

Issue 1063823005: Service Worker: Use more specific errors when StartWorker fails (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update histograms.xml Created 5 years, 8 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_register_job.cc
diff --git a/content/browser/service_worker/service_worker_register_job.cc b/content/browser/service_worker/service_worker_register_job.cc
index 4f6620aecc88af04b43d6bddf4b4931c962104d6..3fe1942111f6286a02e7307562e9d643ac3bb659 100644
--- a/content/browser/service_worker/service_worker_register_job.cc
+++ b/content/browser/service_worker/service_worker_register_job.cc
@@ -333,31 +333,20 @@ void ServiceWorkerRegisterJob::OnStartWorkerFinished(
}
// "If serviceWorker fails to start up..." then reject the promise with an
- // error and abort. When there is a main script network error, the status will
- // be updated to a more specific one.
+ // error and abort.
+ if (status == SERVICE_WORKER_ERROR_TIMEOUT) {
+ Complete(status, "Timed out while trying to start the Service Worker.");
+ return;
+ }
+
const net::URLRequestStatus& main_script_status =
new_version()->script_cache_map()->main_script_status();
std::string message;
if (main_script_status.status() != net::URLRequestStatus::SUCCESS) {
- switch (main_script_status.error()) {
- case net::ERR_INSECURE_RESPONSE:
- case net::ERR_UNSAFE_REDIRECT:
- status = SERVICE_WORKER_ERROR_SECURITY;
- break;
- case net::ERR_ABORTED:
- status = SERVICE_WORKER_ERROR_ABORT;
- break;
- default:
- status = SERVICE_WORKER_ERROR_NETWORK;
- }
message = new_version()->script_cache_map()->main_script_status_message();
if (message.empty())
message = kFetchScriptError;
}
-
- if (status == SERVICE_WORKER_ERROR_TIMEOUT)
- message = "Timed out while trying to start the Service Worker.";
-
Complete(status, message);
}

Powered by Google App Engine
This is Rietveld 408576698