<!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>[193643] 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/193643">193643</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-12-07 12:27:37 -0800 (Mon, 07 Dec 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Fix &quot;old versions&quot; when upgrading databases.
https://bugs.webkit.org/show_bug.cgi?id=151948

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (5 failing tests now pass, and updated results for a 6th test).

This includes the old version on the IDBVersionChangeEvent, as well as the version the
IDBDatabase is left with if the version change transaction is aborted.

Primary mechanism of the fix is to include the original IDBDatabaseInfo along with
IDBTransactionInfos that represent version change transactions.

* Modules/indexeddb/client/IDBDatabaseImpl.cpp:
(WebCore::IDBClient::IDBDatabase::willAbortTransaction):
(WebCore::IDBClient::IDBDatabase::didAbortTransaction):

* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::onUpgradeNeeded):

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::IDBTransaction): Deleted.
(WebCore::IDBClient::IDBTransaction::finishAbortOrCommit): Deleted.
* Modules/indexeddb/client/IDBTransactionImpl.h:
(WebCore::IDBClient::IDBTransaction::info):
(WebCore::IDBClient::IDBTransaction::originalDatabaseInfo):

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction):
(WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
* Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):

* Modules/indexeddb/shared/IDBTransactionInfo.cpp:
(WebCore::IDBTransactionInfo::versionChange):
(WebCore::IDBTransactionInfo::IDBTransactionInfo):
(WebCore::IDBTransactionInfo::isolatedCopy):
* Modules/indexeddb/shared/IDBTransactionInfo.h:
(WebCore::IDBTransactionInfo::originalDatabaseInfo):

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/database-basics-expected.txt:
* storage/indexeddb/modern/deletedatabase-2-expected.txt:</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="#trunkLayoutTestsstorageindexeddbdatabasebasicsexpectedtxt">trunk/LayoutTests/storage/indexeddb/database-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeletedatabase2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.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="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/LayoutTests/ChangeLog        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-12-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Fix &quot;old versions&quot; when upgrading databases.
+        https://bugs.webkit.org/show_bug.cgi?id=151948
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/database-basics-expected.txt:
+        * storage/indexeddb/modern/deletedatabase-2-expected.txt:
+
</ins><span class="cx"> 2015-12-07  Xabier Rodriguez Calvar  &lt;calvaris@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -114,7 +114,6 @@
</span><span class="cx"> storage/indexeddb/cursor-continueprimarykey.html [ Failure ]
</span><span class="cx"> storage/indexeddb/cursor-leak.html [ Failure ]
</span><span class="cx"> storage/indexeddb/cursor-request-cycle.html [ Failure ]
</span><del>-storage/indexeddb/database-basics.html [ Failure ]
</del><span class="cx"> storage/indexeddb/database-deletepending-flag.html [ Failure ]
</span><span class="cx"> storage/indexeddb/database-wrapper.html [ Failure ]
</span><span class="cx"> storage/indexeddb/delete-in-upgradeneeded-close-in-open-success.html [ Failure ]
</span><span class="lines">@@ -133,11 +132,8 @@
</span><span class="cx"> storage/indexeddb/intversion-close-between-events.html [ Failure ]
</span><span class="cx"> storage/indexeddb/intversion-close-in-oncomplete.html [ Failure ]
</span><span class="cx"> storage/indexeddb/intversion-close-in-upgradeneeded.html [ Failure ]
</span><del>-storage/indexeddb/intversion-encoding.html [ Failure ]
</del><span class="cx"> storage/indexeddb/intversion-gated-on-delete.html [ Failure ]
</span><span class="cx"> storage/indexeddb/intversion-open-in-upgradeneeded.html [ Failure ]
</span><del>-storage/indexeddb/intversion-open-with-version.html [ Failure ]
-storage/indexeddb/intversion-persistence.html [ Failure ]
</del><span class="cx"> storage/indexeddb/intversion-upgrades.html [ Failure ]
</span><span class="cx"> storage/indexeddb/key-type-array.html [ Failure ]
</span><span class="cx"> storage/indexeddb/key-type-binary.html [ Failure ]
</span><span class="lines">@@ -151,7 +147,6 @@
</span><span class="cx"> storage/indexeddb/pending-version-change-on-exit.html [ Failure ]
</span><span class="cx"> storage/indexeddb/pending-version-change-stuck-works-with-terminate.html [ Failure ]
</span><span class="cx"> storage/indexeddb/pending-version-change-stuck.html [ Failure ]
</span><del>-storage/indexeddb/persistence.html [ Failure ]
</del><span class="cx"> storage/indexeddb/properties-disabled-at-runtime.html [ Failure ]
</span><span class="cx"> storage/indexeddb/request-leak.html [ Failure ]
</span><span class="cx"> storage/indexeddb/setversion-blocked-by-versionchange-close.html [ Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbdatabasebasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/database-basics-expected.txt (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/database-basics-expected.txt        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/LayoutTests/storage/indexeddb/database-basics-expected.txt        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.INVALID_STATE_ERR
</span><span class="cx"> PASS ename is 'InvalidStateError'
</span><del>-Exception message: InvalidStateError: DOM IDBDatabase Exception 11
</del><ins>+Exception message: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.
</ins><span class="cx"> PASS db.version is 1
</span><span class="cx"> PASS db.name is &quot;database-basics.html&quot;
</span><span class="cx"> PASS db.objectStoreNames is []
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.INVALID_STATE_ERR
</span><span class="cx"> PASS ename is 'InvalidStateError'
</span><del>-Exception message: InvalidStateError: DOM IDBDatabase Exception 11
</del><ins>+Exception message: Failed to execute 'transaction' on 'IDBDatabase': The database connection is closing.
</ins><span class="cx"> Call twice, make sure it's harmless
</span><span class="cx"> db.close()
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeletedatabase2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -2,7 +2,7 @@
</span><span class="cx"> That open connection also has an in-progress transaction at the time it gets the versionChange event.
</span><span class="cx"> Initial upgrade old version - 0 new version - 1
</span><span class="cx"> Requesting deleteDatabase
</span><del>-First connection received versionchange event: oldVersion 0, newVersion null
</del><ins>+First connection received versionchange event: oldVersion 1, newVersion null
</ins><span class="cx"> First version change complete
</span><span class="cx"> open db success
</span><span class="cx"> Delete database success: oldVersion 1, newVersion null
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/ChangeLog        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2015-12-07  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Fix &quot;old versions&quot; when upgrading databases.
+        https://bugs.webkit.org/show_bug.cgi?id=151948
+
+        Reviewed by Alex Christensen.
+
+        No new tests (5 failing tests now pass, and updated results for a 6th test).
+
+        This includes the old version on the IDBVersionChangeEvent, as well as the version the 
+        IDBDatabase is left with if the version change transaction is aborted.
+
+        Primary mechanism of the fix is to include the original IDBDatabaseInfo along with 
+        IDBTransactionInfos that represent version change transactions.
+
+        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
+        (WebCore::IDBClient::IDBDatabase::willAbortTransaction):
+        (WebCore::IDBClient::IDBDatabase::didAbortTransaction):
+
+        * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBOpenDBRequest::onUpgradeNeeded):
+
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::IDBTransaction): Deleted.
+        (WebCore::IDBClient::IDBTransaction::finishAbortOrCommit): Deleted.
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        (WebCore::IDBClient::IDBTransaction::info):
+        (WebCore::IDBClient::IDBTransaction::originalDatabaseInfo):
+
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::startVersionChangeTransaction):
+        (WebCore::IDBServer::UniqueIDBDatabase::commitTransaction):
+        * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseConnection::createVersionChangeTransaction):
+
+        * Modules/indexeddb/shared/IDBTransactionInfo.cpp:
+        (WebCore::IDBTransactionInfo::versionChange):
+        (WebCore::IDBTransactionInfo::IDBTransactionInfo):
+        (WebCore::IDBTransactionInfo::isolatedCopy):
+        * Modules/indexeddb/shared/IDBTransactionInfo.h:
+        (WebCore::IDBTransactionInfo::originalDatabaseInfo):
+
</ins><span class="cx"> 2015-12-07  Nikos Andronikos  &lt;nikos.andronikos-webkit@cisra.canon.com.au&gt;
</span><span class="cx"> 
</span><span class="cx">         Update Objective-C code generator to pass a reference to calling object for partial interfaces
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -307,8 +307,11 @@
</span><span class="cx">     ASSERT(refTransaction);
</span><span class="cx">     m_abortingTransactions.set(transaction.info().identifier(), WTF::move(refTransaction));
</span><span class="cx"> 
</span><del>-    if (transaction.isVersionChange())
</del><ins>+    if (transaction.isVersionChange()) {
+        ASSERT(transaction.originalDatabaseInfo());
+        m_info = *transaction.originalDatabaseInfo();
</ins><span class="cx">         m_closePending = true;
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBDatabase::didAbortTransaction(IDBTransaction&amp; transaction)
</span><span class="lines">@@ -317,7 +320,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (transaction.isVersionChange()) {
</span><span class="cx">         ASSERT(transaction.originalDatabaseInfo());
</span><del>-        m_info = *transaction.originalDatabaseInfo();
</del><ins>+        ASSERT(m_info.version() == transaction.originalDatabaseInfo()-&gt;version());
</ins><span class="cx">         m_closePending = true;
</span><span class="cx">         m_closedInServer = true;
</span><span class="cx">         m_serverConnection-&gt;databaseConnectionClosed(*this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -119,8 +119,9 @@
</span><span class="cx">     Ref&lt;IDBTransaction&gt; transaction = database-&gt;startVersionChangeTransaction(resultData.transactionInfo(), *this);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(transaction-&gt;info().mode() == IndexedDB::TransactionMode::VersionChange);
</span><ins>+    ASSERT(transaction-&gt;originalDatabaseInfo());
</ins><span class="cx"> 
</span><del>-    uint64_t oldVersion = database-&gt;info().version();
</del><ins>+    uint64_t oldVersion = transaction-&gt;originalDatabaseInfo()-&gt;version();
</ins><span class="cx">     uint64_t newVersion = transaction-&gt;info().newVersion();
</span><span class="cx"> 
</span><span class="cx">     LOG(IndexedDB, &quot;IDBOpenDBRequest::onUpgradeNeeded() - current version is %&quot; PRIu64 &quot;, new is %&quot; PRIu64, oldVersion, newVersion);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -71,7 +71,6 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_info.mode() == IndexedDB::TransactionMode::VersionChange) {
</span><span class="cx">         ASSERT(m_openDBRequest);
</span><del>-        m_originalDatabaseInfo = std::make_unique&lt;IDBDatabaseInfo&gt;(m_database-&gt;info());
</del><span class="cx">         m_startedOnServer = true;
</span><span class="cx">     } else {
</span><span class="cx">         activate();
</span><span class="lines">@@ -326,8 +325,6 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_state != IndexedDB::TransactionState::Finished);
</span><span class="cx">     m_state = IndexedDB::TransactionState::Finished;
</span><del>-
-    m_originalDatabaseInfo = nullptr;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBTransaction::didStart(const IDBError&amp; error)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -83,10 +83,10 @@
</span><span class="cx">     virtual bool hasPendingActivity() const override final;
</span><span class="cx">     virtual void stop() override final;
</span><span class="cx"> 
</span><del>-    const IDBTransactionInfo info() const { return m_info; }
</del><ins>+    const IDBTransactionInfo&amp; info() const { return m_info; }
</ins><span class="cx">     IDBDatabase&amp; database() { return m_database.get(); }
</span><span class="cx">     const IDBDatabase&amp; database() const { return m_database.get(); }
</span><del>-    IDBDatabaseInfo* originalDatabaseInfo() const { return m_originalDatabaseInfo.get(); }
</del><ins>+    IDBDatabaseInfo* originalDatabaseInfo() const { return m_info.originalDatabaseInfo(); }
</ins><span class="cx"> 
</span><span class="cx">     void didStart(const IDBError&amp;);
</span><span class="cx">     void didAbort(const IDBError&amp;);
</span><span class="lines">@@ -188,7 +188,6 @@
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;IDBDatabase&gt; m_database;
</span><span class="cx">     IDBTransactionInfo m_info;
</span><del>-    std::unique_ptr&lt;IDBDatabaseInfo&gt; m_originalDatabaseInfo;
</del><span class="cx"> 
</span><span class="cx">     IndexedDB::TransactionState m_state { IndexedDB::TransactionState::Inactive };
</span><span class="cx">     bool m_startedOnServer { false };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -251,6 +251,8 @@
</span><span class="cx">     addOpenDatabaseConnection(*m_versionChangeDatabaseConnection);
</span><span class="cx"> 
</span><span class="cx">     m_versionChangeTransaction = &amp;m_versionChangeDatabaseConnection-&gt;createVersionChangeTransaction(requestedVersion);
</span><ins>+    m_databaseInfo-&gt;setVersion(requestedVersion);
+
</ins><span class="cx">     m_inProgressTransactions.set(m_versionChangeTransaction-&gt;info().identifier(), m_versionChangeTransaction);
</span><span class="cx">     m_server.postDatabaseTask(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::beginTransactionInBackingStore, m_versionChangeTransaction-&gt;info()));
</span><span class="cx"> 
</span><span class="lines">@@ -771,7 +773,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (m_versionChangeTransaction == &amp;transaction) {
</span><span class="cx">         ASSERT(&amp;m_versionChangeTransaction-&gt;databaseConnection() == m_versionChangeDatabaseConnection);
</span><del>-        m_databaseInfo-&gt;setVersion(transaction.info().newVersion());
</del><ins>+        ASSERT(m_databaseInfo-&gt;version() == transaction.info().newVersion());
+
</ins><span class="cx">         m_versionChangeTransaction = nullptr;
</span><span class="cx">         m_versionChangeDatabaseConnection = nullptr;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseConnectioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx">     LOG(IndexedDB, &quot;UniqueIDBDatabaseConnection::createVersionChangeTransaction&quot;);
</span><span class="cx">     ASSERT(!m_closePending);
</span><span class="cx"> 
</span><del>-    IDBTransactionInfo info = IDBTransactionInfo::versionChange(m_connectionToClient, newVersion);
</del><ins>+    IDBTransactionInfo info = IDBTransactionInfo::versionChange(m_connectionToClient, m_database.info(), newVersion);
</ins><span class="cx"> 
</span><span class="cx">     Ref&lt;UniqueIDBDatabaseTransaction&gt; transaction = UniqueIDBDatabaseTransaction::create(*this, info);
</span><span class="cx">     m_transactionMap.set(transaction-&gt;info().identifier(), &amp;transaction.get());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBTransactionInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.cpp        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -44,15 +44,26 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IDBTransactionInfo IDBTransactionInfo::versionChange(const IDBServer::IDBConnectionToClient&amp; connection, uint64_t newVersion)
</del><ins>+IDBTransactionInfo IDBTransactionInfo::versionChange(const IDBServer::IDBConnectionToClient&amp; connection, const IDBDatabaseInfo&amp; originalDatabaseInfo, uint64_t newVersion)
</ins><span class="cx"> {
</span><span class="cx">     IDBTransactionInfo result((IDBResourceIdentifier(connection)));
</span><span class="cx">     result.m_mode = IndexedDB::TransactionMode::VersionChange;
</span><span class="cx">     result.m_newVersion = newVersion;
</span><ins>+    result.m_originalDatabaseInfo = std::make_unique&lt;IDBDatabaseInfo&gt;(originalDatabaseInfo);
</ins><span class="cx"> 
</span><span class="cx">     return WTF::move(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IDBTransactionInfo::IDBTransactionInfo(const IDBTransactionInfo&amp; info)
+    : m_identifier(info.identifier())
+    , m_mode(info.m_mode)
+    , m_newVersion(info.m_newVersion)
+    , m_objectStores(info.m_objectStores)
+{
+    if (info.m_originalDatabaseInfo)
+        m_originalDatabaseInfo = std::make_unique&lt;IDBDatabaseInfo&gt;(*info.m_originalDatabaseInfo);
+}
+
</ins><span class="cx"> IDBTransactionInfo IDBTransactionInfo::isolatedCopy() const
</span><span class="cx"> {
</span><span class="cx">     IDBTransactionInfo result(m_identifier);
</span><span class="lines">@@ -63,6 +74,9 @@
</span><span class="cx">     for (auto&amp; objectStore : m_objectStores)
</span><span class="cx">         result.m_objectStores.uncheckedAppend(objectStore.isolatedCopy());
</span><span class="cx"> 
</span><ins>+    if (m_originalDatabaseInfo)
+        result.m_originalDatabaseInfo = std::make_unique&lt;IDBDatabaseInfo&gt;(*m_originalDatabaseInfo);
+
</ins><span class="cx">     return WTF::move(result);
</span><span class="cx"> }
</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 (193642 => 193643)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-12-07 19:48:37 UTC (rev 193642)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBTransactionInfo.h        2015-12-07 20:27:37 UTC (rev 193643)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><ins>+#include &quot;IDBDatabaseInfo.h&quot;
</ins><span class="cx"> #include &quot;IDBResourceIdentifier.h&quot;
</span><span class="cx"> #include &quot;IndexedDB.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -45,8 +46,10 @@
</span><span class="cx"> class IDBTransactionInfo {
</span><span class="cx"> public:
</span><span class="cx">     static IDBTransactionInfo clientTransaction(const IDBClient::IDBConnectionToServer&amp;, const Vector&lt;String&gt;&amp; objectStores, IndexedDB::TransactionMode);
</span><del>-    static IDBTransactionInfo versionChange(const IDBServer::IDBConnectionToClient&amp;, uint64_t newVersion);
</del><ins>+    static IDBTransactionInfo versionChange(const IDBServer::IDBConnectionToClient&amp;, const IDBDatabaseInfo&amp; originalDatabaseInfo, uint64_t newVersion);
</ins><span class="cx"> 
</span><ins>+    IDBTransactionInfo(const IDBTransactionInfo&amp;);
+
</ins><span class="cx">     IDBTransactionInfo isolatedCopy() const;
</span><span class="cx"> 
</span><span class="cx">     IDBResourceIdentifier identifier() const { return m_identifier; }
</span><span class="lines">@@ -56,6 +59,8 @@
</span><span class="cx"> 
</span><span class="cx">     const Vector&lt;String&gt;&amp; objectStores() const { return m_objectStores; }
</span><span class="cx"> 
</span><ins>+    IDBDatabaseInfo* originalDatabaseInfo() const { return m_originalDatabaseInfo.get(); }
+
</ins><span class="cx"> private:
</span><span class="cx">     IDBTransactionInfo(const IDBResourceIdentifier&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -64,6 +69,7 @@
</span><span class="cx">     IndexedDB::TransactionMode m_mode { IndexedDB::TransactionMode::ReadOnly };
</span><span class="cx">     uint64_t m_newVersion { 0 };
</span><span class="cx">     Vector&lt;String&gt; m_objectStores;
</span><ins>+    std::unique_ptr&lt;IDBDatabaseInfo&gt; m_originalDatabaseInfo;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre>
</div>
</div>

</body>
</html>