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

Side by Side 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: finished up rename-object-store tests. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ASSERT(m_transaction); 64 ASSERT(m_transaction);
65 } 65 }
66 66
67 DEFINE_TRACE(IDBObjectStore) 67 DEFINE_TRACE(IDBObjectStore)
68 { 68 {
69 visitor->trace(m_transaction); 69 visitor->trace(m_transaction);
70 visitor->trace(m_indexMap); 70 visitor->trace(m_indexMap);
71 visitor->trace(m_createdIndexes); 71 visitor->trace(m_createdIndexes);
72 } 72 }
73 73
74 void IDBObjectStore::setName(const String& name, ExceptionState& exceptionState)
75 {
76 IDB_TRACE("IDBObjectStore::setName");
77 if (!m_transaction->isVersionChange()) {
78 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::notVers ionChangeTransactionErrorMessage);
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
79 return;
80 }
81 if (isDeleted()) {
82 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::objectS toreDeletedErrorMessage);
83 return;
84 }
85 if (m_transaction->isFinished() || m_transaction->isFinishing()) {
86 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionFinishedErrorMessage);
87 return;
88 }
89 if (!m_transaction->isActive()) {
90 exceptionState.throwDOMException(TransactionInactiveError, IDBDatabase:: transactionInactiveErrorMessage);
91 return;
92 }
93
94 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
95 exceptionState.throwDOMException(ConstraintError, "An object store with the specified name already exists.");
96 return;
97 }
98 if (!backendDB()) {
99 exceptionState.throwDOMException(InvalidStateError, IDBDatabase::databas eClosedErrorMessage);
100 return;
101 }
102
103 m_metadata.name = name;
104 }
105
74 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const 106 ScriptValue IDBObjectStore::keyPath(ScriptState* scriptState) const
75 { 107 {
76 return ScriptValue::from(scriptState, m_metadata.keyPath); 108 return ScriptValue::from(scriptState, m_metadata.keyPath);
77 } 109 }
78 110
79 DOMStringList* IDBObjectStore::indexNames() const 111 DOMStringList* IDBObjectStore::indexNames() const
80 { 112 {
81 IDB_TRACE("IDBObjectStore::indexNames"); 113 IDB_TRACE("IDBObjectStore::indexNames");
82 DOMStringList* indexNames = DOMStringList::create(DOMStringList::IndexedDB); 114 DOMStringList* indexNames = DOMStringList::create(DOMStringList::IndexedDB);
83 for (const auto& it : m_metadata.indexes) 115 for (const auto& it : m_metadata.indexes)
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 791 }
760 return IDBIndexMetadata::InvalidId; 792 return IDBIndexMetadata::InvalidId;
761 } 793 }
762 794
763 WebIDBDatabase* IDBObjectStore::backendDB() const 795 WebIDBDatabase* IDBObjectStore::backendDB() const
764 { 796 {
765 return m_transaction->backendDB(); 797 return m_transaction->backendDB();
766 } 798 }
767 799
768 } // namespace blink 800 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698