| 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 26 matching lines...) Expand all Loading... |
| 37 #include "wtf/text/WTFString.h" | 37 #include "wtf/text/WTFString.h" |
| 38 #include <v8.h> | 38 #include <v8.h> |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class ExceptionState; | 42 class ExceptionState; |
| 43 | 43 |
| 44 typedef int ExceptionCode; | 44 typedef int ExceptionCode; |
| 45 | 45 |
| 46 class IgnorableExceptionState final : public ExceptionState { | 46 class IgnorableExceptionState final : public ExceptionState { |
| 47 WTF_MAKE_NONCOPYABLE(IgnorableExceptionState); |
| 47 public: | 48 public: |
| 48 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Local<v8::Object>(), 0) { } | 49 IgnorableExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0,
0, v8::Local<v8::Object>(), 0) { } |
| 49 ExceptionState& returnThis() { return *this; } | 50 ExceptionState& returnThis() { return *this; } |
| 50 void throwDOMException(const ExceptionCode&, const String& message = String(
)) override { } | 51 void throwDOMException(const ExceptionCode&, const String& message = String(
)) override { } |
| 51 void throwTypeError(const String& message = String()) override { } | 52 void throwTypeError(const String& message = String()) override { } |
| 52 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override { } | 53 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override { } |
| 53 }; | 54 }; |
| 54 | 55 |
| 55 #define IGNORE_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) | 56 #define IGNORE_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) |
| 56 | 57 |
| 57 #if ENABLE(ASSERT) | 58 #if ENABLE(ASSERT) |
| 58 | 59 |
| 59 class CORE_EXPORT NoExceptionStateAssertionChecker final : public ExceptionState
{ | 60 class CORE_EXPORT NoExceptionStateAssertionChecker final : public ExceptionState
{ |
| 61 WTF_MAKE_NONCOPYABLE(NoExceptionStateAssertionChecker); |
| 60 public: | 62 public: |
| 61 NoExceptionStateAssertionChecker(const char* file, int line); | 63 NoExceptionStateAssertionChecker(const char* file, int line); |
| 62 ExceptionState& returnThis() { return *this; } | 64 ExceptionState& returnThis() { return *this; } |
| 63 void throwDOMException(const ExceptionCode&, const String& message = String(
)) override; | 65 void throwDOMException(const ExceptionCode&, const String& message = String(
)) override; |
| 64 void throwTypeError(const String& message = String()) override; | 66 void throwTypeError(const String& message = String()) override; |
| 65 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override; | 67 void throwSecurityError(const String& sanitizedMessage, const String& unsani
tizedMessage = String()) override; |
| 66 | 68 |
| 67 private: | 69 private: |
| 68 const char* m_file; | 70 const char* m_file; |
| 69 int m_line; | 71 int m_line; |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 #define ASSERT_NO_EXCEPTION (::blink::NoExceptionStateAssertionChecker(__FILE__,
__LINE__).returnThis()) | 74 #define ASSERT_NO_EXCEPTION (::blink::NoExceptionStateAssertionChecker(__FILE__,
__LINE__).returnThis()) |
| 73 | 75 |
| 74 #else | 76 #else |
| 75 | 77 |
| 76 #define ASSERT_NO_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) | 78 #define ASSERT_NO_EXCEPTION (::blink::IgnorableExceptionState().returnThis()) |
| 77 | 79 |
| 78 #endif | 80 #endif |
| 79 | 81 |
| 80 } // namespace blink | 82 } // namespace blink |
| 81 | 83 |
| 82 #endif // ExceptionStatePlaceholder_h | 84 #endif // ExceptionStatePlaceholder_h |
| OLD | NEW |