Service Worker: Use more specific errors when StartWorker fails
UMA shows StartWorker fails more than expected, but most errors are just
the generic START_WORKER_FAILED. Use a more specific error when appropriate.
This has some user-visible behavior change in the error message that register()
rejects with. For example, a syntax error used to fail with "ServiceWorker failed
to install"; now it fails with "ServiceWorker script evaluation failed".
A Blink layout test is added for error messages, which didn't have test
coverage previously.
BUG=448003
TEST=https://codereview.chromium.org/1058323004
Review URL: https://codereview.chromium.org/1063823005
Cr-Commit-Position: refs/heads/master@{#325261}
diff --git a/content/browser/notifications/notification_event_dispatcher_impl.cc b/content/browser/notifications/notification_event_dispatcher_impl.cc
index 9f08158..34fe581 100644
--- a/content/browser/notifications/notification_event_dispatcher_impl.cc
+++ b/content/browser/notifications/notification_event_dispatcher_impl.cc
@@ -51,6 +51,7 @@
case SERVICE_WORKER_ERROR_SECURITY:
case SERVICE_WORKER_ERROR_STATE:
case SERVICE_WORKER_ERROR_TIMEOUT:
+ case SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED:
case SERVICE_WORKER_ERROR_MAX_VALUE:
status = PERSISTENT_NOTIFICATION_STATUS_SERVICE_WORKER_ERROR;
break;
@@ -107,6 +108,7 @@
case SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED:
case SERVICE_WORKER_ERROR_STATE:
case SERVICE_WORKER_ERROR_TIMEOUT:
+ case SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED:
case SERVICE_WORKER_ERROR_MAX_VALUE:
status = PERSISTENT_NOTIFICATION_STATUS_SERVICE_WORKER_ERROR;
break;