| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 class ExceptionState { | 44 class ExceptionState { |
| 45 WTF_MAKE_NONCOPYABLE(ExceptionState); | 45 WTF_MAKE_NONCOPYABLE(ExceptionState); |
| 46 public: | 46 public: |
| 47 enum Context { | 47 enum Context { |
| 48 ConstructionContext, | 48 ConstructionContext, |
| 49 ExecutionContext, | 49 ExecutionContext, |
| 50 DeletionContext, | 50 DeletionContext, |
| 51 GetterContext, | 51 GetterContext, |
| 52 SetterContext, | 52 SetterContext, |
| 53 EnumerationContext, |
| 54 QueryContext, |
| 55 IndexedGetterContext, |
| 56 IndexedSetterContext, |
| 57 IndexedDeletionContext, |
| 53 UnknownContext, // FIXME: Remove this once we've flipped over to the new
API. | 58 UnknownContext, // FIXME: Remove this once we've flipped over to the new
API. |
| 54 }; | 59 }; |
| 55 | 60 |
| 56 explicit ExceptionState(const v8::Handle<v8::Object>& creationContext, v8::I
solate* isolate) | 61 explicit ExceptionState(const v8::Handle<v8::Object>& creationContext, v8::I
solate* isolate) |
| 57 : m_code(0) | 62 : m_code(0) |
| 58 , m_context(UnknownContext) | 63 , m_context(UnknownContext) |
| 59 , m_propertyName(0) | 64 , m_propertyName(0) |
| 60 , m_interfaceName(0) | 65 , m_interfaceName(0) |
| 61 , m_creationContext(creationContext) | 66 , m_creationContext(creationContext) |
| 62 , m_isolate(isolate) { } | 67 , m_isolate(isolate) { } |
| 63 | 68 |
| 64 ExceptionState(Context context, const char* propertyName, const char* interf
aceName, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate) | 69 ExceptionState(Context context, const char* propertyName, const char* interf
aceName, const v8::Handle<v8::Object>& creationContext, v8::Isolate* isolate) |
| 65 : m_code(0) | 70 : m_code(0) |
| 66 , m_context(context) | 71 , m_context(context) |
| 67 , m_propertyName(propertyName) | 72 , m_propertyName(propertyName) |
| 68 , m_interfaceName(interfaceName) | 73 , m_interfaceName(interfaceName) |
| 69 , m_creationContext(creationContext) | 74 , m_creationContext(creationContext) |
| 70 , m_isolate(isolate) { } | 75 , m_isolate(isolate) { } |
| 71 | 76 |
| 72 ExceptionState(Context context, const char* interfaceName, const v8::Handle<
v8::Object>& creationContext, v8::Isolate* isolate) | 77 ExceptionState(Context context, const char* interfaceName, const v8::Handle<
v8::Object>& creationContext, v8::Isolate* isolate) |
| 73 : m_code(0) | 78 : m_code(0) |
| 74 , m_context(context) | 79 , m_context(context) |
| 75 , m_propertyName(0) | 80 , m_propertyName(0) |
| 76 , m_interfaceName(interfaceName) | 81 , m_interfaceName(interfaceName) |
| 77 , m_creationContext(creationContext) | 82 , m_creationContext(creationContext) |
| 78 , m_isolate(isolate) { ASSERT(m_context == ConstructionContext); } | 83 , m_isolate(isolate) { ASSERT(m_context == ConstructionContext || m_cont
ext == EnumerationContext || m_context == IndexedSetterContext || m_context == I
ndexedGetterContext || m_context == IndexedDeletionContext); } |
| 79 | 84 |
| 80 virtual void throwDOMException(const ExceptionCode&, const String& message); | 85 virtual void throwDOMException(const ExceptionCode&, const String& message); |
| 81 virtual void throwTypeError(const String& message); | 86 virtual void throwTypeError(const String& message); |
| 82 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()); | 87 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()); |
| 83 | 88 |
| 84 bool hadException() const { return !m_exception.isEmpty() || m_code; } | 89 bool hadException() const { return !m_exception.isEmpty() || m_code; } |
| 85 void clearException(); | 90 void clearException(); |
| 86 | 91 |
| 87 ExceptionCode code() const { return m_code; } | 92 ExceptionCode code() const { return m_code; } |
| 88 | 93 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 public: | 142 public: |
| 138 TrackExceptionState(): ExceptionState(v8::Handle<v8::Object>(), v8::Isolate:
:GetCurrent()) { } | 143 TrackExceptionState(): ExceptionState(v8::Handle<v8::Object>(), v8::Isolate:
:GetCurrent()) { } |
| 139 virtual void throwDOMException(const ExceptionCode&, const String& message)
OVERRIDE; | 144 virtual void throwDOMException(const ExceptionCode&, const String& message)
OVERRIDE; |
| 140 virtual void throwTypeError(const String& message = String()) OVERRIDE; | 145 virtual void throwTypeError(const String& message = String()) OVERRIDE; |
| 141 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE; | 146 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) OVERRIDE; |
| 142 }; | 147 }; |
| 143 | 148 |
| 144 } // namespace WebCore | 149 } // namespace WebCore |
| 145 | 150 |
| 146 #endif // ExceptionState_h | 151 #endif // ExceptionState_h |
| OLD | NEW |