<!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>[193936] 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/193936">193936</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-12-10 17:35:17 -0800 (Thu, 10 Dec 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Modern IDB: storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html fails
https://bugs.webkit.org/show_bug.cgi?id=152144
Reviewed by Alex Christensen.
Source/WebCore:
No new tests (At least two failing tests now pass, and other incorrect tests updated to be more correct).
- An IDBOpenDBRequest resulting in a versionchange transaction should not have the onsuccess event fire if
the database connection was closed during the versionchange transaction. onerror should fire instead.
- When firing an event at an IDBRequest, it should not have the transaction as an additional target if the
transaction has finished.
- When firing an event at an IDBRequest, it should not have the database as an additional target if the
database is closed or is closing.
* Modules/indexeddb/client/IDBDatabaseImpl.h:
(WebCore::IDBClient::IDBDatabase::isClosingOrClosed):
* Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
(WebCore::IDBClient::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
(WebCore::IDBClient::IDBOpenDBRequest::fireErrorAfterVersionChangeAbort): Deleted.
* Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::dispatchEvent): Don't add finished transactions or closed databases as event targets.
* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::notifyDidAbort):
(WebCore::IDBClient::IDBTransaction::dispatchEvent): If this was a versionchange transaction completing, possibly fire
the error event on the OpenDBRequest instead of the success event.
* Modules/indexeddb/client/IDBTransactionImpl.h:
(WebCore::IDBClient::IDBTransaction::isFinished):
LayoutTests:
* platform/mac-wk1/TestExpectations:
* storage/indexeddb/modern/abort-requests-cancelled-expected.txt:
* storage/indexeddb/modern/aborted-put-expected.txt:
* storage/indexeddb/modern/createobjectstore-basic-expected.txt:
* storage/indexeddb/modern/deletedatabase-2-expected.txt:
* storage/indexeddb/modern/deletedatabase-2.html:
* storage/indexeddb/modern/deleteindex-2-expected.txt:
* storage/indexeddb/modern/deleteobjectstore-1-expected.txt:
* storage/indexeddb/modern/opendatabase-versions-expected.txt:
* storage/indexeddb/modern/opendatabase-versions.html:
* storage/indexeddb/modern/versionchange-abort-then-reopen-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="#trunkLayoutTestsstorageindexeddbmodernabortrequestscancelledexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernabortedputexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncreateobjectstorebasicexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeletedatabase2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeletedatabase2html">trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteobjectstore1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernopendatabaseversionsexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernopendatabaseversionshtml">trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernversionchangeabortthenreopenexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.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="#trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.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>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/ChangeLog        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-12-10 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=152144
+
+ Reviewed by Alex Christensen.
+
+ * platform/mac-wk1/TestExpectations:
+ * storage/indexeddb/modern/abort-requests-cancelled-expected.txt:
+ * storage/indexeddb/modern/aborted-put-expected.txt:
+ * storage/indexeddb/modern/createobjectstore-basic-expected.txt:
+ * storage/indexeddb/modern/deletedatabase-2-expected.txt:
+ * storage/indexeddb/modern/deletedatabase-2.html:
+ * storage/indexeddb/modern/deleteindex-2-expected.txt:
+ * storage/indexeddb/modern/deleteobjectstore-1-expected.txt:
+ * storage/indexeddb/modern/opendatabase-versions-expected.txt:
+ * storage/indexeddb/modern/opendatabase-versions.html:
+ * storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt:
+
</ins><span class="cx"> 2015-12-10 Ryan Haddad <ryanhaddad@apple.com>
</span><span class="cx">
</span><span class="cx"> Rebaselining fast/text/emoji.html for Yosemite.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -95,7 +95,6 @@
</span><span class="cx"> storage/indexeddb/cursor-continue.html [ Failure ]
</span><span class="cx"> storage/indexeddb/database-deletepending-flag.html [ Failure ]
</span><span class="cx"> storage/indexeddb/delete-closed-database-object.html [ Failure ]
</span><del>-storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html [ Failure ]
</del><span class="cx"> storage/indexeddb/index-basics.html [ Failure ]
</span><span class="cx"> storage/indexeddb/index-count.html [ Failure ]
</span><span class="cx"> storage/indexeddb/index-duplicate-keypaths.html [ Failure ]
</span><span class="lines">@@ -109,7 +108,6 @@
</span><span class="cx"> storage/indexeddb/intversion-two-opens-no-versions.html [ Failure ]
</span><span class="cx"> storage/indexeddb/intversion-upgrades.html [ Failure ]
</span><span class="cx"> storage/indexeddb/key-type-array.html [ Failure ]
</span><del>-storage/indexeddb/lazy-index-types.html [ Failure ]
</del><span class="cx"> storage/indexeddb/objectstore-autoincrement.html [ Failure ]
</span><span class="cx"> storage/indexeddb/objectstore-count.html [ Failure ]
</span><span class="cx"> storage/indexeddb/open-cursor.html [ Failure ]
</span><span class="lines">@@ -122,7 +120,6 @@
</span><span class="cx"> storage/indexeddb/properties-disabled-at-runtime.html [ Failure ]
</span><span class="cx"> storage/indexeddb/setversion-blocked-by-versionchange-close.html [ Failure ]
</span><span class="cx"> storage/indexeddb/transaction-scope-sequencing.html [ Failure ]
</span><del>-storage/indexeddb/version-change-abort.html [ Failure ]
</del><span class="cx">
</span><span class="cx"> # Relies on internals.observeGC
</span><span class="cx"> storage/indexeddb/cursor-leak.html [ Failure ]
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernabortrequestscancelledexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/abort-requests-cancelled-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -4,7 +4,6 @@
</span><span class="cx"> Error handling: "objectStore.put({ bar: 'B' }, 2);" (error)
</span><span class="cx"> Error handling: "objectStore.put({ bar: 'C' }, 3);" (error)
</span><span class="cx"> Initial upgrade versionchange transaction aborted
</span><del>-Initial upgrade versionchange transaction error [object Event]
</del><span class="cx"> Second upgrade needed: Old version - 0 New version - 1
</span><span class="cx"> Success handling: "objectStore.put({ bar: 'A' }, 1);"
</span><span class="cx"> Success handling: "objectStore.put({ bar: 'B' }, 2);"
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernabortedputexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/aborted-put-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -11,7 +11,6 @@
</span><span class="cx"> ALERT: get1 'foo' succeeded - value was 'baz'
</span><span class="cx"> ALERT: get2 'far' succeeded - value was 'boo'
</span><span class="cx"> ALERT: Second version change transaction abort
</span><del>-ALERT: Second version change transaction error - [object Event]
</del><span class="cx"> ALERT: Third upgrade needed: Old version - 1 New version - 2
</span><span class="cx"> ALERT: [object IDBTransaction] - versionchange
</span><span class="cx"> ALERT: [object IDBDatabase]
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncreateobjectstorebasicexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/createobjectstore-basic-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -4,7 +4,6 @@
</span><span class="cx"> ALERT: Put succeeded
</span><span class="cx"> ALERT: Initial upgrade versionchange transaction aborted
</span><span class="cx"> ALERT: Object store names:
</span><del>-ALERT: Initial upgrade versionchange transaction error [object Event]
</del><span class="cx"> ALERT: Second upgrade needed: Old version - 0 New version - 1
</span><span class="cx"> ALERT: Object store names:
</span><span class="cx"> ALERT: Second upgrade versionchange transaction complete
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeletedatabase2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -4,7 +4,7 @@
</span><span class="cx"> Requesting deleteDatabase
</span><span class="cx"> First connection received versionchange event: oldVersion 1, newVersion null
</span><span class="cx"> First version change complete
</span><del>-open db success
</del><ins>+Open request error: AbortError
</ins><span class="cx"> Delete database success: oldVersion 1, newVersion null
</span><span class="cx"> Recreating database to make sure it's new and empty
</span><span class="cx"> Second upgrade old version - 0 new version - 1
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeletedatabase2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2.html (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2.html        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/deletedatabase-2.html        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -29,8 +29,7 @@
</span><span class="cx"> }
</span><span class="cx"> request.onerror = function(e)
</span><span class="cx"> {
</span><del>- log("Unexpected error");
-        done();
</del><ins>+ log("Open request error: " + request.error.name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> request.onupgradeneeded = function(e)
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -8,7 +8,6 @@
</span><span class="cx"> Deleted the index
</span><span class="cx"> Aborted the transaction
</span><span class="cx"> Second upgrade versionchange transaction abort
</span><del>-Second upgrade versionchange transaction error [object Event]
</del><span class="cx"> Third upgrade needed: Old version - 1 New version - 3
</span><span class="cx"> Count is: 2
</span><span class="cx"> Cursor at record: A / 1
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteobjectstore1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteobjectstore-1-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -4,7 +4,6 @@
</span><span class="cx"> ALERT: Deleting object store
</span><span class="cx"> ALERT: Second version change transaction abort
</span><span class="cx"> ALERT: Request error - [object Event]
</span><del>-ALERT: Second version change transaction error - [object Event]
</del><span class="cx"> ALERT: Success opening database connection - Starting final transaction
</span><span class="cx"> ALERT: Value gotten was AH AH AH AH AH
</span><span class="cx"> ALERT: Value gotten was AH AH AH AH AH
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernopendatabaseversionsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -1,17 +1,18 @@
</span><del>-ALERT: [object IDBOpenDBRequest] (firstPhase)
-ALERT: upgradeneeded (firstPhase): old version - 0 new version - 1
-ALERT: [object IDBTransaction]
-ALERT: Version change complete (firstPhase). Database version is now - 1
-ALERT: [object IDBOpenDBRequest] (secondPhase)
-ALERT: First version change successful
-ALERT: Successfully opened database at version 1 (secondPhase)
-ALERT: [object IDBOpenDBRequest] (thirdPhase)
-ALERT: upgradeneeded (thirdPhase): old version - 1 new version - 2
-ALERT: [object IDBTransaction]
-ALERT: Version change complete (thirdPhase). Database version is now - 2
-ALERT: [object IDBOpenDBRequest] (fourthPhase)
-ALERT: Version change to version 2 successful
-ALERT: Expected error (fourthPhase) - VersionError
-ALERT: Done
</del><span class="cx"> This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.
</span><ins>+[object IDBOpenDBRequest] (firstPhase)
+upgradeneeded (firstPhase): old version - 0 new version - 1
+[object IDBTransaction]
+Version change complete (firstPhase). Database version is now - 1
+[object IDBOpenDBRequest] (secondPhase)
+Open request error (firstPhase) AbortError
+Successfully opened database at version 1 (secondPhase)
+[object IDBOpenDBRequest] (thirdPhase)
+upgradeneeded (thirdPhase): old version - 1 new version - 2
+[object IDBTransaction]
+Version change complete (thirdPhase). Database version is now - 2
+[object IDBOpenDBRequest] (fourthPhase)
+Open request error (thirdPhase) AbortError
+Expected error (fourthPhase) - VersionError
+Done
</ins><span class="cx">
</span><ins>+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernopendatabaseversionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/opendatabase-versions.html        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -1,6 +1,12 @@
</span><span class="cx"> This test creates a new database with the default version, commits that versionchange transaction, and then reopens it at different versions to make sure the IDBOpenDBRequests behave appropriately.<br>
</span><ins>+<div id="logger"></div><br>
</ins><span class="cx"> <script>
</span><span class="cx">
</span><ins>+function log(msg)
+{
+ document.getElementById("logger").innerHTML += msg + "<br>";
+}
+
</ins><span class="cx"> if (window.testRunner) {
</span><span class="cx"> testRunner.waitUntilDone();
</span><span class="cx"> testRunner.dumpAsText();
</span><span class="lines">@@ -8,44 +14,43 @@
</span><span class="cx">
</span><span class="cx"> function done()
</span><span class="cx"> {
</span><del>- alert("Done");
</del><ins>+ log("Done");
</ins><span class="cx"> if (window.testRunner)
</span><span class="cx"> testRunner.notifyDone();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> var request = window.indexedDB.open("VersionTestDatabase");
</span><del>-alert(request + " (firstPhase)");
</del><ins>+log(request + " (firstPhase)");
</ins><span class="cx">
</span><span class="cx"> request.onsuccess = function()
</span><span class="cx"> {
</span><del>- alert("First version change successful");
</del><ins>+ log("First version change successful");
</ins><span class="cx"> }
</span><span class="cx"> request.onerror = function(e)
</span><span class="cx"> {
</span><del>- alert("Unexpected error (firstPhase)");
-        done();
</del><ins>+ log("Open request error (firstPhase) " + request.error.name);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> request.onupgradeneeded = function(e)
</span><span class="cx"> {
</span><span class="cx"> var database = event.target.result;
</span><span class="cx">
</span><del>- alert("upgradeneeded (firstPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
- alert(request.transaction);
</del><ins>+ log("upgradeneeded (firstPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
+ log(request.transaction);
</ins><span class="cx"> request.transaction.oncomplete = function()
</span><span class="cx"> {
</span><del>- alert("Version change complete (firstPhase). Database version is now - " + database.version);
</del><ins>+ log("Version change complete (firstPhase). Database version is now - " + database.version);
</ins><span class="cx"> database.close();
</span><span class="cx"> secondPhase();
</span><span class="cx"> }
</span><span class="cx"> request.transaction.onabort = function()
</span><span class="cx"> {
</span><del>- alert("Version change transaction unexpected abort! (firstPhase)");
</del><ins>+ log("Version change transaction unexpected abort! (firstPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> request.transaction.onerror = function()
</span><span class="cx"> {
</span><del>- alert("Version change transaction unexpected error! (firstPhase)");
</del><ins>+ log("Version change transaction unexpected error! (firstPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -53,22 +58,22 @@
</span><span class="cx"> function secondPhase()
</span><span class="cx"> {
</span><span class="cx"> var request = window.indexedDB.open("VersionTestDatabase", 1);
</span><del>- alert(request + " (secondPhase)");
</del><ins>+ log(request + " (secondPhase)");
</ins><span class="cx"> request.onsuccess = function()
</span><span class="cx"> {
</span><del>- alert("Successfully opened database at version 1 (secondPhase)");
</del><ins>+ log("Successfully opened database at version 1 (secondPhase)");
</ins><span class="cx"> request.result.close();
</span><span class="cx"> request.result.close(); // Close it twice just for the heck of it
</span><span class="cx"> thirdPhase();
</span><span class="cx"> }
</span><span class="cx"> request.onerror = function(e)
</span><span class="cx"> {
</span><del>- alert("Unexpected error (secondPhase)" + e);
</del><ins>+ log("Unexpected error (secondPhase)" + e);
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> request.onupgradeneeded = function(e)
</span><span class="cx"> {
</span><del>-         alert("Unexpected upgrade needed (secondPhase)" + e);
</del><ins>+         log("Unexpected upgrade needed (secondPhase)" + e);
</ins><span class="cx">         done();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -76,36 +81,35 @@
</span><span class="cx"> function thirdPhase()
</span><span class="cx"> {
</span><span class="cx"> var request = window.indexedDB.open("VersionTestDatabase", 2);
</span><del>- alert(request + " (thirdPhase)");
</del><ins>+ log(request + " (thirdPhase)");
</ins><span class="cx"> request.onsuccess = function()
</span><span class="cx"> {
</span><del>- alert("Version change to version 2 successful");
</del><ins>+ log("Version change to version 2 successful");
</ins><span class="cx"> }
</span><span class="cx"> request.onerror = function(e)
</span><span class="cx"> {
</span><del>- alert("Unexpected error (thirdPhase)");
- done();
</del><ins>+ log("Open request error (thirdPhase) " + request.error.name);
</ins><span class="cx"> }
</span><span class="cx"> request.onupgradeneeded = function(e)
</span><span class="cx"> {
</span><span class="cx"> var database = event.target.result;
</span><span class="cx">
</span><del>- alert("upgradeneeded (thirdPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
- alert(request.transaction);
</del><ins>+ log("upgradeneeded (thirdPhase): old version - " + e.oldVersion + " new version - " + e.newVersion);
+ log(request.transaction);
</ins><span class="cx"> request.transaction.oncomplete = function()
</span><span class="cx"> {
</span><del>- alert("Version change complete (thirdPhase). Database version is now - " + database.version);
</del><ins>+ log("Version change complete (thirdPhase). Database version is now - " + database.version);
</ins><span class="cx"> database.close();
</span><span class="cx"> fourthPhase();
</span><span class="cx"> }
</span><span class="cx"> request.transaction.onabort = function()
</span><span class="cx"> {
</span><del>- alert("Version change transaction unexpected abort! (thirdPhase)");
</del><ins>+ log("Version change transaction unexpected abort! (thirdPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> request.transaction.onerror = function()
</span><span class="cx"> {
</span><del>- alert("Version change transaction unexpected error! (thirdPhase)");
</del><ins>+ log("Version change transaction unexpected error! (thirdPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -115,20 +119,20 @@
</span><span class="cx"> {
</span><span class="cx"> // We've upgraded to version 2, so version 1 should not be openable.
</span><span class="cx"> var request = window.indexedDB.open("VersionTestDatabase", 1);
</span><del>- alert(request + " (fourthPhase)");
</del><ins>+ log(request + " (fourthPhase)");
</ins><span class="cx"> request.onsuccess = function()
</span><span class="cx"> {
</span><del>- alert("Unexpected success (fourthPhase)");
</del><ins>+ log("Unexpected success (fourthPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> request.onerror = function(e)
</span><span class="cx"> {
</span><del>- alert("Expected error (fourthPhase) - " + request.error.name);
</del><ins>+ log("Expected error (fourthPhase) - " + request.error.name);
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> request.onupgradeneeded = function(e)
</span><span class="cx"> {
</span><del>- alert("Unexpected upgradeneeded (fourthPhase)");
</del><ins>+ log("Unexpected upgradeneeded (fourthPhase)");
</ins><span class="cx"> done();
</span><span class="cx"> }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernversionchangeabortthenreopenexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/LayoutTests/storage/indexeddb/modern/versionchange-abort-then-reopen-expected.txt        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -1,11 +1,9 @@
</span><span class="cx"> ALERT: Initial upgrade needed: Old version - 0 New version - 1
</span><span class="cx"> ALERT: Initial upgrade versionchange transaction aborted
</span><del>-ALERT: Initial upgrade versionchange transaction error [object Event]
</del><span class="cx"> ALERT: Second upgrade needed: Old version - 0 New version - 1
</span><span class="cx"> ALERT: Second upgrade versionchange transaction complete
</span><span class="cx"> ALERT: Third upgrade needed: Old version - 1 New version - 2
</span><span class="cx"> ALERT: Third upgrade versionchange transaction aborted
</span><del>-ALERT: Third upgrade versionchange transaction error[object Event]
</del><span class="cx"> ALERT: Fourth upgrade needed: Old version - 1 New version - 2
</span><span class="cx"> ALERT: Done
</span><span class="cx"> This test opens a new database, then aborts the version change transaction.
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/ChangeLog        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2015-12-10 Brady Eidson <beidson@apple.com>
+
+ Modern IDB: storage/indexeddb/delete-in-upgradeneeded-close-in-versionchange.html fails
+ https://bugs.webkit.org/show_bug.cgi?id=152144
+
+ Reviewed by Alex Christensen.
+
+ No new tests (At least two failing tests now pass, and other incorrect tests updated to be more correct).
+
+ - An IDBOpenDBRequest resulting in a versionchange transaction should not have the onsuccess event fire if
+ the database connection was closed during the versionchange transaction. onerror should fire instead.
+ - When firing an event at an IDBRequest, it should not have the transaction as an additional target if the
+ transaction has finished.
+ - When firing an event at an IDBRequest, it should not have the database as an additional target if the
+ database is closed or is closing.
+
+ * Modules/indexeddb/client/IDBDatabaseImpl.h:
+ (WebCore::IDBClient::IDBDatabase::isClosingOrClosed):
+
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp:
+ (WebCore::IDBClient::IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion):
+ (WebCore::IDBClient::IDBOpenDBRequest::fireErrorAfterVersionChangeAbort): Deleted.
+ * Modules/indexeddb/client/IDBOpenDBRequestImpl.h:
+
+ * Modules/indexeddb/client/IDBRequestImpl.cpp:
+ (WebCore::IDBClient::IDBRequest::dispatchEvent): Don't add finished transactions or closed databases as event targets.
+
+ * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+ (WebCore::IDBClient::IDBTransaction::notifyDidAbort):
+ (WebCore::IDBClient::IDBTransaction::dispatchEvent): If this was a versionchange transaction completing, possibly fire
+ the error event on the OpenDBRequest instead of the success event.
+ * Modules/indexeddb/client/IDBTransactionImpl.h:
+ (WebCore::IDBClient::IDBTransaction::isFinished):
+
</ins><span class="cx"> 2015-12-10 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Simple line layout: Use TextPainter to draw simple line text.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBDatabaseImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.h        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -87,6 +87,8 @@
</span><span class="cx"> void didCreateIndexInfo(const IDBIndexInfo&);
</span><span class="cx"> void didDeleteIndexInfo(const IDBIndexInfo&);
</span><span class="cx">
</span><ins>+ bool isClosingOrClosed() const { return m_closePending || m_closedInServer; }
+
</ins><span class="cx"> private:
</span><span class="cx"> IDBDatabase(ScriptExecutionContext&, IDBConnectionToServer&, const IDBResultData&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.cpp        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -86,14 +86,15 @@
</span><span class="cx"> enqueueEvent(Event::create(eventNames().successEvent, false, false));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void IDBOpenDBRequest::fireErrorAfterVersionChangeAbort()
</del><ins>+void IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()
</ins><span class="cx"> {
</span><del>- LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeAbort()");
</del><ins>+ LOG(IndexedDB, "IDBOpenDBRequest::fireErrorAfterVersionChangeCompletion()");
</ins><span class="cx">
</span><span class="cx"> ASSERT(hasPendingActivity());
</span><span class="cx">
</span><span class="cx"> IDBError idbError(IDBDatabaseException::AbortError);
</span><span class="cx"> m_domError = DOMError::create(idbError.name());
</span><ins>+ m_result = IDBAny::createUndefined();
</ins><span class="cx">
</span><span class="cx"> m_transaction->addRequest(*this);
</span><span class="cx"> enqueueEvent(Event::create(eventNames().errorEvent, true, true));
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBOpenDBRequestImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBOpenDBRequestImpl.h        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">
</span><span class="cx"> void versionChangeTransactionWillFinish();
</span><span class="cx"> void fireSuccessAfterVersionChangeCommit();
</span><del>- void fireErrorAfterVersionChangeAbort();
</del><ins>+ void fireErrorAfterVersionChangeCompletion();
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> IDBOpenDBRequest(IDBConnectionToServer&, ScriptExecutionContext*, const IDBDatabaseIdentifier&, uint64_t version);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -266,8 +266,10 @@
</span><span class="cx"> targets.append(this);
</span><span class="cx">
</span><span class="cx"> if (m_transaction) {
</span><del>- targets.append(m_transaction);
- targets.append(m_transaction->db());
</del><ins>+ if (!m_transaction->isFinished())
+ targets.append(m_transaction);
+ if (!m_transaction->database().isClosingOrClosed())
+ targets.append(m_transaction->db());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_hasPendingActivity = false;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -356,7 +356,7 @@
</span><span class="cx">
</span><span class="cx"> if (isVersionChange()) {
</span><span class="cx"> ASSERT(m_openDBRequest);
</span><del>- m_openDBRequest->fireErrorAfterVersionChangeAbort();
</del><ins>+ m_openDBRequest->fireErrorAfterVersionChangeCompletion();
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -427,7 +427,11 @@
</span><span class="cx">
</span><span class="cx"> if (isVersionChange() && event.type() == eventNames().completeEvent) {
</span><span class="cx"> ASSERT(m_openDBRequest);
</span><del>- m_openDBRequest->fireSuccessAfterVersionChangeCommit();
</del><ins>+
+ if (m_database->isClosingOrClosed())
+ m_openDBRequest->fireErrorAfterVersionChangeCompletion();
+ else
+ m_openDBRequest->fireSuccessAfterVersionChangeCommit();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> return result;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (193935 => 193936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-12-11 01:21:29 UTC (rev 193935)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-12-11 01:35:17 UTC (rev 193936)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx"> void operationDidComplete(TransactionOperation&);
</span><span class="cx">
</span><span class="cx"> bool isFinishedOrFinishing() const;
</span><ins>+ bool isFinished() const { return m_state == IndexedDB::TransactionState::Finished; }
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> IDBTransaction(IDBDatabase&, const IDBTransactionInfo&, IDBOpenDBRequest*);
</span></span></pre>
</div>
</div>
</body>
</html>