Chromium Code Reviews| 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); |
|
jsbell
2016/08/26 23:20:50
FYI, we have a generic storage/indexeddb/exception
pwnall
2016/08/29 19:24:12
I think the Web Platform layout tests I wrote cove
|
| + 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)) { |
|
jsbell
2016/08/26 23:20:50
Do we need a special case for `store.name = store.
pwnall
2016/08/29 19:24:12
Yes, we do :)
The code here doesn't pass the test
|
| + 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); |