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

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

Issue 1908313003: Shows the error message while fetching the SW script in the DevTools console. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated falken's comment Created 4 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_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 b1e7d4b3057759f71470ba798a3c67017c8f616a..2053d483df5b675d1046da2a8c845ca22df9b3f1 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
@@ -435,17 +435,8 @@ void ServiceWorkerWriteToCacheJob::NotifyStartErrorHelper(
const net::URLRequestStatus& status,
const std::string& status_message) {
DCHECK(!status.is_io_pending());
-
- net::Error error = NotifyFinishedCaching(status, status_message);
- // The special case mentioned in NotifyFinishedCaching about script being
- // identical does not apply here, since the entire body needs to be read
- // before this is relevant.
- DCHECK_EQ(status.error(), error);
-
- net::URLRequestStatus reported_status = status;
- std::string reported_status_message = status_message;
-
- NotifyStartError(reported_status);
+ NotifyFinishedCaching(status, status_message);
+ NotifyStartError(status);
}
net::Error ServiceWorkerWriteToCacheJob::NotifyFinishedCaching(
@@ -455,6 +446,15 @@ net::Error ServiceWorkerWriteToCacheJob::NotifyFinishedCaching(
if (did_notify_finished_)
return result;
+ if (status.status() != net::URLRequestStatus::SUCCESS) {
+ // AddMessageToConsole must be called before this job notifies that an error
+ // occurred because the worker stops soon after receiving the error
+ // response.
+ version_->embedded_worker()->AddMessageToConsole(
+ CONSOLE_MESSAGE_LEVEL_ERROR,
+ status_message.empty() ? kFetchScriptError : status_message);
+ }
+
int size = -1;
if (status.is_success())
size = cache_writer_->bytes_written();
« no previous file with comments | « content/browser/service_worker/embedded_worker_instance.cc ('k') | content/common/service_worker/embedded_worker_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698