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

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

Issue 2808763007: IndexedDB: Clean up boilerplate when throwing TransactionInactiveError (Closed)
Patch Set: Created 3 years, 8 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
Index: third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
index 30d33e9979f0a8bb3e22419fd72373cdbf8a8498..9aa7b7ffd733a90532852ab734f901328bea22f4 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp
@@ -77,16 +77,9 @@ void IDBIndex::setName(const String& name, ExceptionState& exception_state) {
IDBDatabase::kIndexDeletedErrorMessage);
return;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return;
}
@@ -128,16 +121,9 @@ IDBRequest* IDBIndex::openCursor(ScriptState* script_state,
IDBDatabase::kIndexDeletedErrorMessage);
return nullptr;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return nullptr;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return nullptr;
}
WebIDBCursorDirection direction =
@@ -177,16 +163,9 @@ IDBRequest* IDBIndex::count(ScriptState* script_state,
IDBDatabase::kIndexDeletedErrorMessage);
return nullptr;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return nullptr;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return nullptr;
}
@@ -218,16 +197,9 @@ IDBRequest* IDBIndex::openKeyCursor(ScriptState* script_state,
IDBDatabase::kIndexDeletedErrorMessage);
return nullptr;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return nullptr;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return nullptr;
}
WebIDBCursorDirection direction =
@@ -305,16 +277,9 @@ IDBRequest* IDBIndex::GetInternal(ScriptState* script_state,
IDBDatabase::kIndexDeletedErrorMessage);
return nullptr;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return nullptr;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return nullptr;
}
@@ -353,16 +318,9 @@ IDBRequest* IDBIndex::GetAllInternal(ScriptState* script_state,
IDBDatabase::kIndexDeletedErrorMessage);
return nullptr;
}
- if (transaction_->IsFinished() || transaction_->IsFinishing()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionFinishedErrorMessage);
- return nullptr;
- }
if (!transaction_->IsActive()) {
- exception_state.ThrowDOMException(
- kTransactionInactiveError,
- IDBDatabase::kTransactionInactiveErrorMessage);
+ exception_state.ThrowDOMException(kTransactionInactiveError,
+ transaction_->InactiveErrorMessage());
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698