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

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerError.cpp

Issue 1481523006: ServiceWorker: Should throw TypeError instead of Unknown/SecurityError. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return createException(AbortError, "The Service Worker operation was abo rted.", webError.message); 51 return createException(AbortError, "The Service Worker operation was abo rted.", webError.message);
52 case WebServiceWorkerError::ErrorTypeActivate: 52 case WebServiceWorkerError::ErrorTypeActivate:
53 // Not currently returned as a promise rejection. 53 // Not currently returned as a promise rejection.
54 // FIXME: Introduce new ActivateError type to ExceptionCodes? 54 // FIXME: Introduce new ActivateError type to ExceptionCodes?
55 return createException(AbortError, "The Service Worker activation failed .", webError.message); 55 return createException(AbortError, "The Service Worker activation failed .", webError.message);
56 case WebServiceWorkerError::ErrorTypeDisabled: 56 case WebServiceWorkerError::ErrorTypeDisabled:
57 return createException(NotSupportedError, "Service Worker support is dis abled.", webError.message); 57 return createException(NotSupportedError, "Service Worker support is dis abled.", webError.message);
58 case WebServiceWorkerError::ErrorTypeInstall: 58 case WebServiceWorkerError::ErrorTypeInstall:
59 // FIXME: Introduce new InstallError type to ExceptionCodes? 59 // FIXME: Introduce new InstallError type to ExceptionCodes?
60 return createException(AbortError, "The Service Worker installation fail ed.", webError.message); 60 return createException(AbortError, "The Service Worker installation fail ed.", webError.message);
61 case WebServiceWorkerError::ErrorTypeNavigation:
62 // ErrorTypeNavigation should have bailed out before calling this.
63 ASSERT_NOT_REACHED();
64 return DOMException::create(UnknownError);
61 case WebServiceWorkerError::ErrorTypeNetwork: 65 case WebServiceWorkerError::ErrorTypeNetwork:
62 return createException(NetworkError, "The Service Worker failed by netwo rk.", webError.message); 66 return createException(NetworkError, "The Service Worker failed by netwo rk.", webError.message);
63 case WebServiceWorkerError::ErrorTypeNotFound: 67 case WebServiceWorkerError::ErrorTypeNotFound:
64 return createException(NotFoundError, "The specified Service Worker reso urce was not found.", webError.message); 68 return createException(NotFoundError, "The specified Service Worker reso urce was not found.", webError.message);
65 case WebServiceWorkerError::ErrorTypeSecurity: 69 case WebServiceWorkerError::ErrorTypeSecurity:
66 return createException(SecurityError, "The Service Worker security polic y prevented an action.", webError.message); 70 return createException(SecurityError, "The Service Worker security polic y prevented an action.", webError.message);
67 case WebServiceWorkerError::ErrorTypeState: 71 case WebServiceWorkerError::ErrorTypeState:
68 return createException(InvalidStateError, "The Service Worker state was not valid.", webError.message); 72 return createException(InvalidStateError, "The Service Worker state was not valid.", webError.message);
69 case WebServiceWorkerError::ErrorTypeTimeout: 73 case WebServiceWorkerError::ErrorTypeTimeout:
70 return createException(AbortError, "The Service Worker operation timed o ut.", webError.message); 74 return createException(AbortError, "The Service Worker operation timed o ut.", webError.message);
71 case WebServiceWorkerError::ErrorTypeUnknown: 75 case WebServiceWorkerError::ErrorTypeUnknown:
72 return createException(UnknownError, "An unknown error occurred within S ervice Worker.", webError.message); 76 return createException(UnknownError, "An unknown error occurred within S ervice Worker.", webError.message);
73 } 77 }
74 ASSERT_NOT_REACHED(); 78 ASSERT_NOT_REACHED();
75 return DOMException::create(UnknownError); 79 return DOMException::create(UnknownError);
76 } 80 }
77 81
78 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698