<!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  &lt;beidson@apple.com&gt;
+
+        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  &lt;wenson_hsieh@apple.com&gt;
</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.&lt;br&gt;
+In a new transaction, it then overwrites those values, but then aborts the transaction.&lt;br&gt;
+Finally it verifies everything is set up from the first transaction, and nothing from the aborted one committed.&lt;br&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open(&quot;AbortedPutTestDatabase&quot;);
+
+function done()
+{
+    alert(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+request.onupgradeneeded = function(event)
+{
+    alert(&quot;First upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+    
+    var tx = request.transaction;
+    var db = event.target.result;
+
+    alert(tx + &quot; - &quot; + tx.mode);
+    alert(db);
+
+    var os1 = db.createObjectStore(&quot;TestObjectStore1&quot;);
+    var os2 = db.createObjectStore(&quot;TestObjectStore2&quot;);
+
+    var putRequest = os1.put(&quot;bar&quot;, &quot;foo&quot;);
+    
+    putRequest.onsuccess = function(event) {
+        alert(&quot;put succeeded - key was '&quot; + putRequest.result + &quot;'&quot;);
+        
+        var getRequest1 = os1.get(&quot;foo&quot;);
+        getRequest1.onsuccess = function(event) {
+            alert(&quot;get 'foo' succeeded - value was '&quot; + getRequest1.result + &quot;'&quot;);
+        }
+
+        getRequest1.onerror = function(event) {
+            alert(&quot;get 'foo' unexpectedly failed - &quot; + event);
+            done();
+        }
+        
+        var getRequest2 = os2.get(&quot;far&quot;);
+        getRequest2.onsuccess = function(event) {
+            alert(&quot;get 'far' succeeded - value was '&quot; + getRequest2.result + &quot;'&quot;);
+        }
+
+        getRequest2.onerror = function(event) {
+            alert(&quot;get 'far' unexpectedly failed - &quot; + event);
+            done();
+        }
+    }
+
+    putRequest.onerror = function(event) {
+        alert(&quot;put unexpectedly failed - &quot; + event);
+        done();
+    }
+    
+    tx.onabort = function(event) {
+        alert(&quot;First version change transaction unexpected abort&quot;);
+        done();
+    }
+
+    tx.oncomplete = function(event) {
+        alert(&quot;First version change transaction completed&quot;);
+        db.close();
+        continueTest1();
+    }
+
+    tx.onerror = function(event) {
+        alert(&quot;First version change transaction unexpected error - &quot; + event);
+        done();
+    }
+}
+
+function continueTest1()
+{
+    var request = window.indexedDB.open(&quot;AbortedPutTestDatabase&quot;, 2);
+
+    request.onupgradeneeded = function(event) {
+        alert(&quot;Second upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+    
+        var tx = request.transaction;
+        var db = event.target.result;
+
+        alert(tx + &quot; - &quot; + tx.mode);
+        alert(db);
+
+        var os1 = tx.objectStore(&quot;TestObjectStore1&quot;);
+        var os2 = tx.objectStore(&quot;TestObjectStore2&quot;);
+        var putRequest1 = os1.put(&quot;baz&quot;, &quot;foo&quot;);
+        var putRequest2 = os2.put(&quot;boo&quot;, &quot;far&quot;);
+    
+        putRequest1.onerror = function(e) {
+            alert(&quot;Unexpected error overwriting bar with baz - &quot; + e);
+            done();
+        }
+
+        putRequest2.onerror = function(e) {
+            alert(&quot;Writing into second object store unexpectedly failed - &quot; + e);
+            done();
+        }
+        
+        putRequest2.onsuccess = function(e) {
+            var getRequest1 = os1.get(&quot;foo&quot;);
+            var getRequest2 = os2.get(&quot;far&quot;);
+            
+            getRequest1.onsuccess = function(event) {
+                alert(&quot;get1 'foo' succeeded - value was '&quot; + getRequest1.result + &quot;'&quot;);
+            }
+
+            getRequest1.onerror = function(event) {
+                alert(&quot;get1 unexpectedly failed - &quot; + event);
+                done();
+            }
+
+            getRequest2.onsuccess = function(event) {
+                alert(&quot;get2 'far' succeeded - value was '&quot; + getRequest2.result + &quot;'&quot;);
+                tx.abort();
+            }
+
+            getRequest2.onerror = function(event) {
+                alert(&quot;get2 unexpectedly failed - &quot; + event);
+                done();
+            }
+        }
+        
+        tx.onabort = function(event) {
+            alert(&quot;Second version change transaction abort&quot;);
+            db.close();
+            continueTest2();
+        }
+
+        tx.oncomplete = function(event) {
+            alert(&quot;Second version change transaction unexpected complete&quot;);
+            done();
+        }
+
+        tx.onerror = function(event) {
+            alert(&quot;Second version change transaction unexpected error - &quot; + event);
+            done();
+        }
+    }
+}
+
+function continueTest2()
+{
+    var request = window.indexedDB.open(&quot;AbortedPutTestDatabase&quot;, 2);
+
+    request.onupgradeneeded = function(event) {
+        alert(&quot;Third upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+    
+        var tx = request.transaction;
+        var db = event.target.result;
+
+        alert(tx + &quot; - &quot; + tx.mode);
+        alert(db);
+
+        var os1 = tx.objectStore(&quot;TestObjectStore1&quot;);
+        var os2 = tx.objectStore(&quot;TestObjectStore2&quot;);
+        var getRequest1 = os1.get(&quot;foo&quot;);
+        var getRequest2 = os2.get(&quot;far&quot;);
+    
+        getRequest1.onsuccess = function(event) {
+            alert(&quot;get1 'foo' succeeded - value was '&quot; + getRequest1.result + &quot;'&quot;);
+        }
+
+        getRequest1.onerror = function(event) {
+            alert(&quot;get1 'foo' unexpectedly failed - &quot; + event);
+            done();
+        }
+
+        getRequest2.onsuccess = function(event) {
+            alert(&quot;get2 'far' succeeded - value was '&quot; + getRequest2.result + &quot;'&quot;);
+        }
+
+        getRequest2.onerror = function(event) {
+            alert(&quot;get2 'far' unexpectedly failed - &quot; + event);
+            done();
+        }
+        
+        tx.onabort = function(event) {
+            alert(&quot;Third version change transaction unexpected abort&quot;);
+            done();
+        }
+
+        tx.oncomplete = function(event) {
+            alert(&quot;Third version change transaction complete&quot;);
+            done();
+        }
+
+        tx.onerror = function(event) {
+            alert(&quot;Third version change transaction unexpected error - &quot; + event);
+            done();
+        }
+    }
+}
+
+&lt;/script&gt;
</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()&lt;br&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+var request = window.indexedDB.open(&quot;TransactionObjectStoreFailuresTestDatabase&quot;);
+
+function done()
+{
+    alert(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+request.onupgradeneeded = function(event)
+{
+    alert(&quot;Upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+    
+    var tx = request.transaction;
+    var db = event.target.result;
+
+    alert(tx + &quot; - &quot; + tx.mode);
+    alert(db);
+
+    var os1 = db.createObjectStore(&quot;TestObjectStore1&quot;);
+    var os2 = db.createObjectStore(&quot;TestObjectStore2&quot;);
+
+    var putRequest = os1.put(&quot;bar&quot;, &quot;foo&quot;);
+    
+    putRequest.onerror = function(event) {
+        alert(&quot;put unexpectedly failed - &quot; + event);
+        done();
+    }
+    
+    try {
+        tx.objectStore(&quot;&quot;);
+    } catch(e) {
+        alert(&quot;Caught attempt to access empty-named object store on the transaction&quot;);
+    }
+    
+    try {
+        tx.objectStore();
+    } catch(e) {
+        alert(&quot;Caught attempt to access null-named object store on the transaction&quot;);
+    }
+     
+    try {
+        tx.objectStore(&quot;ThisObjectStoreDoesNotExist&quot;);
+    } catch(e) {
+        alert(&quot;Caught attempt to access non-existant object store on the transaction&quot;);
+    }
+    
+    tx.abort();
+    
+    try {
+        tx.objectStore(&quot;TestObjectStore1&quot;);
+    } catch(e) {
+        alert(&quot;Caught attempt to access valid object store on a transaction that is already finishing&quot;);
+    }
+      
+    tx.onabort = function(event) {
+        alert(&quot;First version change transaction abort&quot;);
+        done();
+    }
+
+    tx.oncomplete = function(event) {
+        alert(&quot;First version change transaction unexpected complete&quot;);
+        done();
+    }
+
+    tx.onerror = function(event) {
+        alert(&quot;First version change transaction unexpected error - &quot; + event);
+        done();
+    }
+}
+&lt;/script&gt;
</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  &lt;beidson@apple.com&gt;
+
+        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  &lt;pecoraro@apple.com&gt;
</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&lt;WebCore::IDBRequest&gt; IDBObjectStore::put(JSC::ExecState&amp; execState, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; 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&lt;WebCore::IDBRequest&gt; IDBObjectStore::putOrAdd(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, RefPtr&lt;IDBKey&gt; key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode&amp; 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&lt;WebCore::IDBObjectStore&gt; IDBTransaction::objectStore(const String&amp;, ExceptionCode&amp;)
</del><ins>+RefPtr&lt;WebCore::IDBObjectStore&gt; IDBTransaction::objectStore(const String&amp; objectStoreName, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    ASSERT_NOT_REACHED();
-    return nullptr;
</del><ins>+    LOG(IndexedDB, &quot;IDBTransaction::objectStore&quot;);
+
+    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-&gt;value;
+
+    bool found = false;
+    for (auto&amp; objectStore : m_info.objectStores()) {
+        if (objectStore == objectStoreName) {
+            found = true;
+            break;
+        }
+    }
+
+    auto* info = m_database-&gt;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 &amp;&amp; !isVersionChange()) {
+        ec = NOT_FOUND_ERR;
+        return nullptr;
+    }
+
+    auto objectStore = IDBObjectStore::create(*info, *this);
+    m_referencedObjectStores.set(objectStoreName, &amp;objectStore.get());
+
+    return adoptRef(&amp;objectStore.leakRef());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBTransaction::abort(ExceptionCode&amp; ec)
</span><span class="lines">@@ -297,9 +335,11 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBTransaction::createObjectStoreOnServer&quot;);
</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-&gt;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&lt;RefPtr&lt;TransactionOperation&gt;&gt; m_transactionOperationQueue;
</span><span class="cx">     HashMap&lt;IDBResourceIdentifier, RefPtr&lt;TransactionOperation&gt;&gt; m_transactionOperationMap;
</span><ins>+
+    HashMap&lt;String, RefPtr&lt;IDBObjectStore&gt;&gt; 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&amp; objectStore)
+{
+    LOG(IndexedDB, &quot;MemoryBackingStoreTransaction::addExistingObjectStore&quot;);
+
+    ASSERT(isWriting());
+
+    ASSERT(!m_objectStores.contains(&amp;objectStore));
+    m_objectStores.add(&amp;objectStore);
+
+    objectStore.writeTransactionStarted(*this);
+}
+
</ins><span class="cx"> void MemoryBackingStoreTransaction::recordValueChanged(MemoryObjectStore&amp; objectStore, const IDBKeyData&amp; key)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_objectStores.contains(&amp;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&amp; originalDatabaseInfo() const;
</span><span class="cx"> 
</span><span class="cx">     void addNewObjectStore(MemoryObjectStore&amp;);
</span><ins>+    void addExistingObjectStore(MemoryObjectStore&amp;);
</ins><span class="cx">     void recordValueChanged(MemoryObjectStore&amp;, const IDBKeyData&amp;);
</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, &quot;Backing store asked to create transaction it already has a record of&quot;);
</span><span class="cx"> 
</span><span class="cx">     auto transaction = MemoryBackingStoreTransaction::create(*this, info);
</span><ins>+
+    // VersionChange transactions are scoped to &quot;every object store&quot;.
+    if (transaction-&gt;isVersionChange()) {
+        for (auto&amp; objectStore : m_objectStores.values())
+            transaction-&gt;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 &amp;iterator-&gt;value;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+const IDBObjectStoreInfo* IDBDatabaseInfo::infoForExistingObjectStore(const String&amp; name) const
+{
+    for (auto&amp; objectStore : m_objectStoreMap.values()) {
+        if (objectStore.name() == name)
+            return &amp;objectStore;
+    }
+
+    return nullptr;
+}
+
</ins><span class="cx"> Vector&lt;String&gt; IDBDatabaseInfo::objectStoreNames() const
</span><span class="cx"> {
</span><span class="cx">     Vector&lt;String&gt; 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&amp; name, const IDBKeyPath&amp;, bool autoIncrement);
</span><span class="cx">     void addExistingObjectStore(const IDBObjectStoreInfo&amp;);
</span><span class="cx">     const IDBObjectStoreInfo* infoForExistingObjectStore(uint64_t objectStoreIdentifier) const;
</span><ins>+    const IDBObjectStoreInfo* infoForExistingObjectStore(const String&amp; objectStoreName) const;
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;String&gt; 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 &quot;IDBResourceIdentifier.h&quot;
</span><span class="cx"> #include &quot;IndexedDB.h&quot;
</span><ins>+#include &lt;wtf/Vector.h&gt;
</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&lt;String&gt;&amp; objectStores() const { return m_objectStores; }
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBTransactionInfo(const IDBResourceIdentifier&amp;);
</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&lt;String&gt; m_objectStores;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>