| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 : m_code(0), | 76 : m_code(0), |
| 77 m_context(contextType), | 77 m_context(contextType), |
| 78 m_propertyName(propertyName), | 78 m_propertyName(propertyName), |
| 79 m_interfaceName(interfaceName), | 79 m_interfaceName(interfaceName), |
| 80 m_isolate(isolate) {} | 80 m_isolate(isolate) {} |
| 81 | 81 |
| 82 ExceptionState(v8::Isolate* isolate, | 82 ExceptionState(v8::Isolate* isolate, |
| 83 ContextType contextType, | 83 ContextType contextType, |
| 84 const char* interfaceName) | 84 const char* interfaceName) |
| 85 : ExceptionState(isolate, contextType, interfaceName, nullptr) { | 85 : ExceptionState(isolate, contextType, interfaceName, nullptr) { |
| 86 #if ENABLE(ASSERT) | 86 #if DCHECK_IS_ON() |
| 87 switch (m_context) { | 87 switch (m_context) { |
| 88 case ConstructionContext: | 88 case ConstructionContext: |
| 89 case EnumerationContext: | 89 case EnumerationContext: |
| 90 case IndexedGetterContext: | 90 case IndexedGetterContext: |
| 91 case IndexedSetterContext: | 91 case IndexedSetterContext: |
| 92 case IndexedDeletionContext: | 92 case IndexedDeletionContext: |
| 93 break; | 93 break; |
| 94 default: | 94 default: |
| 95 NOTREACHED(); | 95 NOTREACHED(); |
| 96 } | 96 } |
| 97 #endif // ENABLE(ASSERT) | 97 #endif // DCHECK_IS_ON() |
| 98 } | 98 } |
| 99 | 99 |
| 100 ~ExceptionState() { | 100 ~ExceptionState() { |
| 101 if (!m_exception.isEmpty()) { | 101 if (!m_exception.isEmpty()) { |
| 102 V8ThrowException::throwException(m_isolate, | 102 V8ThrowException::throwException(m_isolate, |
| 103 m_exception.newLocal(m_isolate)); | 103 m_exception.newLocal(m_isolate)); |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 | 106 |
| 107 virtual void throwDOMException(ExceptionCode, const String& message); | 107 virtual void throwDOMException(ExceptionCode, const String& message); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 const char* m_file; | 171 const char* m_file; |
| 172 const int m_line; | 172 const int m_line; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 // Syntax sugar for NonThrowableExceptionState. | 175 // Syntax sugar for NonThrowableExceptionState. |
| 176 // This can be used as a default value of an ExceptionState parameter like this: | 176 // This can be used as a default value of an ExceptionState parameter like this: |
| 177 // | 177 // |
| 178 // Node* removeChild(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); | 178 // Node* removeChild(Node*, ExceptionState& = ASSERT_NO_EXCEPTION); |
| 179 #if ENABLE(ASSERT) | 179 #if DCHECK_IS_ON() |
| 180 #define ASSERT_NO_EXCEPTION \ | 180 #define ASSERT_NO_EXCEPTION \ |
| 181 (::blink::NonThrowableExceptionState(__FILE__, __LINE__).returnThis()) | 181 (::blink::NonThrowableExceptionState(__FILE__, __LINE__).returnThis()) |
| 182 #else | 182 #else |
| 183 #define ASSERT_NO_EXCEPTION \ | 183 #define ASSERT_NO_EXCEPTION \ |
| 184 (::blink::DummyExceptionStateForTesting().returnThis()) | 184 (::blink::DummyExceptionStateForTesting().returnThis()) |
| 185 #endif | 185 #endif |
| 186 | 186 |
| 187 // DummyExceptionStateForTesting ignores all thrown exceptions. You should not | 187 // DummyExceptionStateForTesting ignores all thrown exceptions. You should not |
| 188 // use DummyExceptionStateForTesting in production code, where you need to | 188 // use DummyExceptionStateForTesting in production code, where you need to |
| 189 // handle all exceptions properly. If you really need to ignore exceptions in | 189 // handle all exceptions properly. If you really need to ignore exceptions in |
| (...skipping 23 matching lines...) Expand all Loading... |
| 213 // Syntax sugar for DummyExceptionStateForTesting. | 213 // Syntax sugar for DummyExceptionStateForTesting. |
| 214 // This can be used as a default value of an ExceptionState parameter like this: | 214 // This can be used as a default value of an ExceptionState parameter like this: |
| 215 // | 215 // |
| 216 // Node* removeChild(Node*, ExceptionState& = IGNORE_EXCEPTION_FOR_TESTING); | 216 // Node* removeChild(Node*, ExceptionState& = IGNORE_EXCEPTION_FOR_TESTING); |
| 217 #define IGNORE_EXCEPTION_FOR_TESTING \ | 217 #define IGNORE_EXCEPTION_FOR_TESTING \ |
| 218 (::blink::DummyExceptionStateForTesting().returnThis()) | 218 (::blink::DummyExceptionStateForTesting().returnThis()) |
| 219 | 219 |
| 220 } // namespace blink | 220 } // namespace blink |
| 221 | 221 |
| 222 #endif // ExceptionState_h | 222 #endif // ExceptionState_h |
| OLD | NEW |