| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef FileError_h | 31 #ifndef FileError_h |
| 32 #define FileError_h | 32 #define FileError_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptWrappable.h" | |
| 35 #include "core/CoreExport.h" | 34 #include "core/CoreExport.h" |
| 36 #include "core/dom/DOMError.h" | |
| 37 #include "platform/heap/Handle.h" | 35 #include "platform/heap/Handle.h" |
| 38 | 36 |
| 39 namespace blink { | 37 namespace blink { |
| 40 | 38 |
| 39 class DOMException; |
| 41 class ExceptionState; | 40 class ExceptionState; |
| 42 | 41 |
| 43 class CORE_EXPORT FileError final : public DOMError { | 42 // A FileError holds a return code (success or failure) from a FileAPI |
| 44 DEFINE_WRAPPERTYPEINFO(); | 43 // or File System operation. |
| 44 // |
| 45 // FileError used to be a subclass of DOMError exposed via IDL to script, |
| 46 // but DOMException is now used instead, with instances created lazily |
| 47 // when thrown (from synchronous APIs) or assigned as `error` members |
| 48 // or passed to callbacks (for asynchronous APIs). |
| 49 // |
| 50 // TODO(jsbell): Eliminate this class, as it contains just one member. |
| 51 class CORE_EXPORT FileError final : public GarbageCollected<FileError> { |
| 45 public: | 52 public: |
| 46 enum ErrorCode { | 53 enum ErrorCode { |
| 47 OK = 0, | 54 OK = 0, |
| 48 NOT_FOUND_ERR = 1, | 55 NOT_FOUND_ERR = 1, |
| 49 SECURITY_ERR = 2, | 56 SECURITY_ERR = 2, |
| 50 ABORT_ERR = 3, | 57 ABORT_ERR = 3, |
| 51 NOT_READABLE_ERR = 4, | 58 NOT_READABLE_ERR = 4, |
| 52 ENCODING_ERR = 5, | 59 ENCODING_ERR = 5, |
| 53 NO_MODIFICATION_ALLOWED_ERR = 6, | 60 NO_MODIFICATION_ALLOWED_ERR = 6, |
| 54 INVALID_STATE_ERR = 7, | 61 INVALID_STATE_ERR = 7, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 71 static const char syntaxErrorMessage[]; | 78 static const char syntaxErrorMessage[]; |
| 72 static const char typeMismatchErrorMessage[]; | 79 static const char typeMismatchErrorMessage[]; |
| 73 | 80 |
| 74 static FileError* create(ErrorCode code) | 81 static FileError* create(ErrorCode code) |
| 75 { | 82 { |
| 76 return new FileError(code); | 83 return new FileError(code); |
| 77 } | 84 } |
| 78 | 85 |
| 79 ErrorCode code() const { return m_code; } | 86 ErrorCode code() const { return m_code; } |
| 80 | 87 |
| 88 DEFINE_INLINE_TRACE() { } |
| 89 |
| 81 static void throwDOMException(ExceptionState&, ErrorCode); | 90 static void throwDOMException(ExceptionState&, ErrorCode); |
| 91 static DOMException* createDOMException(ErrorCode); |
| 82 | 92 |
| 83 private: | 93 private: |
| 84 explicit FileError(ErrorCode); | 94 explicit FileError(ErrorCode); |
| 85 | 95 |
| 86 ErrorCode m_code; | 96 ErrorCode m_code; |
| 87 }; | 97 }; |
| 88 | 98 |
| 89 } // namespace blink | 99 } // namespace blink |
| 90 | 100 |
| 91 #endif // FileError_h | 101 #endif // FileError_h |
| OLD | NEW |