<!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>[194414] 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/194414">194414</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-12-23 23:40:29 -0800 (Wed, 23 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Don't open any new connections until after version change transactions are completely handled.
https://bugs.webkit.org/show_bug.cgi?id=152441

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least 4 failing tests now pass).

When a version change transaction is in progress for a database, the server should not open any new connections
to that database until the version change transaction has been 100% completed.

This means *all* events related to finishing the transaction must fire.

To support this, a new message from client -&gt; server is added.

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::dispatchEvent):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
* Modules/indexeddb/client/IDBRequestImpl.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::didFinishHandlingVersionChangeTransaction):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
(WebCore::IDBServer::UniqueIDBDatabase::didFinishHandlingVersionChange):
(WebCore::IDBServer::UniqueIDBDatabase::commitTransaction): Deleted.
(WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction): Deleted.
(WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted.
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
(WebCore::IDBTransactionInfo::loggingString):
* Modules/indexeddb/shared/IDBTransactionInfo.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didFinishHandlingVersionChangeTransaction):
* Modules/indexeddb/shared/InProcessIDBServer.h:

LayoutTests:

* platform/mac-wk1/TestExpectations: Enable 4 now-passing tests.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</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="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBRequestImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.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="#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="#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="#trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/LayoutTests/ChangeLog        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -1,5 +1,14 @@
</span><span class="cx"> 2015-12-23  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Modern IDB: Don't open any new connections until after version change transactions are completely handled.
+        https://bugs.webkit.org/show_bug.cgi?id=152441
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations: Enable 4 now-passing tests.
+
+2015-12-23  Brady Eidson  &lt;beidson@apple.com&gt;
+
</ins><span class="cx">         Modern IDB: storage/indexeddb/transaction-basics.html fails.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152481
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -99,10 +99,6 @@
</span><span class="cx"> storage/indexeddb/database-deletepending-flag.html [ Failure ]
</span><span class="cx"> storage/indexeddb/delete-closed-database-object.html [ Failure ]
</span><span class="cx"> storage/indexeddb/intversion-gated-on-delete.html [ Failure ]
</span><del>-storage/indexeddb/intversion-open-in-upgradeneeded.html [ Failure ]
-storage/indexeddb/intversion-pending-version-changes-descending.html [ Failure ]
-storage/indexeddb/intversion-pending-version-changes-same.html [ Failure ]
-storage/indexeddb/intversion-two-opens-no-versions.html [ Failure ]
</del><span class="cx"> storage/indexeddb/odd-strings.html [ Failure ]
</span><span class="cx"> storage/indexeddb/open-db-private-browsing.html [ Failure ]
</span><span class="cx"> storage/indexeddb/properties-disabled-at-runtime.html [ Failure ]
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/ChangeLog        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -1,5 +1,55 @@
</span><span class="cx"> 2015-12-23  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Modern IDB: Don't open any new connections until after version change transactions are completely handled.
+        https://bugs.webkit.org/show_bug.cgi?id=152441
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least 4 failing tests now pass).
+        
+        When a version change transaction is in progress for a database, the server should not open any new connections
+        to that database until the version change transaction has been 100% completed.
+        
+        This means *all* events related to finishing the transaction must fire.
+        
+        To support this, a new message from client -&gt; server is added.
+
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::didFinishHandlingVersionChangeTransaction):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+        
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::dispatchEvent):
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
+        * Modules/indexeddb/client/IDBRequestImpl.h:
+        
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::didFinishHandlingVersionChangeTransaction):
+        * Modules/indexeddb/server/IDBServer.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::handleDatabaseOperations):
+        (WebCore::IDBServer::UniqueIDBDatabase::didFinishHandlingVersionChange):
+        (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction): Deleted.
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformAbortTransaction): Deleted.
+        (WebCore::IDBServer::UniqueIDBDatabase::inProgressTransactionCompleted): Deleted.
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange):
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+        
+        * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
+        (WebCore::IDBTransactionInfo::loggingString):
+        * Modules/indexeddb/shared/IDBTransactionInfo.h:
+        
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::didFinishHandlingVersionChangeTransaction):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
+2015-12-23  Brady Eidson  &lt;beidson@apple.com&gt;
+
</ins><span class="cx">         Modern IDB: storage/indexeddb/transaction-basics.html fails.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152481
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -290,6 +290,13 @@
</span><span class="cx">     transaction-&gt;didCommit(error);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBConnectionToServer::didFinishHandlingVersionChangeTransaction(IDBTransaction&amp; transaction)
+{
+    LOG(IndexedDB, &quot;IDBConnectionToServer::didFinishHandlingVersionChangeTransaction&quot;);
+    auto identifier = transaction.info().identifier();
+    m_delegate-&gt;didFinishHandlingVersionChangeTransaction(identifier);
+}
+
</ins><span class="cx"> void IDBConnectionToServer::abortTransaction(IDBTransaction&amp; transaction)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBConnectionToServer::abortTransaction&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -98,6 +98,8 @@
</span><span class="cx">     void commitTransaction(IDBTransaction&amp;);
</span><span class="cx">     void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
</span><span class="cx"> 
</span><ins>+    void didFinishHandlingVersionChangeTransaction(IDBTransaction&amp;);
+
</ins><span class="cx">     void abortTransaction(IDBTransaction&amp;);
</span><span class="cx">     void didAbortTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
</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 (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">     virtual void openDatabase(IDBRequestData&amp;) = 0;
</span><span class="cx">     virtual void abortTransaction(IDBResourceIdentifier&amp;) = 0;
</span><span class="cx">     virtual void commitTransaction(IDBResourceIdentifier&amp;) = 0;
</span><ins>+    virtual void didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier&amp;) = 0;
</ins><span class="cx">     virtual void createObjectStore(const IDBRequestData&amp;, const IDBObjectStoreInfo&amp;) = 0;
</span><span class="cx">     virtual void deleteObjectStore(const IDBRequestData&amp;, const String&amp; objectStoreName) = 0;
</span><span class="cx">     virtual void clearObjectStore(const IDBRequestData&amp;, uint64_t objectStoreIdentifier) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -101,6 +101,16 @@
</span><span class="cx">     enqueueEvent(Event::create(eventNames().errorEvent, true, true));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool IDBOpenDBRequest::dispatchEvent(Event&amp; event)
+{
+    bool result = IDBRequest::dispatchEvent(event);
+
+    if (m_transaction &amp;&amp; m_transaction-&gt;isVersionChange() &amp;&amp; (event.type() == eventNames().errorEvent || event.type() == eventNames().successEvent))
+        m_transaction-&gt;database().serverConnection().didFinishHandlingVersionChangeTransaction(*m_transaction);
+
+    return result;
+}
+
</ins><span class="cx"> void IDBOpenDBRequest::onSuccess(const IDBResultData&amp; resultData)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBOpenDBRequest::onSuccess()&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -57,6 +57,8 @@
</span><span class="cx">     void fireSuccessAfterVersionChangeCommit();
</span><span class="cx">     void fireErrorAfterVersionChangeCompletion();
</span><span class="cx"> 
</span><ins>+    virtual bool dispatchEvent(Event&amp;) override final;
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBOpenDBRequest(IDBConnectionToServer&amp;, ScriptExecutionContext*, const IDBDatabaseIdentifier&amp;, uint64_t version, IndexedDB::RequestType);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBRequestImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">     using RefCounted&lt;IDBRequest&gt;::deref;
</span><span class="cx"> 
</span><span class="cx">     void enqueueEvent(Ref&lt;Event&gt;&amp;&amp;);
</span><del>-    virtual bool dispatchEvent(Event&amp;) override final;
</del><ins>+    virtual bool dispatchEvent(Event&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     IDBConnectionToServer&amp; connection() { return m_connection; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -317,6 +317,17 @@
</span><span class="cx">     transaction-&gt;commit();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBServer::didFinishHandlingVersionChangeTransaction(const IDBResourceIdentifier&amp; transactionIdentifier)
+{
+    LOG(IndexedDB, &quot;IDBServer::didFinishHandlingVersionChangeTransaction&quot;);
+
+    auto transaction = m_transactions.get(transactionIdentifier);
+    if (!transaction)
+        return;
+
+    transaction-&gt;didFinishHandlingVersionChange();
+}
+
</ins><span class="cx"> void IDBServer::databaseConnectionClosed(uint64_t databaseConnectionIdentifier)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBServer::databaseConnectionClosed&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">     void deleteDatabase(const IDBRequestData&amp;);
</span><span class="cx">     void abortTransaction(const IDBResourceIdentifier&amp;);
</span><span class="cx">     void commitTransaction(const IDBResourceIdentifier&amp;);
</span><ins>+    void didFinishHandlingVersionChangeTransaction(const IDBResourceIdentifier&amp;);
</ins><span class="cx">     void createObjectStore(const IDBRequestData&amp;, const IDBObjectStoreInfo&amp;);
</span><span class="cx">     void deleteObjectStore(const IDBRequestData&amp;, const String&amp; objectStoreName);
</span><span class="cx">     void clearObjectStore(const IDBRequestData&amp;, uint64_t objectStoreIdentifier);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -206,13 +206,10 @@
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::handleDatabaseOperations - There are %zu pending&quot;, m_pendingDatabaseOperations.size());
</span><span class="cx"> 
</span><del>-    if (m_versionChangeDatabaseConnection || m_currentOperation) {
-        // We can't start the next database operation quite yet, but we might need to notify all open connections
-        // about a pending delete.
-        if (!m_pendingDatabaseOperations.isEmpty() &amp;&amp; m_pendingDatabaseOperations.first()-&gt;isDeleteRequest() &amp;&amp; !m_hasNotifiedConnectionsOfDelete) {
-            m_hasNotifiedConnectionsOfDelete = true;
-            notifyConnectionsOfVersionChange(0);
-        }
</del><ins>+    if (m_versionChangeDatabaseConnection || m_versionChangeTransaction || m_currentOperation) {
+        // We can't start any new open-database operations right now, but we might be able to start handling a delete operation.
+        if (!m_currentOperation &amp;&amp; !m_pendingDatabaseOperations.isEmpty() &amp;&amp; m_pendingDatabaseOperations.first()-&gt;isDeleteRequest())
+            m_currentOperation = m_pendingDatabaseOperations.takeFirst();
</ins><span class="cx"> 
</span><span class="cx">         // Some operations (such as the first open operation after a delete) require multiple passes to completely handle
</span><span class="cx">         if (m_currentOperation)
</span><span class="lines">@@ -849,9 +846,6 @@
</span><span class="cx">         ASSERT(&amp;m_versionChangeTransaction-&gt;databaseConnection() == m_versionChangeDatabaseConnection);
</span><span class="cx">         ASSERT(m_databaseInfo-&gt;version() == transaction.info().newVersion());
</span><span class="cx"> 
</span><del>-        m_versionChangeTransaction = nullptr;
-        m_versionChangeDatabaseConnection = nullptr;
-
</del><span class="cx">         invokeOperationAndTransactionTimer();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -889,6 +883,20 @@
</span><span class="cx">     m_server.postDatabaseTask(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::performAbortTransaction, callbackID, transaction.info().identifier()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabase::didFinishHandlingVersionChange(UniqueIDBDatabaseTransaction&amp; transaction)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::didFinishHandlingVersionChange&quot;);
+
+    ASSERT(m_versionChangeTransaction);
+    ASSERT_UNUSED(transaction, m_versionChangeTransaction == &amp;transaction);
+
+    m_versionChangeTransaction = nullptr;
+    m_versionChangeDatabaseConnection = nullptr;
+
+    invokeOperationAndTransactionTimer();
+}
+
</ins><span class="cx"> void UniqueIDBDatabase::performAbortTransaction(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isMainThread());
</span><span class="lines">@@ -907,9 +915,6 @@
</span><span class="cx">         ASSERT(&amp;m_versionChangeTransaction-&gt;databaseConnection() == m_versionChangeDatabaseConnection);
</span><span class="cx">         ASSERT(m_versionChangeTransaction-&gt;originalDatabaseInfo());
</span><span class="cx">         m_databaseInfo = std::make_unique&lt;IDBDatabaseInfo&gt;(*m_versionChangeTransaction-&gt;originalDatabaseInfo());
</span><del>-
-        m_versionChangeTransaction = nullptr;
-        m_versionChangeDatabaseConnection = nullptr;
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     inProgressTransactionCompleted(transactionIdentifier);
</span><span class="lines">@@ -1094,9 +1099,6 @@
</span><span class="cx">     auto transaction = m_inProgressTransactions.take(transactionIdentifier);
</span><span class="cx">     ASSERT(transaction);
</span><span class="cx"> 
</span><del>-    if (m_versionChangeTransaction == transaction)
-        m_versionChangeTransaction = nullptr;
-
</del><span class="cx">     for (auto objectStore : transaction-&gt;objectStoreIdentifiers())
</span><span class="cx">         m_objectStoreTransactionCounts.remove(objectStore);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -92,6 +92,7 @@
</span><span class="cx">     void iterateCursor(const IDBRequestData&amp;, const IDBKeyData&amp;, unsigned long count, GetResultCallback);
</span><span class="cx">     void commitTransaction(UniqueIDBDatabaseTransaction&amp;, ErrorCallback);
</span><span class="cx">     void abortTransaction(UniqueIDBDatabaseTransaction&amp;, ErrorCallback);
</span><ins>+    void didFinishHandlingVersionChange(UniqueIDBDatabaseTransaction&amp;);
</ins><span class="cx">     void transactionDestroyed(UniqueIDBDatabaseTransaction&amp;);
</span><span class="cx">     void connectionClosedFromClient(UniqueIDBDatabaseConnection&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -183,7 +184,7 @@
</span><span class="cx">     HashSet&lt;RefPtr&lt;UniqueIDBDatabaseConnection&gt;&gt; m_closePendingDatabaseConnections;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;UniqueIDBDatabaseConnection&gt; m_versionChangeDatabaseConnection;
</span><del>-    UniqueIDBDatabaseTransaction* m_versionChangeTransaction { nullptr };
</del><ins>+    RefPtr&lt;UniqueIDBDatabaseTransaction&gt; m_versionChangeTransaction;
</ins><span class="cx"> 
</span><span class="cx">     bool m_isOpeningBackingStore { false };
</span><span class="cx">     std::unique_ptr&lt;IDBBackingStore&gt; m_backingStore;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -309,6 +309,14 @@
</span><span class="cx">     m_databaseConnection-&gt;connectionToClient().didStartTransaction(m_transactionInfo.identifier(), error);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange()
+{
+    LOG(IndexedDB, &quot;UniqueIDBDatabaseTransaction::didFinishHandlingVersionChange&quot;);
+    ASSERT(isVersionChange());
+
+    m_databaseConnection-&gt;database().didFinishHandlingVersionChange(*this);
+}
+
</ins><span class="cx"> } // namespace IDBServer
</span><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -79,6 +79,7 @@
</span><span class="cx">     void iterateCursor(const IDBRequestData&amp;, const IDBKeyData&amp;, unsigned long count);
</span><span class="cx"> 
</span><span class="cx">     void didActivateInBackingStore(const IDBError&amp;);
</span><ins>+    void didFinishHandlingVersionChange();
</ins><span class="cx"> 
</span><span class="cx">     const Vector&lt;uint64_t&gt;&amp; objectStoreIdentifiers();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -28,6 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><ins>+#include &quot;IDBTransactionImpl.h&quot;
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> IDBTransactionInfo::IDBTransactionInfo(const IDBResourceIdentifier&amp; identifier)
</span><span class="lines">@@ -80,6 +82,28 @@
</span><span class="cx">     return WTF::move(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#ifndef NDEBUG
+String IDBTransactionInfo::loggingString() const
+{
+    String modeString;
+    switch (m_mode) {
+    case IndexedDB::TransactionMode::ReadOnly:
+        modeString = IDBTransaction::modeReadOnly();
+        break;
+    case IndexedDB::TransactionMode::ReadWrite:
+        modeString = IDBTransaction::modeReadWrite();
+        break;
+    case IndexedDB::TransactionMode::VersionChange:
+        modeString = IDBTransaction::modeVersionChange();
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+    
+    return makeString(&quot;Transaction: &quot;, m_identifier.loggingString(), &quot; mode &quot;, modeString, &quot; newVersion &quot;, String::number(m_newVersion));
+}
+#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="trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -61,6 +61,10 @@
</span><span class="cx"> 
</span><span class="cx">     IDBDatabaseInfo* originalDatabaseInfo() const { return m_originalDatabaseInfo.get(); }
</span><span class="cx"> 
</span><ins>+#ifndef NDEBUG
+    String loggingString() const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBTransactionInfo(const IDBResourceIdentifier&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -224,6 +224,14 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InProcessIDBServer::didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier&amp; transactionIdentifier)
+{
+    RefPtr&lt;InProcessIDBServer&gt; self(this);
+    RunLoop::current().dispatch([this, self, transactionIdentifier] {
+        m_server-&gt;didFinishHandlingVersionChangeTransaction(transactionIdentifier);
+    });
+}
+
</ins><span class="cx"> void InProcessIDBServer::createObjectStore(const IDBRequestData&amp; resultData, const IDBObjectStoreInfo&amp; info)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InProcessIDBServer&gt; self(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (194413 => 194414)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-12-24 07:39:01 UTC (rev 194413)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-12-24 07:40:29 UTC (rev 194414)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">     virtual void openDatabase(IDBRequestData&amp;) override final;
</span><span class="cx">     virtual void abortTransaction(IDBResourceIdentifier&amp;) override final;
</span><span class="cx">     virtual void commitTransaction(IDBResourceIdentifier&amp;) override final;
</span><ins>+    virtual void didFinishHandlingVersionChangeTransaction(IDBResourceIdentifier&amp;) override final;
</ins><span class="cx">     virtual void createObjectStore(const IDBRequestData&amp;, const IDBObjectStoreInfo&amp;) override final;
</span><span class="cx">     virtual void deleteObjectStore(const IDBRequestData&amp;, const String&amp; objectStoreName) override final;
</span><span class="cx">     virtual void clearObjectStore(const IDBRequestData&amp;, uint64_t objectStoreIdentifier) override final;
</span></span></pre>
</div>
</div>

</body>
</html>