Chromium Code Reviews| Index: third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp |
| diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp |
| index 86e2166751b60c43799b018e011b477ce57e10a7..1599c7f233ae0a68d8ac6491df5dfad7fab1cb39 100644 |
| --- a/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp |
| +++ b/third_party/WebKit/Source/modules/indexeddb/IDBIndex.cpp |
| @@ -65,6 +65,46 @@ DEFINE_TRACE(IDBIndex) |
| visitor->trace(m_transaction); |
| } |
| +void IDBIndex::setName(const String& name, ExceptionState& exceptionState) |
| +{ |
| + if (!RuntimeEnabledFeatures::indexedDBExperimentalEnabled()) |
|
foolip
2016/09/09 08:12:17
With 'use strict', trying to set a readonly proper
jsbell
2016/09/09 18:17:22
Did you want something different than what's captu
foolip
2016/09/09 20:04:34
I was thinking about something like this:
assert_
pwnall
2016/09/09 20:50:35
I wrote the test and jsbell helped me figure out w
foolip
2016/09/09 22:31:17
Yeah, that seems OK.
|
| + return; |
| + |
| + IDB_TRACE("IDBIndex::setName"); |
| + if (!m_transaction->isVersionChange()) { |
| + exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVersionChangeTransactionErrorMessage); |
| + return; |
| + } |
| + if (isDeleted()) { |
| + exceptionState.throwDOMException(InvalidStateError, IDBDatabase::indexDeletedErrorMessage); |
| + 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_metadata.name == name) |
| + return; |
| + if (m_objectStore->containsIndex(name)) { |
| + exceptionState.throwDOMException(ConstraintError, IDBDatabase::indexNameTakenErrorMessage); |
| + return; |
| + } |
| + if (!backendDB()) { |
| + exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databaseClosedErrorMessage); |
| + return; |
| + } |
| + |
| + backendDB()->renameIndex(m_transaction->id(), m_objectStore->id(), id(), name); |
| + m_metadata.name = name; |
| + m_objectStore->indexRenamed(m_metadata.id, name); |
| + m_transaction->db()->indexRenamed(m_objectStore->id(), id(), name); |
| +} |
| + |
| ScriptValue IDBIndex::keyPath(ScriptState* scriptState) const |
| { |
| return ScriptValue::from(scriptState, m_metadata.keyPath); |