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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 #include "bindings/core/v8/ExceptionState.h" | 31 #include "bindings/core/v8/ExceptionState.h" |
32 | 32 |
33 #include "bindings/core/v8/ExceptionMessages.h" | 33 #include "bindings/core/v8/ExceptionMessages.h" |
34 #include "bindings/core/v8/ScriptPromiseResolver.h" | 34 #include "bindings/core/v8/ScriptPromiseResolver.h" |
35 #include "bindings/core/v8/V8ThrowException.h" | 35 #include "bindings/core/v8/V8ThrowException.h" |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 ExceptionState::~ExceptionState() | |
41 { | |
42 if (!m_exception.isEmpty()) | |
43 throwException(); | |
44 } | |
45 | |
40 void ExceptionState::clearException() | 46 void ExceptionState::clearException() |
41 { | 47 { |
42 m_code = 0; | 48 m_code = 0; |
43 m_exception.clear(); | 49 m_exception.clear(); |
44 } | 50 } |
45 | 51 |
46 ScriptPromise ExceptionState::reject(ScriptState* scriptState) | 52 ScriptPromise ExceptionState::reject(ScriptState* scriptState) |
47 { | 53 { |
48 ScriptPromise promise = ScriptPromise::reject(scriptState, m_exception.newLo cal(scriptState->isolate())); | 54 ScriptPromise promise = ScriptPromise::reject(scriptState, m_exception.newLo cal(scriptState->isolate())); |
49 clearException(); | 55 clearException(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 return; | 97 return; |
92 } | 98 } |
93 | 99 |
94 m_exception.set(m_isolate, exception); | 100 m_exception.set(m_isolate, exception); |
95 } | 101 } |
96 | 102 |
97 void ExceptionState::throwException() | 103 void ExceptionState::throwException() |
98 { | 104 { |
99 ASSERT(!m_exception.isEmpty()); | 105 ASSERT(!m_exception.isEmpty()); |
100 V8ThrowException::throwException(m_exception.newLocal(m_isolate), m_isolate) ; | 106 V8ThrowException::throwException(m_exception.newLocal(m_isolate), m_isolate) ; |
107 clearException(); | |
Yuki
2016/06/15 07:23:25
Why do you need this line?
throwException() is a
| |
101 } | 108 } |
102 | 109 |
103 void ExceptionState::throwTypeError(const String& message) | 110 void ExceptionState::throwTypeError(const String& message) |
104 { | 111 { |
105 ASSERT(m_isolate); | 112 ASSERT(m_isolate); |
106 m_code = V8TypeError; | 113 m_code = V8TypeError; |
107 m_message = message; | 114 m_message = message; |
108 setException(V8ThrowException::createTypeError(m_isolate, addExceptionContex t(message))); | 115 setException(V8ThrowException::createTypeError(m_isolate, addExceptionContex t(message))); |
109 } | 116 } |
110 | 117 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
192 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message); | 199 processedMessage = ExceptionMessages::failedToDeleteIndexed(interfac eName(), message); |
193 else if (m_context == IndexedGetterContext) | 200 else if (m_context == IndexedGetterContext) |
194 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message); | 201 processedMessage = ExceptionMessages::failedToGetIndexed(interfaceNa me(), message); |
195 else if (m_context == IndexedSetterContext) | 202 else if (m_context == IndexedSetterContext) |
196 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message); | 203 processedMessage = ExceptionMessages::failedToSetIndexed(interfaceNa me(), message); |
197 } | 204 } |
198 return processedMessage; | 205 return processedMessage; |
199 } | 206 } |
200 | 207 |
201 } // namespace blink | 208 } // namespace blink |
OLD | NEW |