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

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

Issue 18398002: Remove IDBNotFoundError ExceptionCode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: merge Created 7 years, 6 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/IDBDatabase.cpp
diff --git a/Source/modules/indexeddb/IDBDatabase.cpp b/Source/modules/indexeddb/IDBDatabase.cpp
index 73661b1d53df067e8177c7491db40af4064025b5..eb7fb75221b6883d395051ee726e8e9ca3a40557 100644
--- a/Source/modules/indexeddb/IDBDatabase.cpp
+++ b/Source/modules/indexeddb/IDBDatabase.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "modules/indexeddb/IDBDatabase.h"
+#include "bindings/v8/ExceptionState.h"
#include "core/dom/DOMStringList.h"
#include "core/dom/EventQueue.h"
#include "core/dom/ExceptionCode.h"
@@ -209,23 +210,23 @@ PassRefPtr<IDBObjectStore> IDBDatabase::createObjectStore(const String& name, co
return objectStore.release();
}
-void IDBDatabase::deleteObjectStore(const String& name, ExceptionCode& ec)
+void IDBDatabase::deleteObjectStore(const String& name, ExceptionState& es)
{
IDB_TRACE("IDBDatabase::deleteObjectStore");
HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBDeleteObjectStoreCall, IDBMethodsMax);
if (!m_versionChangeTransaction) {
- ec = INVALID_STATE_ERR;
+ es.throwDOMException(INVALID_STATE_ERR);
return;
}
if (!m_versionChangeTransaction->isActive()) {
- ec = TransactionInactiveError;
+ es.throwDOMException(TransactionInactiveError);
return;
}
int64_t objectStoreId = findObjectStoreId(name);
if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
- // FIXME: Should use (NotFoundError, "...").
- ec = IDBNotFoundError;
+ // FIXME: Should use constant
arv (Not doing code reviews) 2013/07/01 22:29:31 Where would be a good place to put this string?
jsbell 2013/07/02 18:48:08 For DOMError messages minted in Blink and Chromium
arv (Not doing code reviews) 2013/07/09 23:41:04 Went with a single constant for now.
+ es.throwDOMException(NOT_FOUND_ERR, "An operation failed because the requested database object could not be found.");
return;
}
@@ -234,21 +235,21 @@ void IDBDatabase::deleteObjectStore(const String& name, ExceptionCode& ec)
m_metadata.objectStores.remove(objectStoreId);
}
-PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const Vector<String>& scope, const String& modeString, ExceptionCode& ec)
+PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const Vector<String>& scope, const String& modeString, ExceptionState& es)
{
IDB_TRACE("IDBDatabase::transaction");
HistogramSupport::histogramEnumeration("WebCore.IndexedDB.FrontEndAPICalls", IDBTransactionCall, IDBMethodsMax);
if (!scope.size()) {
- ec = INVALID_ACCESS_ERR;
+ es.throwDOMException(INVALID_ACCESS_ERR);
return 0;
}
- IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, ec);
- if (ec)
+ IndexedDB::TransactionMode mode = IDBTransaction::stringToMode(modeString, es);
+ if (es.hadException())
return 0;
if (m_versionChangeTransaction || m_closePending) {
- ec = INVALID_STATE_ERR;
+ es.throwDOMException(INVALID_STATE_ERR);
return 0;
}
@@ -256,8 +257,8 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
for (size_t i = 0; i < scope.size(); ++i) {
int64_t objectStoreId = findObjectStoreId(scope[i]);
if (objectStoreId == IDBObjectStoreMetadata::InvalidId) {
- // FIXME: Should use (NotFoundError, "...").
- ec = IDBNotFoundError;
+ // FIXME: Should use constant
+ es.throwDOMException(NOT_FOUND_ERR, "An operation failed because the requested database object could not be found.");
return 0;
}
objectStoreIds.append(objectStoreId);
@@ -270,11 +271,11 @@ PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* cont
return transaction.release();
}
-PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const String& storeName, const String& mode, ExceptionCode& ec)
+PassRefPtr<IDBTransaction> IDBDatabase::transaction(ScriptExecutionContext* context, const String& storeName, const String& mode, ExceptionState& es)
{
RefPtr<DOMStringList> storeNames = DOMStringList::create();
storeNames->append(storeName);
- return transaction(context, storeNames, mode, ec);
+ return transaction(context, storeNames, mode, es);
}
void IDBDatabase::forceClose()

Powered by Google App Engine
This is Rietveld 408576698