<!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>[208568] 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/208568">208568</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-11-10 15:27:37 -0800 (Thu, 10 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>IndexedDB 2.0 Support the IDBDatabase.onclose event.
https://bugs.webkit.org/show_bug.cgi?id=164602

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/interfaces-expected.txt:

Source/WebCore:

No new tests (Covered by existing tests).

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::connectionToServerLost): Fire &quot;onclose&quot; after &quot;onerror&quot;
* Modules/indexeddb/IDBDatabase.idl:

LayoutTests:

* TestExpectations:
* storage/indexeddb/modern/handle-user-delete-expected.txt:
* storage/indexeddb/modern/resources/handle-user-delete.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBinterfacesexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/interfaces-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernhandleuserdeleteexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/handle-user-delete-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourceshandleuserdeletejs">trunk/LayoutTests/storage/indexeddb/modern/resources/handle-user-delete.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBDatabaseidl">trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/ChangeLog        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-11-10  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IndexedDB 2.0 Support the IDBDatabase.onclose event.
+        https://bugs.webkit.org/show_bug.cgi?id=164602
+
+        Reviewed by Alex Christensen.
+
+        * TestExpectations:
+        * storage/indexeddb/modern/handle-user-delete-expected.txt:
+        * storage/indexeddb/modern/resources/handle-user-delete.js:
+
</ins><span class="cx"> 2016-11-10  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking swipe/pushState-cached-back-swipe.html and swipe/main-frame-pinning-requirement.html as failing.
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/TestExpectations        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -803,9 +803,6 @@
</span><span class="cx"> ########################################
</span><span class="cx"> ### START OF IndexedDB failures
</span><span class="cx"> 
</span><del>-# Our IDL parser test harness is not what this test expects
-imported/w3c/web-platform-tests/IndexedDB/interfaces.html [ Skip ]
-
</del><span class="cx"> # Times out for unexplored reasons                                                             
</span><span class="cx"> storage/indexeddb/database-quota.html [ Skip ]
</span><span class="cx"> storage/indexeddb/database-quota-private.html [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-11-10  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IndexedDB 2.0 Support the IDBDatabase.onclose event.
+        https://bugs.webkit.org/show_bug.cgi?id=164602
+
+        Reviewed by Alex Christensen.
+
+        * web-platform-tests/IndexedDB/interfaces-expected.txt:
+
</ins><span class="cx"> 2016-11-05  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Update SubtleCrypto::importKey to match the latest spec
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBinterfacesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/interfaces-expected.txt (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/interfaces-expected.txt        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/interfaces-expected.txt        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -1,2 +1,161 @@
</span><del>-FAIL: Timed out waiting for notifyDone to be called
</del><ins>+IndexedDB IDL tests
</ins><span class="cx"> 
</span><ins>+
+PASS Window interface: attribute indexedDB 
+PASS IDBKeyRange interface: existence and properties of interface object 
+PASS IDBKeyRange interface object length 
+PASS IDBKeyRange interface object name 
+PASS IDBKeyRange interface: existence and properties of interface prototype object 
+PASS IDBKeyRange interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBKeyRange interface: attribute lower 
+PASS IDBKeyRange interface: attribute upper 
+PASS IDBKeyRange interface: attribute lowerOpen 
+PASS IDBKeyRange interface: attribute upperOpen 
+PASS IDBKeyRange interface: operation only(any) 
+PASS IDBKeyRange interface: operation lowerBound(any,boolean) 
+PASS IDBKeyRange interface: operation upperBound(any,boolean) 
+PASS IDBKeyRange interface: operation bound(any,any,boolean,boolean) 
+PASS IDBKeyRange must be primary interface of IDBKeyRange.only(0) 
+PASS Stringification of IDBKeyRange.only(0) 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;lower&quot; with the proper type (0) 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;upper&quot; with the proper type (1) 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;lowerOpen&quot; with the proper type (2) 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;upperOpen&quot; with the proper type (3) 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;only&quot; with the proper type (4) 
+PASS IDBKeyRange interface: calling only(any) on IDBKeyRange.only(0) with too few arguments must throw TypeError 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;lowerBound&quot; with the proper type (5) 
+PASS IDBKeyRange interface: calling lowerBound(any,boolean) on IDBKeyRange.only(0) with too few arguments must throw TypeError 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;upperBound&quot; with the proper type (6) 
+PASS IDBKeyRange interface: calling upperBound(any,boolean) on IDBKeyRange.only(0) with too few arguments must throw TypeError 
+PASS IDBKeyRange interface: IDBKeyRange.only(0) must inherit property &quot;bound&quot; with the proper type (7) 
+PASS IDBKeyRange interface: calling bound(any,any,boolean,boolean) on IDBKeyRange.only(0) with too few arguments must throw TypeError 
+PASS IDBRequest interface: existence and properties of interface object 
+PASS IDBRequest interface object length 
+PASS IDBRequest interface object name 
+PASS IDBRequest interface: existence and properties of interface prototype object 
+PASS IDBRequest interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBRequest interface: attribute result 
+PASS IDBRequest interface: attribute error 
+PASS IDBRequest interface: attribute source 
+PASS IDBRequest interface: attribute transaction 
+PASS IDBRequest interface: attribute readyState 
+PASS IDBRequest interface: attribute onsuccess 
+PASS IDBRequest interface: attribute onerror 
+PASS IDBOpenDBRequest interface: existence and properties of interface object 
+PASS IDBOpenDBRequest interface object length 
+PASS IDBOpenDBRequest interface object name 
+PASS IDBOpenDBRequest interface: existence and properties of interface prototype object 
+PASS IDBOpenDBRequest interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBOpenDBRequest interface: attribute onblocked 
+PASS IDBOpenDBRequest interface: attribute onupgradeneeded 
+PASS IDBVersionChangeEvent interface: existence and properties of interface object 
+PASS IDBVersionChangeEvent interface object length 
+PASS IDBVersionChangeEvent interface object name 
+PASS IDBVersionChangeEvent interface: existence and properties of interface prototype object 
+PASS IDBVersionChangeEvent interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBVersionChangeEvent interface: attribute oldVersion 
+PASS IDBVersionChangeEvent interface: attribute newVersion 
+PASS IDBVersionChangeEvent must be primary interface of new IDBVersionChangeEvent('foo') 
+PASS Stringification of new IDBVersionChangeEvent('foo') 
+PASS IDBVersionChangeEvent interface: new IDBVersionChangeEvent('foo') must inherit property &quot;oldVersion&quot; with the proper type (0) 
+PASS IDBVersionChangeEvent interface: new IDBVersionChangeEvent('foo') must inherit property &quot;newVersion&quot; with the proper type (1) 
+PASS IDBFactory interface: existence and properties of interface object 
+PASS IDBFactory interface object length 
+PASS IDBFactory interface object name 
+PASS IDBFactory interface: existence and properties of interface prototype object 
+PASS IDBFactory interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBFactory interface: operation open(DOMString,unsigned long long) 
+PASS IDBFactory interface: operation deleteDatabase(DOMString) 
+PASS IDBFactory interface: operation cmp(any,any) 
+PASS IDBFactory must be primary interface of window.indexedDB 
+PASS Stringification of window.indexedDB 
+PASS IDBFactory interface: window.indexedDB must inherit property &quot;open&quot; with the proper type (0) 
+PASS IDBFactory interface: calling open(DOMString,unsigned long long) on window.indexedDB with too few arguments must throw TypeError 
+PASS IDBFactory interface: window.indexedDB must inherit property &quot;deleteDatabase&quot; with the proper type (1) 
+PASS IDBFactory interface: calling deleteDatabase(DOMString) on window.indexedDB with too few arguments must throw TypeError 
+PASS IDBFactory interface: window.indexedDB must inherit property &quot;cmp&quot; with the proper type (2) 
+PASS IDBFactory interface: calling cmp(any,any) on window.indexedDB with too few arguments must throw TypeError 
+PASS IDBDatabase interface: existence and properties of interface object 
+PASS IDBDatabase interface object length 
+PASS IDBDatabase interface object name 
+PASS IDBDatabase interface: existence and properties of interface prototype object 
+PASS IDBDatabase interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBDatabase interface: attribute name 
+PASS IDBDatabase interface: attribute version 
+PASS IDBDatabase interface: attribute objectStoreNames 
+PASS IDBDatabase interface: operation createObjectStore(DOMString,IDBObjectStoreParameters) 
+PASS IDBDatabase interface: operation deleteObjectStore(DOMString) 
+PASS IDBDatabase interface: operation transaction([object Object],[object Object],IDBTransactionMode) 
+PASS IDBDatabase interface: operation close() 
+PASS IDBDatabase interface: attribute onabort 
+PASS IDBDatabase interface: attribute onclose 
+PASS IDBDatabase interface: attribute onerror 
+PASS IDBDatabase interface: attribute onversionchange 
+PASS IDBObjectStore interface: existence and properties of interface object 
+PASS IDBObjectStore interface object length 
+PASS IDBObjectStore interface object name 
+PASS IDBObjectStore interface: existence and properties of interface prototype object 
+PASS IDBObjectStore interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBObjectStore interface: attribute name 
+PASS IDBObjectStore interface: attribute keyPath 
+PASS IDBObjectStore interface: attribute indexNames 
+PASS IDBObjectStore interface: attribute transaction 
+PASS IDBObjectStore interface: attribute autoIncrement 
+PASS IDBObjectStore interface: operation put(any,any) 
+PASS IDBObjectStore interface: operation add(any,any) 
+PASS IDBObjectStore interface: operation delete(any) 
+PASS IDBObjectStore interface: operation get(any) 
+PASS IDBObjectStore interface: operation clear() 
+PASS IDBObjectStore interface: operation openCursor(any,IDBCursorDirection) 
+PASS IDBObjectStore interface: operation createIndex(DOMString,[object Object],[object Object],IDBIndexParameters) 
+PASS IDBObjectStore interface: operation index(DOMString) 
+PASS IDBObjectStore interface: operation deleteIndex(DOMString) 
+PASS IDBObjectStore interface: operation count(any) 
+PASS IDBIndex interface: existence and properties of interface object 
+PASS IDBIndex interface object length 
+PASS IDBIndex interface object name 
+PASS IDBIndex interface: existence and properties of interface prototype object 
+PASS IDBIndex interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBIndex interface: attribute name 
+PASS IDBIndex interface: attribute objectStore 
+PASS IDBIndex interface: attribute keyPath 
+PASS IDBIndex interface: attribute multiEntry 
+PASS IDBIndex interface: attribute unique 
+PASS IDBIndex interface: operation openCursor(any,IDBCursorDirection) 
+PASS IDBIndex interface: operation openKeyCursor(any,IDBCursorDirection) 
+PASS IDBIndex interface: operation get(any) 
+PASS IDBIndex interface: operation getKey(any) 
+PASS IDBIndex interface: operation count(any) 
+PASS IDBCursor interface: existence and properties of interface object 
+PASS IDBCursor interface object length 
+PASS IDBCursor interface object name 
+PASS IDBCursor interface: existence and properties of interface prototype object 
+PASS IDBCursor interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBCursor interface: attribute source 
+PASS IDBCursor interface: attribute direction 
+PASS IDBCursor interface: attribute key 
+PASS IDBCursor interface: attribute primaryKey 
+PASS IDBCursor interface: operation update(any) 
+PASS IDBCursor interface: operation advance(unsigned long) 
+PASS IDBCursor interface: operation continue(any) 
+PASS IDBCursor interface: operation delete() 
+PASS IDBCursorWithValue interface: existence and properties of interface object 
+PASS IDBCursorWithValue interface object length 
+PASS IDBCursorWithValue interface object name 
+PASS IDBCursorWithValue interface: existence and properties of interface prototype object 
+PASS IDBCursorWithValue interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBCursorWithValue interface: attribute value 
+PASS IDBTransaction interface: existence and properties of interface object 
+PASS IDBTransaction interface object length 
+PASS IDBTransaction interface object name 
+PASS IDBTransaction interface: existence and properties of interface prototype object 
+PASS IDBTransaction interface: existence and properties of interface prototype object's &quot;constructor&quot; property 
+PASS IDBTransaction interface: attribute mode 
+PASS IDBTransaction interface: attribute db 
+PASS IDBTransaction interface: attribute error 
+PASS IDBTransaction interface: operation objectStore(DOMString) 
+PASS IDBTransaction interface: operation abort() 
+PASS IDBTransaction interface: attribute onabort 
+PASS IDBTransaction interface: attribute oncomplete 
+PASS IDBTransaction interface: attribute onerror 
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernhandleuserdeleteexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/handle-user-delete-expected.txt (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/handle-user-delete-expected.txt        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/storage/indexeddb/modern/handle-user-delete-expected.txt        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -12,6 +12,7 @@
</span><span class="cx"> Requested clearAllDatabases
</span><span class="cx"> [PASS] Both requests hit a failure condition (Received onerror or failed to start a new request because the transaction was aborted)
</span><span class="cx"> [PASS] Database received correct error.
</span><ins>+[PASS] Database received onclose event.
</ins><span class="cx"> [PASS] Transaction aborted.
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourceshandleuserdeletejs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/resources/handle-user-delete.js (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/handle-user-delete.js        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/handle-user-delete.js        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -4,6 +4,7 @@
</span><span class="cx"> 
</span><span class="cx"> var requestErrorCount = 0;
</span><span class="cx"> var databaseError = false;
</span><ins>+var databaseOnclose = false;
</ins><span class="cx"> var transactionAbort = false;
</span><span class="cx"> 
</span><span class="cx"> function done()
</span><span class="lines">@@ -18,6 +19,11 @@
</span><span class="cx">     else
</span><span class="cx">         log(&quot;[FAIL] Database did not receive correct error.&quot;);
</span><span class="cx"> 
</span><ins>+    if (databaseOnclose)
+        log(&quot;[PASS] Database received onclose event.&quot;);
+    else
+        log(&quot;[FAIL] Database did not receive onclose event.&quot;);
+
</ins><span class="cx">     if (transactionAbort)
</span><span class="cx">         log(&quot;[PASS] Transaction aborted.&quot;);
</span><span class="cx">     else
</span><span class="lines">@@ -33,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> function maybeFinish()
</span><span class="cx"> {
</span><del>-    if (requestErrorCount == 2 &amp;&amp; databaseError &amp;&amp; transactionAbort)
</del><ins>+    if (requestErrorCount == 2 &amp;&amp; databaseError &amp;&amp; databaseOnclose &amp;&amp; transactionAbort)
</ins><span class="cx">         done();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -51,6 +57,11 @@
</span><span class="cx">         maybeFinish();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+        database.onclose = function(event) {
+                databaseOnclose = true;
+        maybeFinish();
+        }
+
</ins><span class="cx">     var hasClearedDatabases = false;
</span><span class="cx">     var spinGet = function() { 
</span><span class="cx">         try {
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/Source/WebCore/ChangeLog        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-11-10  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IndexedDB 2.0 Support the IDBDatabase.onclose event.
+        https://bugs.webkit.org/show_bug.cgi?id=164602
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by existing tests).
+
+        * Modules/indexeddb/IDBDatabase.cpp:
+        (WebCore::IDBDatabase::connectionToServerLost): Fire &quot;onclose&quot; after &quot;onerror&quot;
+        * Modules/indexeddb/IDBDatabase.idl:
+
</ins><span class="cx"> 2016-11-10  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Copied text would contain text inside CDATA sections and comments
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -262,11 +262,17 @@
</span><span class="cx">     for (auto&amp; transaction : m_activeTransactions.values())
</span><span class="cx">         transaction-&gt;connectionClosedFromServer(error);
</span><span class="cx"> 
</span><del>-    Ref&lt;Event&gt; event = Event::create(m_eventNames.errorEvent, true, false);
-    event-&gt;setTarget(this);
</del><ins>+    auto errorEvent = Event::create(m_eventNames.errorEvent, true, false);
+    errorEvent-&gt;setTarget(this);
</ins><span class="cx"> 
</span><span class="cx">     if (auto* context = scriptExecutionContext())
</span><del>-        context-&gt;eventQueue().enqueueEvent(WTFMove(event));
</del><ins>+        context-&gt;eventQueue().enqueueEvent(WTFMove(errorEvent));
+
+    auto closeEvent = Event::create(m_eventNames.closeEvent, true, false);
+    closeEvent-&gt;setTarget(this);
+
+    if (auto* context = scriptExecutionContext())
+        context-&gt;eventQueue().enqueueEvent(WTFMove(closeEvent));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void IDBDatabase::maybeCloseInServer()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBDatabaseidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl (208567 => 208568)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl        2016-11-10 23:07:15 UTC (rev 208567)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.idl        2016-11-10 23:27:37 UTC (rev 208568)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     void close();
</span><span class="cx"> 
</span><span class="cx">     attribute EventHandler onabort;
</span><ins>+    attribute EventHandler onclose;
</ins><span class="cx">     attribute EventHandler onerror;
</span><span class="cx">     attribute EventHandler onversionchange;
</span><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>