[ServiceWorker] Add blink.mojom.ServiceWorkerErrorType enum

This CL creates blink.mojom.ServiceWorkerErrorType enum type and
uses it to replace existing native enum type
blink::WebServiceWorkerError::ErrorType.
This is for preparation to impl content.mojom.ServiceWorkerProviderHost
interface, whose methods need to pass such an enum type.

BUG=755836

Change-Id: I9ee0ae1cc53e462226b179a79a046362aeddbd65
Reviewed-on: https://chromium-review.googlesource.com/620169
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Commit-Queue: Han Leon <leon.han@intel.com>
Cr-Commit-Position: refs/heads/master@{#497677}
diff --git a/content/browser/DEPS b/content/browser/DEPS
index 4e31326..8feb727 100644
--- a/content/browser/DEPS
+++ b/content/browser/DEPS
@@ -119,6 +119,7 @@
   "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerEventResult.h",
   "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponseError.h",
   "+third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerState.h",
+  "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h",
   "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_event_status.mojom.h",
   "+third_party/WebKit/public/platform/modules/serviceworker/service_worker_stream_handle.mojom.h",
   "+third_party/WebKit/public/platform/modules/webauth/authenticator.mojom.h",
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index 1151d8d..54f1e042 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -39,6 +39,7 @@
 #include "ipc/ipc_message_macros.h"
 #include "net/http/http_util.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h"
 #include "url/gurl.h"
 
 using blink::WebServiceWorkerError;
@@ -273,7 +274,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           base::ASCIIToUTF16(kServiceWorkerRegisterErrorPrefix) +
               base::ASCIIToUTF16(kShutdownErrorMessage)));
       return;
@@ -282,7 +283,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           base::ASCIIToUTF16(kServiceWorkerRegisterErrorPrefix) +
               base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
       return;
@@ -314,7 +316,7 @@
           base::Bind(&GetWebContents, render_process_id_,
                      provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         base::ASCIIToUTF16(kServiceWorkerRegisterErrorPrefix) +
             base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
     return;
@@ -344,7 +346,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
               base::ASCIIToUTF16(kShutdownErrorMessage)));
       return;
@@ -353,7 +355,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
               base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
       return;
@@ -383,7 +386,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
             base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
     return;
@@ -393,7 +396,7 @@
     // This can happen if update() is called during initial script evaluation.
     // Abort the following steps according to the spec.
     Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeState,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kState,
         base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
             base::ASCIIToUTF16(kInvalidStateErrorMessage)));
     return;
@@ -423,7 +426,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           base::ASCIIToUTF16(kServiceWorkerUpdateErrorPrefix) +
               base::ASCIIToUTF16(kShutdownErrorMessage)));
       return;
@@ -433,7 +436,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           base::ASCIIToUTF16(kServiceWorkerUnregisterErrorPrefix) +
               base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
       return;
@@ -463,7 +467,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
     return;
   }
@@ -493,7 +497,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationError(
-          thread_id, request_id, blink::WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           base::ASCIIToUTF16(kServiceWorkerGetRegistrationErrorPrefix) +
               base::ASCIIToUTF16(kShutdownErrorMessage)));
       return;
@@ -503,7 +507,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           base::ASCIIToUTF16(kServiceWorkerGetRegistrationErrorPrefix) +
               base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
       return;
@@ -529,7 +534,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         base::ASCIIToUTF16(kServiceWorkerGetRegistrationErrorPrefix) +
             base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
     return;
@@ -561,7 +566,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationsError(
-          thread_id, request_id, blink::WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           base::ASCIIToUTF16(kServiceWorkerGetRegistrationsErrorPrefix) +
               base::ASCIIToUTF16(kShutdownErrorMessage)));
       return;
@@ -571,7 +576,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationsError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           base::ASCIIToUTF16(kServiceWorkerGetRegistrationsErrorPrefix) +
               base::ASCIIToUTF16(kNoDocumentURLErrorMessage)));
       return;
@@ -590,7 +596,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationsError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         base::ASCIIToUTF16(kServiceWorkerGetRegistrationsErrorPrefix) +
             base::ASCIIToUTF16(kUserDeniedPermissionMessage)));
     return;
@@ -647,7 +653,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_EnableNavigationPreloadError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           std::string(kEnableNavigationPreloadErrorPrefix) +
               std::string(kShutdownErrorMessage)));
       return;
@@ -657,7 +663,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_EnableNavigationPreloadError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           std::string(kEnableNavigationPreloadErrorPrefix) +
               std::string(kNoDocumentURLErrorMessage)));
       return;
@@ -676,7 +683,7 @@
   }
   if (!registration->active_version()) {
     Send(new ServiceWorkerMsg_EnableNavigationPreloadError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeState,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kState,
         std::string(kEnableNavigationPreloadErrorPrefix) +
             std::string(kNoActiveWorkerErrorMessage)));
     return;
@@ -695,7 +702,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_EnableNavigationPreloadError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         std::string(kEnableNavigationPreloadErrorPrefix) +
             std::string(kUserDeniedPermissionMessage)));
     return;
