| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 // NonThrowableExceptionState never allow call sites to throw an exception. | 153 // NonThrowableExceptionState never allow call sites to throw an exception. |
| 154 // Should be used if an exception must not be thrown. | 154 // Should be used if an exception must not be thrown. |
| 155 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState { | 155 class CORE_EXPORT NonThrowableExceptionState final : public ExceptionState { |
| 156 public: | 156 public: |
| 157 NonThrowableExceptionState() | 157 NonThrowableExceptionState() |
| 158 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullp
tr) { } | 158 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullp
tr) { } |
| 159 | 159 |
| 160 void throwDOMException(const ExceptionCode&, const String& message) override
; | 160 void throwDOMException(const ExceptionCode&, const String& message) override
; |
| 161 void throwTypeError(const String& message = String()) override; | 161 void throwTypeError(const String& message) override; |
| 162 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override; | 162 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage) override; |
| 163 void throwRangeError(const String& message) override; | 163 void throwRangeError(const String& message) override; |
| 164 void rethrowV8Exception(v8::Local<v8::Value>) override; | 164 void rethrowV8Exception(v8::Local<v8::Value>) override; |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 // TrackExceptionState never actually throws an exception, but just records | 167 // TrackExceptionState never actually throws an exception, but just records |
| 168 // whether a call site tried to throw an exception or not. Should be used | 168 // whether a call site tried to throw an exception or not. Should be used |
| 169 // if any exceptions must be ignored. | 169 // if any exceptions must be ignored. |
| 170 class CORE_EXPORT TrackExceptionState final : public ExceptionState { | 170 class CORE_EXPORT TrackExceptionState final : public ExceptionState { |
| 171 public: | 171 public: |
| 172 TrackExceptionState() | 172 TrackExceptionState() |
| 173 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullp
tr) { } | 173 : ExceptionState(nullptr, ExceptionState::UnknownContext, nullptr, nullp
tr) { } |
| 174 ~TrackExceptionState() | 174 ~TrackExceptionState() |
| 175 { | 175 { |
| 176 // Prevent the base class throw an exception. | 176 // Prevent the base class throw an exception. |
| 177 if (hadException()) { | 177 if (hadException()) { |
| 178 clearException(); | 178 clearException(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 void throwDOMException(const ExceptionCode&, const String& message) override
; | 182 void throwDOMException(const ExceptionCode&, const String& message) override
; |
| 183 void throwTypeError(const String& message = String()) override; | 183 void throwTypeError(const String& message) override; |
| 184 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override; | 184 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage) override; |
| 185 void throwRangeError(const String& message) override; | 185 void throwRangeError(const String& message) override; |
| 186 void rethrowV8Exception(v8::Local<v8::Value>) override; | 186 void rethrowV8Exception(v8::Local<v8::Value>) override; |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 } // namespace blink | 189 } // namespace blink |
| 190 | 190 |
| 191 #endif // ExceptionState_h | 191 #endif // ExceptionState_h |
| OLD | NEW |