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

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: Review feedback: more cases, split files, better messages Created 4 years, 3 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 | « third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a185bada56400b81923430bf9060d55c968bcd7d..224149e9c276ad000611f55260abc6c9cf0bdba0 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBDatabase.cpp
@@ -195,13 +195,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;
}
@@ -279,27 +279,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;
}
@@ -313,8 +310,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;
}
« no previous file with comments | « third_party/WebKit/Source/modules/indexeddb/IDBCursor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698