| Index: third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| index 60a4b16686fa63563d07266abf6b096957dba3a4..ffcdd58592acdfb649cc08c391d5742c82fbe34f 100644
|
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp
|
| @@ -472,6 +472,7 @@ DispatchEventResult IDBRequest::dispatchEventInternal(Event* event) {
|
| if (setTransactionActive)
|
| m_transaction->setActive(true);
|
|
|
| + m_didThrowInEventHandler = false;
|
| DispatchEventResult dispatchResult =
|
| IDBEventDispatcher::dispatch(event, targets);
|
|
|
| @@ -482,11 +483,16 @@ DispatchEventResult IDBRequest::dispatchEventInternal(Event* event) {
|
| // Possibly abort the transaction. This must occur after unregistering (so
|
| // this request doesn't receive a second error) and before deactivating
|
| // (which might trigger commit).
|
| - if (event->type() == EventTypeNames::error &&
|
| - dispatchResult == DispatchEventResult::NotCanceled &&
|
| - !m_requestAborted) {
|
| - m_transaction->setError(m_error);
|
| - m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING);
|
| + if (!m_requestAborted) {
|
| + if (m_didThrowInEventHandler) {
|
| + m_transaction->setError(DOMException::create(
|
| + AbortError, "Uncaught exception in event handler."));
|
| + m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING);
|
| + } else if (event->type() == EventTypeNames::error &&
|
| + dispatchResult == DispatchEventResult::NotCanceled) {
|
| + m_transaction->setError(m_error);
|
| + m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING);
|
| + }
|
| }
|
|
|
| // If this was the last request in the transaction's list, it may commit
|
| @@ -507,11 +513,7 @@ DispatchEventResult IDBRequest::dispatchEventInternal(Event* event) {
|
| }
|
|
|
| void IDBRequest::uncaughtExceptionInEventHandler() {
|
| - if (m_transaction && !m_requestAborted) {
|
| - m_transaction->setError(DOMException::create(
|
| - AbortError, "Uncaught exception in event handler."));
|
| - m_transaction->abort(IGNORE_EXCEPTION_FOR_TESTING);
|
| - }
|
| + m_didThrowInEventHandler = true;
|
| }
|
|
|
| void IDBRequest::transactionDidFinishAndDispatch() {
|
|
|