@@ -720,7 +727,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_GetNavigationPreloadStateError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           std::string(kGetNavigationPreloadStateErrorPrefix) +
               std::string(kShutdownErrorMessage)));
       return;
@@ -730,7 +737,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_GetNavigationPreloadStateError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           std::string(kGetNavigationPreloadStateErrorPrefix) +
               std::string(kNoDocumentURLErrorMessage)));
       return;
@@ -762,7 +770,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_GetNavigationPreloadStateError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         std::string(kGetNavigationPreloadStateErrorPrefix) +
             std::string(kUserDeniedPermissionMessage)));
     return;
@@ -785,7 +793,7 @@
     case ProviderStatus::NO_CONTEXT:  // fallthrough
     case ProviderStatus::DEAD_HOST:
       Send(new ServiceWorkerMsg_SetNavigationPreloadHeaderError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeAbort,
+          thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
           std::string(kSetNavigationPreloadHeaderErrorPrefix) +
               std::string(kShutdownErrorMessage)));
       return;
@@ -795,7 +803,8 @@
       return;
     case ProviderStatus::NO_URL:
       Send(new ServiceWorkerMsg_SetNavigationPreloadHeaderError(
-          thread_id, request_id, WebServiceWorkerError::kErrorTypeSecurity,
+          thread_id, request_id,
+          blink::mojom::ServiceWorkerErrorType::kSecurity,
           std::string(kSetNavigationPreloadHeaderErrorPrefix) +
               std::string(kNoDocumentURLErrorMessage)));
       return;
@@ -815,7 +824,7 @@
   }
   if (!registration->active_version()) {
     Send(new ServiceWorkerMsg_SetNavigationPreloadHeaderError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeState,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kState,
         std::string(kSetNavigationPreloadHeaderErrorPrefix) +
             std::string(kNoActiveWorkerErrorMessage)));
     return;
@@ -842,7 +851,7 @@
           resource_context_, base::Bind(&GetWebContents, render_process_id_,
                                         provider_host->frame_id()))) {
     Send(new ServiceWorkerMsg_SetNavigationPreloadHeaderError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeDisabled,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kDisabled,
         std::string(kSetNavigationPreloadHeaderErrorPrefix) +
             std::string(kUserDeniedPermissionMessage)));
     return;
