Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBRequest.cpp

Issue 2734533002: IndexedDB: Align abort behavior on uncaught exception with Gecko (Closed)
Patch Set: Test refactors per review Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBRequest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBRequest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698