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 25 matching lines...) Expand all Loading... |
36 #include "bindings/core/v8/ScriptPromise.h" | 36 #include "bindings/core/v8/ScriptPromise.h" |
37 #include "bindings/core/v8/V8ThrowException.h" | 37 #include "bindings/core/v8/V8ThrowException.h" |
38 #include "core/CoreExport.h" | 38 #include "core/CoreExport.h" |
39 #include "wtf/Noncopyable.h" | 39 #include "wtf/Noncopyable.h" |
40 #include "wtf/text/WTFString.h" | 40 #include "wtf/text/WTFString.h" |
41 #include <v8.h> | 41 #include <v8.h> |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 typedef int ExceptionCode; | 45 typedef int ExceptionCode; |
| 46 class ScriptPromiseResolver; |
46 class ScriptState; | 47 class ScriptState; |
47 | 48 |
48 class CORE_EXPORT ExceptionState { | 49 class CORE_EXPORT ExceptionState { |
49 WTF_MAKE_NONCOPYABLE(ExceptionState); | 50 WTF_MAKE_NONCOPYABLE(ExceptionState); |
50 public: | 51 public: |
51 enum Context { | 52 enum Context { |
52 ConstructionContext, | 53 ConstructionContext, |
53 ExecutionContext, | 54 ExecutionContext, |
54 DeletionContext, | 55 DeletionContext, |
55 GetterContext, | 56 GetterContext, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 { | 94 { |
94 if (!hadException()) | 95 if (!hadException()) |
95 return false; | 96 return false; |
96 throwException(); | 97 throwException(); |
97 return true; | 98 return true; |
98 } | 99 } |
99 | 100 |
100 // This method clears out the exception which |this| has. | 101 // This method clears out the exception which |this| has. |
101 ScriptPromise reject(ScriptState*); | 102 ScriptPromise reject(ScriptState*); |
102 | 103 |
| 104 // This method clears out the exception which |this| has. |
| 105 void reject(ScriptPromiseResolver*); |
| 106 |
103 Context context() const { return m_context; } | 107 Context context() const { return m_context; } |
104 const char* propertyName() const { return m_propertyName; } | 108 const char* propertyName() const { return m_propertyName; } |
105 const char* interfaceName() const { return m_interfaceName; } | 109 const char* interfaceName() const { return m_interfaceName; } |
106 | 110 |
107 void rethrowV8Exception(v8::Local<v8::Value> value) | 111 void rethrowV8Exception(v8::Local<v8::Value> value) |
108 { | 112 { |
109 setException(value); | 113 setException(value); |
110 } | 114 } |
111 | 115 |
112 #if ENABLE(ASSERT) | 116 #if ENABLE(ASSERT) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0,
v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { } | 154 TrackExceptionState(): ExceptionState(ExceptionState::UnknownContext, 0, 0,
v8::Local<v8::Object>(), v8::Isolate::GetCurrent()) { } |
151 virtual void throwDOMException(const ExceptionCode&, const String& message)
override; | 155 virtual void throwDOMException(const ExceptionCode&, const String& message)
override; |
152 virtual void throwTypeError(const String& message = String()) override; | 156 virtual void throwTypeError(const String& message = String()) override; |
153 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) override; | 157 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()) override; |
154 virtual void throwRangeError(const String& message) override; | 158 virtual void throwRangeError(const String& message) override; |
155 }; | 159 }; |
156 | 160 |
157 } // namespace blink | 161 } // namespace blink |
158 | 162 |
159 #endif // ExceptionState_h | 163 #endif // ExceptionState_h |
OLD | NEW |