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