<!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>[191645] 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/191645">191645</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-27 17:12:00 -0700 (Tue, 27 Oct 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: IDBTransaction.objectStore() support.
https://bugs.webkit.org/show_bug.cgi?id=150607
Reviewed by Alex Christensen.
Source/WebCore:
Tests: storage/indexeddb/modern/aborted-put.html
storage/indexeddb/modern/idbtransaction-objectstore-failures.html
* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::put):
* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::objectStore):
(WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:
* Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
* Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::infoForExistingObjectStore):
* Modules/indexeddb/shared/IDBDatabaseInfo.h:
* Modules/indexeddb/shared/IDBTransactionInfo.h:
(WebCore::IDBTransactionInfo::objectStores):
LayoutTests:
* storage/indexeddb/modern/aborted-put-expected.txt: Added.
* storage/indexeddb/modern/aborted-put.html: Added.
* storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt: Added.
* storage/indexeddb/modern/idbtransaction-objectstore-failures.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#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="#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="#trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernabortedputexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernabortedputhtml">trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbtransactionobjectstorefailuresexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbtransactionobjectstorefailureshtml">trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/LayoutTests/ChangeLog        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-10-27 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: IDBTransaction.objectStore() support.
+ https://bugs.webkit.org/show_bug.cgi?id=150607
+
+ Reviewed by Alex Christensen.
+
+ * storage/indexeddb/modern/aborted-put-expected.txt: Added.
+ * storage/indexeddb/modern/aborted-put.html: Added.
+ * storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt: Added.
+ * storage/indexeddb/modern/idbtransaction-objectstore-failures.html: Added.
+
</ins><span class="cx"> 2015-10-27 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Implement viewport-width-based fast-click heuristic
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernabortedputexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt (0 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+ALERT: First upgrade needed: Old version - 0 New version - 1
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: put succeeded - key was 'foo'
+ALERT: get 'foo' succeeded - value was 'bar'
+ALERT: get 'far' succeeded - value was 'undefined'
+ALERT: First version change transaction completed
+ALERT: Second upgrade needed: Old version - 1 New version - 2
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: get1 'foo' succeeded - value was 'baz'
+ALERT: get2 'far' succeeded - value was 'boo'
+ALERT: Second version change transaction abort
+ALERT: Third upgrade needed: Old version - 1 New version - 2
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: get1 'foo' succeeded - value was 'bar'
+ALERT: get2 'far' succeeded - value was 'undefined'
+ALERT: Third version change transaction complete
+ALERT: Done
+This test creates some object stores, putting some values in them, committing the transaction.
+In a new transaction, it then overwrites those values, but then aborts the transaction.
+Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernabortedputhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html (0 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/aborted-put.html        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -0,0 +1,204 @@
</span><ins>+This test creates some object stores, putting some values in them, committing the transaction.<br>
+In a new transaction, it then overwrites those values, but then aborts the transaction.<br>
+Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.<br>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open("AbortedPutTestDatabase");
+
+function done()
+{
+ alert("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+request.onupgradeneeded = function(event)
+{
+ alert("First upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var tx = request.transaction;
+ var db = event.target.result;
+
+ alert(tx + " - " + tx.mode);
+ alert(db);
+
+ var os1 = db.createObjectStore("TestObjectStore1");
+ var os2 = db.createObjectStore("TestObjectStore2");
+
+ var putRequest = os1.put("bar", "foo");
+
+ putRequest.onsuccess = function(event) {
+ alert("put succeeded - key was '" + putRequest.result + "'");
+
+ var getRequest1 = os1.get("foo");
+ getRequest1.onsuccess = function(event) {
+ alert("get 'foo' succeeded - value was '" + getRequest1.result + "'");
+ }
+
+ getRequest1.onerror = function(event) {
+ alert("get 'foo' unexpectedly failed - " + event);
+ done();
+ }
+
+ var getRequest2 = os2.get("far");
+ getRequest2.onsuccess = function(event) {
+ alert("get 'far' succeeded - value was '" + getRequest2.result + "'");
+ }
+
+ getRequest2.onerror = function(event) {
+ alert("get 'far' unexpectedly failed - " + event);
+ done();
+ }
+ }
+
+ putRequest.onerror = function(event) {
+ alert("put unexpectedly failed - " + event);
+ done();
+ }
+
+ tx.onabort = function(event) {
+ alert("First version change transaction unexpected abort");
+ done();
+ }
+
+ tx.oncomplete = function(event) {
+ alert("First version change transaction completed");
+ db.close();
+ continueTest1();
+ }
+
+ tx.onerror = function(event) {
+ alert("First version change transaction unexpected error - " + event);
+ done();
+ }
+}
+
+function continueTest1()
+{
+ var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+
+ request.onupgradeneeded = function(event) {
+ alert("Second upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var tx = request.transaction;
+ var db = event.target.result;
+
+ alert(tx + " - " + tx.mode);
+ alert(db);
+
+ var os1 = tx.objectStore("TestObjectStore1");
+ var os2 = tx.objectStore("TestObjectStore2");
+ var putRequest1 = os1.put("baz", "foo");
+ var putRequest2 = os2.put("boo", "far");
+
+ putRequest1.onerror = function(e) {
+ alert("Unexpected error overwriting bar with baz - " + e);
+ done();
+ }
+
+ putRequest2.onerror = function(e) {
+ alert("Writing into second object store unexpectedly failed - " + e);
+ done();
+ }
+
+ putRequest2.onsuccess = function(e) {
+ var getRequest1 = os1.get("foo");
+ var getRequest2 = os2.get("far");
+
+ getRequest1.onsuccess = function(event) {
+ alert("get1 'foo' succeeded - value was '" + getRequest1.result + "'");
+ }
+
+ getRequest1.onerror = function(event) {
+ alert("get1 unexpectedly failed - " + event);
+ done();
+ }
+
+ getRequest2.onsuccess = function(event) {
+ alert("get2 'far' succeeded - value was '" + getRequest2.result + "'");
+ tx.abort();
+ }
+
+ getRequest2.onerror = function(event) {
+ alert("get2 unexpectedly failed - " + event);
+ done();
+ }
+ }
+
+ tx.onabort = function(event) {
+ alert("Second version change transaction abort");
+ db.close();
+ continueTest2();
+ }
+
+ tx.oncomplete = function(event) {
+ alert("Second version change transaction unexpected complete");
+ done();
+ }
+
+ tx.onerror = function(event) {
+ alert("Second version change transaction unexpected error - " + event);
+ done();
+ }
+ }
+}
+
+function continueTest2()
+{
+ var request = window.indexedDB.open("AbortedPutTestDatabase", 2);
+
+ request.onupgradeneeded = function(event) {
+ alert("Third upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var tx = request.transaction;
+ var db = event.target.result;
+
+ alert(tx + " - " + tx.mode);
+ alert(db);
+
+ var os1 = tx.objectStore("TestObjectStore1");
+ var os2 = tx.objectStore("TestObjectStore2");
+ var getRequest1 = os1.get("foo");
+ var getRequest2 = os2.get("far");
+
+ getRequest1.onsuccess = function(event) {
+ alert("get1 'foo' succeeded - value was '" + getRequest1.result + "'");
+ }
+
+ getRequest1.onerror = function(event) {
+ alert("get1 'foo' unexpectedly failed - " + event);
+ done();
+ }
+
+ getRequest2.onsuccess = function(event) {
+ alert("get2 'far' succeeded - value was '" + getRequest2.result + "'");
+ }
+
+ getRequest2.onerror = function(event) {
+ alert("get2 'far' unexpectedly failed - " + event);
+ done();
+ }
+
+ tx.onabort = function(event) {
+ alert("Third version change transaction unexpected abort");
+ done();
+ }
+
+ tx.oncomplete = function(event) {
+ alert("Third version change transaction complete");
+ done();
+ }
+
+ tx.onerror = function(event) {
+ alert("Third version change transaction unexpected error - " + event);
+ done();
+ }
+ }
+}
+
+</script>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbtransactionobjectstorefailuresexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt (0 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures-expected.txt        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+ALERT: Upgrade needed: Old version - 0 New version - 1
+ALERT: [object IDBTransaction] - versionchange
+ALERT: [object IDBDatabase]
+ALERT: Caught attempt to access empty-named object store on the transaction
+ALERT: Caught attempt to access null-named object store on the transaction
+ALERT: Caught attempt to access non-existant object store on the transaction
+ALERT: Caught attempt to access valid object store on a transaction that is already finishing
+ALERT: First version change transaction abort
+ALERT: Done
+This tests some obvious failures that can happen while calling transaction.objectStore()
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbtransactionobjectstorefailureshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html (0 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbtransaction-objectstore-failures.html        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -0,0 +1,79 @@
</span><ins>+This tests some obvious failures that can happen while calling transaction.objectStore()<br>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open("TransactionObjectStoreFailuresTestDatabase");
+
+function done()
+{
+ alert("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+request.onupgradeneeded = function(event)
+{
+ alert("Upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var tx = request.transaction;
+ var db = event.target.result;
+
+ alert(tx + " - " + tx.mode);
+ alert(db);
+
+ var os1 = db.createObjectStore("TestObjectStore1");
+ var os2 = db.createObjectStore("TestObjectStore2");
+
+ var putRequest = os1.put("bar", "foo");
+
+ putRequest.onerror = function(event) {
+ alert("put unexpectedly failed - " + event);
+ done();
+ }
+
+ try {
+ tx.objectStore("");
+ } catch(e) {
+ alert("Caught attempt to access empty-named object store on the transaction");
+ }
+
+ try {
+ tx.objectStore();
+ } catch(e) {
+ alert("Caught attempt to access null-named object store on the transaction");
+ }
+
+ try {
+ tx.objectStore("ThisObjectStoreDoesNotExist");
+ } catch(e) {
+ alert("Caught attempt to access non-existant object store on the transaction");
+ }
+
+ tx.abort();
+
+ try {
+ tx.objectStore("TestObjectStore1");
+ } catch(e) {
+ alert("Caught attempt to access valid object store on a transaction that is already finishing");
+ }
+
+ tx.onabort = function(event) {
+ alert("First version change transaction abort");
+ done();
+ }
+
+ tx.oncomplete = function(event) {
+ alert("First version change transaction unexpected complete");
+ done();
+ }
+
+ tx.onerror = function(event) {
+ alert("First version change transaction unexpected error - " + event);
+ done();
+ }
+}
+</script>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/ChangeLog        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2015-10-27 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: IDBTransaction.objectStore() support.
+ https://bugs.webkit.org/show_bug.cgi?id=150607
+
+ Reviewed by Alex Christensen.
+
+ Tests: storage/indexeddb/modern/aborted-put.html
+ storage/indexeddb/modern/idbtransaction-objectstore-failures.html
+
+ * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+ (WebCore::IDBClient::IDBObjectStore::put):
+
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+ (WebCore::IDBClient::IDBTransaction::objectStore):
+ (WebCore::IDBClient::IDBTransaction::createObjectStoreOnServer):
+ * Modules/indexeddb/client/IDBTransactionImpl.h:
+
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
+ (WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
+ * Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::beginTransaction):
+
+ * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+ (WebCore::IDBDatabaseInfo::infoForExistingObjectStore):
+ * Modules/indexeddb/shared/IDBDatabaseInfo.h:
+
+ * Modules/indexeddb/shared/IDBTransactionInfo.h:
+ (WebCore::IDBTransactionInfo::objectStores):
+
</ins><span class="cx"> 2015-10-27 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Remove unused / duplicated XHR timeline instrumentation
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -169,7 +169,7 @@
</span><span class="cx"> RefPtr<WebCore::IDBRequest> IDBObjectStore::put(JSC::ExecState& execState, Deprecated::ScriptValue& value, const Deprecated::ScriptValue& key, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> auto idbKey = scriptValueToIDBKey(execState, key);
</span><del>- return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
</del><ins>+ return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<WebCore::IDBRequest> IDBObjectStore::putOrAdd(JSC::ExecState& state, Deprecated::ScriptValue& value, RefPtr<IDBKey> key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode& ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -99,10 +99,48 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String&, ExceptionCode&)
</del><ins>+RefPtr<WebCore::IDBObjectStore> IDBTransaction::objectStore(const String& objectStoreName, ExceptionCode& ec)
</ins><span class="cx"> {
</span><del>- ASSERT_NOT_REACHED();
- return nullptr;
</del><ins>+ LOG(IndexedDB, "IDBTransaction::objectStore");
+
+ if (objectStoreName.isEmpty()) {
+ ec = NOT_FOUND_ERR;
+ return nullptr;
+ }
+
+ if (isFinishedOrFinishing()) {
+ ec = INVALID_STATE_ERR;
+ return nullptr;
+ }
+
+ auto iterator = m_referencedObjectStores.find(objectStoreName);
+ if (iterator != m_referencedObjectStores.end())
+ return iterator->value;
+
+ bool found = false;
+ for (auto& objectStore : m_info.objectStores()) {
+ if (objectStore == objectStoreName) {
+ found = true;
+ break;
+ }
+ }
+
+ auto* info = m_database->info().infoForExistingObjectStore(objectStoreName);
+ if (!info) {
+ ec = NOT_FOUND_ERR;
+ return nullptr;
+ }
+
+ // Version change transactions are scoped to every object store in the database.
+ if (!found && !isVersionChange()) {
+ ec = NOT_FOUND_ERR;
+ return nullptr;
+ }
+
+ auto objectStore = IDBObjectStore::create(*info, *this);
+ m_referencedObjectStores.set(objectStoreName, &objectStore.get());
+
+ return adoptRef(&objectStore.leakRef());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void IDBTransaction::abort(ExceptionCode& ec)
</span><span class="lines">@@ -297,9 +335,11 @@
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::createObjectStoreOnServer");
</span><span class="cx">
</span><del>- ASSERT(!isFinishedOrFinishing());
</del><span class="cx"> ASSERT(isVersionChange());
</span><span class="cx">
</span><ins>+ if (isFinishedOrFinishing())
+ return;
+
</ins><span class="cx"> m_database->serverConnection().createObjectStore(operation, info);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -133,6 +133,8 @@
</span><span class="cx">
</span><span class="cx"> Deque<RefPtr<TransactionOperation>> m_transactionOperationQueue;
</span><span class="cx"> HashMap<IDBResourceIdentifier, RefPtr<TransactionOperation>> m_transactionOperationMap;
</span><ins>+
+ HashMap<String, RefPtr<IDBObjectStore>> m_referencedObjectStores;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class TransactionActivator {
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -68,6 +68,18 @@
</span><span class="cx"> objectStore.writeTransactionStarted(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryBackingStoreTransaction::addExistingObjectStore(MemoryObjectStore& objectStore)
+{
+ LOG(IndexedDB, "MemoryBackingStoreTransaction::addExistingObjectStore");
+
+ ASSERT(isWriting());
+
+ ASSERT(!m_objectStores.contains(&objectStore));
+ m_objectStores.add(&objectStore);
+
+ objectStore.writeTransactionStarted(*this);
+}
+
</ins><span class="cx"> void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore& objectStore, const IDBKeyData& key)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_objectStores.contains(&objectStore));
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryBackingStoreTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> const IDBDatabaseInfo& originalDatabaseInfo() const;
</span><span class="cx">
</span><span class="cx"> void addNewObjectStore(MemoryObjectStore&);
</span><ins>+ void addExistingObjectStore(MemoryObjectStore&);
</ins><span class="cx"> void recordValueChanged(MemoryObjectStore&, const IDBKeyData&);
</span><span class="cx">
</span><span class="cx"> void abort();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -72,6 +72,13 @@
</span><span class="cx"> return IDBError(IDBExceptionCode::InvalidStateError, "Backing store asked to create transaction it already has a record of");
</span><span class="cx">
</span><span class="cx"> auto transaction = MemoryBackingStoreTransaction::create(*this, info);
</span><ins>+
+ // VersionChange transactions are scoped to "every object store".
+ if (transaction->isVersionChange()) {
+ for (auto& objectStore : m_objectStores.values())
+ transaction->addExistingObjectStore(*objectStore);
+ }
+
</ins><span class="cx"> m_transactions.set(info.identifier(), WTF::move(transaction));
</span><span class="cx">
</span><span class="cx"> return IDBError();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -86,6 +86,16 @@
</span><span class="cx"> return &iterator->value;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+const IDBObjectStoreInfo* IDBDatabaseInfo::infoForExistingObjectStore(const String& name) const
+{
+ for (auto& objectStore : m_objectStoreMap.values()) {
+ if (objectStore.name() == name)
+ return &objectStore;
+ }
+
+ return nullptr;
+}
+
</ins><span class="cx"> Vector<String> IDBDatabaseInfo::objectStoreNames() const
</span><span class="cx"> {
</span><span class="cx"> Vector<String> names;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBDatabaseInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.h        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> IDBObjectStoreInfo createNewObjectStore(const String& name, const IDBKeyPath&, bool autoIncrement);
</span><span class="cx"> void addExistingObjectStore(const IDBObjectStoreInfo&);
</span><span class="cx"> const IDBObjectStoreInfo* infoForExistingObjectStore(uint64_t objectStoreIdentifier) const;
</span><ins>+ const IDBObjectStoreInfo* infoForExistingObjectStore(const String& objectStoreName) const;
</ins><span class="cx">
</span><span class="cx"> Vector<String> objectStoreNames() const;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (191644 => 191645)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-10-27 23:34:54 UTC (rev 191644)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-10-28 00:12:00 UTC (rev 191645)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "IDBResourceIdentifier.h"
</span><span class="cx"> #include "IndexedDB.h"
</span><ins>+#include <wtf/Vector.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -47,6 +48,8 @@
</span><span class="cx"> IndexedDB::TransactionMode mode() const { return m_mode; }
</span><span class="cx"> uint64_t newVersion() const { return m_newVersion; }
</span><span class="cx">
</span><ins>+ const Vector<String>& objectStores() const { return m_objectStores; }
+
</ins><span class="cx"> private:
</span><span class="cx"> IDBTransactionInfo(const IDBResourceIdentifier&);
</span><span class="cx">
</span><span class="lines">@@ -54,6 +57,7 @@
</span><span class="cx">
</span><span class="cx"> IndexedDB::TransactionMode m_mode { IndexedDB::TransactionMode::ReadOnly };
</span><span class="cx"> uint64_t m_newVersion { 0 };
</span><ins>+ Vector<String> m_objectStores;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>
</body>
</html>