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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 public: | 46 public: |
47 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Handle<v8::Object>(), 0) { } | 47 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Handle<v8::Object>(), 0) { } |
48 ExceptionState& returnThis() { return *this; } | 48 ExceptionState& returnThis() { return *this; } |
49 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE { } | 49 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE { } |
50 virtual void throwTypeError(const String& message = String()) OVERRIDE { } | 50 virtual void throwTypeError(const String& message = String()) OVERRIDE { } |
51 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE { } | 51 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE { } |
52 }; | 52 }; |
53 | 53 |
54 #define IGNORE_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis()) | 54 #define IGNORE_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis()) |
55 | 55 |
56 #if ASSERT_DISABLED | 56 #if ASSERT_ENABLED |
57 | |
58 #define ASSERT_NO_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis()) | |
59 | |
60 #else | |
61 | 57 |
62 class NoExceptionStateAssertionChecker FINAL : public ExceptionState { | 58 class NoExceptionStateAssertionChecker FINAL : public ExceptionState { |
63 public: | 59 public: |
64 NoExceptionStateAssertionChecker(const char* file, int line); | 60 NoExceptionStateAssertionChecker(const char* file, int line); |
65 ExceptionState& returnThis() { return *this; } | 61 ExceptionState& returnThis() { return *this; } |
66 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE; | 62 virtual void throwDOMException(const ExceptionCode&, const String& message =
String()) OVERRIDE; |
67 virtual void throwTypeError(const String& message = String()) OVERRIDE; | 63 virtual void throwTypeError(const String& message = String()) OVERRIDE; |
68 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE; | 64 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE; |
69 | 65 |
70 private: | 66 private: |
71 const char* m_file; | 67 const char* m_file; |
72 int m_line; | 68 int m_line; |
73 }; | 69 }; |
74 | 70 |
75 #define ASSERT_NO_EXCEPTION (::WebCore::NoExceptionStateAssertionChecker(__FILE_
_, __LINE__).returnThis()) | 71 #define ASSERT_NO_EXCEPTION (::WebCore::NoExceptionStateAssertionChecker(__FILE_
_, __LINE__).returnThis()) |
76 | 72 |
| 73 #else |
| 74 |
| 75 #define ASSERT_NO_EXCEPTION (::WebCore::IgnorableExceptionState().returnThis()) |
| 76 |
77 #endif | 77 #endif |
78 | 78 |
79 } // namespace WebCore | 79 } // namespace WebCore |
80 | 80 |
81 #endif // ExceptionStatePlaceholder_h | 81 #endif // ExceptionStatePlaceholder_h |
OLD | NEW |