@@ -1137,7 +1146,7 @@
 
   if (status != SERVICE_WORKER_OK) {
     base::string16 error_message;
-    blink::WebServiceWorkerError::ErrorType error_type;
+    blink::mojom::ServiceWorkerErrorType error_type;
     GetServiceWorkerRegistrationStatusResponse(status, status_message,
                                                &error_type, &error_message);
     Send(new ServiceWorkerMsg_ServiceWorkerRegistrationError(
@@ -1179,7 +1188,7 @@
 
   if (status != SERVICE_WORKER_OK) {
     base::string16 error_message;
-    blink::WebServiceWorkerError::ErrorType error_type;
+    blink::mojom::ServiceWorkerErrorType error_type;
     GetServiceWorkerRegistrationStatusResponse(status, status_message,
                                                &error_type, &error_message);
     Send(new ServiceWorkerMsg_ServiceWorkerUpdateError(
@@ -1277,7 +1286,7 @@
                          request_id, "Status", status);
   if (status != SERVICE_WORKER_OK && status != SERVICE_WORKER_ERROR_NOT_FOUND) {
     base::string16 error_message;
-    blink::WebServiceWorkerError::ErrorType error_type;
+    blink::mojom::ServiceWorkerErrorType error_type;
     GetServiceWorkerRegistrationStatusResponse(status, std::string(),
                                                &error_type, &error_message);
     Send(new ServiceWorkerMsg_ServiceWorkerUnregistrationError(
@@ -1312,7 +1321,7 @@
 
   if (status != SERVICE_WORKER_OK && status != SERVICE_WORKER_ERROR_NOT_FOUND) {
     base::string16 error_message;
-    blink::WebServiceWorkerError::ErrorType error_type;
+    blink::mojom::ServiceWorkerErrorType error_type;
     GetServiceWorkerRegistrationStatusResponse(status, std::string(),
                                                &error_type, &error_message);
     Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationError(
@@ -1357,7 +1366,7 @@
 
   if (status != SERVICE_WORKER_OK) {
     base::string16 error_message;
-    blink::WebServiceWorkerError::ErrorType error_type;
+    blink::mojom::ServiceWorkerErrorType error_type;
     GetServiceWorkerRegistrationStatusResponse(status, std::string(),
                                                &error_type, &error_message);
     Send(new ServiceWorkerMsg_ServiceWorkerGetRegistrationsError(
@@ -1454,7 +1463,7 @@
     ServiceWorkerStatusCode status) {
   if (status != SERVICE_WORKER_OK) {
     Send(new ServiceWorkerMsg_EnableNavigationPreloadError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeUnknown,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kUnknown,
         std::string(kEnableNavigationPreloadErrorPrefix) +
             std::string(kDatabaseErrorMessage)));
     return;
@@ -1476,7 +1485,7 @@
     ServiceWorkerStatusCode status) {
   if (status != SERVICE_WORKER_OK) {
     Send(new ServiceWorkerMsg_SetNavigationPreloadHeaderError(
-        thread_id, request_id, WebServiceWorkerError::kErrorTypeUnknown,
+        thread_id, request_id, blink::mojom::ServiceWorkerErrorType::kUnknown,
         std::string(kSetNavigationPreloadHeaderErrorPrefix) +
             std::string(kDatabaseErrorMessage)));
     return;
diff --git a/content/browser/service_worker/service_worker_registration_status.cc b/content/browser/service_worker/service_worker_registration_status.cc
index a367273..ed6bc74 100644
--- a/content/browser/service_worker/service_worker_registration_status.cc
+++ b/content/browser/service_worker/service_worker_registration_status.cc
@@ -8,6 +8,7 @@
 
 #include "base/logging.h"
 #include "base/strings/utf_string_conversions.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h"
 
 namespace content {
 
@@ -16,9 +17,9 @@
 void GetServiceWorkerRegistrationStatusResponse(
     ServiceWorkerStatusCode status,
     const std::string& status_message,
-    blink::WebServiceWorkerError::ErrorType* error_type,
+    blink::mojom::ServiceWorkerErrorType* error_type,
     base::string16* message) {
-  *error_type = WebServiceWorkerError::kErrorTypeUnknown;
+  *error_type = blink::mojom::ServiceWorkerErrorType::kUnknown;
   if (!status_message.empty())
     *message = base::UTF8ToUTF16(status_message);
   else
@@ -33,31 +34,31 @@
     case SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND:
     case SERVICE_WORKER_ERROR_REDUNDANT:
     case SERVICE_WORKER_ERROR_DISALLOWED:
-      *error_type = WebServiceWorkerError::kErrorTypeInstall;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kInstall;
       return;
 
     case SERVICE_WORKER_ERROR_NOT_FOUND:
-      *error_type = WebServiceWorkerError::kErrorTypeNotFound;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kNotFound;
       return;
 
     case SERVICE_WORKER_ERROR_NETWORK:
-      *error_type = WebServiceWorkerError::kErrorTypeNetwork;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kNetwork;
       return;
 
     case SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED:
-      *error_type = WebServiceWorkerError::kErrorTypeScriptEvaluateFailed;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kScriptEvaluateFailed;
       return;
 
     case SERVICE_WORKER_ERROR_SECURITY:
-      *error_type = WebServiceWorkerError::kErrorTypeSecurity;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kSecurity;
       return;
 
     case SERVICE_WORKER_ERROR_TIMEOUT:
-      *error_type = WebServiceWorkerError::kErrorTypeTimeout;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kTimeout;
       return;
 
     case SERVICE_WORKER_ERROR_ABORT:
-      *error_type = WebServiceWorkerError::kErrorTypeAbort;
+      *error_type = blink::mojom::ServiceWorkerErrorType::kAbort;
       return;
 
     case SERVICE_WORKER_ERROR_ACTIVATE_WORKER_FAILED:
diff --git a/content/browser/service_worker/service_worker_registration_status.h b/content/browser/service_worker/service_worker_registration_status.h
index 44e6d92..7f94b26 100644
--- a/content/browser/service_worker/service_worker_registration_status.h
+++ b/content/browser/service_worker/service_worker_registration_status.h
@@ -15,7 +15,7 @@
 void GetServiceWorkerRegistrationStatusResponse(
     ServiceWorkerStatusCode status,
     const std::string& status_message,
-    blink::WebServiceWorkerError::ErrorType* error_type,
+    blink::mojom::ServiceWorkerErrorType* error_type,
     base::string16* message);
 
 }  // namespace content
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index 72b1bb2a..0ce3b4f3 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -44,6 +44,7 @@
 #include "content/public/common/result_codes.h"
 #include "net/http/http_response_headers.h"
 #include "net/http/http_response_info.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h"
 #include "third_party/WebKit/public/web/WebConsoleMessage.h"
 
 namespace content {
@@ -1352,7 +1353,7 @@
 void ServiceWorkerVersion::OnClaimClients(int request_id) {
   if (status_ != ACTIVATING && status_ != ACTIVATED) {
     embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
-        request_id, blink::WebServiceWorkerError::kErrorTypeState,
+        request_id, blink::mojom::ServiceWorkerErrorType::kState,
         base::ASCIIToUTF16(kClaimClientsStateErrorMesage)));
     return;
   }
@@ -1367,7 +1368,7 @@
   }
 
   embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
-      request_id, blink::WebServiceWorkerError::kErrorTypeAbort,
+      request_id, blink::mojom::ServiceWorkerErrorType::kAbort,
       base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage)));
 }
 
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index 87f8fd09..60d2100 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -28,6 +28,7 @@
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebNavigationPreloadState.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerProviderClient.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h"
 #include "url/url_constants.h"
 
 using blink::WebServiceWorkerError;
@@ -128,7 +129,7 @@
     std::string error_message(kServiceWorkerRegisterErrorPrefix);
     error_message += "The provided scriptURL or scope is too long.";
     callbacks->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeSecurity,
+        WebServiceWorkerError(blink::mojom::ServiceWorkerErrorType::kSecurity,
                               blink::WebString::FromASCII(error_message)));
     return;
   }
@@ -178,7 +179,7 @@
     std::string error_message(kServiceWorkerGetRegistrationErrorPrefix);
     error_message += "The provided documentURL is too long.";
     callbacks->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeSecurity,
+        WebServiceWorkerError(blink::mojom::ServiceWorkerErrorType::kSecurity,
                               blink::WebString::FromASCII(error_message)));
     return;
   }
@@ -572,7 +573,7 @@
 void ServiceWorkerDispatcher::OnRegistrationError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker",
                                "ServiceWorkerDispatcher::RegisterServiceWorker",
@@ -595,7 +596,7 @@
 void ServiceWorkerDispatcher::OnUpdateError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT_ASYNC_STEP_INTO0("ServiceWorker",
                                "ServiceWorkerDispatcher::UpdateServiceWorker",
@@ -617,7 +618,7 @@
 void ServiceWorkerDispatcher::OnUnregistrationError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT_ASYNC_STEP_INTO0(
       "ServiceWorker",
@@ -641,7 +642,7 @@
 void ServiceWorkerDispatcher::OnGetRegistrationError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT_ASYNC_STEP_INTO0(
       "ServiceWorker",
@@ -665,7 +666,7 @@
 void ServiceWorkerDispatcher::OnGetRegistrationsError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT_ASYNC_STEP_INTO0(
       "ServiceWorker",
@@ -689,7 +690,7 @@
 void ServiceWorkerDispatcher::OnEnableNavigationPreloadError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const std::string& message) {
   WebEnableNavigationPreloadCallbacks* callbacks =
       enable_navigation_preload_callbacks_.Lookup(request_id);
@@ -704,7 +705,7 @@
 void ServiceWorkerDispatcher::OnGetNavigationPreloadStateError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const std::string& message) {
   WebGetNavigationPreloadStateCallbacks* callbacks =
       get_navigation_preload_state_callbacks_.Lookup(request_id);
@@ -719,7 +720,7 @@
 void ServiceWorkerDispatcher::OnSetNavigationPreloadHeaderError(
     int thread_id,
     int request_id,
-    WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const std::string& message) {
   WebSetNavigationPreloadHeaderCallbacks* callbacks =
       set_navigation_preload_header_callbacks_.Lookup(request_id);
diff --git a/content/child/service_worker/service_worker_dispatcher.h b/content/child/service_worker/service_worker_dispatcher.h
index 2caedbc..f21f9bf 100644
--- a/content/child/service_worker/service_worker_dispatcher.h
+++ b/content/child/service_worker/service_worker_dispatcher.h
@@ -241,40 +241,38 @@
   void OnDidSetNavigationPreloadHeader(int thread_id, int request_id);
   void OnRegistrationError(int thread_id,
                            int request_id,
-                           blink::WebServiceWorkerError::ErrorType error_type,
+                           blink::mojom::ServiceWorkerErrorType error_type,
                            const base::string16& message);
   void OnUpdateError(int thread_id,
                      int request_id,
-                     blink::WebServiceWorkerError::ErrorType error_type,
+                     blink::mojom::ServiceWorkerErrorType error_type,
                      const base::string16& message);
   void OnUnregistrationError(int thread_id,
                              int request_id,
-                             blink::WebServiceWorkerError::ErrorType error_type,
+                             blink::mojom::ServiceWorkerErrorType error_type,
                              const base::string16& message);
-  void OnGetRegistrationError(
-      int thread_id,
-      int request_id,
-      blink::WebServiceWorkerError::ErrorType error_type,
-      const base::string16& message);
-  void OnGetRegistrationsError(
-      int thread_id,
-      int request_id,
-      blink::WebServiceWorkerError::ErrorType error_type,
-      const base::string16& message);
+  void OnGetRegistrationError(int thread_id,
+                              int request_id,
+                              blink::mojom::ServiceWorkerErrorType error_type,
+                              const base::string16& message);
+  void OnGetRegistrationsError(int thread_id,
+                               int request_id,
+                               blink::mojom::ServiceWorkerErrorType error_type,
+                               const base::string16& message);
   void OnEnableNavigationPreloadError(
       int thread_id,
       int request_id,
-      blink::WebServiceWorkerError::ErrorType error_type,
+      blink::mojom::ServiceWorkerErrorType error_type,
       const std::string& message);
   void OnGetNavigationPreloadStateError(
       int thread_id,
       int request_id,
-      blink::WebServiceWorkerError::ErrorType error_type,
+      blink::mojom::ServiceWorkerErrorType error_type,
       const std::string& message);
   void OnSetNavigationPreloadHeaderError(
       int thread_id,
       int request_id,
-      blink::WebServiceWorkerError::ErrorType error_type,
+      blink::mojom::ServiceWorkerErrorType error_type,
       const std::string& message);
   void OnServiceWorkerStateChanged(int thread_id,
                                    int handle_id,
diff --git a/content/common/service_worker/service_worker_messages.h b/content/common/service_worker/service_worker_messages.h
index 4116e83..f5dd1ca 100644
--- a/content/common/service_worker/service_worker_messages.h
+++ b/content/common/service_worker/service_worker_messages.h
@@ -30,8 +30,8 @@
 
 #define IPC_MESSAGE_START ServiceWorkerMsgStart
 
-IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerError::ErrorType,
-                          blink::WebServiceWorkerError::kErrorTypeLast)
+IPC_ENUM_TRAITS_MAX_VALUE(blink::mojom::ServiceWorkerErrorType,
+                          blink::mojom::ServiceWorkerErrorType::kLast)
 
 IPC_ENUM_TRAITS_MAX_VALUE(blink::WebServiceWorkerEventResult,
                           blink::kWebServiceWorkerEventResultLast)
@@ -367,7 +367,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerRegistrationError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Sent when any kind of update error occurs during a
@@ -375,7 +375,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerUpdateError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Sent when any kind of registration error occurs during a
@@ -383,7 +383,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerUnregistrationError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Sent when any kind of registration error occurs during a
@@ -391,7 +391,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerGetRegistrationError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Sent when any kind of registration error occurs during a
@@ -399,7 +399,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_ServiceWorkerGetRegistrationsError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Informs the child process that the ServiceWorker's state has changed.
@@ -432,7 +432,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_EnableNavigationPreloadError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      std::string /* message */)
 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_DidGetNavigationPreloadState,
                      int /* thread_id */,
@@ -441,7 +441,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_GetNavigationPreloadStateError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      std::string /* message */)
 IPC_MESSAGE_CONTROL2(ServiceWorkerMsg_DidSetNavigationPreloadHeader,
                      int /* thread_id */,
@@ -449,7 +449,7 @@
 IPC_MESSAGE_CONTROL4(ServiceWorkerMsg_SetNavigationPreloadHeaderError,
                      int /* thread_id */,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      std::string /* message */)
 
 // Sends MessageEvent to a client document (browser->renderer).
@@ -471,7 +471,7 @@
                      int /* request_id */)
 IPC_MESSAGE_CONTROL3(ServiceWorkerMsg_ClaimClientsError,
                      int /* request_id */,
-                     blink::WebServiceWorkerError::ErrorType /* code */,
+                     blink::mojom::ServiceWorkerErrorType,
                      base::string16 /* message */)
 
 // Sent via EmbeddedWorker as a response of GetClient.
diff --git a/content/renderer/service_worker/service_worker_context_client.cc b/content/renderer/service_worker/service_worker_context_client.cc
index 77874ff..8e2755de 100644
--- a/content/renderer/service_worker/service_worker_context_client.cc
+++ b/content/renderer/service_worker/service_worker_context_client.cc
@@ -80,6 +80,7 @@
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerRequest.h"
 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerResponse.h"
+#include "third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom.h"
 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextClient.h"
 #include "third_party/WebKit/public/web/modules/serviceworker/WebServiceWorkerContextProxy.h"
 
@@ -592,7 +593,7 @@
     // This will delete |this|.
     client->OnNavigationPreloadError(
         fetch_event_id_, base::MakeUnique<blink::WebServiceWorkerError>(
-                             blink::WebServiceWorkerError::kErrorTypeNetwork,
+                             blink::mojom::ServiceWorkerErrorType::kNetwork,
                              blink::WebString::FromUTF8(message),
                              blink::WebString::FromUTF8(unsanitized_message)));
   }
@@ -1712,7 +1713,7 @@
     return;
   }
   callbacks->OnError(blink::WebServiceWorkerError(
-      blink::WebServiceWorkerError::kErrorTypeNavigation,
+      blink::mojom::ServiceWorkerErrorType::kNavigation,
       blink::WebString::FromUTF8(message)));
   context_->client_callbacks.Remove(request_id);
 }
@@ -1735,7 +1736,7 @@
     callback->OnSuccess(std::move(web_client));
   } else {
     callback->OnError(blink::WebServiceWorkerError(
-        blink::WebServiceWorkerError::kErrorTypeNotFound,
+        blink::mojom::ServiceWorkerErrorType::kNotFound,
         "The WindowClient was not found."));
   }
 
@@ -1775,7 +1776,7 @@
   }
   std::string message = "Cannot navigate to URL: " + url.spec();
   callbacks->OnError(blink::WebServiceWorkerError(
-      blink::WebServiceWorkerError::kErrorTypeNavigation,
+      blink::mojom::ServiceWorkerErrorType::kNavigation,
       blink::WebString::FromUTF8(message)));
   context_->client_callbacks.Remove(request_id);
 }
@@ -1808,7 +1809,7 @@
 
 void ServiceWorkerContextClient::OnClaimClientsError(
     int request_id,
-    blink::WebServiceWorkerError::ErrorType error_type,
+    blink::mojom::ServiceWorkerErrorType error_type,
     const base::string16& message) {
   TRACE_EVENT0("ServiceWorker",
                "ServiceWorkerContextClient::OnClaimClientsError");
diff --git a/content/renderer/service_worker/service_worker_context_client.h b/content/renderer/service_worker/service_worker_context_client.h
index 6817a8a..5756d6f 100644
--- a/content/renderer/service_worker/service_worker_context_client.h
+++ b/content/renderer/service_worker/service_worker_context_client.h
@@ -351,7 +351,7 @@
   void OnDidSkipWaiting(int request_id);
   void OnDidClaimClients(int request_id);
   void OnClaimClientsError(int request_id,
-                           blink::WebServiceWorkerError::ErrorType error_type,
+                           blink::mojom::ServiceWorkerErrorType error_type,
                            const base::string16& message);
   // Called to resolve the FetchEvent.preloadResponse promise.
   void OnNavigationPreloadResponse(
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index f939ee9..ae27836 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -63,6 +63,7 @@
 #include "public/platform/modules/serviceworker/WebServiceWorker.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerProvider.h"
 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h"
+#include "public/platform/modules/serviceworker/service_worker_error_type.mojom-blink.h"
 
 namespace blink {
 
@@ -159,7 +160,7 @@
     std::unique_ptr<RegistrationCallbacks> callbacks) {
   if (!provider_) {
     callbacks->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeState,
+        WebServiceWorkerError(mojom::blink::ServiceWorkerErrorType::kState,
                               "Failed to register a ServiceWorker: The "
                               "document is in an invalid state."));
     return;
@@ -172,7 +173,7 @@
   // https://w3c.github.io/webappsec/specs/powerfulfeatures/#settings-privileged
   if (!execution_context->IsSecureContext(error_message)) {
     callbacks->OnError(WebServiceWorkerError(
-        WebServiceWorkerError::kErrorTypeSecurity, error_message));
+        mojom::blink::ServiceWorkerErrorType::kSecurity, error_message));
     return;
   }
 
@@ -180,7 +181,7 @@
   if (!SchemeRegistry::ShouldTreatURLSchemeAsAllowingServiceWorkers(
           page_url.Protocol())) {
     callbacks->OnError(WebServiceWorkerError(
-        WebServiceWorkerError::kErrorTypeSecurity,
+        mojom::blink::ServiceWorkerErrorType::kSecurity,
         String("Failed to register a ServiceWorker: The URL protocol of the "
                "current origin ('" +
                document_origin->ToString() + "') is not supported.")));
@@ -192,7 +193,7 @@
   if (!document_origin->CanRequest(script_url)) {
     RefPtr<SecurityOrigin> script_origin = SecurityOrigin::Create(script_url);
     callbacks->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeSecurity,
+        WebServiceWorkerError(mojom::blink::ServiceWorkerErrorType::kSecurity,
                               String("Failed to register a ServiceWorker: The "
                                      "origin of the provided scriptURL ('" +
                                      script_origin->ToString() +
@@ -203,7 +204,7 @@
   if (!SchemeRegistry::ShouldTreatURLSchemeAsAllowingServiceWorkers(
           script_url.Protocol())) {
     callbacks->OnError(WebServiceWorkerError(
-        WebServiceWorkerError::kErrorTypeSecurity,
+        mojom::blink::ServiceWorkerErrorType::kSecurity,
         String("Failed to register a ServiceWorker: The URL protocol of the "
                "script ('" +
                script_url.GetString() + "') is not supported.")));
@@ -216,7 +217,7 @@
   if (!document_origin->CanRequest(pattern_url)) {
     RefPtr<SecurityOrigin> pattern_origin = SecurityOrigin::Create(pattern_url);
     callbacks->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeSecurity,
+        WebServiceWorkerError(mojom::blink::ServiceWorkerErrorType::kSecurity,
                               String("Failed to register a ServiceWorker: The "
                                      "origin of the provided scope ('" +
                                      pattern_origin->ToString() +
@@ -227,7 +228,7 @@
   if (!SchemeRegistry::ShouldTreatURLSchemeAsAllowingServiceWorkers(
           pattern_url.Protocol())) {
     callbacks->OnError(WebServiceWorkerError(
-        WebServiceWorkerError::kErrorTypeSecurity,
+        mojom::blink::ServiceWorkerErrorType::kSecurity,
         String("Failed to register a ServiceWorker: The URL protocol of the "
                "scope ('" +
                pattern_url.GetString() + "') is not supported.")));
@@ -238,7 +239,7 @@
   if (!provider_->ValidateScopeAndScriptURL(pattern_url, script_url,
                                             &web_error_message)) {
     callbacks->OnError(WebServiceWorkerError(
-        WebServiceWorkerError::kErrorTypeType,
+        mojom::blink::ServiceWorkerErrorType::kType,
         WebString::FromUTF8("Failed to register a ServiceWorker: " +
                             web_error_message.Utf8())));
     return;
@@ -252,7 +253,7 @@
               script_url, ResourceRequest::RedirectStatus::kNoRedirect,
               SecurityViolationReportingPolicy::kReport))) {
       callbacks->OnError(WebServiceWorkerError(
-          WebServiceWorkerError::kErrorTypeSecurity,
+          mojom::blink::ServiceWorkerErrorType::kSecurity,
           String(
               "Failed to register a ServiceWorker: The provided scriptURL ('" +
               script_url.GetString() +
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.cpp
index d06c4b0a..a948d79 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.cpp
@@ -29,6 +29,7 @@
  */
 
 #include "modules/serviceworkers/ServiceWorkerError.h"
+#include "public/platform/modules/serviceworker/service_worker_error_type.mojom-blink.h"
 
 #include "bindings/core/v8/ScriptPromiseResolver.h"
 #include "bindings/core/v8/ToV8ForCore.h"
@@ -54,60 +55,61 @@
 
 ExceptionParams GetExceptionParams(const WebServiceWorkerError& web_error) {
   switch (web_error.error_type) {
-    case WebServiceWorkerError::kErrorTypeAbort:
+    case mojom::blink::ServiceWorkerErrorType::kAbort:
       return ExceptionParams(kAbortError,
                              "The Service Worker operation was aborted.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeActivate:
+    case mojom::blink::ServiceWorkerErrorType::kActivate:
       // Not currently returned as a promise rejection.
       // TODO: Introduce new ActivateError type to ExceptionCodes?
       return ExceptionParams(kAbortError,
                              "The Service Worker activation failed.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeDisabled:
+    case mojom::blink::ServiceWorkerErrorType::kDisabled:
       return ExceptionParams(kNotSupportedError,
                              "Service Worker support is disabled.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeInstall:
+    case mojom::blink::ServiceWorkerErrorType::kInstall:
       // TODO: Introduce new InstallError type to ExceptionCodes?
       return ExceptionParams(kAbortError,
                              "The Service Worker installation failed.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeScriptEvaluateFailed:
+    case mojom::blink::ServiceWorkerErrorType::kScriptEvaluateFailed:
       return ExceptionParams(kAbortError,
                              "The Service Worker script failed to evaluate.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeNavigation:
+    case mojom::blink::ServiceWorkerErrorType::kNavigation:
       // ErrorTypeNavigation should have bailed out before calling this.
       NOTREACHED();
       return ExceptionParams(kUnknownError);
-    case WebServiceWorkerError::kErrorTypeNetwork:
+    case mojom::blink::ServiceWorkerErrorType::kNetwork:
       return ExceptionParams(kNetworkError,
                              "The Service Worker failed by network.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeNotFound:
+    case mojom::blink::ServiceWorkerErrorType::kNotFound:
       return ExceptionParams(
           kNotFoundError,
           "The specified Service Worker resource was not found.",
           web_error.message);
-    case WebServiceWorkerError::kErrorTypeSecurity:
+    case mojom::blink::ServiceWorkerErrorType::kSecurity:
       return ExceptionParams(
           kSecurityError,
           "The Service Worker security policy prevented an action.",
           web_error.message);
-    case WebServiceWorkerError::kErrorTypeState:
+    case mojom::blink::ServiceWorkerErrorType::kState:
       return ExceptionParams(kInvalidStateError,
                              "The Service Worker state was not valid.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeTimeout:
+    case mojom::blink::ServiceWorkerErrorType::kTimeout:
       return ExceptionParams(kAbortError,
                              "The Service Worker operation timed out.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeUnknown:
+    case mojom::blink::ServiceWorkerErrorType::kUnknown:
       return ExceptionParams(kUnknownError,
                              "An unknown error occurred within Service Worker.",
                              web_error.message);
-    case WebServiceWorkerError::kErrorTypeType:
+    case mojom::blink::ServiceWorkerErrorType::kNone:
+    case mojom::blink::ServiceWorkerErrorType::kType:
       // ErrorTypeType should have been handled before reaching this point.
       NOTREACHED();
       return ExceptionParams(kUnknownError);
@@ -132,14 +134,14 @@
     const WebServiceWorkerError& web_error) {
   ScriptState* script_state = resolver->GetScriptState();
   switch (web_error.error_type) {
-    case WebServiceWorkerError::kErrorTypeNetwork:
-    case WebServiceWorkerError::kErrorTypeNotFound:
-    case WebServiceWorkerError::kErrorTypeScriptEvaluateFailed:
+    case mojom::blink::ServiceWorkerErrorType::kNetwork:
+    case mojom::blink::ServiceWorkerErrorType::kNotFound:
+    case mojom::blink::ServiceWorkerErrorType::kScriptEvaluateFailed:
       // According to the spec, these errors during update should result in
       // a TypeError.
       return V8ThrowException::CreateTypeError(
           script_state->GetIsolate(), GetExceptionParams(web_error).message);
-    case WebServiceWorkerError::kErrorTypeType:
+    case mojom::blink::ServiceWorkerErrorType::kType:
       return V8ThrowException::CreateTypeError(script_state->GetIsolate(),
                                                web_error.message);
     default:
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
index a929ba7..c2785078 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerLinkResource.cpp
@@ -18,6 +18,7 @@
 #include "platform/scheduler/child/web_scheduler.h"
 #include "platform/wtf/PtrUtil.h"
 #include "public/platform/Platform.h"
+#include "public/platform/modules/serviceworker/service_worker_error_type.mojom-blink.h"
 
 namespace blink {
 
@@ -92,7 +93,7 @@
         "Cannot register service worker with <link> element. " +
             error_message));
     WTF::MakeUnique<RegistrationCallback>(owner_)->OnError(
-        WebServiceWorkerError(WebServiceWorkerError::kErrorTypeSecurity,
+        WebServiceWorkerError(mojom::blink::ServiceWorkerErrorType::kSecurity,
                               error_message));
     return;
   }
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp
index 6203d3a..d539d1b 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerWindowClientCallback.cpp
@@ -10,6 +10,7 @@
 #include "modules/serviceworkers/ServiceWorkerWindowClient.h"
 #include "platform/bindings/V8ThrowException.h"
 #include "platform/wtf/PtrUtil.h"
+#include "public/platform/modules/serviceworker/service_worker_error_type.mojom-blink.h"
 
 namespace blink {
 
@@ -27,7 +28,7 @@
       resolver_->GetExecutionContext()->IsContextDestroyed())
     return;
 
-  if (error.error_type == WebServiceWorkerError::kErrorTypeNavigation) {
+  if (error.error_type == mojom::blink::ServiceWorkerErrorType::kNavigation) {
     ScriptState::Scope scope(resolver_->GetScriptState());
     resolver_->Reject(V8ThrowException::CreateTypeError(
         resolver_->GetScriptState()->GetIsolate(), error.message));
diff --git a/third_party/WebKit/public/BUILD.gn b/third_party/WebKit/public/BUILD.gn
index 77e11c57..628f0f6 100644
--- a/third_party/WebKit/public/BUILD.gn
+++ b/third_party/WebKit/public/BUILD.gn
@@ -795,6 +795,7 @@
     "platform/modules/permissions/permission.mojom",
     "platform/modules/permissions/permission_status.mojom",
     "platform/modules/presentation/presentation.mojom",
+    "platform/modules/serviceworker/service_worker_error_type.mojom",
     "platform/modules/serviceworker/service_worker_event_status.mojom",
     "platform/modules/serviceworker/service_worker_stream_handle.mojom",
     "platform/modules/webauth/authenticator.mojom",
diff --git a/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h b/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h
index 5f976c8..8a27a76 100644
--- a/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h
+++ b/third_party/WebKit/public/platform/modules/serviceworker/WebServiceWorkerError.h
@@ -32,38 +32,23 @@
 #define WebServiceWorkerError_h
 
 #include "public/platform/WebString.h"
+#include "public/platform/modules/serviceworker/service_worker_error_type.mojom-shared.h"
 
 namespace blink {
 
 struct WebServiceWorkerError {
-  enum ErrorType {
-    kErrorTypeAbort = 0,
-    kErrorTypeActivate,
-    kErrorTypeDisabled,
-    kErrorTypeInstall,
-    kErrorTypeNavigation,
-    kErrorTypeNetwork,
-    kErrorTypeNotFound,
-    kErrorTypeScriptEvaluateFailed,
-    kErrorTypeSecurity,
-    kErrorTypeState,
-    kErrorTypeTimeout,
-    kErrorTypeUnknown,
-    kErrorTypeType,
-    kErrorTypeLast = kErrorTypeUnknown
-  };
-
-  WebServiceWorkerError(ErrorType error_type, const WebString& message)
+  WebServiceWorkerError(mojom::ServiceWorkerErrorType error_type,
+                        const WebString& message)
       : WebServiceWorkerError(error_type, message, WebString()) {}
 
-  WebServiceWorkerError(ErrorType error_type,
+  WebServiceWorkerError(mojom::ServiceWorkerErrorType error_type,
                         const WebString& message,
                         const WebString& unsanitized_message)
       : error_type(error_type),
         message(message),
         unsanitized_message(unsanitized_message) {}
 
-  ErrorType error_type;
+  mojom::ServiceWorkerErrorType error_type;
   // |message| can be used to populate an error that's exposed to JavaScript.
   // For service worker APIs, typically a promise will reject with this error.
   WebString message;
diff --git a/third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom b/third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom
new file mode 100644
index 0000000..960a569
--- /dev/null
+++ b/third_party/WebKit/public/platform/modules/serviceworker/service_worker_error_type.mojom
@@ -0,0 +1,27 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module blink.mojom;
+
+// Error codes for service worker APIs. This enum is used by
+// blink::WebServiceWorkerError, and the related class blink::ServiceWorkerError
+// converts blink::WebServiceWorkerError to runtime exceptions.
+enum ServiceWorkerErrorType {
+  kNone = 0,
+  kAbort,
+  kActivate,
+  kDisabled,
+  kInstall,
+  kNavigation,
+  kNetwork,
+  kNotFound,
+  kScriptEvaluateFailed,
+  kSecurity,
+  kState,
+  kTimeout,
+  kType,
+  kUnknown,
+  // Add a new type in alphabetical order, and update kLast if needed.
+  kLast = kUnknown,
+};