Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 // static | 40 // static |
| 41 PassRefPtrWillBeRawPtr<DOMException> ServiceWorkerError::take(ScriptPromiseResol ver*, WebType* webErrorRaw) | 41 PassRefPtrWillBeRawPtr<DOMException> ServiceWorkerError::take(ScriptPromiseResol ver*, WebType* webErrorRaw) |
| 42 { | 42 { |
| 43 OwnPtr<WebType> webError = adoptPtr(webErrorRaw); | 43 OwnPtr<WebType> webError = adoptPtr(webErrorRaw); |
| 44 switch (webError->errorType) { | 44 switch (webError->errorType) { |
| 45 case WebServiceWorkerError::ErrorTypeDisabled: | 45 case WebServiceWorkerError::ErrorTypeDisabled: |
| 46 return DOMException::create(NotSupportedError, "Service Worker support i s disabled."); | 46 return DOMException::create(NotSupportedError, "Service Worker support i s disabled."); |
| 47 case WebServiceWorkerError::ErrorTypeAbort: | 47 case WebServiceWorkerError::ErrorTypeAbort: |
| 48 return DOMException::create(AbortError, "The Service Worker operation wa s aborted."); | 48 return DOMException::create(AbortError, "The Service Worker operation wa s aborted."); |
| 49 case WebServiceWorkerError::ErrorTypeSecurity: | 49 case WebServiceWorkerError::ErrorTypeSecurity: |
| 50 return DOMException::create(SecurityError, "The Service Worker security policy prevented an action."); | 50 // FIXME clean this once Chromium side change landed. |
| 51 return DOMException::create(AbortError, "The Service Worker security pol icy prevented an action."); | |
|
nhiroki
2014/09/12 07:57:28
IIUC, you don't have to change this error type and
xiang
2014/09/16 05:47:41
Done.
| |
| 51 case WebServiceWorkerError::ErrorTypeInstall: | 52 case WebServiceWorkerError::ErrorTypeInstall: |
| 52 // FIXME: Introduce new InstallError type to ExceptionCodes? | 53 // FIXME: Introduce new InstallError type to ExceptionCodes? |
| 53 return DOMException::create(AbortError, "The Service Worker installation failed."); | 54 return DOMException::create(AbortError, "The Service Worker installation failed."); |
| 54 case WebServiceWorkerError::ErrorTypeActivate: | 55 case WebServiceWorkerError::ErrorTypeActivate: |
| 55 // Not currently returned as a promise rejection. | 56 // Not currently returned as a promise rejection. |
| 56 // FIXME: Introduce new ActivateError type to ExceptionCodes? | 57 // FIXME: Introduce new ActivateError type to ExceptionCodes? |
| 57 return DOMException::create(AbortError, "The Service Worker activation f ailed."); | 58 return DOMException::create(AbortError, "The Service Worker activation f ailed."); |
| 59 case WebServiceWorkerError::ErrorTypeNetwork: | |
| 60 // FIXME clean this once Chromium side change landed. | |
| 61 return DOMException::create(AbortError, "The Service Worker failed by ne twork."); | |
|
nhiroki
2014/09/12 07:57:28
ditto (you can pass "NetworkError" if disabling th
xiang
2014/09/16 05:47:41
Done.
| |
| 58 case WebServiceWorkerError::ErrorTypeNotFound: | 62 case WebServiceWorkerError::ErrorTypeNotFound: |
| 59 return DOMException::create(NotFoundError, "The specified Service Worker resource was not found."); | 63 return DOMException::create(NotFoundError, "The specified Service Worker resource was not found."); |
| 60 case WebServiceWorkerError::ErrorTypeUnknown: | 64 case WebServiceWorkerError::ErrorTypeUnknown: |
| 61 return DOMException::create(UnknownError, "An unknown error occurred wit hin Service Worker."); | 65 return DOMException::create(UnknownError, "An unknown error occurred wit hin Service Worker."); |
| 62 } | 66 } |
| 63 ASSERT_NOT_REACHED(); | 67 ASSERT_NOT_REACHED(); |
| 64 return DOMException::create(UnknownError); | 68 return DOMException::create(UnknownError); |
| 65 } | 69 } |
| 66 | 70 |
| 67 // static | 71 // static |
| 68 void ServiceWorkerError::dispose(WebType* webErrorRaw) | 72 void ServiceWorkerError::dispose(WebType* webErrorRaw) |
| 69 { | 73 { |
| 70 delete webErrorRaw; | 74 delete webErrorRaw; |
| 71 } | 75 } |
| 72 | 76 |
| 73 } // namespace blink | 77 } // namespace blink |
| OLD | NEW |