Index: third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
diff --git a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
index 191f03d3b479194f68f80f5fbf6397e7c662c34c..2e6b79a7ac4cda71c9fb86c473237f10a3fcf19d 100644 |
--- a/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
+++ b/third_party/WebKit/Source/bindings/core/v8/ExceptionState.cpp |
@@ -37,6 +37,12 @@ |
namespace blink { |
+ExceptionState::~ExceptionState() |
+{ |
+ if (!m_exception.isEmpty()) |
+ throwException(); |
+} |
+ |
void ExceptionState::clearException() |
{ |
m_code = 0; |
@@ -46,6 +52,7 @@ void ExceptionState::clearException() |
ScriptPromise ExceptionState::reject(ScriptState* scriptState) |
{ |
ScriptPromise promise = ScriptPromise::reject(scriptState, m_exception.newLocal(scriptState->isolate())); |
+ throwException(); |
clearException(); |
return promise; |
} |
@@ -53,6 +60,7 @@ ScriptPromise ExceptionState::reject(ScriptState* scriptState) |
void ExceptionState::reject(ScriptPromiseResolver* resolver) |
{ |
resolver->reject(m_exception.newLocal(resolver->getScriptState()->isolate())); |
+ throwException(); |
clearException(); |
} |
@@ -98,6 +106,7 @@ void ExceptionState::throwException() |
{ |
ASSERT(!m_exception.isEmpty()); |
V8ThrowException::throwException(m_exception.newLocal(m_isolate), m_isolate); |
+ clearException(); |
} |
void ExceptionState::throwTypeError(const String& message) |