<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192645] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192645">192645</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-19 11:57:18 -0800 (Thu, 19 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: IDBObjectStore.deleteIndex() support.
https://bugs.webkit.org/show_bug.cgi?id=150911
Reviewed by Alex Christensen.
Source/WebCore:
Tests: storage/indexeddb/modern/deleteindex-1.html
storage/indexeddb/modern/deleteindex-2.html
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
(WebCore::IDBClient::IDBConnectionToServer::didDeleteIndex):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
* Modules/indexeddb/client/IDBDatabaseImpl.cpp:
(WebCore::IDBClient::IDBDatabase::didDeleteIndexInfo):
* Modules/indexeddb/client/IDBDatabaseImpl.h:
* Modules/indexeddb/client/IDBIndexImpl.cpp:
(WebCore::IDBClient::IDBIndex::markAsDeleted):
* Modules/indexeddb/client/IDBIndexImpl.h:
* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::index):
(WebCore::IDBClient::IDBObjectStore::deleteIndex):
* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::deleteIndex):
(WebCore::IDBClient::IDBTransaction::deleteIndexOnServer):
(WebCore::IDBClient::IDBTransaction::didDeleteIndexOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:
* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::createTransactionOperation):
* Modules/indexeddb/server/IDBBackingStore.h:
* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::deleteIndex):
* Modules/indexeddb/server/IDBServer.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:
* Modules/indexeddb/server/MemoryIndex.cpp:
(WebCore::IDBServer::MemoryIndex::clearIndexValueStore):
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::maybeRestoreDeletedIndex):
(WebCore::IDBServer::MemoryObjectStore::takeIndexByName):
(WebCore::IDBServer::MemoryObjectStore::deleteIndex):
* Modules/indexeddb/server/MemoryObjectStore.h:
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
(WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteIndex):
* Modules/indexeddb/server/UniqueIDBDatabase.h:
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteIndex):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteIndex):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::loggingString):
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* Modules/indexeddb/shared/IDBIndexInfo.cpp:
(WebCore::IDBIndexInfo::loggingString):
* Modules/indexeddb/shared/IDBIndexInfo.h:
* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
(WebCore::IDBObjectStoreInfo::hasIndex):
(WebCore::IDBObjectStoreInfo::deleteIndex):
(WebCore::IDBObjectStoreInfo::loggingString):
* Modules/indexeddb/shared/IDBObjectStoreInfo.h:
* Modules/indexeddb/shared/IDBResultData.cpp:
(WebCore::IDBResultData::deleteIndexSuccess):
* Modules/indexeddb/shared/IDBResultData.h:
* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didDeleteIndex):
(WebCore::InProcessIDBServer::createIndex):
(WebCore::InProcessIDBServer::deleteIndex):
* Modules/indexeddb/shared/InProcessIDBServer.h:
LayoutTests:
* storage/indexeddb/modern/deleteindex-1-expected.txt: Added.
* storage/indexeddb/modern/deleteindex-1.html: Added.
* storage/indexeddb/modern/deleteindex-2-expected.txt: Added.
* storage/indexeddb/modern/deleteindex-2.html: Added.
* storage/indexeddb/modern/index-get-count-failures.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexgetcountfailuresexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexgetcountfailureshtml">trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientTransactionOperationh">trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServerh">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectionh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBIndexInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBIndexInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResultDatacpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex1html">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex2html">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/LayoutTests/ChangeLog        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-11-19 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: IDBObjectStore.deleteIndex() support.
+ https://bugs.webkit.org/show_bug.cgi?id=150911
+
+ Reviewed by Alex Christensen.
+
+ * storage/indexeddb/modern/deleteindex-1-expected.txt: Added.
+ * storage/indexeddb/modern/deleteindex-1.html: Added.
+ * storage/indexeddb/modern/deleteindex-2-expected.txt: Added.
+ * storage/indexeddb/modern/deleteindex-2.html: Added.
+ * storage/indexeddb/modern/index-get-count-failures.html:
+
</ins><span class="cx"> 2015-11-19 Brian Burg <bburg@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r8780): Backwards delete by word incorrectly appends deleted text to kill ring, should be prepend
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt (0 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+This tests deleting an index and then committing the transaction.
+Initial upgrade needed: Old version - 0 New version - 1
+Count is: 2
+Cursor at record: A / 1
+Cursor at record: A / 2
+Cursor at record: undefined / undefined
+Deleted the index
+Initial upgrade versionchange transaction complete
+Object store has indexes:
+Unable to get index from object store (it shouldn't exist)
+Transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html (0 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -0,0 +1,113 @@
</span><ins>+This tests deleting an index and then committing the transaction.<br>
+<div id="logger"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function done()
+{
+ log("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+function log(message)
+{
+ document.getElementById("logger").innerHTML += message + "<br>";
+}
+
+var index;
+var objectStore;
+var database;
+
+function checkIndexValues()
+{
+ var countRequest = index.count();
+ countRequest.onsuccess = function() {
+ log("Count is: " + countRequest.result);
+ }
+
+ var cursorRequest = index.openCursor();
+ cursorRequest.onsuccess = function() {
+ var cursor = cursorRequest.result;
+ log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
+
+ if (cursor.key != undefined)
+ cursor.continue();
+ else {
+ objectStore.deleteIndex("TestIndex1");
+ log("Deleted the index");
+ }
+ }
+ cursorRequest.onerror = function(e) {
+ log("Unexpected error opening or iterating cursor");
+ logCursor(cursorRequest.result);
+ done();
+ }
+}
+
+var createRequest = window.indexedDB.open("DeleteIndex1Database", 1);
+createRequest.onupgradeneeded = function(event) {
+ log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ objectStore = database.createObjectStore("TestObjectStore");
+ objectStore.put({ bar: "A" }, 1);
+ objectStore.put({ bar: "A" }, 2);
+
+ index = objectStore.createIndex("TestIndex1", "bar");
+
+ checkIndexValues();
+
+ versionTransaction.onabort = function(event) {
+ log("Initial upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Initial upgrade versionchange transaction complete");
+ continueTest();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function continueTest() {
+ var transaction = database.transaction("TestObjectStore");
+ objectStore = transaction.objectStore("TestObjectStore");
+
+ var names = objectStore.indexNames;
+ log("Object store has indexes:")
+ for (var i = 0; i < names.length; ++i)
+ log(names[i]);
+
+ try {
+ objectStore.index("TestIndex1");
+ } catch(e) {
+ log("Unable to get index from object store (it shouldn't exist)");
+ }
+
+ transaction.onabort = function(event) {
+ log("Transaction unexpected abort");
+ done();
+ }
+
+ transaction.oncomplete = function(event) {
+ log("Transaction complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ log("Transaction unexpected error" + event);
+ done();
+ }
+}
+
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt (0 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+This tests deleting an index and then aborting the transaction.
+Initial upgrade needed: Old version - 0 New version - 1
+Count is: 2
+Cursor at record: A / 1
+Cursor at record: A / 2
+Cursor at record: undefined / undefined
+Initial upgrade versionchange transaction complete
+Second upgrade needed: Old version - 1 New version - 2
+Deleted the index
+Aborted the transaction
+Second upgrade versionchange transaction abort
+Third upgrade needed: Old version - 1 New version - 3
+Count is: 2
+Cursor at record: A / 1
+Cursor at record: A / 2
+Cursor at record: undefined / undefined
+Third upgrade versionchange transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html (0 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -0,0 +1,138 @@
</span><ins>+This tests deleting an index and then aborting the transaction.<br>
+<div id="logger"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function done()
+{
+ log("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+function log(message)
+{
+ document.getElementById("logger").innerHTML += message + "<br>";
+}
+
+var index;
+var objectStore;
+var database;
+
+function checkIndexValues()
+{
+ var countRequest = index.count();
+ countRequest.onsuccess = function() {
+ log("Count is: " + countRequest.result);
+ }
+
+ var cursorRequest = index.openCursor();
+ cursorRequest.onsuccess = function() {
+ var cursor = cursorRequest.result;
+ log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
+
+ if (cursor.key != undefined)
+ cursor.continue();
+ }
+ cursorRequest.onerror = function(e) {
+ log("Unexpected error opening or iterating cursor");
+ logCursor(cursorRequest.result);
+ done();
+ }
+}
+
+var createRequest = window.indexedDB.open("DeleteIndex2Database", 1);
+createRequest.onupgradeneeded = function(event) {
+ log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ objectStore = database.createObjectStore("TestObjectStore");
+ objectStore.put({ bar: "A" }, 1);
+ objectStore.put({ bar: "A" }, 2);
+
+ index = objectStore.createIndex("TestIndex1", "bar");
+
+ checkIndexValues();
+
+ versionTransaction.onabort = function(event) {
+ log("Initial upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Initial upgrade versionchange transaction complete");
+ database.close();
+ continueTest1();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function continueTest1() {
+ var createRequest = window.indexedDB.open("DeleteIndex2Database", 2);
+ createRequest.onupgradeneeded = function(event) {
+ log("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ database = event.target.result;
+ var versionTransaction = createRequest.transaction;
+ objectStore = versionTransaction.objectStore("TestObjectStore");
+ objectStore.deleteIndex("TestIndex1");
+ log("Deleted the index");
+ versionTransaction.abort();
+ log("Aborted the transaction");
+
+ versionTransaction.onabort = function(event) {
+ log("Second upgrade versionchange transaction abort");
+ database.close();
+ continueTest2();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Second upgrade versionchange transaction unexpected complete");
+ done();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Second upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+ }
+}
+
+function continueTest2() {
+ var createRequest = window.indexedDB.open("DeleteIndex2Database", 3);
+ createRequest.onupgradeneeded = function(event) {
+ log("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ objectStore = versionTransaction.objectStore("TestObjectStore");
+ index = objectStore.index("TestIndex1");
+
+ checkIndexValues();
+
+ versionTransaction.onabort = function(event) {
+ log("Third upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Third upgrade versionchange transaction complete");
+ done();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Third upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+ }
+}
+
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexgetcountfailuresexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures-expected.txt        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -3,6 +3,10 @@
</span><span class="cx"> Failed to get with a null key
</span><span class="cx"> Failed to getKey with a null key
</span><span class="cx"> Failed to count with a null range
</span><ins>+Failed to get with deleted IDBIndex
+Failed to getKey with deleted IDBIndex
+Failed to count with deleted IDBIndex
+Failed to delete a nonexistent IDBIndex
</ins><span class="cx"> Failed to get with deleted IDBObjectStore
</span><span class="cx"> Failed to getKey with deleted IDBObjectStore
</span><span class="cx"> Failed to count with deleted IDBObjectStore
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexgetcountfailureshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures.html (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures.html        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-get-count-failures.html        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -49,27 +49,31 @@
</span><span class="cx"> log("Failed to count with a null range");
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // FIXME: once IDBObjectStore.deleteIndex() is implemented, try these
- // https://bugs.webkit.org/show_bug.cgi?id=150911
- // objectStore.deleteIndex("TestIndex");
- //
- // try {
- // index.get("test");
- // } catch(e) {
- // log("Failed to get with deleted IDBIndex");
- // }
- //
- // try {
- // index.getKey("test");
- // } catch(e) {
- // log("Failed to getKey with deleted IDBIndex");
- // }
- //
- // try {
- // index.count();
- // } catch(e) {
- // log("Failed to count with deleted IDBIndex");
- // }
</del><ins>+ objectStore.deleteIndex("TestIndex");
+
+ try {
+ index.get("test");
+ } catch(e) {
+ log("Failed to get with deleted IDBIndex");
+ }
+
+ try {
+ index.getKey("test");
+ } catch(e) {
+ log("Failed to getKey with deleted IDBIndex");
+ }
+
+ try {
+ index.count();
+ } catch(e) {
+ log("Failed to count with deleted IDBIndex");
+ }
+
+ try {
+ objectStore.deleteIndex("TestIndex");
+ } catch(e) {
+ log("Failed to delete a nonexistent IDBIndex");
+ }
</ins><span class="cx">
</span><span class="cx"> database.deleteObjectStore("TestObjectStore");
</span><span class="cx"> try {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/ChangeLog        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -1,3 +1,108 @@
</span><ins>+2015-11-19 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: IDBObjectStore.deleteIndex() support.
+ https://bugs.webkit.org/show_bug.cgi?id=150911
+
+ Reviewed by Alex Christensen.
+
+ Tests: storage/indexeddb/modern/deleteindex-1.html
+ storage/indexeddb/modern/deleteindex-2.html
+
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ (WebCore::IDBClient::IDBConnectionToServer::deleteIndex):
+ (WebCore::IDBClient::IDBConnectionToServer::didDeleteIndex):
+ * Modules/indexeddb/client/IDBConnectionToServer.h:
+ * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+
+ * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+ (WebCore::IDBClient::IDBDatabase::didDeleteIndexInfo):
+ * Modules/indexeddb/client/IDBDatabaseImpl.h:
+
+ * Modules/indexeddb/client/IDBIndexImpl.cpp:
+ (WebCore::IDBClient::IDBIndex::markAsDeleted):
+ * Modules/indexeddb/client/IDBIndexImpl.h:
+
+ * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+ (WebCore::IDBClient::IDBObjectStore::index):
+ (WebCore::IDBClient::IDBObjectStore::deleteIndex):
+
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+ (WebCore::IDBClient::IDBTransaction::deleteIndex):
+ (WebCore::IDBClient::IDBTransaction::deleteIndexOnServer):
+ (WebCore::IDBClient::IDBTransaction::didDeleteIndexOnServer):
+ * Modules/indexeddb/client/IDBTransactionImpl.h:
+
+ * Modules/indexeddb/client/TransactionOperation.h:
+ (WebCore::IDBClient::createTransactionOperation):
+
+ * Modules/indexeddb/server/IDBBackingStore.h:
+
+ * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+ (WebCore::IDBServer::IDBConnectionToClient::didDeleteIndex):
+ * Modules/indexeddb/server/IDBConnectionToClient.h:
+ * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+
+ * Modules/indexeddb/server/IDBServer.cpp:
+ (WebCore::IDBServer::IDBServer::deleteIndex):
+ * Modules/indexeddb/server/IDBServer.h:
+
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::indexDeleted):
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::deleteIndex):
+ * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+
+ * Modules/indexeddb/server/MemoryIndex.cpp:
+ (WebCore::IDBServer::MemoryIndex::clearIndexValueStore):
+ * Modules/indexeddb/server/MemoryIndex.h:
+
+ * Modules/indexeddb/server/MemoryObjectStore.cpp:
+ (WebCore::IDBServer::MemoryObjectStore::maybeRestoreDeletedIndex):
+ (WebCore::IDBServer::MemoryObjectStore::takeIndexByName):
+ (WebCore::IDBServer::MemoryObjectStore::deleteIndex):
+ * Modules/indexeddb/server/MemoryObjectStore.h:
+
+ * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabase::deleteIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::performDeleteIndex):
+ (WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteIndex):
+ * Modules/indexeddb/server/UniqueIDBDatabase.h:
+
+ * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseConnection::didDeleteIndex):
+ * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h:
+
+ * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+ (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteIndex):
+ * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+
+ * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+ (WebCore::IDBDatabaseInfo::loggingString):
+ * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+
+ * Modules/indexeddb/shared/IDBIndexInfo.cpp:
+ (WebCore::IDBIndexInfo::loggingString):
+ * Modules/indexeddb/shared/IDBIndexInfo.h:
+
+ * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
+ (WebCore::IDBObjectStoreInfo::hasIndex):
+ (WebCore::IDBObjectStoreInfo::deleteIndex):
+ (WebCore::IDBObjectStoreInfo::loggingString):
+ * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
+
+ * Modules/indexeddb/shared/IDBResultData.cpp:
+ (WebCore::IDBResultData::deleteIndexSuccess):
+ * Modules/indexeddb/shared/IDBResultData.h:
+
+ * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+ (WebCore::InProcessIDBServer::didDeleteIndex):
+ (WebCore::InProcessIDBServer::createIndex):
+ (WebCore::InProcessIDBServer::deleteIndex):
+ * Modules/indexeddb/shared/InProcessIDBServer.h:
+
</ins><span class="cx"> 2015-11-19 Brian Burg <bburg@apple.com>
</span><span class="cx">
</span><span class="cx"> REGRESSION(r8780): Backwards delete by word incorrectly appends deleted text to kill ring, should be prepend
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -155,6 +155,21 @@
</span><span class="cx"> completeOperation(resultData);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBConnectionToServer::deleteIndex(TransactionOperation& operation, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBConnectionToServer::deleteIndex");
+
+ saveOperation(operation);
+
+ m_delegate->deleteIndex(IDBRequestData(operation), objectStoreIdentifier, indexName);
+}
+
+void IDBConnectionToServer::didDeleteIndex(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBConnectionToServer::didDeleteIndex");
+ completeOperation(resultData);
+}
+
</ins><span class="cx"> void IDBConnectionToServer::putOrAdd(TransactionOperation& operation, RefPtr<IDBKey>& key, RefPtr<SerializedScriptValue>& value, const IndexedDB::ObjectStoreOverwriteMode overwriteMode)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBConnectionToServer::putOrAdd");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -74,6 +74,9 @@
</span><span class="cx"> void createIndex(TransactionOperation&, const IDBIndexInfo&);
</span><span class="cx"> void didCreateIndex(const IDBResultData&);
</span><span class="cx">
</span><ins>+ void deleteIndex(TransactionOperation&, uint64_t objectStoreIdentifier, const String& indexName);
+ void didDeleteIndex(const IDBResultData&);
+
</ins><span class="cx"> void putOrAdd(TransactionOperation&, RefPtr<IDBKey>&, RefPtr<SerializedScriptValue>&, const IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void didPutOrAdd(const IDBResultData&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) = 0;
</span><span class="cx"> virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) = 0;
</span><span class="cx"> virtual void createIndex(const IDBRequestData&, const IDBIndexInfo&) = 0;
</span><ins>+ virtual void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) = 0;
</ins><span class="cx"> virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) = 0;
</span><span class="cx"> virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
</span><span class="cx"> virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -341,6 +341,13 @@
</span><span class="cx"> objectStore->addExistingIndex(info);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBDatabase::didDeleteIndexInfo(const IDBIndexInfo& info)
+{
+ auto* objectStore = m_info.infoForExistingObjectStore(info.objectStoreIdentifier());
+ ASSERT(objectStore);
+ objectStore->deleteIndex(info.name());
+}
+
</ins><span class="cx"> } // namespace IDBClient
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -85,6 +85,7 @@
</span><span class="cx"> IDBConnectionToServer& serverConnection() { return m_serverConnection.get(); }
</span><span class="cx">
</span><span class="cx"> void didCreateIndexInfo(const IDBIndexInfo&);
</span><ins>+ void didDeleteIndexInfo(const IDBIndexInfo&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> IDBDatabase(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -327,6 +327,11 @@
</span><span class="cx"> return transaction.requestGetKey(context, *this, range);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBIndex::markAsDeleted()
+{
+ m_deleted = true;
+}
+
</ins><span class="cx"> } // namespace IDBClient
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBIndexImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBIndexImpl.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -78,6 +78,8 @@
</span><span class="cx"> const IDBIndexInfo& info() const { return m_info; }
</span><span class="cx">
</span><span class="cx"> IDBObjectStore& modernObjectStore() { return m_objectStore.get(); }
</span><ins>+
+ void markAsDeleted();
</ins><span class="cx"> bool isDeleted() const { return m_deleted; }
</span><span class="cx">
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -424,6 +424,8 @@
</span><span class="cx">
</span><span class="cx"> // Create the actual IDBObjectStore from the transaction, which also schedules the operation server side.
</span><span class="cx"> Ref<IDBIndex> index = m_transaction->createIndex(*this, info);
</span><ins>+ m_referencedIndexes.set(name, &index.get());
+
</ins><span class="cx"> return WTF::move(index);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -441,6 +443,11 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (!m_transaction->isActive()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ return nullptr;
+ }
+
</ins><span class="cx"> auto iterator = m_referencedIndexes.find(indexName);
</span><span class="cx"> if (iterator != m_referencedIndexes.end())
</span><span class="cx"> return iterator->value;
</span><span class="lines">@@ -457,9 +464,40 @@
</span><span class="cx"> return WTF::move(index);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBObjectStore::deleteIndex(const String&, ExceptionCode&)
</del><ins>+void IDBObjectStore::deleteIndex(const String& name, ExceptionCode& ec)
</ins><span class="cx"> {
</span><del>- RELEASE_ASSERT_NOT_REACHED();
</del><ins>+ LOG(IndexedDB, "IDBObjectStore::deleteIndex %s", name.utf8().data());
+
+ if (m_deleted) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ return;
+ }
+
+ if (!m_transaction->isVersionChange()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::InvalidStateError);
+ return;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ return;
+ }
+
+ if (!m_info.hasIndex(name)) {
+ ec = IDBDatabaseException::NotFoundError;
+ return;
+ }
+
+ auto* info = m_info.infoForExistingIndex(name);
+ ASSERT(info);
+ m_transaction->database().didDeleteIndexInfo(*info);
+
+ m_info.deleteIndex(name);
+
+ if (auto index = m_referencedIndexes.take(name))
+ index->markAsDeleted();
+
+ m_transaction->deleteIndex(m_info.identifier(), name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<WebCore::IDBRequest> IDBObjectStore::count(ScriptExecutionContext* context, ExceptionCode& ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -751,6 +751,30 @@
</span><span class="cx"> ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteObjectStoreSuccess);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBTransaction::deleteIndex(uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteIndex");
+
+ ASSERT(isVersionChange());
+
+ auto operation = createTransactionOperation(*this, &IDBTransaction::didDeleteIndexOnServer, &IDBTransaction::deleteIndexOnServer, objectStoreIdentifier, indexName);
+ scheduleOperation(WTF::move(operation));
+}
+
+void IDBTransaction::deleteIndexOnServer(TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteIndexOnServer");
+ ASSERT(isVersionChange());
+
+ serverConnection().deleteIndex(operation, objectStoreIdentifier, indexName);
+}
+
+void IDBTransaction::didDeleteIndexOnServer(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didDeleteIndexOnServer");
+ ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::DeleteIndexSuccess);
+}
+
</ins><span class="cx"> void IDBTransaction::operationDidComplete(TransactionOperation& operation)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_transactionOperationMap.get(operation.identifier()) == &operation);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -109,6 +109,7 @@
</span><span class="cx"> void iterateCursor(IDBCursor&, const IDBKeyData&, unsigned long count);
</span><span class="cx">
</span><span class="cx"> void deleteObjectStore(const String& objectStoreName);
</span><ins>+ void deleteIndex(uint64_t objectStoreIdentifier, const String& indexName);
</ins><span class="cx">
</span><span class="cx"> void addRequest(IDBRequest&);
</span><span class="cx"> void removeRequest(IDBRequest&);
</span><span class="lines">@@ -165,6 +166,9 @@
</span><span class="cx"> void deleteObjectStoreOnServer(TransactionOperation&, const String& objectStoreName);
</span><span class="cx"> void didDeleteObjectStoreOnServer(const IDBResultData&);
</span><span class="cx">
</span><ins>+ void deleteIndexOnServer(TransactionOperation&, const uint64_t& objectStoreIdentifier, const String& indexName);
+ void didDeleteIndexOnServer(const IDBResultData&);
+
</ins><span class="cx"> Ref<IDBRequest> doRequestOpenCursor(ScriptExecutionContext&, Ref<IDBCursor>&&);
</span><span class="cx"> void openCursorOnServer(TransactionOperation&, const IDBCursorInfo&);
</span><span class="cx"> void didOpenCursorOnServer(IDBRequest&, const IDBResultData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientTransactionOperationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -138,6 +138,18 @@
</span><span class="cx"> return adoptRef(operation);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<typename MP1, typename P1, typename MP2, typename P2>
+RefPtr<TransactionOperation> createTransactionOperation(
+ IDBTransaction& transaction,
+ void (IDBTransaction::*complete)(const IDBResultData&),
+ void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2),
+ const P1& parameter1,
+ const P2& parameter2)
+{
+ auto operation = new TransactionOperationImpl<MP1, MP2>(transaction, complete, perform, parameter1, parameter2);
+ return adoptRef(operation);
+}
+
</ins><span class="cx"> template<typename MP1, typename P1>
</span><span class="cx"> RefPtr<TransactionOperation> createTransactionOperation(
</span><span class="cx"> IDBTransaction& transaction,
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName) = 0;
</span><span class="cx"> virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
</span><span class="cx"> virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0;
</span><ins>+ virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) = 0;
</ins><span class="cx"> virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
</span><span class="cx"> virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0;
</span><span class="cx"> virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -83,6 +83,11 @@
</span><span class="cx"> m_delegate->didCreateIndex(result);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBConnectionToClient::didDeleteIndex(const IDBResultData& result)
+{
+ m_delegate->didDeleteIndex(result);
+}
+
</ins><span class="cx"> void IDBConnectionToClient::didPutOrAdd(const IDBResultData& result)
</span><span class="cx"> {
</span><span class="cx"> m_delegate->didPutOrAdd(result);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> void didDeleteObjectStore(const IDBResultData&);
</span><span class="cx"> void didClearObjectStore(const IDBResultData&);
</span><span class="cx"> void didCreateIndex(const IDBResultData&);
</span><ins>+ void didDeleteIndex(const IDBResultData&);
</ins><span class="cx"> void didPutOrAdd(const IDBResultData&);
</span><span class="cx"> void didGetRecord(const IDBResultData&);
</span><span class="cx"> void didGetCount(const IDBResultData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> virtual void didDeleteObjectStore(const IDBResultData&) = 0;
</span><span class="cx"> virtual void didClearObjectStore(const IDBResultData&) = 0;
</span><span class="cx"> virtual void didCreateIndex(const IDBResultData&) = 0;
</span><ins>+ virtual void didDeleteIndex(const IDBResultData&) = 0;
</ins><span class="cx"> virtual void didPutOrAdd(const IDBResultData&) = 0;
</span><span class="cx"> virtual void didGetRecord(const IDBResultData&) = 0;
</span><span class="cx"> virtual void didGetCount(const IDBResultData&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -203,6 +203,18 @@
</span><span class="cx"> transaction->createIndex(requestData, info);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBServer::deleteIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "IDBServer::deleteIndex");
+
+ auto transaction = m_transactions.get(requestData.transactionIdentifier());
+ if (!transaction)
+ return;
+
+ ASSERT(transaction->isVersionChange());
+ transaction->deleteIndex(requestData, objectStoreIdentifier, indexName);
+}
+
</ins><span class="cx"> void IDBServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBServer::putOrAdd");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx"> void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
</span><span class="cx"> void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
</span><span class="cx"> void createIndex(const IDBRequestData&, const IDBIndexInfo&);
</span><ins>+ void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName);
</ins><span class="cx"> void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -86,6 +86,16 @@
</span><span class="cx"> m_indexes.add(&index);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryBackingStoreTransaction::indexDeleted(std::unique_ptr<MemoryIndex> index)
+{
+ ASSERT(index);
+ m_indexes.remove(index.get());
+
+ auto addResult = m_deletedIndexes.add(index->info().name(), nullptr);
+ if (addResult.isNewEntry)
+ addResult.iterator->value = WTF::move(index);
+}
+
</ins><span class="cx"> void MemoryBackingStoreTransaction::addExistingObjectStore(MemoryObjectStore& objectStore)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "MemoryBackingStoreTransaction::addExistingObjectStore");
</span><span class="lines">@@ -170,7 +180,7 @@
</span><span class="cx">
</span><span class="cx"> TemporaryChange<bool> change(m_isAborting, true);
</span><span class="cx">
</span><del>- // This loop moves the underlying unique_ptrs from out of the m_deleteObjectStores map,
</del><ins>+ // This loop moves the underlying unique_ptrs from out of the m_deletedObjectStores map,
</ins><span class="cx"> // but the entries in the map still remain.
</span><span class="cx"> for (auto& objectStore : m_deletedObjectStores.values()) {
</span><span class="cx"> MemoryObjectStore* rawObjectStore = objectStore.get();
</span><span class="lines">@@ -214,6 +224,16 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // This loop moves the underlying unique_ptrs from out of the m_deletedIndexes map,
+ // but the entries in the map still remain.
+ for (auto& index : m_deletedIndexes.values()) {
+ MemoryObjectStore& objectStore = index->objectStore();
+ objectStore.maybeRestoreDeletedIndex(WTF::move(index));
+ }
+
+ // This clears the entries from the map.
+ m_deletedIndexes.clear();
+
</ins><span class="cx"> finish();
</span><span class="cx">
</span><span class="cx"> for (auto objectStore : m_versionChangeAddedObjectStores)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx">
</span><span class="cx"> void addNewIndex(MemoryIndex&);
</span><span class="cx"> void addExistingIndex(MemoryIndex&);
</span><ins>+ void indexDeleted(std::unique_ptr<MemoryIndex>);
</ins><span class="cx">
</span><span class="cx"> void abort();
</span><span class="cx"> void commit();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -201,6 +201,21 @@
</span><span class="cx"> return objectStore->createIndex(*rawTransaction, info);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBError MemoryIDBBackingStore::deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "MemoryIDBBackingStore::deleteIndex");
+
+ auto rawTransaction = m_transactions.get(transactionIdentifier);
+ ASSERT(rawTransaction);
+ ASSERT(rawTransaction->isVersionChange());
+
+ auto* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
+ if (!objectStore)
+ return IDBError(IDBExceptionCode::ConstraintError);
+
+ return objectStore->deleteIndex(*rawTransaction, indexName);
+}
+
</ins><span class="cx"> void MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort(MemoryObjectStore& objectStore)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName) override final;
</span><span class="cx"> virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
</span><span class="cx"> virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) override final;
</span><ins>+ virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName) override final;
</ins><span class="cx"> virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
</span><span class="cx"> virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
</span><span class="cx"> virtual IDBError addRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -93,6 +93,14 @@
</span><span class="cx"> ASSERT(m_cleanCursors.isEmpty());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryIndex::clearIndexValueStore()
+{
+ ASSERT(m_objectStore.writeTransaction());
+ ASSERT(m_objectStore.writeTransaction()->isAborting());
+
+ m_records = nullptr;
+}
+
</ins><span class="cx"> void MemoryIndex::replaceIndexValueStore(std::unique_ptr<IndexValueStore>&& valueStore)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_objectStore.writeTransaction());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> void removeRecord(const IDBKeyData&, const IndexKey&);
</span><span class="cx">
</span><span class="cx"> void objectStoreCleared();
</span><ins>+ void clearIndexValueStore();
</ins><span class="cx"> void replaceIndexValueStore(std::unique_ptr<IndexValueStore>&&);
</span><span class="cx">
</span><span class="cx"> MemoryIndexCursor* maybeOpenCursor(const IDBCursorInfo&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -102,6 +102,59 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryObjectStore::maybeRestoreDeletedIndex(std::unique_ptr<MemoryIndex> index)
+{
+ LOG(IndexedDB, "MemoryObjectStore::maybeRestoreDeletedIndex");
+
+ ASSERT(index);
+
+ if (m_info.hasIndex(index->info().name()))
+ return;
+
+ m_info.addExistingIndex(index->info());
+
+ ASSERT(!m_indexesByIdentifier.contains(index->info().identifier()));
+ index->clearIndexValueStore();
+ auto error = populateIndexWithExistingRecords(*index);
+
+ // Since this index was installed in the object store before this transaction started,
+ // assuming things were in a valid state then, we should definitely be able to successfully
+ // repopulate the index with the object store's pre-transaction records.
+ ASSERT_UNUSED(error, error.isNull());
+
+ registerIndex(WTF::move(index));
+}
+
+std::unique_ptr<MemoryIndex> MemoryObjectStore::takeIndexByName(const String& name)
+{
+ auto rawIndex = m_indexesByName.take(name);
+ if (!rawIndex)
+ return nullptr;
+
+ auto index = m_indexesByIdentifier.take(rawIndex->info().identifier());
+ ASSERT(index);
+
+ return index;
+}
+
+IDBError MemoryObjectStore::deleteIndex(MemoryBackingStoreTransaction& transaction, const String& indexName)
+{
+ LOG(IndexedDB, "MemoryObjectStore::deleteIndex");
+
+ if (!m_writeTransaction || !m_writeTransaction->isVersionChange() || m_writeTransaction != &transaction)
+ return IDBError(IDBExceptionCode::ConstraintError);
+
+ auto index = takeIndexByName(indexName);
+ ASSERT(index);
+ if (!index)
+ return IDBError(IDBExceptionCode::ConstraintError);
+
+ m_info.deleteIndex(indexName);
+ transaction.indexDeleted(WTF::move(index));
+
+ return { };
+}
+
</ins><span class="cx"> bool MemoryObjectStore::containsRecord(const IDBKeyData& key)
</span><span class="cx"> {
</span><span class="cx"> if (!m_keyValueStore)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -66,6 +66,8 @@
</span><span class="cx"> MemoryBackingStoreTransaction* writeTransaction() { return m_writeTransaction; }
</span><span class="cx">
</span><span class="cx"> IDBError createIndex(MemoryBackingStoreTransaction&, const IDBIndexInfo&);
</span><ins>+ IDBError deleteIndex(MemoryBackingStoreTransaction&, const String& indexName);
+ void registerIndex(std::unique_ptr<MemoryIndex>&&);
</ins><span class="cx">
</span><span class="cx"> bool containsRecord(const IDBKeyData&);
</span><span class="cx"> void deleteRecord(const IDBKeyData&);
</span><span class="lines">@@ -91,6 +93,8 @@
</span><span class="cx">
</span><span class="cx"> MemoryIndex* indexForIdentifier(uint64_t);
</span><span class="cx">
</span><ins>+ void maybeRestoreDeletedIndex(std::unique_ptr<MemoryIndex>);
+
</ins><span class="cx"> private:
</span><span class="cx"> MemoryObjectStore(const IDBObjectStoreInfo&);
</span><span class="cx">
</span><span class="lines">@@ -103,6 +107,8 @@
</span><span class="cx"> void updateCursorsForPutRecord(std::set<IDBKeyData>::iterator);
</span><span class="cx"> void updateCursorsForDeleteRecord(const IDBKeyData&);
</span><span class="cx">
</span><ins>+ std::unique_ptr<MemoryIndex> takeIndexByName(const String& name);
+
</ins><span class="cx"> IDBObjectStoreInfo m_info;
</span><span class="cx">
</span><span class="cx"> MemoryBackingStoreTransaction* m_writeTransaction { nullptr };
</span><span class="lines">@@ -111,7 +117,6 @@
</span><span class="cx"> std::unique_ptr<KeyValueMap> m_keyValueStore;
</span><span class="cx"> std::unique_ptr<std::set<IDBKeyData>> m_orderedKeys;
</span><span class="cx">
</span><del>- void registerIndex(std::unique_ptr<MemoryIndex>&&);
</del><span class="cx"> void unregisterIndex(MemoryIndex&);
</span><span class="cx"> HashMap<uint64_t, std::unique_ptr<MemoryIndex>> m_indexesByIdentifier;
</span><span class="cx"> HashMap<String, MemoryIndex*> m_indexesByName;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -373,6 +373,41 @@
</span><span class="cx"> performErrorCallback(callbackIdentifier, error);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void UniqueIDBDatabase::deleteIndex(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, const String& indexName, ErrorCallback callback)
+{
+ ASSERT(isMainThread());
+ LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteIndex");
+
+ uint64_t callbackID = storeCallback(callback);
+ m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexName));
+}
+
+void UniqueIDBDatabase::performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ ASSERT(!isMainThread());
+ LOG(IndexedDB, "(db) UniqueIDBDatabase::performDeleteIndex");
+
+ ASSERT(m_backingStore);
+ m_backingStore->deleteIndex(transactionIdentifier, objectStoreIdentifier, indexName);
+
+ IDBError error;
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteIndex, callbackIdentifier, error, objectStoreIdentifier, indexName));
+}
+
+void UniqueIDBDatabase::didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ ASSERT(isMainThread());
+ LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformDeleteIndex");
+
+ if (error.isNull()) {
+ auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier);
+ if (objectStoreInfo)
+ objectStoreInfo->deleteIndex(indexName);
+ }
+
+ performErrorCallback(callbackIdentifier, error);
+}
+
</ins><span class="cx"> void UniqueIDBDatabase::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode overwriteMode, KeyDataCallback callback)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx"> void deleteObjectStore(UniqueIDBDatabaseTransaction&, const String& objectStoreName, ErrorCallback);
</span><span class="cx"> void clearObjectStore(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, ErrorCallback);
</span><span class="cx"> void createIndex(UniqueIDBDatabaseTransaction&, const IDBIndexInfo&, ErrorCallback);
</span><ins>+ void deleteIndex(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, const String& indexName, ErrorCallback);
</ins><span class="cx"> void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&, GetResultCallback);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&, CountCallback);
</span><span class="lines">@@ -114,6 +115,7 @@
</span><span class="cx"> void performDeleteObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName);
</span><span class="cx"> void performClearObjectStore(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier);
</span><span class="cx"> void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&);
</span><ins>+ void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const String& indexName);
</ins><span class="cx"> void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
</span><span class="cx"> void performGetIndexRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, IndexedDB::IndexRecordType, const IDBKeyRangeData&);
</span><span class="lines">@@ -129,6 +131,7 @@
</span><span class="cx"> void didPerformDeleteObjectStore(uint64_t callbackIdentifier, const IDBError&, const String& objectStoreName);
</span><span class="cx"> void didPerformClearObjectStore(uint64_t callbackIdentifier, const IDBError&);
</span><span class="cx"> void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&);
</span><ins>+ void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, const String& indexName);
</ins><span class="cx"> void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&);
</span><span class="cx"> void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const IDBGetResult&);
</span><span class="cx"> void didPerformGetCount(uint64_t callbackIdentifier, const IDBError&, uint64_t);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -160,6 +160,13 @@
</span><span class="cx"> m_connectionToClient.didCreateIndex(resultData);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void UniqueIDBDatabaseConnection::didDeleteIndex(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "UniqueIDBDatabaseConnection::didDeleteIndex");
+
+ m_connectionToClient.didDeleteIndex(resultData);
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> void didDeleteObjectStore(const IDBResultData&);
</span><span class="cx"> void didClearObjectStore(const IDBResultData&);
</span><span class="cx"> void didCreateIndex(const IDBResultData&);
</span><ins>+ void didDeleteIndex(const IDBResultData&);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> UniqueIDBDatabaseConnection(UniqueIDBDatabase&, IDBConnectionToClient&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -163,6 +163,23 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void UniqueIDBDatabaseTransaction::deleteIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ LOG(IndexedDB, "UniqueIDBDatabaseTransaction::deleteIndex");
+
+ ASSERT(isVersionChange());
+ ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
+
+ RefPtr<UniqueIDBDatabaseTransaction> self(this);
+ m_databaseConnection->database().deleteIndex(*this, objectStoreIdentifier, indexName, [this, self, requestData](const IDBError& error) {
+ LOG(IndexedDB, "UniqueIDBDatabaseTransaction::createIndex (callback)");
+ if (error.isNull())
+ m_databaseConnection->didDeleteIndex(IDBResultData::deleteIndexSuccess(requestData.requestIdentifier()));
+ else
+ m_databaseConnection->didDeleteIndex(IDBResultData::error(requestData.requestIdentifier(), error));
+ });
+}
+
</ins><span class="cx"> void UniqueIDBDatabaseTransaction::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode overwriteMode)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "UniqueIDBDatabaseTransaction::putOrAdd");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx"> void deleteObjectStore(const IDBRequestData&, const String& objectStoreName);
</span><span class="cx"> void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier);
</span><span class="cx"> void createIndex(const IDBRequestData&, const IDBIndexInfo&);
</span><ins>+ void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName);
</ins><span class="cx"> void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -135,6 +135,17 @@
</span><span class="cx"> m_objectStoreMap.remove(info->identifier());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#ifndef NDEBUG
+String IDBDatabaseInfo::loggingString() const
+{
+ String top = makeString("Database: ", m_name, " version ", String::number(m_version), "\n");
+ for (auto objectStore : m_objectStoreMap.values())
+ top.append(makeString(objectStore.loggingString(1), "\n"));
+
+ return top;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -58,6 +58,10 @@
</span><span class="cx">
</span><span class="cx"> void deleteObjectStore(const String& objectStoreName);
</span><span class="cx">
</span><ins>+#ifndef NDEBUG
+ String loggingString() const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> IDBDatabaseInfo();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBIndexInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -49,6 +49,17 @@
</span><span class="cx"> return { m_identifier, m_objectStoreIdentifier, m_name.isolatedCopy(), m_keyPath.isolatedCopy(), m_unique, m_multiEntry };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#ifndef NDEBUG
+String IDBIndexInfo::loggingString(int indent) const
+{
+ String indentString;
+ for (int i = 0; i < indent; ++i)
+ indentString.append(" ");
+
+ return makeString(indentString, "Index: ", m_name, String::format(" (%" PRIu64 ") \n", m_identifier));
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBIndexInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -47,6 +47,10 @@
</span><span class="cx"> bool unique() const { return m_unique; }
</span><span class="cx"> bool multiEntry() const { return m_multiEntry; }
</span><span class="cx">
</span><ins>+#ifndef NDEBUG
+ String loggingString(int indent = 0) const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> uint64_t m_identifier { 0 };
</span><span class="cx"> uint64_t m_objectStoreIdentifier { 0 };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -69,6 +69,11 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool IDBObjectStoreInfo::hasIndex(uint64_t indexIdentifier) const
+{
+ return m_indexMap.contains(indexIdentifier);
+}
+
</ins><span class="cx"> IDBIndexInfo* IDBObjectStoreInfo::infoForExistingIndex(const String& name)
</span><span class="cx"> {
</span><span class="cx"> for (auto& index : m_indexMap.values()) {
</span><span class="lines">@@ -99,6 +104,30 @@
</span><span class="cx"> return names;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBObjectStoreInfo::deleteIndex(const String& indexName)
+{
+ auto* info = infoForExistingIndex(indexName);
+ if (!info)
+ return;
+
+ m_indexMap.remove(info->identifier());
+}
+
+#ifndef NDEBUG
+String IDBObjectStoreInfo::loggingString(int indent) const
+{
+ String indentString;
+ for (int i = 0; i < indent; ++i)
+ indentString.append(" ");
+
+ String top = makeString(indentString, "Object store: ", m_name, String::format(" (%" PRIu64 ") \n", m_identifier));
+ for (auto index : m_indexMap.values())
+ top.append(makeString(index.loggingString(indent + 1), "\n"));
+
+ return top;
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -52,10 +52,17 @@
</span><span class="cx"> IDBIndexInfo createNewIndex(const String& name, const IDBKeyPath&, bool unique, bool multiEntry);
</span><span class="cx"> void addExistingIndex(const IDBIndexInfo&);
</span><span class="cx"> bool hasIndex(const String& name) const;
</span><ins>+ bool hasIndex(uint64_t indexIdentifier) const;
</ins><span class="cx"> IDBIndexInfo* infoForExistingIndex(const String& name);
</span><span class="cx">
</span><span class="cx"> Vector<String> indexNames() const;
</span><span class="cx">
</span><ins>+ void deleteIndex(const String& indexName);
+
+#ifndef NDEBUG
+ String loggingString(int indent = 0) const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx"> uint64_t m_identifier { 0 };
</span><span class="cx"> String m_name;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResultDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -110,6 +110,11 @@
</span><span class="cx"> return { IDBResultType::CreateIndexSuccess, requestIdentifier };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBResultData IDBResultData::deleteIndexSuccess(const IDBResourceIdentifier& requestIdentifier)
+{
+ return { IDBResultType::DeleteIndexSuccess, requestIdentifier };
+}
+
</ins><span class="cx"> IDBResultData IDBResultData::putOrAddSuccess(const IDBResourceIdentifier& requestIdentifier, const IDBKeyData& resultKey)
</span><span class="cx"> {
</span><span class="cx"> IDBResultData result(IDBResultType::PutOrAddSuccess, requestIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> GetCountSuccess,
</span><span class="cx"> DeleteRecordSuccess,
</span><span class="cx"> CreateIndexSuccess,
</span><ins>+ DeleteIndexSuccess,
</ins><span class="cx"> OpenCursorSuccess,
</span><span class="cx"> IterateCursorSuccess,
</span><span class="cx"> };
</span><span class="lines">@@ -71,6 +72,7 @@
</span><span class="cx"> static IDBResultData deleteObjectStoreSuccess(const IDBResourceIdentifier&);
</span><span class="cx"> static IDBResultData clearObjectStoreSuccess(const IDBResourceIdentifier&);
</span><span class="cx"> static IDBResultData createIndexSuccess(const IDBResourceIdentifier&);
</span><ins>+ static IDBResultData deleteIndexSuccess(const IDBResourceIdentifier&);
</ins><span class="cx"> static IDBResultData putOrAddSuccess(const IDBResourceIdentifier&, const IDBKeyData&);
</span><span class="cx"> static IDBResultData getRecordSuccess(const IDBResourceIdentifier&, const IDBGetResult&);
</span><span class="cx"> static IDBResultData getCountSuccess(const IDBResourceIdentifier&, uint64_t count);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -152,6 +152,14 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InProcessIDBServer::didDeleteIndex(const IDBResultData& resultData)
+{
+ RefPtr<InProcessIDBServer> self(this);
+ RunLoop::current().dispatch([this, self, resultData] {
+ m_connectionToServer->didDeleteIndex(resultData);
+ });
+}
+
</ins><span class="cx"> void InProcessIDBServer::didPutOrAdd(const IDBResultData& resultData)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<InProcessIDBServer> self(this);
</span><span class="lines">@@ -240,14 +248,22 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void InProcessIDBServer::createIndex(const IDBRequestData& resultData, const IDBIndexInfo& info)
</del><ins>+void InProcessIDBServer::createIndex(const IDBRequestData& requestData, const IDBIndexInfo& info)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<InProcessIDBServer> self(this);
</span><del>- RunLoop::current().dispatch([this, self, resultData, info] {
- m_server->createIndex(resultData, info);
</del><ins>+ RunLoop::current().dispatch([this, self, requestData, info] {
+ m_server->createIndex(requestData, info);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InProcessIDBServer::deleteIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, const String& indexName)
+{
+ RefPtr<InProcessIDBServer> self(this);
+ RunLoop::current().dispatch([this, self, requestData, objectStoreIdentifier, indexName] {
+ m_server->deleteIndex(requestData, objectStoreIdentifier, indexName);
+ });
+}
+
</ins><span class="cx"> void InProcessIDBServer::putOrAdd(const IDBRequestData& requestData, IDBKey* key, SerializedScriptValue& value, const IndexedDB::ObjectStoreOverwriteMode overwriteMode)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<InProcessIDBServer> self(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (192644 => 192645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-11-19 19:55:46 UTC (rev 192644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-11-19 19:57:18 UTC (rev 192645)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> virtual void deleteObjectStore(const IDBRequestData&, const String& objectStoreName) override final;
</span><span class="cx"> virtual void clearObjectStore(const IDBRequestData&, uint64_t objectStoreIdentifier) override final;
</span><span class="cx"> virtual void createIndex(const IDBRequestData&, const IDBIndexInfo&) override final;
</span><ins>+ virtual void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) override final;
</ins><span class="cx"> virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) override final;
</span><span class="cx"> virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
</span><span class="cx"> virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) override final;
</span><span class="lines">@@ -81,6 +82,7 @@
</span><span class="cx"> virtual void didDeleteObjectStore(const IDBResultData&) override final;
</span><span class="cx"> virtual void didClearObjectStore(const IDBResultData&) override final;
</span><span class="cx"> virtual void didCreateIndex(const IDBResultData&) override final;
</span><ins>+ virtual void didDeleteIndex(const IDBResultData&) override final;
</ins><span class="cx"> virtual void didPutOrAdd(const IDBResultData&) override final;
</span><span class="cx"> virtual void didGetRecord(const IDBResultData&) override final;
</span><span class="cx"> virtual void didGetCount(const IDBResultData&) override final;
</span></span></pre>
</div>
</div>
</body>
</html>