IndexedDB 2.0: Support IDBObjectStore name assignment.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2016 23:03:21 +0000 (23:03 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Oct 2016 23:03:21 +0000 (23:03 +0000)
<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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207641 268f45cc-cd09-0410-ab3c-d52691b4dbfc

58 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt
LayoutTests/storage/indexeddb/modern/objectstore-rename-1-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/objectstore-rename-1.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/resources/objectstore-rename-1.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/readonly-expected.txt
LayoutTests/storage/indexeddb/readonly-private-expected.txt
LayoutTests/storage/indexeddb/resources/readonly.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBDatabase.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp
Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h
Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h
Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp
Source/WebCore/Modules/indexeddb/shared/IDBResultData.h
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in

index 604f15b..76d0151 100644 (file)
@@ -1,3 +1,21 @@
+2016-10-20  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Support IDBObjectStore name assignment.
+        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
+
+        Reviewed by Alex Christensen.
+
+        * 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.
+
 2016-10-20  Zalan Bujtas  <zalan@apple.com>
 
         Unreviewed gardening.
index a3e0c65..5525e81 100644 (file)
@@ -1,3 +1,13 @@
+2016-10-20  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Support IDBObjectStore name assignment.
+        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/IndexedDB/idbobjectstore-rename-errors-expected.txt:
+        * web-platform-tests/IndexedDB/idbobjectstore-rename-store-expected.txt:
+
 2016-10-20  Chris Dumez  <cdumez@apple.com>
 
         Make table.deleteRow(-1) a no-op when there are no rows
index f957225..56c9a48 100644 (file)
@@ -1,10 +1,8 @@
 
-FAIL IndexedDB deleted object store rename throws assert_throws: function "() => store.name = 'renamed_books'" did not throw
-FAIL IndexedDB object store rename throws in a readonly transaction assert_throws: function "() => store.name = 'renamed_books'" did not throw
-FAIL IndexedDB object store rename throws in a readwrite transaction assert_throws: function "() => store.name = 'renamed_books'" did not throw
-FAIL IndexedDB object store rename throws in an inactive transaction assert_throws: function "() => { bookStore.name = 'renamed_books'; }" did not throw
-FAIL IndexedDB object store rename to the name of another store throws assert_throws: function "() => store.name = 'not_books'" did not throw
-FAIL IndexedDB object store rename handles exceptions when stringifying names assert_throws: IDBObjectStore rename should re-raise toString() exception function "() => {
-              store.name = {
-                toSt..." did not throw
+PASS IndexedDB deleted object store rename throws 
+PASS IndexedDB object store rename throws in a readonly transaction 
+PASS IndexedDB object store rename throws in a readwrite transaction 
+FAIL 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
+FAIL 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
+PASS IndexedDB object store rename handles exceptions when stringifying names 
 
index e485bd2..8ac90c6 100644 (file)
@@ -1,13 +1,13 @@
 
-FAIL IndexedDB object store rename in new transaction assert_equals: IDBObjectStore name should change immediately after a rename expected "renamed_books" but got "books"
-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"
-FAIL IndexedDB object store rename covers index promise_test: Unhandled rejection with value: object "NotFoundError (DOM IDBDatabase Exception 8): Failed to ex..."
-FAIL IndexedDB object store rename covers key generator promise_test: Unhandled rejection with value: object "NotFoundError (DOM IDBDatabase Exception 8): Failed to ex..."
+FAIL IndexedDB object store rename in new transaction undefined is not an object (evaluating 'actual.length')
+FAIL IndexedDB object store rename in the transaction where it is created undefined is not an object (evaluating 'actual.length')
+PASS IndexedDB object store rename covers index 
+FAIL 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
 PASS IndexedDB object store rename to the same name succeeds 
-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"
-FAIL IndexedDB object store swapping via renames succeeds Failed to execute 'objectStore' on 'IDBTransaction': The specified object store was not found.
-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"
-FAIL IndexedDB object store can be renamed to "" assert_equals: IDBObjectStore name should change immediately after the rename expected "" but got "books"
-FAIL IndexedDB object store can be renamed to "\u0000" assert_equals: IDBObjectStore name should change immediately after the rename expected "\0" but got "books"
-FAIL IndexedDB object store can be renamed to "\uDC00\uD800" assert_equals: IDBObjectStore name should change immediately after the rename expected "í°\80í \80" but got "books"
+PASS IndexedDB object store rename to the name of a deleted store succeeds 
+PASS IndexedDB object store swapping via renames succeeds 
+PASS IndexedDB object store rename stringifies non-string names 
+PASS IndexedDB object store can be renamed to "" 
+PASS IndexedDB object store can be renamed to "\u0000" 
+PASS IndexedDB object store can be renamed to "\uDC00\uD800" 
 
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-expected.txt b/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-expected.txt
new file mode 100644 (file)
index 0000000..ed12216
--- /dev/null
@@ -0,0 +1,25 @@
+This tests expectations with renaming existing object stores.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Initial upgrade needed: Old version - 0 New version - 1
+Initial objectStore name: TestObjectStore
+Caught exception renaming object store to the name of another existing object store: InvalidStateError (DOM Exception 11): Failed set property 'name' on 'IDBObjectStore': The database already has an object store named 'ExistingObjectStore'.
+Renamed objectStore name: RenamedObjectStore
+Current objectStore name in a new transaction: RenamedObjectStore
+Caught exception renaming object store outside of a version change transaction: InvalidStateError (DOM Exception 11): Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not a version change transaction.
+Current objectStoreNames during second upgrade transaction includes 'ExistingObjectStore': true
+Current objectStoreNames during second upgrade transaction includes 'RenamedObjectStore': true
+Renamed objectstore again to: YetAnotherName
+Aborting version change transaction...
+Current objectStoreNames during final transaction includes 'ExistingObjectStore': true
+Current objectStoreNames during final transaction includes 'RenamedObjectStore': true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private-expected.txt b/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private-expected.txt
new file mode 100644 (file)
index 0000000..ed12216
--- /dev/null
@@ -0,0 +1,25 @@
+This tests expectations with renaming existing object stores.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+indexedDB = self.indexedDB || self.webkitIndexedDB || self.mozIndexedDB || self.msIndexedDB || self.OIndexedDB;
+
+indexedDB.deleteDatabase(dbname)
+indexedDB.open(dbname)
+Initial upgrade needed: Old version - 0 New version - 1
+Initial objectStore name: TestObjectStore
+Caught exception renaming object store to the name of another existing object store: InvalidStateError (DOM Exception 11): Failed set property 'name' on 'IDBObjectStore': The database already has an object store named 'ExistingObjectStore'.
+Renamed objectStore name: RenamedObjectStore
+Current objectStore name in a new transaction: RenamedObjectStore
+Caught exception renaming object store outside of a version change transaction: InvalidStateError (DOM Exception 11): Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not a version change transaction.
+Current objectStoreNames during second upgrade transaction includes 'ExistingObjectStore': true
+Current objectStoreNames during second upgrade transaction includes 'RenamedObjectStore': true
+Renamed objectstore again to: YetAnotherName
+Aborting version change transaction...
+Current objectStoreNames during final transaction includes 'ExistingObjectStore': true
+Current objectStoreNames during final transaction includes 'RenamedObjectStore': true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private.html b/LayoutTests/storage/indexeddb/modern/objectstore-rename-1-private.html
new file mode 100644 (file)
index 0000000..6f6914a
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/objectstore-rename-1.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/modern/objectstore-rename-1.html b/LayoutTests/storage/indexeddb/modern/objectstore-rename-1.html
new file mode 100644 (file)
index 0000000..3a2689b
--- /dev/null
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+<script src="resources/objectstore-rename-1.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/modern/resources/objectstore-rename-1.js b/LayoutTests/storage/indexeddb/modern/resources/objectstore-rename-1.js
new file mode 100644 (file)
index 0000000..6278a35
--- /dev/null
@@ -0,0 +1,102 @@
+description("This tests expectations with renaming existing object stores.");
+
+indexedDBTest(prepareDatabase);
+
+function log(message)
+{
+    debug(message);
+}
+
+var testGenerator;
+function next()
+{
+    testGenerator.next();
+}
+
+function asyncNext()
+{
+    setTimeout("testGenerator.next();", 0);
+}
+
+var db;
+var dbName;
+var dbVersion;
+
+function prepareDatabase(event)
+{
+    log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+    db = event.target.result;
+       dbName = db.name;
+       dbVersion = db.version;
+
+       objectStore = db.createObjectStore("ExistingObjectStore");
+
+       objectStore = db.createObjectStore("TestObjectStore");
+       log("Initial objectStore name: " + objectStore.name);
+       
+       try {
+               objectStore.name = "ExistingObjectStore";
+               log("Was incorrectly able to rename this object store to the name of another existing object store");
+       } catch(e) {
+               log("Caught exception renaming object store to the name of another existing object store: " + e);
+       }
+
+       objectStore.name = "RenamedObjectStore";
+       log("Renamed objectStore name: " + objectStore.name);
+
+    event.target.onsuccess = function() {
+        testGenerator = testSteps();
+        testGenerator.next();
+    };
+}
+
+function* testSteps()
+{    
+    tx = db.transaction("RenamedObjectStore", "readwrite");
+    tx.oncomplete = next;
+    objectStore = tx.objectStore("RenamedObjectStore");
+    log("Current objectStore name in a new transaction: " + objectStore.name);
+
+       try {
+               objectStore.name = "newName";
+               log("Renaming object store succeeded, but it shouldn't have");
+       } catch(e) {
+               log("Caught exception renaming object store outside of a version change transaction: " + e);
+       }
+    
+    yield; // For the transaction's completion.
+
+       db.close();
+    
+       upgradeOpenRequest = indexedDB.open(dbName, dbVersion + 1);
+       upgradeOpenRequest.onerror = next;
+       upgradeOpenRequest.onupgradeneeded = function() {
+               db = upgradeOpenRequest.result;
+               
+               log("Current objectStoreNames during second upgrade transaction includes 'ExistingObjectStore': " + db.objectStoreNames.contains("ExistingObjectStore"));
+               log("Current objectStoreNames during second upgrade transaction includes 'RenamedObjectStore': " + db.objectStoreNames.contains("RenamedObjectStore"));
+
+               objectStore = event.target.transaction.objectStore("RenamedObjectStore");
+               objectStore.name = "YetAnotherName";
+               
+               log("Renamed objectstore again to: " + objectStore.name);
+               log("Aborting version change transaction...");
+               event.target.transaction.abort();
+       }
+
+       yield; // For the open request's failure (due to aborting the version change transaction)
+
+       upgradeOpenRequest = indexedDB.open(dbName);
+       upgradeOpenRequest.onsuccess = function(event) {
+               log("Current objectStoreNames during final transaction includes 'ExistingObjectStore': " + db.objectStoreNames.contains("ExistingObjectStore"));
+               log("Current objectStoreNames during final transaction includes 'RenamedObjectStore': " + db.objectStoreNames.contains("RenamedObjectStore"));
+
+               next();
+       }
+       
+       yield; // To balance the next() above.
+       
+    finishJSTest();
+ }
\ No newline at end of file
index 2e5b060..1e026fb 100644 (file)
@@ -16,9 +16,6 @@ transaction.db = this
 PASS transaction.db is still [object IDBDatabase]
 Deleted all object stores.
 objectStore = db.createObjectStore('foo');
-trying to set readonly property objectStore.name
-objectStore.name = 'bar'
-PASS objectStore.name is still foo
 trying to set readonly property objectStore.keyPath
 objectStore.keyPath = 'bar'
 PASS objectStore.keyPath is still null
index 5891ef4..051874f 100644 (file)
@@ -16,9 +16,6 @@ transaction.db = this
 PASS transaction.db is still [object IDBDatabase]
 Deleted all object stores.
 objectStore = db.createObjectStore('foo');
-trying to set readonly property objectStore.name
-objectStore.name = 'bar'
-PASS objectStore.name is still foo
 trying to set readonly property objectStore.keyPath
 objectStore.keyPath = 'bar'
 PASS objectStore.keyPath is still null
index 195ccaa..d3ea32f 100644 (file)
@@ -30,7 +30,6 @@ function prepareDatabase()
 
     objectStore = evalAndLog("objectStore = db.createObjectStore('foo');");
 
-    setReadonlyProperty("objectStore.name", "'bar'");
     setReadonlyProperty("objectStore.keyPath", "'bar'");
 /* fails, split into separate test
     setReadonlyProperty("objectStore.indexNames", "['bar']");
index 1358a29..d9cf956 100644 (file)
@@ -1,3 +1,99 @@
+2016-10-20  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Support IDBObjectStore name assignment.
+        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
+
+        Reviewed by Alex Christensen.
+
+        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:
+
 2016-10-20  Chris Dumez  <cdumez@apple.com>
 
         Make table.deleteRow(-1) a no-op when there are no rows
index 4304cf3..3ed7c7a 100644 (file)
@@ -106,6 +106,17 @@ RefPtr<DOMStringList> IDBDatabase::objectStoreNames() const
     return objectStoreNames;
 }
 
+void IDBDatabase::renameObjectStore(IDBObjectStore& objectStore, const String& newName)
+{
+    ASSERT(currentThread() == originThreadID());
+    ASSERT(m_versionChangeTransaction);
+    ASSERT(m_info.hasObjectStore(objectStore.info().name()));
+
+    m_info.renameObjectStore(objectStore.info().identifier(), newName);
+
+    m_versionChangeTransaction->renameObjectStore(objectStore, newName);
+}
+
 ExceptionOr<Ref<IDBObjectStore>> IDBDatabase::createObjectStore(const String&, const Dictionary&)
 {
     ASSERT_NOT_REACHED();
index 2065e4c..7de6458 100644 (file)
@@ -62,6 +62,8 @@ public:
     ExceptionOr<void> deleteObjectStore(const String& name);
     void close();
 
+    void renameObjectStore(IDBObjectStore&, const String& newName);
+
     // EventTarget
     EventTargetInterface eventTargetInterface() const final { return IDBDatabaseEventTargetInterfaceType; }
     ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
index acc7976..d41d124 100644 (file)
@@ -95,6 +95,31 @@ const String& IDBObjectStore::name() const
     return m_info.name();
 }
 
+ExceptionOr<void> IDBObjectStore::setName(const String& name)
+{
+    ASSERT(currentThread() == m_transaction->database().originThreadID());
+
+    if (m_deleted)
+        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store has been deleted.") };
+
+    if (!m_transaction->isVersionChange())
+        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not a version change transaction.") };
+
+    if (!m_transaction->isActive())
+        return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBObjectStore': The object store's transaction is not active.") };
+
+    if (m_info.name() == name)
+        return { };
+
+    if (m_transaction->database().info().hasObjectStore(name))
+        return Exception { INVALID_STATE_ERR, makeString("Failed set property 'name' on 'IDBObjectStore': The database already has an object store named '", name, "'.") };
+
+    m_transaction->database().renameObjectStore(*this, name);
+    m_info.rename(name);
+
+    return { };
+}
+
 const IDBKeyPath& IDBObjectStore::keyPath() const
 {
     ASSERT(currentThread() == m_transaction->database().originThreadID());
index 5750b98..9ee62d3 100644 (file)
@@ -60,6 +60,7 @@ public:
     ~IDBObjectStore();
 
     const String& name() const;
+    ExceptionOr<void> setName(const String&);
     const IDBKeyPath& keyPath() const;
     RefPtr<DOMStringList> indexNames() const;
     IDBTransaction& transaction();
index 2f5532d..aaffd94 100644 (file)
@@ -30,7 +30,7 @@
     JSCustomMarkFunction,
     SkipVTableValidation,
 ] interface IDBObjectStore {
-    readonly attribute DOMString? name;
+    [SetterMayThrowException] attribute DOMString name;
     [ImplementationReturnType=IDBKeyPath] readonly attribute any keyPath;
     readonly attribute DOMStringList indexNames;
     readonly attribute IDBTransaction transaction;
index 77c5499..32e943a 100644 (file)
@@ -601,6 +601,40 @@ void IDBTransaction::didCreateObjectStoreOnServer(const IDBResultData& resultDat
     ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::CreateObjectStoreSuccess || resultData.type() == IDBResultType::Error);
 }
 
+void IDBTransaction::renameObjectStore(IDBObjectStore& objectStore, const String& newName)
+{
+    LOG(IndexedDB, "IDBTransaction::renameObjectStore");
+    ASSERT(isVersionChange());
+    ASSERT(scriptExecutionContext());
+    ASSERT(currentThread() == m_database->originThreadID());
+
+    ASSERT(m_referencedObjectStores.contains(objectStore.info().name()));
+    ASSERT(!m_referencedObjectStores.contains(newName));
+    ASSERT(m_referencedObjectStores.get(objectStore.info().name()) == &objectStore);
+
+    uint64_t objectStoreIdentifier = objectStore.info().identifier();
+    auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameObjectStoreOnServer, &IDBTransaction::renameObjectStoreOnServer, objectStoreIdentifier, newName);
+    scheduleOperation(WTFMove(operation));
+
+    m_referencedObjectStores.set(newName, m_referencedObjectStores.take(objectStore.info().name()));
+}
+
+void IDBTransaction::renameObjectStoreOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "IDBTransaction::renameObjectStoreOnServer");
+    ASSERT(currentThread() == m_database->originThreadID());
+    ASSERT(isVersionChange());
+
+    m_database->connectionProxy().renameObjectStore(operation, objectStoreIdentifier, newName);
+}
+
+void IDBTransaction::didRenameObjectStoreOnServer(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "IDBTransaction::didRenameObjectStoreOnServer");
+    ASSERT(currentThread() == m_database->originThreadID());
+    ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::RenameObjectStoreSuccess || resultData.type() == IDBResultType::Error);
+}
+
 std::unique_ptr<IDBIndex> IDBTransaction::createIndex(IDBObjectStore& objectStore, const IDBIndexInfo& info)
 {
     LOG(IndexedDB, "IDBTransaction::createIndex");
index ae7eb25..26574a8 100644 (file)
@@ -113,6 +113,7 @@ public:
     bool isActive() const;
 
     Ref<IDBObjectStore> createObjectStore(const IDBObjectStoreInfo&);
+    void renameObjectStore(IDBObjectStore&, const String& newName);
     std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&);
 
     Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
@@ -171,6 +172,9 @@ private:
     void createObjectStoreOnServer(IDBClient::TransactionOperation&, const IDBObjectStoreInfo&);
     void didCreateObjectStoreOnServer(const IDBResultData&);
 
+    void renameObjectStoreOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& newName);
+    void didRenameObjectStoreOnServer(const IDBResultData&);
+
     void createIndexOnServer(IDBClient::TransactionOperation&, const IDBIndexInfo&);
     void didCreateIndexOnServer(const IDBResultData&);
 
index 37d22b2..aa5f191 100644 (file)
@@ -125,6 +125,14 @@ void IDBConnectionProxy::createObjectStore(TransactionOperation& operation, cons
     callConnectionOnMainThread(&IDBConnectionToServer::createObjectStore, requestData, info);
 }
 
+void IDBConnectionProxy::renameObjectStore(TransactionOperation& operation, uint64_t objectStoreIdentifier, const String& newName)
+{
+    const IDBRequestData requestData(operation);
+    saveOperation(operation);
+
+    callConnectionOnMainThread(&IDBConnectionToServer::renameObjectStore, requestData, objectStoreIdentifier, newName);
+}
+
 void IDBConnectionProxy::deleteObjectStore(TransactionOperation& operation, const String& objectStoreName)
 {
     const IDBRequestData requestData(operation);
index 15aa0e2..0052a44 100644 (file)
@@ -77,7 +77,8 @@ public:
     void deleteRecord(TransactionOperation&, const IDBKeyRangeData&);
     void openCursor(TransactionOperation&, const IDBCursorInfo&);
     void iterateCursor(TransactionOperation&, const IDBKeyData&, unsigned long count);
-    
+    void renameObjectStore(TransactionOperation&, uint64_t objectStoreIdentifier, const String& newName);
+
     void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion);
     void didFireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier);
 
index 9341113..d6aa858 100644 (file)
@@ -116,6 +116,20 @@ void IDBConnectionToServer::didDeleteObjectStore(const IDBResultData& resultData
     m_proxy->completeOperation(resultData);
 }
 
+void IDBConnectionToServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::renameObjectStore");
+    ASSERT(isMainThread());
+
+    m_delegate->renameObjectStore(requestData, objectStoreIdentifier, newName);
+}
+
+void IDBConnectionToServer::didRenameObjectStore(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "IDBConnectionToServer::didRenameObjectStore");
+    m_proxy->completeOperation(resultData);
+}
+
 void IDBConnectionToServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
 {
     LOG(IndexedDB, "IDBConnectionToServer::clearObjectStore");
index 48cbe10..be269b6 100644 (file)
@@ -68,6 +68,9 @@ public:
     void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
     WEBCORE_EXPORT void didDeleteObjectStore(const IDBResultData&);
 
+    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
+    WEBCORE_EXPORT void didRenameObjectStore(const IDBResultData&);
+
     void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
     WEBCORE_EXPORT void didClearObjectStore(const IDBResultData&);
 
index dfd245d..9ce7549 100644 (file)
@@ -63,6 +63,7 @@ public:
     virtual void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier&) = 0;
     virtual void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) = 0;
     virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) = 0;
+    virtual void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) = 0;
     virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) = 0;
     virtual void createIndex(const IDBRequestData&, const IDBIndexInfo&) = 0;
     virtual void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) = 0;
index e4face3..f8a2039 100644 (file)
@@ -70,6 +70,7 @@ public:
 
     virtual IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) = 0;
     virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
+    virtual IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) = 0;
     virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
     virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0;
     virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) = 0;
index 99159b0..4f8be9a 100644 (file)
@@ -73,6 +73,11 @@ void IDBConnectionToClient::didDeleteObjectStore(const IDBResultData& result)
     m_delegate->didDeleteObjectStore(result);
 }
 
+void IDBConnectionToClient::didRenameObjectStore(const IDBResultData& result)
+{
+    m_delegate->didRenameObjectStore(result);
+}
+
 void IDBConnectionToClient::didClearObjectStore(const IDBResultData& result)
 {
     m_delegate->didClearObjectStore(result);
index 97e2a75..9e8f8dc 100644 (file)
@@ -55,6 +55,7 @@ public:
     void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
     void didCreateObjectStore(const IDBResultData&);
     void didDeleteObjectStore(const IDBResultData&);
+    void didRenameObjectStore(const IDBResultData&);
     void didClearObjectStore(const IDBResultData&);
     void didCreateIndex(const IDBResultData&);
     void didDeleteIndex(const IDBResultData&);
index 62caf46..fdbbfe0 100644 (file)
@@ -53,6 +53,7 @@ public:
     virtual void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 0;
     virtual void didCreateObjectStore(const IDBResultData&) = 0;
     virtual void didDeleteObjectStore(const IDBResultData&) = 0;
+    virtual void didRenameObjectStore(const IDBResultData&) = 0;
     virtual void didClearObjectStore(const IDBResultData&) = 0;
     virtual void didCreateIndex(const IDBResultData&) = 0;
     virtual void didDeleteIndex(const IDBResultData&) = 0;
index f5dbbf5..28bd3eb 100644 (file)
@@ -213,6 +213,18 @@ void IDBServer::deleteObjectStore(const IDBRequestData& requestData, const Strin
     transaction->deleteObjectStore(requestData, objectStoreName);
 }
 
+void IDBServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "IDBServer::renameObjectStore");
+
+    auto transaction = m_transactions.get(requestData.transactionIdentifier());
+    if (!transaction)
+        return;
+
+    ASSERT(transaction->isVersionChange());
+    transaction->renameObjectStore(requestData, objectStoreIdentifier, newName);
+}
+
 void IDBServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
 {
     LOG(IndexedDB, "IDBServer::clearObjectStore");
index a20e40b..05e442a 100644 (file)
@@ -66,6 +66,7 @@ public:
     WEBCORE_EXPORT void commitTransaction(const IDBResourceIdentifier&);
     WEBCORE_EXPORT void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier&);
     WEBCORE_EXPORT void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
+    WEBCORE_EXPORT void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
     WEBCORE_EXPORT void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
     WEBCORE_EXPORT void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
     WEBCORE_EXPORT void createIndex(const IDBRequestData&, const IDBIndexInfo&);
index a0bd8f7..2548313 100644 (file)
@@ -150,6 +150,16 @@ void MemoryBackingStoreTransaction::objectStoreCleared(MemoryObjectStore& object
     m_clearedOrderedKeys.add(&objectStore, WTFMove(orderedKeys));
 }
 
+void MemoryBackingStoreTransaction::objectStoreRenamed(MemoryObjectStore& objectStore, const String& oldName)
+{
+    ASSERT(m_objectStores.contains(&objectStore));
+    ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange);
+
+    // We only care about the first rename in a given transaction, because if the transaction is aborted we want
+    // to go back to the first 'oldName'
+    m_originalObjectStoreNames.add(&objectStore, oldName);
+}
+
 void MemoryBackingStoreTransaction::indexCleared(MemoryIndex& index, std::unique_ptr<IndexValueStore>&& valueStore)
 {
     auto addResult = m_clearedIndexValueStores.add(&index, nullptr);
@@ -193,6 +203,10 @@ void MemoryBackingStoreTransaction::abort()
 
     TemporaryChange<bool> change(m_isAborting, true);
 
+    for (auto iterator : m_originalObjectStoreNames)
+        iterator.key->rename(iterator.value);
+    m_originalObjectStoreNames.clear();
+
     for (auto objectStore : m_versionChangeAddedObjectStores)
         m_backingStore.removeObjectStoreForVersionChangeAbort(*objectStore);
     m_versionChangeAddedObjectStores.clear();
index 9e7712b..98b2469 100644 (file)
@@ -64,6 +64,7 @@ public:
     void recordValueChanged(MemoryObjectStore&, const IDBKeyData&, ThreadSafeDataBuffer*);
     void objectStoreDeleted(Ref<MemoryObjectStore>&&);
     void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&);
+    void objectStoreRenamed(MemoryObjectStore&, const String& oldName);
     void indexCleared(MemoryIndex&, std::unique_ptr<IndexValueStore>&&);
 
     void addNewIndex(MemoryIndex&);
@@ -95,6 +96,7 @@ private:
     HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_originalValues;
     HashMap<MemoryObjectStore*, std::unique_ptr<KeyValueMap>> m_clearedKeyValueMaps;
     HashMap<MemoryObjectStore*, std::unique_ptr<std::set<IDBKeyData>>> m_clearedOrderedKeys;
+    HashMap<MemoryObjectStore*, String> m_originalObjectStoreNames;
     HashMap<MemoryIndex*, std::unique_ptr<IndexValueStore>> m_clearedIndexValueStores;
 };
 
index e47e899..df240b5 100644 (file)
@@ -171,6 +171,32 @@ IDBError MemoryIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& t
     return IDBError();
 }
 
+IDBError MemoryIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "MemoryIDBBackingStore::renameObjectStore");
+
+    ASSERT(m_databaseInfo);
+    if (!m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier))
+        return IDBError(IDBDatabaseException::ConstraintError);
+
+    auto transaction = m_transactions.get(transactionIdentifier);
+    ASSERT(transaction);
+    ASSERT(transaction->isVersionChange());
+
+    auto objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
+    ASSERT(objectStore);
+    if (!objectStore)
+        return IDBError(IDBDatabaseException::ConstraintError);
+
+    String oldName = objectStore->info().name();
+    objectStore->rename(newName);
+    transaction->objectStoreRenamed(*objectStore, oldName);
+
+    m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
+
+    return IDBError();
+}
+
 IDBError MemoryIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier)
 {
     LOG(IndexedDB, "MemoryIDBBackingStore::clearObjectStore");
index 5e79def..b5b981e 100644 (file)
@@ -54,6 +54,7 @@ public:
     IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier) final;
     IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) final;
     IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
+    IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) final;
     IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
     IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final;
     IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) final;
index fb6be97..3c76aa0 100644 (file)
@@ -97,6 +97,8 @@ public:
 
     void maybeRestoreDeletedIndex(Ref<MemoryIndex>&&);
 
+    void rename(const String& newName) { m_info.rename(newName); }
+
 private:
     MemoryObjectStore(const IDBObjectStoreInfo&);
 
index 203df47..0262146 100644 (file)
@@ -978,6 +978,39 @@ IDBError SQLiteIDBBackingStore::deleteObjectStore(const IDBResourceIdentifier& t
     return { };
 }
 
+IDBError SQLiteIDBBackingStore::renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "SQLiteIDBBackingStore::renameObjectStore - object store %" PRIu64, objectStoreIdentifier);
+
+    ASSERT(m_sqliteDB);
+    ASSERT(m_sqliteDB->isOpen());
+
+    auto* transaction = m_transactions.get(transactionIdentifier);
+    if (!transaction || !transaction->inProgress()) {
+        LOG_ERROR("Attempt to rename an object store without an in-progress transaction");
+        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store without an in-progress transaction") };
+    }
+    if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) {
+        LOG_ERROR("Attempt to rename an object store in a non-version-change transaction");
+        return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an object store in a non-version-change transaction") };
+    }
+
+    {
+        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("UPDATE ObjectStoreInfo SET name = ? WHERE id = ?;"));
+        if (sql.prepare() != SQLITE_OK
+            || sql.bindText(1, newName) != SQLITE_OK
+            || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK
+            || sql.step() != SQLITE_DONE) {
+            LOG_ERROR("Could not update name for object store id %" PRIi64 " in ObjectStoreInfo table (%i) - %s", objectStoreIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
+            return { IDBDatabaseException::UnknownError, ASCIILiteral("Could not rename object store") };
+        }
+    }
+
+    m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
+
+    return { };
+}
+
 IDBError SQLiteIDBBackingStore::clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID)
 {
     LOG(IndexedDB, "SQLiteIDBBackingStore::clearObjectStore - object store %" PRIu64, objectStoreID);
index f99f885..87dcb92 100644 (file)
@@ -58,6 +58,7 @@ public:
     IDBError commitTransaction(const IDBResourceIdentifier& transactionIdentifier) final;
     IDBError createObjectStore(const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&) final;
     IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
+    IDBError renameObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName) final;
     IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) final;
     IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final;
     IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) final;
index 4082f48..c25677b 100644 (file)
@@ -660,6 +660,47 @@ void UniqueIDBDatabase::didPerformDeleteObjectStore(uint64_t callbackIdentifier,
     performErrorCallback(callbackIdentifier, error);
 }
 
+void UniqueIDBDatabase::renameObjectStore(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, const String& newName, ErrorCallback callback)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::renameObjectStore");
+
+    uint64_t callbackID = storeCallbackOrFireError(callback);
+    if (!callbackID)
+        return;
+
+    auto* info = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
+    if (!info) {
+        performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename non-existant object store") });
+        return;
+    }
+
+    postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performRenameObjectStore, callbackID, transaction.info().identifier(), objectStoreIdentifier, newName));
+}
+
+void UniqueIDBDatabase::performRenameObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName)
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, "(db) UniqueIDBDatabase::performRenameObjectStore");
+
+    ASSERT(m_backingStore);
+    m_backingStore->renameObjectStore(transactionIdentifier, objectStoreIdentifier, newName);
+
+    IDBError error;
+    postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformRenameObjectStore, callbackIdentifier, error, objectStoreIdentifier, newName));
+}
+
+void UniqueIDBDatabase::didPerformRenameObjectStore(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, const String& newName)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformRenameObjectStore");
+
+    if (error.isNull())
+        m_databaseInfo->renameObjectStore(objectStoreIdentifier, newName);
+
+    performErrorCallback(callbackIdentifier, error);
+}
+
 void UniqueIDBDatabase::clearObjectStore(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, ErrorCallback callback)
 {
     ASSERT(isMainThread());
index c58607c..19fa153 100644 (file)
@@ -87,6 +87,7 @@ public:
 
     void createObjectStore(UniqueIDBDatabaseTransaction&, const IDBObjectStoreInfo&, ErrorCallback);
     void deleteObjectStore(UniqueIDBDatabaseTransaction&, const String& objectStoreName, ErrorCallback);
+    void renameObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, const String& newName, ErrorCallback);
     void clearObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, ErrorCallback);
     void createIndex(UniqueIDBDatabaseTransaction&, const IDBIndexInfo&, ErrorCallback);
     void deleteIndex(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, const String& indexName, ErrorCallback);
@@ -144,6 +145,7 @@ private:
     void beginTransactionInBackingStore(const IDBTransactionInfo&);
     void performCreateObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBObjectStoreInfo&);
     void performDeleteObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
+    void performRenameObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& newName);
     void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
     void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&);
     void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
@@ -162,6 +164,7 @@ private:
     void didOpenBackingStore(const IDBDatabaseInfo&, const IDBError&);
     void didPerformCreateObjectStore(uint64_t callbackIdentifier, const IDBError&, const IDBObjectStoreInfo&);
     void didPerformDeleteObjectStore(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier);
+    void didPerformRenameObjectStore(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, const String& newName);
     void didPerformClearObjectStore(uint64_t callbackIdentifier, const IDBError&);
     void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&);
     void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier);
index c9da02b..252c54b 100644 (file)
@@ -184,6 +184,13 @@ void UniqueIDBDatabaseConnection::didDeleteObjectStore(const IDBResultData& resu
     m_connectionToClient.didDeleteObjectStore(resultData);
 }
 
+void UniqueIDBDatabaseConnection::didRenameObjectStore(const IDBResultData& resultData)
+{
+    LOG(IndexedDB, "UniqueIDBDatabaseConnection::didRenameObjectStore");
+
+    m_connectionToClient.didRenameObjectStore(resultData);
+}
+
 void UniqueIDBDatabaseConnection::didClearObjectStore(const IDBResultData& resultData)
 {
     LOG(IndexedDB, "UniqueIDBDatabaseConnection::didClearObjectStore");
index 5aa0287..56cf7df 100644 (file)
@@ -69,6 +69,7 @@ public:
     void didCommitTransaction(UniqueIDBDatabaseTransaction&, const IDBError&);
     void didCreateObjectStore(const IDBResultData&);
     void didDeleteObjectStore(const IDBResultData&);
+    void didRenameObjectStore(const IDBResultData&);
     void didClearObjectStore(const IDBResultData&);
     void didCreateIndex(const IDBResultData&);
     void didDeleteIndex(const IDBResultData&);
index d08698d..0ec2eab 100644 (file)
@@ -137,6 +137,23 @@ void UniqueIDBDatabaseTransaction::deleteObjectStore(const IDBRequestData& reque
     });
 }
 
+void UniqueIDBDatabaseTransaction::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
+{
+    LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameObjectStore");
+
+    ASSERT(isVersionChange());
+    ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
+
+    RefPtr<UniqueIDBDatabaseTransaction> protectedThis(this);
+    m_databaseConnection->database().renameObjectStore(*this, objectStoreIdentifier, newName, [this, protectedThis, requestData](const IDBError& error) {
+        LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameObjectStore (callback)");
+        if (error.isNull())
+            m_databaseConnection->didRenameObjectStore(IDBResultData::renameObjectStoreSuccess(requestData.requestIdentifier()));
+        else
+            m_databaseConnection->didRenameObjectStore(IDBResultData::error(requestData.requestIdentifier(), error));
+    });
+}
+
 void UniqueIDBDatabaseTransaction::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
 {
     LOG(IndexedDB, "UniqueIDBDatabaseTransaction::clearObjectStore");
index 016acc5..8ccdb77 100644 (file)
@@ -69,6 +69,7 @@ public:
 
     void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&);
     void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
+    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
     void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
     void createIndex(const IDBRequestData&, const IDBIndexInfo&);
     void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName);
index d250b98..44c2b46 100644 (file)
@@ -122,6 +122,15 @@ IDBObjectStoreInfo* IDBDatabaseInfo::infoForExistingObjectStore(const String& na
     return getInfoForExistingObjectStore(name);
 }
 
+void IDBDatabaseInfo::renameObjectStore(uint64_t objectStoreIdentifier, const String& newName)
+{
+    auto* info = infoForExistingObjectStore(objectStoreIdentifier);
+    if (!info)
+        return;
+
+    info->rename(newName);
+}
+
 Vector<String> IDBDatabaseInfo::objectStoreNames() const
 {
     Vector<String> names;
index d34ddcc..8e3d481 100644 (file)
@@ -57,6 +57,8 @@ public:
     const IDBObjectStoreInfo* infoForExistingObjectStore(uint64_t objectStoreIdentifier) const;
     const IDBObjectStoreInfo* infoForExistingObjectStore(const String& objectStoreName) const;
 
+    void renameObjectStore(uint64_t objectStoreIdentifier, const String& newName);
+
     Vector<String> objectStoreNames() const;
 
     void deleteObjectStore(const String& objectStoreName);
index 03c9be3..e879611 100644 (file)
@@ -48,6 +48,8 @@ public:
     bool autoIncrement() const { return m_autoIncrement; }
     uint64_t maxIndexID() const { return m_maxIndexID; }
 
+    void rename(const String& newName) { m_name = newName; }
+
     IDBObjectStoreInfo isolatedCopy() const;
 
     IDBIndexInfo createNewIndex(const String& name, const IDBKeyPath&, bool unique, bool multiEntry);
index 742befa..078c177 100644 (file)
@@ -139,6 +139,11 @@ IDBResultData IDBResultData::deleteObjectStoreSuccess(const IDBResourceIdentifie
     return { IDBResultType::DeleteObjectStoreSuccess, requestIdentifier };
 }
 
+IDBResultData IDBResultData::renameObjectStoreSuccess(const IDBResourceIdentifier& requestIdentifier)
+{
+    return { IDBResultType::RenameObjectStoreSuccess, requestIdentifier };
+}
+
 IDBResultData IDBResultData::clearObjectStoreSuccess(const IDBResourceIdentifier& requestIdentifier)
 {
     return { IDBResultType::ClearObjectStoreSuccess, requestIdentifier };
index 69951af..e8638d8 100644 (file)
@@ -57,6 +57,7 @@ enum class IDBResultType {
     DeleteIndexSuccess,
     OpenCursorSuccess,
     IterateCursorSuccess,
+    RenameObjectStoreSuccess,
 };
 
 namespace IDBServer {
@@ -72,6 +73,7 @@ public:
     static IDBResultData deleteDatabaseSuccess(const IDBResourceIdentifier&, const IDBDatabaseInfo&);
     static IDBResultData createObjectStoreSuccess(const IDBResourceIdentifier&);
     static IDBResultData deleteObjectStoreSuccess(const IDBResourceIdentifier&);
+    static IDBResultData renameObjectStoreSuccess(const IDBResourceIdentifier&);
     static IDBResultData clearObjectStoreSuccess(const IDBResourceIdentifier&);
     static IDBResultData createIndexSuccess(const IDBResourceIdentifier&);
     static IDBResultData deleteIndexSuccess(const IDBResourceIdentifier&);
index 150b11e..181342e 100644 (file)
@@ -146,6 +146,13 @@ void InProcessIDBServer::didDeleteObjectStore(const IDBResultData& resultData)
     });
 }
 
+void InProcessIDBServer::didRenameObjectStore(const IDBResultData& resultData)
+{
+    RunLoop::current().dispatch([this, protectedThis = makeRef(*this), resultData] {
+        m_connectionToServer->didRenameObjectStore(resultData);
+    });
+}
+
 void InProcessIDBServer::didClearObjectStore(const IDBResultData& resultData)
 {
     RunLoop::current().dispatch([this, protectedThis = makeRef(*this), resultData] {
@@ -244,6 +251,13 @@ void InProcessIDBServer::deleteObjectStore(const IDBRequestData& requestData, co
     });
 }
 
+void InProcessIDBServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
+{
+    RunLoop::current().dispatch([this, protectedThis = makeRef(*this), requestData, objectStoreIdentifier, newName] {
+        m_server->renameObjectStore(requestData, objectStoreIdentifier, newName);
+    });
+}
+
 void InProcessIDBServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
 {
     RunLoop::current().dispatch([this, protectedThis = makeRef(*this), requestData, objectStoreIdentifier] {
index eaa447c..744043f 100644 (file)
@@ -64,6 +64,7 @@ public:
     void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier&) final;
     void createObjectStore(const IDBRequestData&, const IDBObjectStoreInfo&) final;
     void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) final;
+    void renameObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) final;
     void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) final;
     void createIndex(const IDBRequestData&, const IDBIndexInfo&) final;
     void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) final;
@@ -89,6 +90,7 @@ public:
     void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) final;
     void didCreateObjectStore(const IDBResultData&) final;
     void didDeleteObjectStore(const IDBResultData&) final;
+    void didRenameObjectStore(const IDBResultData&) final;
     void didClearObjectStore(const IDBResultData&) final;
     void didCreateIndex(const IDBResultData&) final;
     void didDeleteIndex(const IDBResultData&) final;
index 485ed1a..85b9170 100644 (file)
@@ -1,3 +1,22 @@
+2016-10-20  Brady Eidson  <beidson@apple.com>
+
+        IndexedDB 2.0: Support IDBObjectStore name assignment.
+        <rdar://problem/28806931> and https://bugs.webkit.org/show_bug.cgi?id=163749
+
+        Reviewed by Alex Christensen.
+
+        * 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:
+
 2016-10-20  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] Avoid strstr() when checking (E)GL extensions
index f3ecfb1..82dc744 100644 (file)
@@ -107,6 +107,11 @@ void WebIDBConnectionToClient::didDeleteObjectStore(const WebCore::IDBResultData
     send(Messages::WebIDBConnectionToServer::DidDeleteObjectStore(resultData));
 }
 
+void WebIDBConnectionToClient::didRenameObjectStore(const WebCore::IDBResultData& resultData)
+{
+    send(Messages::WebIDBConnectionToServer::DidRenameObjectStore(resultData));
+}
+
 void WebIDBConnectionToClient::didClearObjectStore(const WebCore::IDBResultData& resultData)
 {
     send(Messages::WebIDBConnectionToServer::DidClearObjectStore(resultData));
@@ -235,6 +240,11 @@ void WebIDBConnectionToClient::deleteObjectStore(const IDBRequestData& request,
     DatabaseProcess::singleton().idbServer().deleteObjectStore(request, name);
 }
 
+void WebIDBConnectionToClient::renameObjectStore(const IDBRequestData& request, uint64_t objectStoreIdentifier, const String& newName)
+{
+    DatabaseProcess::singleton().idbServer().renameObjectStore(request, objectStoreIdentifier, newName);
+}
+
 void WebIDBConnectionToClient::clearObjectStore(const IDBRequestData& request, uint64_t objectStoreIdentifier)
 {
     DatabaseProcess::singleton().idbServer().clearObjectStore(request, objectStoreIdentifier);
index 8125ed9..d548201 100644 (file)
@@ -64,6 +64,7 @@ public:
     void didCommitTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&) final;
     void didCreateObjectStore(const WebCore::IDBResultData&) final;
     void didDeleteObjectStore(const WebCore::IDBResultData&) final;
+    void didRenameObjectStore(const WebCore::IDBResultData&) final;
     void didClearObjectStore(const WebCore::IDBResultData&) final;
     void didCreateIndex(const WebCore::IDBResultData&) final;
     void didDeleteIndex(const WebCore::IDBResultData&) final;
@@ -92,6 +93,7 @@ public:
     void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier&);
     void createObjectStore(const WebCore::IDBRequestData&, const WebCore::IDBObjectStoreInfo&);
     void deleteObjectStore(const WebCore::IDBRequestData&, const String& objectStoreName);
+    void renameObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName);
     void clearObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier);
     void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&);
     void deleteIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName);
index 4e0b5c6..20bb575 100644 (file)
@@ -30,6 +30,7 @@ messages -> WebIDBConnectionToClient {
     DidFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, WebCore::IDBResourceIdentifier transactionIdentifier);
     CreateObjectStore(WebCore::IDBRequestData requestData, WebCore::IDBObjectStoreInfo info);
     DeleteObjectStore(WebCore::IDBRequestData requestData, String objectStoreName);
+    RenameObjectStore(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, String newName);
     ClearObjectStore(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier);
     CreateIndex(WebCore::IDBRequestData requestData, WebCore::IDBIndexInfo info);
     DeleteIndex(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, String indexName);
index 18c1bac..6e694c4 100644 (file)
@@ -118,6 +118,11 @@ void WebIDBConnectionToServer::deleteObjectStore(const IDBRequestData& requestDa
     send(Messages::WebIDBConnectionToClient::DeleteObjectStore(requestData, objectStoreName));
 }
 
+void WebIDBConnectionToServer::renameObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& newName)
+{
+    send(Messages::WebIDBConnectionToClient::RenameObjectStore(requestData, objectStoreIdentifier, newName));
+}
+
 void WebIDBConnectionToServer::clearObjectStore(const IDBRequestData& requestData, uint64_t objectStoreIdentifier)
 {
     send(Messages::WebIDBConnectionToClient::ClearObjectStore(requestData, objectStoreIdentifier));
@@ -228,6 +233,11 @@ void WebIDBConnectionToServer::didDeleteObjectStore(const IDBResultData& result)
     m_connectionToServer->didDeleteObjectStore(result);
 }
 
+void WebIDBConnectionToServer::didRenameObjectStore(const IDBResultData& result)
+{
+    m_connectionToServer->didRenameObjectStore(result);
+}
+
 void WebIDBConnectionToServer::didClearObjectStore(const IDBResultData& result)
 {
     m_connectionToServer->didClearObjectStore(result);
index 1e92049..6d523c6 100644 (file)
@@ -53,6 +53,7 @@ public:
     void didFinishHandlingVersionChangeTransaction(uint64_t databaseConnectionIdentifier, const WebCore::IDBResourceIdentifier&) final;
     void createObjectStore(const WebCore::IDBRequestData&, const WebCore::IDBObjectStoreInfo&) final;
     void deleteObjectStore(const WebCore::IDBRequestData&, const String& objectStoreName) final;
+    void renameObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& newName) final;
     void clearObjectStore(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier) final;
     void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&) final;
     void deleteIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) final;
@@ -81,6 +82,7 @@ public:
     void didCommitTransaction(const WebCore::IDBResourceIdentifier& transactionIdentifier, const WebCore::IDBError&);
     void didCreateObjectStore(const WebCore::IDBResultData&);
     void didDeleteObjectStore(const WebCore::IDBResultData&);
+    void didRenameObjectStore(const WebCore::IDBResultData&);
     void didClearObjectStore(const WebCore::IDBResultData&);
     void didCreateIndex(const WebCore::IDBResultData&);
     void didDeleteIndex(const WebCore::IDBResultData&);
index b3d35aa..9b457f5 100644 (file)
@@ -29,6 +29,7 @@ messages -> WebIDBConnectionToServer {
     DidCommitTransaction(WebCore::IDBResourceIdentifier transactionIdentifier, WebCore::IDBError error)
     DidCreateObjectStore(WebCore::IDBResultData result)
     DidDeleteObjectStore(WebCore::IDBResultData result)
+    DidRenameObjectStore(WebCore::IDBResultData result)
     DidClearObjectStore(WebCore::IDBResultData result)
     DidCreateIndex(WebCore::IDBResultData result)
     DidDeleteIndex(WebCore::IDBResultData result)