Changeset 207641 in webkit


Ignore:
Timestamp:
Oct 20, 2016 4:03:21 PM (7 years ago)
Author:
beidson@apple.com
Message:

IndexedDB 2.0: Support IDBObjectStore name assignment.
<rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

  • web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt:
  • web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:

Source/WebCore:

Tests: storage/indexeddb/modern/objectstore-rename-1-private.html

storage/indexeddb/modern/objectstore-rename-1.html

Touches a *lot* of code sites, but none of them are particularly interesting.
They are all just getting the new name spread out to all of the various objects that need it.

  • Modules/indexeddb/IDBDatabase.cpp:

(WebCore::IDBDatabase::renameObjectStore):

  • Modules/indexeddb/IDBDatabase.h:
  • Modules/indexeddb/IDBObjectStore.cpp:

(WebCore::IDBObjectStore::setName):

  • Modules/indexeddb/IDBObjectStore.h:
  • Modules/indexeddb/IDBObjectStore.idl:
  • Modules/indexeddb/IDBTransaction.cpp:

(WebCore::IDBTransaction::renameObjectStore):
(WebCore::IDBTransaction::renameObjectStoreOnServer):
(WebCore::IDBTransaction::didRenameObjectStoreOnServer):

  • Modules/indexeddb/IDBTransaction.h:
  • Modules/indexeddb/client/IDBConnectionProxy.cpp:

(WebCore::IDBClient::IDBConnectionProxy::renameObjectStore):

  • Modules/indexeddb/client/IDBConnectionProxy.h:
  • Modules/indexeddb/client/IDBConnectionToServer.cpp:

(WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
(WebCore::IDBClient::IDBConnectionToServer::didRenameObjectStore):

  • Modules/indexeddb/client/IDBConnectionToServer.h:
  • Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
  • Modules/indexeddb/server/IDBBackingStore.h:
  • Modules/indexeddb/server/IDBConnectionToClient.cpp:

(WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
(WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):

  • Modules/indexeddb/server/IDBConnectionToClient.h:
  • Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
  • Modules/indexeddb/server/IDBServer.cpp:

(WebCore::IDBServer::IDBServer::renameObjectStore):

  • Modules/indexeddb/server/IDBServer.h:
  • Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:

(WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):

  • Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
  • Modules/indexeddb/server/MemoryIDBBackingStore.cpp:

(WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):

  • Modules/indexeddb/server/MemoryIDBBackingStore.h:
  • Modules/indexeddb/server/MemoryObjectStore.h:

(WebCore::IDBServer::MemoryObjectStore::rename):

  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):

  • Modules/indexeddb/server/SQLiteIDBBackingStore.h:
  • Modules/indexeddb/server/UniqueIDBDatabase.cpp:

(WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
(WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameObjectStore):

  • Modules/indexeddb/server/UniqueIDBDatabase.h:
  • Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:

(WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore):

  • Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
  • Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:

(WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore):

  • Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
  • Modules/indexeddb/shared/IDBDatabaseInfo.cpp:

(WebCore::IDBDatabaseInfo::renameObjectStore):

  • Modules/indexeddb/shared/IDBDatabaseInfo.h:
  • Modules/indexeddb/shared/IDBObjectStoreInfo.h:

(WebCore::IDBObjectStoreInfo::rename):

  • Modules/indexeddb/shared/IDBResultData.cpp:

(WebCore::IDBResultData::renameObjectStoreSuccess):

  • Modules/indexeddb/shared/IDBResultData.h:
  • Modules/indexeddb/shared/InProcessIDBServer.cpp:

(WebCore::InProcessIDBServer::didRenameObjectStore):
(WebCore::InProcessIDBServer::renameObjectStore):

  • Modules/indexeddb/shared/InProcessIDBServer.h:

Source/WebKit2:

  • DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:

(WebKit::WebIDBConnectionToClient::didRenameObjectStore):
(WebKit::WebIDBConnectionToClient::renameObjectStore):

  • DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
  • DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
  • WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:

(WebKit::WebIDBConnectionToServer::renameObjectStore):
(WebKit::WebIDBConnectionToServer::didRenameObjectStore):

  • WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
  • WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:

LayoutTests:

  • storage/indexeddb/modern/objectstore-rename-1-expected.txt: Added.
  • storage/indexeddb/modern/objectstore-rename-1-private-expected.txt: Added.
  • storage/indexeddb/modern/objectstore-rename-1-private.html: Added.
  • storage/indexeddb/modern/objectstore-rename-1.html: Added.
  • storage/indexeddb/modern/resources/objectstore-rename-1.js: Added.
  • storage/indexeddb/readonly-expected.txt:
  • storage/indexeddb/readonly-private-expected.txt:
  • storage/indexeddb/resources/readonly.js: Removed the test that verifies that object store names are readonly as they are no longer readonly.
Location:
trunk
Files:
5 added
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r207639 r207641  
     12016-10-20  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB 2.0: Support IDBObjectStore name assignment.
     4        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
     5
     6        Reviewed by Alex Christensen.
     7
     8        * storage/indexeddb/modern/objectstore-rename-1-expected.txt: Added.
     9        * storage/indexeddb/modern/objectstore-rename-1-private-expected.txt: Added.
     10        * storage/indexeddb/modern/objectstore-rename-1-private.html: Added.
     11        * storage/indexeddb/modern/objectstore-rename-1.html: Added.
     12        * storage/indexeddb/modern/resources/objectstore-rename-1.js: Added.
     13
     14        * storage/indexeddb/readonly-expected.txt:
     15        * storage/indexeddb/readonly-private-expected.txt:
     16        * storage/indexeddb/resources/readonly.js: Removed the test that verifies that object store names are
     17          readonly as they are no longer readonly.
     18
    1192016-10-20  Zalan Bujtas  <zalan@apple.com>
    220
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r207640 r207641  
     12016-10-20  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB 2.0: Support IDBObjectStore name assignment.
     4        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
     5
     6        Reviewed by Alex Christensen.
     7
     8        * web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt:
     9        * web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:
     10
    1112016-10-20  Chris Dumez  <cdumez@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt

    r206999 r207641  
    11
    2 FAIL IndexedDB deleted object store rename throws assert_throws: function "() => store.name = 'renamed_books'" did not throw
    3 FAIL IndexedDB object store rename throws in a readonly transaction assert_throws: function "() => store.name = 'renamed_books'" did not throw
    4 FAIL IndexedDB object store rename throws in a readwrite transaction assert_throws: function "() => store.name = 'renamed_books'" did not throw
    5 FAIL IndexedDB object store rename throws in an inactive transaction assert_throws: function "() => { bookStore.name = 'renamed_books'; }" did not throw
    6 FAIL IndexedDB object store rename to the name of another store throws assert_throws: function "() => store.name = 'not_books'" did not throw
    7 FAIL IndexedDB object store rename handles exceptions when stringifying names assert_throws: IDBObjectStore rename should re-raise toString() exception function "() => {
    8               store.name = {
    9                 toSt..." did not throw
     2PASS IndexedDB deleted object store rename throws
     3PASS IndexedDB object store rename throws in a readonly transaction
     4PASS IndexedDB object store rename throws in a readwrite transaction
     5FAIL IndexedDB object store rename throws in an inactive transaction assert_throws: function "() => { bookStore.name = 'renamed_books'; }" threw object "InvalidStateError (DOM Exception 11): Failed set property..." that is not a DOMException TransactionInactiveError: property "code" is equal to 11, expected 0
     6FAIL IndexedDB object store rename to the name of another store throws assert_throws: function "() => store.name = 'not_books'" threw object "InvalidStateError (DOM Exception 11): Failed set property..." that is not a DOMException ConstraintError: property "code" is equal to 11, expected 0
     7PASS IndexedDB object store rename handles exceptions when stringifying names
    108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt

    r206999 r207641  
    11
    2 FAIL IndexedDB object store rename in new transaction assert_equals: IDBObjectStore name should change immediately after a rename expected "renamed_books" but got "books"
    3 FAIL IndexedDB object store rename in the transaction where it is created assert_equals: IDBObjectStore name should change immediately after a rename expected "renamed_books" but got "books"
    4 FAIL IndexedDB object store rename covers index promise_test: Unhandled rejection with value: object "NotFoundError (DOM IDBDatabase Exception 8): Failed to ex..."
    5 FAIL IndexedDB object store rename covers key generator promise_test: Unhandled rejection with value: object "NotFoundError (DOM IDBDatabase Exception 8): Failed to ex..."
     2FAIL IndexedDB object store rename in new transaction undefined is not an object (evaluating 'actual.length')
     3FAIL IndexedDB object store rename in the transaction where it is created undefined is not an object (evaluating 'actual.length')
     4PASS IndexedDB object store rename covers index
     5FAIL IndexedDB object store rename covers key generator assert_equals: Renaming an object store should not change the state of its key generator expected 345680 but got 345679
    66PASS IndexedDB object store rename to the same name succeeds
    7 FAIL IndexedDB object store rename to the name of a deleted store succeeds assert_array_equals: IDBDatabase.objectStoreNames should immediately reflect the rename property 0, expected "not_books" but got "books"
    8 FAIL IndexedDB object store swapping via renames succeeds Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.
    9 FAIL IndexedDB object store rename stringifies non-string names assert_equals: IDBObjectStore name should change immediately after a rename to a number expected "42" but got "books"
    10 FAIL IndexedDB object store can be renamed to "" assert_equals: IDBObjectStore name should change immediately after the rename expected "" but got "books"
    11 FAIL IndexedDB object store can be renamed to "\u0000" assert_equals: IDBObjectStore name should change immediately after the rename expected "\0" but got "books"
    12 FAIL IndexedDB object store can be renamed to "\uDC00\uD800" assert_equals: IDBObjectStore name should change immediately after the rename expected "í°€í €" but got "books"
     7PASS IndexedDB object store rename to the name of a deleted store succeeds
     8PASS IndexedDB object store swapping via renames succeeds
     9PASS IndexedDB object store rename stringifies non-string names
     10PASS IndexedDB object store can be renamed to ""
     11PASS IndexedDB object store can be renamed to "\u0000"
     12PASS IndexedDB object store can be renamed to "\uDC00\uD800"
    1313
  • trunk/LayoutTests/storage/indexeddb/readonly-expected.txt

    r195181 r207641  
    1717Deleted all object stores.
    1818objectStore = db.createObjectStore('foo');
    19 trying to set readonly property objectStore.name
    20 objectStore.name = 'bar'
    21 PASS objectStore.name is still foo
    2219trying to set readonly property objectStore.keyPath
    2320objectStore.keyPath = 'bar'
  • trunk/LayoutTests/storage/indexeddb/readonly-private-expected.txt

    r195247 r207641  
    1717Deleted all object stores.
    1818objectStore = db.createObjectStore('foo');
    19 trying to set readonly property objectStore.name
    20 objectStore.name = 'bar'
    21 PASS objectStore.name is still foo
    2219trying to set readonly property objectStore.keyPath
    2320objectStore.keyPath = 'bar'
  • trunk/LayoutTests/storage/indexeddb/resources/readonly.js

    r163963 r207641  
    3131    objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
    3232
    33     setReadonlyProperty("objectStore.name", "'bar'");
    3433    setReadonlyProperty("objectStore.keyPath", "'bar'");
    3534/* fails, split into separate test
  • trunk/Source/WebCore/ChangeLog

    r207640 r207641  
     12016-10-20  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB 2.0: Support IDBObjectStore name assignment.
     4        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
     5
     6        Reviewed by Alex Christensen.
     7
     8        Tests: storage/indexeddb/modern/objectstore-rename-1-private.html
     9               storage/indexeddb/modern/objectstore-rename-1.html
     10
     11        Touches a *lot* of code sites, but none of them are particularly interesting.
     12        They are all just getting the new name spread out to all of the various objects that need it.
     13
     14        * Modules/indexeddb/IDBDatabase.cpp:
     15        (WebCore::IDBDatabase::renameObjectStore):
     16        * Modules/indexeddb/IDBDatabase.h:
     17
     18        * Modules/indexeddb/IDBObjectStore.cpp:
     19        (WebCore::IDBObjectStore::setName):
     20        * Modules/indexeddb/IDBObjectStore.h:
     21        * Modules/indexeddb/IDBObjectStore.idl:
     22
     23        * Modules/indexeddb/IDBTransaction.cpp:
     24        (WebCore::IDBTransaction::renameObjectStore):
     25        (WebCore::IDBTransaction::renameObjectStoreOnServer):
     26        (WebCore::IDBTransaction::didRenameObjectStoreOnServer):
     27        * Modules/indexeddb/IDBTransaction.h:
     28
     29        * Modules/indexeddb/client/IDBConnectionProxy.cpp:
     30        (WebCore::IDBClient::IDBConnectionProxy::renameObjectStore):
     31        * Modules/indexeddb/client/IDBConnectionProxy.h:
     32
     33        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
     34        (WebCore::IDBClient::IDBConnectionToServer::renameObjectStore):
     35        (WebCore::IDBClient::IDBConnectionToServer::didRenameObjectStore):
     36        * Modules/indexeddb/client/IDBConnectionToServer.h:
     37        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
     38
     39        * Modules/indexeddb/server/IDBBackingStore.h:
     40
     41        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
     42        (WebCore::IDBServer::IDBConnectionToClient::didDeleteObjectStore):
     43        (WebCore::IDBServer::IDBConnectionToClient::didRenameObjectStore):
     44        * Modules/indexeddb/server/IDBConnectionToClient.h:
     45        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
     46
     47        * Modules/indexeddb/server/IDBServer.cpp:
     48        (WebCore::IDBServer::IDBServer::renameObjectStore):
     49        * Modules/indexeddb/server/IDBServer.h:
     50
     51        * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
     52        (WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreRenamed):
     53        (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
     54        * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
     55
     56        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
     57        (WebCore::IDBServer::MemoryIDBBackingStore::renameObjectStore):
     58        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
     59
     60        * Modules/indexeddb/server/MemoryObjectStore.h:
     61        (WebCore::IDBServer::MemoryObjectStore::rename):
     62
     63        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
     64        (WebCore::IDBServer::SQLiteIDBBackingStore::renameObjectStore):
     65        * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
     66
     67        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
     68        (WebCore::IDBServer::UniqueIDBDatabase::renameObjectStore):
     69        (WebCore::IDBServer::UniqueIDBDatabase::performRenameObjectStore):
     70        (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameObjectStore):
     71        * Modules/indexeddb/server/UniqueIDBDatabase.h:
     72
     73        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
     74        (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameObjectStore):
     75        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
     76
     77        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
     78        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameObjectStore):
     79        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
     80
     81        * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
     82        (WebCore::IDBDatabaseInfo::renameObjectStore):
     83        * Modules/indexeddb/shared/IDBDatabaseInfo.h:
     84
     85        * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
     86        (WebCore::IDBObjectStoreInfo::rename):
     87
     88        * Modules/indexeddb/shared/IDBResultData.cpp:
     89        (WebCore::IDBResultData::renameObjectStoreSuccess):
     90        * Modules/indexeddb/shared/IDBResultData.h:
     91
     92        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
     93        (WebCore::InProcessIDBServer::didRenameObjectStore):
     94        (WebCore::InProcessIDBServer::renameObjectStore):
     95        * Modules/indexeddb/shared/InProcessIDBServer.h:
     96
    1972016-10-20  Chris Dumez  <cdumez@apple.com>
    298
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp

    r206976 r207641  
    107107}
    108108
     109void IDBDatabase::renameObjectStore(IDBObjectStore& objectStore, const String& newName)
     110{
     111    ASSERT(currentThread() == originThreadID());
     112    ASSERT(m_versionChangeTransaction);
     113    ASSERT(m_info.hasObjectStore(objectStore.info().name()));
     114
     115    m_info.renameObjectStore(objectStore.info().identifier(), newName);
     116
     117    m_versionChangeTransaction->renameObjectStore(objectStore, newName);
     118}
     119
    109120ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String&, const Dictionary&)
    110121{
  • trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h

    r206976 r207641  
    6363    void close();
    6464
     65    void renameObjectStore(IDBObjectStore&, const String& newName);
     66
    6567    // EventTarget
    6668    EventTargetInterface eventTargetInterface() const final { return IDBDatabaseEventTargetInterfaceType; }
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp

    r207505 r207641  
    9696}
    9797
     98ExceptionOr<void> IDBObjectStore::setName(const String& name)
     99{
     100    ASSERT(currentThread() == m_transaction->database().originThreadID());
     101
     102    if (m_deleted)
     103        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store has been deleted.") };
     104
     105    if (!m_transaction->isVersionChange())
     106        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not a version change transaction.") };
     107
     108    if (!m_transaction->isActive())
     109        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not active.") };
     110
     111    if (m_info.name() == name)
     112        return { };
     113
     114    if (m_transaction->database().info().hasObjectStore(name))
     115        return Exception { INVALID_STATE_ERR, makeString("Failed set property 'name' on 'IDBObjectStore': The database already has an object store named '", name, "'.") };
     116
     117    m_transaction->database().renameObjectStore(*this, name);
     118    m_info.rename(name);
     119
     120    return { };
     121}
     122
    98123const IDBKeyPath& IDBObjectStore::keyPath() const
    99124{
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h

    r206976 r207641  
    6161
    6262    const String& name() const;
     63    ExceptionOr<void> setName(const String&);
    6364    const IDBKeyPath& keyPath() const;
    6465    RefPtr<DOMStringList> indexNames() const;
  • trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl

    r206976 r207641  
    3131    SkipVTableValidation,
    3232] interface IDBObjectStore {
    33     readonly attribute DOMString? name;
     33    [SetterMayThrowException] attribute DOMString name;
    3434    [ImplementationReturnType=IDBKeyPath] readonly attribute any keyPath;
    3535    readonly attribute DOMStringList indexNames;
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp

    r206976 r207641  
    602602}
    603603
     604void IDBTransaction::renameObjectStore(IDBObjectStore& objectStore, const String& newName)
     605{
     606    LOG(IndexedDB, "IDBTransaction::renameObjectStore");
     607    ASSERT(isVersionChange());
     608    ASSERT(scriptExecutionContext());
     609    ASSERT(currentThread() == m_database->originThreadID());
     610
     611    ASSERT(m_referencedObjectStores.contains(objectStore.info().name()));
     612    ASSERT(!m_referencedObjectStores.contains(newName));
     613    ASSERT(m_referencedObjectStores.get(objectStore.info().name()) == &objectStore);
     614
     615    uint64_t objectStoreIdentifier = objectStore.info().identifier();
     616    auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameObjectStoreOnServer, &IDBTransaction::renameObjectStoreOnServer, objectStoreIdentifier, newName);
     617    scheduleOperation(WTFMove(operation));
     618
     619    m_referencedObjectStores.set(newName, m_referencedObjectStores.take(objectStore.info().name()));
     620}
     621
     622void IDBTransaction::renameObjectStoreOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& newName)
     623{
     624    LOG(IndexedDB, "IDBTransaction::renameObjectStoreOnServer");
     625    ASSERT(currentThread() == m_database->originThreadID());
     626    ASSERT(isVersionChange());
     627
     628    m_database->connectionProxy().renameObjectStore(operation, objectStoreIdentifier, newName);
     629}
     630
     631void IDBTransaction::didRenameObjectStoreOnServer(const IDBResultData& resultData)
     632{
     633    LOG(IndexedDB, "IDBTransaction::didRenameObjectStoreOnServer");
     634    ASSERT(currentThread() == m_database->originThreadID());
     635    ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::RenameObjectStoreSuccess || resultData.type() == IDBResultType::Error);
     636}
     637
    604638std::unique_ptr<IDBIndex> IDBTransaction::createIndex(IDBObjectStore& objectStore, const IDBIndexInfo& info)
    605639{
  • trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h

    r206976 r207641  
    114114
    115115    Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
     116    void renameObjectStore(IDBObjectStore&, const String& newName);
    116117    std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&);
    117118
     
    172173    void didCreateObjectStoreOnServer(const IDBResultData&);
    173174
     175    void renameObjectStoreOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& newName);
     176    void didRenameObjectStoreOnServer(const IDBResultData&);
     177
    174178    void createIndexOnServer(IDBClient::TransactionOperation&, const IDBIndexInfo&);
    175179    void didCreateIndexOnServer(const IDBResultData&);
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp

    r206976 r207641  
    126126}
    127127
     128void IDBConnectionProxy::renameObjectStore(TransactionOperation& operation, uint64_t objectStoreIdentifier, const String& newName)
     129{
     130    const IDBRequestData requestData(operation);
     131    saveOperation(operation);
     132
     133    callConnectionOnMainThread(&IDBConnectionToServer::renameObjectStore, requestData, objectStoreIdentifier, newName);
     134}
     135
    128136void IDBConnectionProxy::deleteObjectStore(TransactionOperation& operation, const String& objectStoreName)
    129137{
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h

    r206976 r207641  
    7878    void openCursor(TransactionOperation&, const IDBCursorInfo&);
    7979    void iterateCursor(TransactionOperation&, const IDBKeyData&, unsigned long count);
    80    
     80    void renameObjectStore(TransactionOperation&, uint64_t objectStoreIdentifier, const String& newName);
     81
    8182    void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion);
    8283    void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier);
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp

    r204018 r207641  
    117117}
    118118
     119void IDBConnectionToServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
     120{
     121    LOG(IndexedDB, "IDBConnectionToServer::renameObjectStore");
     122    ASSERT(isMainThread());
     123
     124    m_delegate->renameObjectStore(requestData, objectStoreIdentifier, newName);
     125}
     126
     127void IDBConnectionToServer::didRenameObjectStore(const IDBResultData& resultData)
     128{
     129    LOG(IndexedDB, "IDBConnectionToServer::didRenameObjectStore");
     130    m_proxy->completeOperation(resultData);
     131}
     132
    119133void IDBConnectionToServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
    120134{
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h

    r204466 r207641  
    6868    void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
    6969    WEBCORE_EXPORT void didDeleteObjectStore(const IDBResultData&);
     70
     71    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
     72    WEBCORE_EXPORT void didRenameObjectStore(const IDBResultData&);
    7073
    7174    void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h

    r204018 r207641  
    6464    virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) = 0;
    6565    virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) = 0;
     66    virtual void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) = 0;
    6667    virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) = 0;
    6768    virtual void createIndex(const IDBRequestData&, const IDBIndexInfo&) = 0;
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h

    r199250 r207641  
    7171    virtual IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) = 0;
    7272    virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
     73    virtual IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) = 0;
    7374    virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
    7475    virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0;
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp

    r202359 r207641  
    7272{
    7373    m_delegate->didDeleteObjectStore(result);
     74}
     75
     76void IDBConnectionToClient::didRenameObjectStore(const IDBResultData& result)
     77{
     78    m_delegate->didRenameObjectStore(result);
    7479}
    7580
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h

    r202359 r207641  
    5656    void didCreateObjectStore(const IDBResultData&);
    5757    void didDeleteObjectStore(const IDBResultData&);
     58    void didRenameObjectStore(const IDBResultData&);
    5859    void didClearObjectStore(const IDBResultData&);
    5960    void didCreateIndex(const IDBResultData&);
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h

    r201098 r207641  
    5454    virtual void didCreateObjectStore(const IDBResultData&) = 0;
    5555    virtual void didDeleteObjectStore(const IDBResultData&) = 0;
     56    virtual void didRenameObjectStore(const IDBResultData&) = 0;
    5657    virtual void didClearObjectStore(const IDBResultData&) = 0;
    5758    virtual void didCreateIndex(const IDBResultData&) = 0;
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp

    r204041 r207641  
    214214}
    215215
     216void IDBServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
     217{
     218    LOG(IndexedDB, "IDBServer::renameObjectStore");
     219
     220    auto transaction = m_transactions.get(requestData.transactionIdentifier());
     221    if (!transaction)
     222        return;
     223
     224    ASSERT(transaction->isVersionChange());
     225    transaction->renameObjectStore(requestData, objectStoreIdentifier, newName);
     226}
     227
    216228void IDBServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
    217229{
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h

    r204466 r207641  
    6767    WEBCORE_EXPORT void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier&);
    6868    WEBCORE_EXPORT void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
     69    WEBCORE_EXPORT void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
    6970    WEBCORE_EXPORT void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
    7071    WEBCORE_EXPORT void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp

    r199250 r207641  
    151151}
    152152
     153void MemoryBackingStoreTransaction::objectStoreRenamed(MemoryObjectStore& objectStore, const String& oldName)
     154{
     155    ASSERT(m_objectStores.contains(&objectStore));
     156    ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange);
     157
     158    // We only care about the first rename in a given transaction, because if the transaction is aborted we want
     159    // to go back to the first 'oldName'
     160    m_originalObjectStoreNames.add(&objectStore, oldName);
     161}
     162
    153163void MemoryBackingStoreTransaction::indexCleared(MemoryIndex& index, std::unique_ptr<IndexValueStore>&& valueStore)
    154164{
     
    193203
    194204    TemporaryChange<bool> change(m_isAborting, true);
     205
     206    for (auto iterator : m_originalObjectStoreNames)
     207        iterator.key->rename(iterator.value);
     208    m_originalObjectStoreNames.clear();
    195209
    196210    for (auto objectStore : m_versionChangeAddedObjectStores)
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h

    r200036 r207641  
    6565    void objectStoreDeleted(Ref<MemoryObjectStore>&&);
    6666    void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&);
     67    void objectStoreRenamed(MemoryObjectStore&, const String& oldName);
    6768    void indexCleared(MemoryIndex&, std::unique_ptr<IndexValueStore>&&);
    6869
     
    9697    HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_clearedKeyValueMaps;
    9798    HashMap<MemoryObjectStore*, std::unique_ptr<std::set<IDBKeyData>>> m_clearedOrderedKeys;
     99    HashMap<MemoryObjectStore*, String> m_originalObjectStoreNames;
    98100    HashMap<MemoryIndex*, std::unique_ptr<IndexValueStore>> m_clearedIndexValueStores;
    99101};
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp

    r202806 r207641  
    172172}
    173173
     174IDBError MemoryIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
     175{
     176    LOG(IndexedDB, "MemoryIDBBackingStore::renameObjectStore");
     177
     178    ASSERT(m_databaseInfo);
     179    if (!m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier))
     180        return IDBError(IDBDatabaseException::ConstraintError);
     181
     182    auto transaction = m_transactions.get(transactionIdentifier);
     183    ASSERT(transaction);
     184    ASSERT(transaction->isVersionChange());
     185
     186    auto objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
     187    ASSERT(objectStore);
     188    if (!objectStore)
     189        return IDBError(IDBDatabaseException::ConstraintError);
     190
     191    String oldName = objectStore->info().name();
     192    objectStore->rename(newName);
     193    transaction->objectStoreRenamed(*objectStore, oldName);
     194
     195    m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
     196
     197    return IDBError();
     198}
     199
    174200IDBError MemoryIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier)
    175201{
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h

    r200036 r207641  
    5555    IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) final;
    5656    IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
     57    IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) final;
    5758    IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
    5859    IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final;
  • trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h

    r199668 r207641  
    9898    void maybeRestoreDeletedIndex(Ref<MemoryIndex>&&);
    9999
     100    void rename(const String& newName) { m_info.rename(newName); }
     101
    100102private:
    101103    MemoryObjectStore(const IDBObjectStoreInfo&);
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

    r205462 r207641  
    979979}
    980980
     981IDBError SQLiteIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
     982{
     983    LOG(IndexedDB, "SQLiteIDBBackingStore::renameObjectStore - object store %" PRIu64, objectStoreIdentifier);
     984
     985    ASSERT(m_sqliteDB);
     986    ASSERT(m_sqliteDB->isOpen());
     987
     988    auto* transaction = m_transactions.get(transactionIdentifier);
     989    if (!transaction || !transaction->inProgress()) {
     990        LOG_ERROR("Attempt to rename an object store without an in-progress transaction");
     991        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store without an in-progress transaction") };
     992    }
     993    if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
     994        LOG_ERROR("Attempt to rename an object store in a non-version-change transaction");
     995        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store in a non-version-change transaction") };
     996    }
     997
     998    {
     999        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("UPDATE ObjectStoreInfo SET name = ? WHERE id = ?;"));
     1000        if (sql.prepare() != SQLITE_OK
     1001            || sql.bindText(1, newName) != SQLITE_OK
     1002            || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
     1003            || sql.step() != SQLITE_DONE) {
     1004            LOG_ERROR("Could not update name for object store id %" PRIi64 " in ObjectStoreInfo table (%i) - %s", objectStoreIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     1005            return { IDBDatabaseException::UnknownError, ASCIILiteral("Could not rename object store") };
     1006        }
     1007    }
     1008
     1009    m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
     1010
     1011    return { };
     1012}
     1013
    9811014IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID)
    9821015{
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h

    r200163 r207641  
    5959    IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) final;
    6060    IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
     61    IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) final;
    6162    IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
    6263    IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final;
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp

    r207505 r207641  
    661661}
    662662
     663void UniqueIDBDatabase::renameObjectStore(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, const String& newName, ErrorCallback callback)
     664{
     665    ASSERT(isMainThread());
     666    LOG(IndexedDB, "(main) UniqueIDBDatabase::renameObjectStore");
     667
     668    uint64_t callbackID = storeCallbackOrFireError(callback);
     669    if (!callbackID)
     670        return;
     671
     672    auto* info = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
     673    if (!info) {
     674        performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename non-existant object store") });
     675        return;
     676    }
     677
     678    postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performRenameObjectStore, callbackID, transaction.info().identifier(), objectStoreIdentifier, newName));
     679}
     680
     681void UniqueIDBDatabase::performRenameObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
     682{
     683    ASSERT(!isMainThread());
     684    LOG(IndexedDB, "(db) UniqueIDBDatabase::performRenameObjectStore");
     685
     686    ASSERT(m_backingStore);
     687    m_backingStore->renameObjectStore(transactionIdentifier, objectStoreIdentifier, newName);
     688
     689    IDBError error;
     690    postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformRenameObjectStore, callbackIdentifier, error, objectStoreIdentifier, newName));
     691}
     692
     693void UniqueIDBDatabase::didPerformRenameObjectStore(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, const String& newName)
     694{
     695    ASSERT(isMainThread());
     696    LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformRenameObjectStore");
     697
     698    if (error.isNull())
     699        m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
     700
     701    performErrorCallback(callbackIdentifier, error);
     702}
     703
    663704void UniqueIDBDatabase::clearObjectStore(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, ErrorCallback callback)
    664705{
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h

    r204466 r207641  
    8888    void createObjectStore(UniqueIDBDatabaseTransaction&, const IDBObjectStoreInfo&, ErrorCallback);
    8989    void deleteObjectStore(UniqueIDBDatabaseTransaction&, const String& objectStoreName, ErrorCallback);
     90    void renameObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, const String& newName, ErrorCallback);
    9091    void clearObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, ErrorCallback);
    9192    void createIndex(UniqueIDBDatabaseTransaction&, const IDBIndexInfo&, ErrorCallback);
     
    145146    void performCreateObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&);
    146147    void performDeleteObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
     148    void performRenameObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName);
    147149    void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
    148150    void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&);
     
    163165    void didPerformCreateObjectStore(uint64_t callbackIdentifier, const IDBError&, const IDBObjectStoreInfo&);
    164166    void didPerformDeleteObjectStore(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier);
     167    void didPerformRenameObjectStore(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, const String& newName);
    165168    void didPerformClearObjectStore(uint64_t callbackIdentifier, const IDBError&);
    166169    void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&);
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp

    r203241 r207641  
    185185}
    186186
     187void UniqueIDBDatabaseConnection::didRenameObjectStore(const IDBResultData& resultData)
     188{
     189    LOG(IndexedDB, "UniqueIDBDatabaseConnection::didRenameObjectStore");
     190
     191    m_connectionToClient.didRenameObjectStore(resultData);
     192}
     193
    187194void UniqueIDBDatabaseConnection::didClearObjectStore(const IDBResultData& resultData)
    188195{
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h

    r201098 r207641  
    7070    void didCreateObjectStore(const IDBResultData&);
    7171    void didDeleteObjectStore(const IDBResultData&);
     72    void didRenameObjectStore(const IDBResultData&);
    7273    void didClearObjectStore(const IDBResultData&);
    7374    void didCreateIndex(const IDBResultData&);
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp

    r204018 r207641  
    138138}
    139139
     140void UniqueIDBDatabaseTransaction::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
     141{
     142    LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameObjectStore");
     143
     144    ASSERT(isVersionChange());
     145    ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
     146
     147    RefPtr<UniqueIDBDatabaseTransaction> protectedThis(this);
     148    m_databaseConnection->database().renameObjectStore(*this, objectStoreIdentifier, newName, [this, protectedThis, requestData](const IDBError& error) {
     149        LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameObjectStore (callback)");
     150        if (error.isNull())
     151            m_databaseConnection->didRenameObjectStore(IDBResultData::renameObjectStoreSuccess(requestData.requestIdentifier()));
     152        else
     153            m_databaseConnection->didRenameObjectStore(IDBResultData::error(requestData.requestIdentifier(), error));
     154    });
     155}
     156
    140157void UniqueIDBDatabaseTransaction::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
    141158{
  • trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h

    r204018 r207641  
    7070    void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
    7171    void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
     72    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
    7273    void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
    7374    void createIndex(const IDBRequestData&, const IDBIndexInfo&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp

    r204394 r207641  
    123123}
    124124
     125void IDBDatabaseInfo::renameObjectStore(uint64_t objectStoreIdentifier, const String& newName)
     126{
     127    auto* info = infoForExistingObjectStore(objectStoreIdentifier);
     128    if (!info)
     129        return;
     130
     131    info->rename(newName);
     132}
     133
    125134Vector<String> IDBDatabaseInfo::objectStoreNames() const
    126135{
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h

    r202806 r207641  
    5858    const IDBObjectStoreInfo* infoForExistingObjectStore(const String& objectStoreName) const;
    5959
     60    void renameObjectStore(uint64_t objectStoreIdentifier, const String& newName);
     61
    6062    Vector<String> objectStoreNames() const;
    6163
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h

    r202806 r207641  
    4848    bool autoIncrement() const { return m_autoIncrement; }
    4949    uint64_t maxIndexID() const { return m_maxIndexID; }
     50
     51    void rename(const String& newName) { m_name = newName; }
    5052
    5153    IDBObjectStoreInfo isolatedCopy() const;
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp

    r200484 r207641  
    140140}
    141141
     142IDBResultData IDBResultData::renameObjectStoreSuccess(const IDBResourceIdentifier& requestIdentifier)
     143{
     144    return { IDBResultType::RenameObjectStoreSuccess, requestIdentifier };
     145}
     146
    142147IDBResultData IDBResultData::clearObjectStoreSuccess(const IDBResourceIdentifier& requestIdentifier)
    143148{
  • trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h

    r200484 r207641  
    5858    OpenCursorSuccess,
    5959    IterateCursorSuccess,
     60    RenameObjectStoreSuccess,
    6061};
    6162
     
    7374    static IDBResultData createObjectStoreSuccess(const IDBResourceIdentifier&);
    7475    static IDBResultData deleteObjectStoreSuccess(const IDBResourceIdentifier&);
     76    static IDBResultData renameObjectStoreSuccess(const IDBResourceIdentifier&);
    7577    static IDBResultData clearObjectStoreSuccess(const IDBResourceIdentifier&);
    7678    static IDBResultData createIndexSuccess(const IDBResourceIdentifier&);
  • trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp

    r204018 r207641  
    147147}
    148148
     149void InProcessIDBServer::didRenameObjectStore(const IDBResultData& resultData)
     150{
     151    RunLoop::current().dispatch([this, protectedThis = makeRef(*this), resultData] {
     152        m_connectionToServer->didRenameObjectStore(resultData);
     153    });
     154}
     155
    149156void InProcessIDBServer::didClearObjectStore(const IDBResultData& resultData)
    150157{
     
    245252}
    246253
     254void InProcessIDBServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
     255{
     256    RunLoop::current().dispatch([this, protectedThis = makeRef(*this), requestData, objectStoreIdentifier, newName] {
     257        m_server->renameObjectStore(requestData, objectStoreIdentifier, newName);
     258    });
     259}
     260
    247261void InProcessIDBServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
    248262{
  • trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h

    r204018 r207641  
    6565    void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) final;
    6666    void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) final;
     67    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) final;
    6768    void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) final;
    6869    void createIndex(const IDBRequestData&, const IDBIndexInfo&) final;
     
    9091    void didCreateObjectStore(const IDBResultData&) final;
    9192    void didDeleteObjectStore(const IDBResultData&) final;
     93    void didRenameObjectStore(const IDBResultData&) final;
    9294    void didClearObjectStore(const IDBResultData&) final;
    9395    void didCreateIndex(const IDBResultData&) final;
  • trunk/Source/WebKit2/ChangeLog

    r207614 r207641  
     12016-10-20  Brady Eidson  <beidson@apple.com>
     2
     3        IndexedDB 2.0: Support IDBObjectStore name assignment.
     4        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
     5
     6        Reviewed by Alex Christensen.
     7
     8        * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
     9        (WebKit::WebIDBConnectionToClient::didRenameObjectStore):
     10        (WebKit::WebIDBConnectionToClient::renameObjectStore):
     11        * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
     12        * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:
     13
     14        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
     15        (WebKit::WebIDBConnectionToServer::renameObjectStore):
     16        (WebKit::WebIDBConnectionToServer::didRenameObjectStore):
     17        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
     18        * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:
     19
    1202016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp

    r204018 r207641  
    108108}
    109109
     110void WebIDBConnectionToClient::didRenameObjectStore(const WebCore::IDBResultData& resultData)
     111{
     112    send(Messages::WebIDBConnectionToServer::DidRenameObjectStore(resultData));
     113}
     114
    110115void WebIDBConnectionToClient::didClearObjectStore(const WebCore::IDBResultData& resultData)
    111116{
     
    236241}
    237242
     243void WebIDBConnectionToClient::renameObjectStore(const IDBRequestData& request, uint64_t objectStoreIdentifier, const String& newName)
     244{
     245    DatabaseProcess::singleton().idbServer().renameObjectStore(request, objectStoreIdentifier, newName);
     246}
     247
    238248void WebIDBConnectionToClient::clearObjectStore(const IDBRequestData& request, uint64_t objectStoreIdentifier)
    239249{
  • trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h

    r204668 r207641  
    6565    void didCreateObjectStore(const WebCore::IDBResultData&) final;
    6666    void didDeleteObjectStore(const WebCore::IDBResultData&) final;
     67    void didRenameObjectStore(const WebCore::IDBResultData&) final;
    6768    void didClearObjectStore(const WebCore::IDBResultData&) final;
    6869    void didCreateIndex(const WebCore::IDBResultData&) final;
     
    9394    void createObjectStore(const WebCore::IDBRequestData&, const WebCore::IDBObjectStoreInfo&);
    9495    void deleteObjectStore(const WebCore::IDBRequestData&, const String& objectStoreName);
     96    void renameObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
    9597    void clearObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier);
    9698    void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&);
  • trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in

    r204018 r207641  
    3131    CreateObjectStore(WebCore::IDBRequestData requestData, WebCore::IDBObjectStoreInfo info);
    3232    DeleteObjectStore(WebCore::IDBRequestData requestData, String objectStoreName);
     33    RenameObjectStore(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, String newName);
    3334    ClearObjectStore(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier);
    3435    CreateIndex(WebCore::IDBRequestData requestData, WebCore::IDBIndexInfo info);
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp

    r204772 r207641  
    119119}
    120120
     121void WebIDBConnectionToServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
     122{
     123    send(Messages::WebIDBConnectionToClient::RenameObjectStore(requestData, objectStoreIdentifier, newName));
     124}
     125
    121126void WebIDBConnectionToServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
    122127{
     
    227232{
    228233    m_connectionToServer->didDeleteObjectStore(result);
     234}
     235
     236void WebIDBConnectionToServer::didRenameObjectStore(const IDBResultData& result)
     237{
     238    m_connectionToServer->didRenameObjectStore(result);
    229239}
    230240
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h

    r204668 r207641  
    5454    void createObjectStore(const WebCore::IDBRequestData&, const WebCore::IDBObjectStoreInfo&) final;
    5555    void deleteObjectStore(const WebCore::IDBRequestData&, const String& objectStoreName) final;
     56    void renameObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) final;
    5657    void clearObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier) final;
    5758    void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&) final;
     
    8283    void didCreateObjectStore(const WebCore::IDBResultData&);
    8384    void didDeleteObjectStore(const WebCore::IDBResultData&);
     85    void didRenameObjectStore(const WebCore::IDBResultData&);
    8486    void didClearObjectStore(const WebCore::IDBResultData&);
    8587    void didCreateIndex(const WebCore::IDBResultData&);
  • trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in

    r202414 r207641  
    3030    DidCreateObjectStore(WebCore::IDBResultData result)
    3131    DidDeleteObjectStore(WebCore::IDBResultData result)
     32    DidRenameObjectStore(WebCore::IDBResultData result)
    3233    DidClearObjectStore(WebCore::IDBResultData result)
    3334    DidCreateIndex(WebCore::IDBResultData result)
Note: See TracChangeset for help on using the changeset viewer.