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

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

Issue 2276593002: Support renaming of IndexedDB indexes and object stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed feedback on tests. Created 4 years, 4 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/IDBObjectStore.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
index 2f035a201a6dd6e53b3f691d8f07dbd57a52a8e3..100a5bc6e2904c070173d299197f15313129a91f 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -71,6 +71,38 @@ DEFINE_TRACE(IDBObjectStore)
visitor->trace(m_createdIndexes);
}
+void IDBObjectStore::setName(const String& name, ExceptionState& exceptionState)
+{
+ IDB_TRACE("IDBObjectStore::setName");
+ if (!m_transaction->isVersionChange()) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTransactionErrorMessage);
+ return;
+ }
+ if (isDeleted()) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectStoreDeletedErrorMessage);
+ return;
+ }
+ if (m_transaction->isFinished() || m_transaction->isFinishing()) {
+ exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionFinishedErrorMessage);
+ return;
+ }
+ if (!m_transaction->isActive()) {
+ exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase::transactionInactiveErrorMessage);
+ return;
+ }
+
+ if (m_transaction->db()->containsObjectStore(name)) {
+ exceptionState.throwDOMException(ConstraintError, "An object store with the specified name already exists.");
+ return;
+ }
+ if (!backendDB()) {
+ exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage);
+ return;
+ }
+
+ m_metadata.name = name;
+}
+
ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const
{
return ScriptValue::from(scriptState, m_metadata.keyPath);

Powered by Google App Engine
This is Rietveld 408576698