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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBCursor.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
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
index 15d5515f9acf3897be020061f1617ade376ac8b1..292553e6a391353d4ae314476e1df7badce4e46c 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp
@@ -104,16 +104,9 @@ IDBRequest* IDBCursor::update(ScriptState* script_state,
ExceptionState& exception_state) {
IDB_TRACE("IDBCursor::update");
- 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;
}
if (transaction_->IsReadOnly()) {
@@ -152,16 +145,9 @@ void IDBCursor::advance(unsigned count, ExceptionState& exception_state) {
"than 0.");
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;
}
if (IsDeleted()) {
@@ -185,16 +171,9 @@ void IDBCursor::continueFunction(ScriptState* script_state,
ExceptionState& exception_state) {
IDB_TRACE("IDBCursor::continue");
- 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;
}
if (!got_value_) {
@@ -228,16 +207,9 @@ void IDBCursor::continuePrimaryKey(ScriptState* script_state,
ExceptionState& exception_state) {
IDB_TRACE("IDBCursor::continuePrimaryKey");
- 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;
}
@@ -336,16 +308,9 @@ void IDBCursor::Continue(IDBKey* key,
IDBRequest* IDBCursor::deleteFunction(ScriptState* script_state,
ExceptionState& exception_state) {
IDB_TRACE("IDBCursor::delete");
- 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;
}
if (transaction_->IsReadOnly()) {
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698