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

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

Issue 18580013: IndexedDB: Make DOMException messages more useful. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Message => ErrorMessage Created 7 years, 5 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: Source/modules/indexeddb/IDBIndex.cpp
diff --git a/Source/modules/indexeddb/IDBIndex.cpp b/Source/modules/indexeddb/IDBIndex.cpp
index 316cc0c7013247da59cbe8f98e4aedd89763092c..5ae6d740500da03795761b78793f72c1f478cb1c 100644
--- a/Source/modules/indexeddb/IDBIndex.cpp
+++ b/Source/modules/indexeddb/IDBIndex.cpp
@@ -60,7 +60,11 @@ PassRefPtr<IDBRequest> IDBIndex::openCursor(ScriptExecutionContext* context, Pas
{
IDB_TRACE("IDBIndex::openCursor");
if (isDeleted()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished()) {
+ es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return 0;
}
if (!m_transaction->isActive()) {
@@ -90,7 +94,11 @@ PassRefPtr<IDBRequest> IDBIndex::count(ScriptExecutionContext* context, PassRefP
{
IDB_TRACE("IDBIndex::count");
if (isDeleted()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished()) {
+ es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return 0;
}
if (!m_transaction->isActive()) {
@@ -115,7 +123,11 @@ PassRefPtr<IDBRequest> IDBIndex::openKeyCursor(ScriptExecutionContext* context,
{
IDB_TRACE("IDBIndex::openKeyCursor");
if (isDeleted()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished()) {
+ es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return 0;
}
if (!m_transaction->isActive()) {
@@ -154,7 +166,11 @@ PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr
{
IDB_TRACE("IDBIndex::get");
if (isDeleted()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished()) {
+ es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return 0;
}
if (!m_transaction->isActive()) {
@@ -162,7 +178,7 @@ PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr
return 0;
}
if (!keyRange) {
- es.throwDOMException(DataError);
+ es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage);
return 0;
}
@@ -185,7 +201,11 @@ PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRef
{
IDB_TRACE("IDBIndex::getKey");
if (isDeleted()) {
- es.throwDOMException(InvalidStateError);
+ es.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage);
+ return 0;
+ }
+ if (m_transaction->isFinished()) {
+ es.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
return 0;
}
if (!m_transaction->isActive()) {
@@ -193,7 +213,7 @@ PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRef
return 0;
}
if (!keyRange) {
- es.throwDOMException(DataError);
+ es.throwDOMException(DataError, IDBDatabase::noKeyOrKeyRangeErrorMessage);
return 0;
}

Powered by Google App Engine
This is Rietveld 408576698