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

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

Issue 1897253003: IndexedDB: Align exception priorities with Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/IDBDatabase.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
index e578787d82ff46aa5858e53922a8c367f9109a8e..2099bbc4e3c1184107a1bade9f3e765fe616d1fe 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
@@ -187,13 +187,13 @@ IDBObjectStore* IDBDatabase::createObjectStore(const String& name, const IDBKeyP
return nullptr;
}
- if (containsObjectStore(name)) {
- exceptionState.throwDOMException(ConstraintError, "An object store with the specified name already exists.");
+ if (!keyPath.isNull() && !keyPath.isValid()) {
+ exceptionState.throwDOMException(SyntaxError, "The keyPath option is not a valid key path.");
return nullptr;
}
- if (!keyPath.isNull() && !keyPath.isValid()) {
- exceptionState.throwDOMException(SyntaxError, "The keyPath option is not a valid key path.");
+ if (containsObjectStore(name)) {
+ exceptionState.throwDOMException(ConstraintError, "An object store with the specified name already exists.");
return nullptr;
}
@@ -271,27 +271,24 @@ IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO
ASSERT_NOT_REACHED();
}
- if (scope.isEmpty()) {
- exceptionState.throwDOMException(InvalidAccessError, "The storeNames parameter was empty.");
+ if (m_versionChangeTransaction) {
+ exceptionState.throwDOMException(InvalidStateError, "A version change transaction is running.");
return nullptr;
}
- WebIDBTransactionMode mode = IDBTransaction::stringToMode(modeString);
- if (mode != WebIDBTransactionModeReadOnly && mode != WebIDBTransactionModeReadWrite) {
- exceptionState.throwTypeError("The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'.");
+ if (m_closePending) {
+ exceptionState.throwDOMException(InvalidStateError, "The database connection is closing.");
return nullptr;
}
- if (exceptionState.hadException())
- return nullptr;
-
- if (m_versionChangeTransaction) {
- exceptionState.throwDOMException(InvalidStateError, "A version change transaction is running.");
+ if (!m_backend) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
return nullptr;
}
- if (m_closePending) {
- exceptionState.throwDOMException(InvalidStateError, "The database connection is closing.");
+
+ if (scope.isEmpty()) {
+ exceptionState.throwDOMException(InvalidAccessError, "The storeNames parameter was empty.");
return nullptr;
}
@@ -305,8 +302,9 @@ IDBTransaction* IDBDatabase::transaction(ScriptState* scriptState, const StringO
objectStoreIds.append(objectStoreId);
}
- if (!m_backend) {
- exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
+ WebIDBTransactionMode mode = IDBTransaction::stringToMode(modeString);
+ if (mode != WebIDBTransactionModeReadOnly && mode != WebIDBTransactionModeReadWrite) {
+ exceptionState.throwTypeError("The mode provided ('" + modeString + "') is not one of 'readonly' or 'readwrite'.");
return nullptr;
}

Powered by Google App Engine
This is Rietveld 408576698