<!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>[205086] trunk/LayoutTests</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/205086">205086</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-27 17:10:29 -0700 (Sat, 27 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Race between creating/deleting a database in test
https://bugs.webkit.org/show_bug.cgi?id=161285

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2016-08-27
Reviewed by Darin Adler.

Because IndexedDB creation is asynchronous, we were not waiting for the
database to be completely open before sending more commands. These
could race and give unexpected results. Wait for the database to be
successfully created before interacting with it.

* inspector/indexeddb/resources/utilities.js:
(createEmptyDatabase):
(createDatabaseWithStores):
Send a single when the database creation is completed.

* inspector/indexeddb/clearObjectStore-expected.txt:
* inspector/indexeddb/clearObjectStore.html:
* inspector/indexeddb/deleteDatabaseNamesWithSpace.html:
* inspector/indexeddb/requestData-expected.txt:
* inspector/indexeddb/requestDatabase-expected.txt:
* inspector/indexeddb/requestDatabase.html:
* inspector/indexeddb/requestDatabaseNames.html:
Listen for the database created signal before proceeding
with the test.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbclearObjectStoreexpectedtxt">trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbclearObjectStorehtml">trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbdeleteDatabaseNamesWithSpacehtml">trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDataexpectedtxt">trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDatabaseexpectedtxt">trunk/LayoutTests/inspector/indexeddb/requestDatabase-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDatabasehtml">trunk/LayoutTests/inspector/indexeddb/requestDatabase.html</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbrequestDatabaseNameshtml">trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html</a></li>
<li><a href="#trunkLayoutTestsinspectorindexeddbresourcesutilitiesjs">trunk/LayoutTests/inspector/indexeddb/resources/utilities.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/ChangeLog        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2016-08-27  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Race between creating/deleting a database in test
+        https://bugs.webkit.org/show_bug.cgi?id=161285
+
+        Reviewed by Darin Adler.
+
+        Because IndexedDB creation is asynchronous, we were not waiting for the
+        database to be completely open before sending more commands. These
+        could race and give unexpected results. Wait for the database to be
+        successfully created before interacting with it.
+
+        * inspector/indexeddb/resources/utilities.js:
+        (createEmptyDatabase):
+        (createDatabaseWithStores):
+        Send a single when the database creation is completed.
+
+        * inspector/indexeddb/clearObjectStore-expected.txt:
+        * inspector/indexeddb/clearObjectStore.html:
+        * inspector/indexeddb/deleteDatabaseNamesWithSpace.html:
+        * inspector/indexeddb/requestData-expected.txt:
+        * inspector/indexeddb/requestDatabase-expected.txt:
+        * inspector/indexeddb/requestDatabase.html:
+        * inspector/indexeddb/requestDatabaseNames.html:
+        Listen for the database created signal before proceeding
+        with the test.
+
</ins><span class="cx"> 2016-08-27  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         adoptcallback
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbclearObjectStoreexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/clearObjectStore-expected.txt        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-CONSOLE MESSAGE: line 18: Created Database 'CompleteDatabase'
</del><ins>+CONSOLE MESSAGE: line 19: Created Database 'CompleteDatabase'
</ins><span class="cx"> CONSOLE MESSAGE: line 9: Created Database 'EmptyDatabase'
</span><span class="cx"> 
</span><span class="cx"> == Running test suite: IndexedDB.clearObjectStore
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbclearObjectStorehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/clearObjectStore.html        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -71,10 +71,12 @@
</span><span class="cx">         name: &quot;NoSuchObjectStore&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('EmptyDatabase', 1)&quot;);
</span><del>-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;EmptyDatabase&quot;, (error, database) =&gt; {
-                IndexedDBAgent.clearObjectStore(WebInspector.frameResourceManager.mainFrame.securityOrigin, database.name, &quot;NoSuchObjectStore&quot;, (error) =&gt; {
-                    InspectorTest.expectThat(error, &quot;Should be an error attempting to clear an object store that does not exist.&quot;);
-                    resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;EmptyDatabase&quot;, (error, database) =&gt; {
+                    IndexedDBAgent.clearObjectStore(WebInspector.frameResourceManager.mainFrame.securityOrigin, database.name, &quot;NoSuchObjectStore&quot;, (error) =&gt; {
+                        InspectorTest.expectThat(error, &quot;Should be an error attempting to clear an object store that does not exist.&quot;);
+                        resolve();
+                    });
</ins><span class="cx">                 });
</span><span class="cx">             });
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbdeleteDatabaseNamesWithSpacehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/deleteDatabaseNamesWithSpace.html        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -24,14 +24,11 @@
</span><span class="cx">         name: &quot;EnsureNoDatabases&quot;,
</span><span class="cx">         description: &quot;Ensure no databases exist at the start.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><del>-            // FIXME: &lt;https://webkit.org/b/161285&gt; Race between deleting a database and requesting database names seen in test
-            setTimeout(() =&gt; {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                    InspectorTest.expectNoError(error);
-                    InspectorTest.expectThat(names.length === 0, &quot;No IndexedDB databases should exist initially.&quot;);
-                    resolve();
-                });
-            }, 50);
</del><ins>+            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                InspectorTest.expectNoError(error);
+                InspectorTest.expectThat(names.length === 0, &quot;No IndexedDB databases should exist initially.&quot;);
+                resolve();
+            });
</ins><span class="cx">         }
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="lines">@@ -40,11 +37,13 @@
</span><span class="cx">         description: &quot;Create a database with spaces in the name.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('Database With Space')&quot;);
</span><del>-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(names.length === 1, &quot;A single IndexedDB database should exist.&quot;);
-                InspectorTest.log(JSON.stringify(names));
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 1, &quot;A single IndexedDB database should exist.&quot;);
+                    InspectorTest.log(JSON.stringify(names));
+                    resolve();
+                });                
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="lines">@@ -54,15 +53,12 @@
</span><span class="cx">         description: &quot;Delete the database.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;deleteDatabaseNames(['Database With Space'])&quot;);
</span><del>-            // FIXME: &lt;https://webkit.org/b/161285&gt; Race between deleting a database and requesting database names seen in test
-            setTimeout(() =&gt; {
-                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                    InspectorTest.expectNoError(error);
-                    InspectorTest.expectThat(names.length === 0, &quot;No IndexedDB databases should exist because we just deleted them.&quot;);
-                    InspectorTest.log(JSON.stringify(names));
-                    resolve();
-                });
-            }, 50);
</del><ins>+            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                InspectorTest.expectNoError(error);
+                InspectorTest.expectThat(names.length === 0, &quot;No IndexedDB databases should exist because we just deleted them.&quot;);
+                InspectorTest.log(JSON.stringify(names));
+                resolve();
+            });
</ins><span class="cx">         }
</span><span class="cx">     });
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDataexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/requestData-expected.txt        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><del>-CONSOLE MESSAGE: line 18: Created Database 'Database1'
-CONSOLE MESSAGE: line 18: Created Database 'Database2'
-CONSOLE MESSAGE: line 18: Created Database 'Database3'
</del><ins>+CONSOLE MESSAGE: line 19: Created Database 'Database1'
+CONSOLE MESSAGE: line 19: Created Database 'Database2'
+CONSOLE MESSAGE: line 19: Created Database 'Database3'
</ins><span class="cx"> 
</span><span class="cx"> == Running test suite: IndexedDB.requestData
</span><span class="cx"> -- Running test case: ClearDatabases
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDatabaseexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/requestDatabase-expected.txt (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestDatabase-expected.txt        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabase-expected.txt        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> CONSOLE MESSAGE: line 9: Created Database 'EmptyDatabase'
</span><del>-CONSOLE MESSAGE: line 18: Created Database 'CompleteDatabase'
</del><ins>+CONSOLE MESSAGE: line 19: Created Database 'CompleteDatabase'
</ins><span class="cx"> 
</span><span class="cx"> == Running test suite: IndexedDB.requestDatabase
</span><span class="cx"> -- Running test case: ClearDatabases
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDatabasehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/requestDatabase.html (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestDatabase.html        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabase.html        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -24,12 +24,14 @@
</span><span class="cx">         name: &quot;CreateAndRequestEmptyDatabase&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('EmptyDatabase', 123)&quot;);
</span><del>-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;EmptyDatabase&quot;, (error, databaseWithObjectStores) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(databaseWithObjectStores.name === &quot;EmptyDatabase&quot;, &quot;Database name should be 'EmptyDatabase'.&quot;);
-                InspectorTest.expectThat(databaseWithObjectStores.version === 123, &quot;Database version should be 123.&quot;);
-                InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 0, &quot;Database should not have any object stores.&quot;);
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;EmptyDatabase&quot;, (error, databaseWithObjectStores) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(databaseWithObjectStores.name === &quot;EmptyDatabase&quot;, &quot;Database name should be 'EmptyDatabase'.&quot;);
+                    InspectorTest.expectThat(databaseWithObjectStores.version === 123, &quot;Database version should be 123.&quot;);
+                    InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 0, &quot;Database should not have any object stores.&quot;);
+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="lines">@@ -38,34 +40,36 @@
</span><span class="cx">         name: &quot;CreateAndRequestDatabaseWithStores&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createDatabaseWithStores('CompleteDatabase', 456)&quot;);
</span><del>-            IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;CompleteDatabase&quot;, (error, databaseWithObjectStores) =&gt; {
-                InspectorTest.expectNoError(error);
-                let objectStores = databaseWithObjectStores.objectStores;
-                InspectorTest.expectThat(databaseWithObjectStores.name === &quot;CompleteDatabase&quot;, &quot;Database name should be 'EmptyDatabase'.&quot;);
-                InspectorTest.expectThat(databaseWithObjectStores.version === 456, &quot;Database version should be 456.&quot;);
-                InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 3, &quot;Database should have 3 object stores.&quot;);
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabase(WebInspector.frameResourceManager.mainFrame.securityOrigin, &quot;CompleteDatabase&quot;, (error, databaseWithObjectStores) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    let objectStores = databaseWithObjectStores.objectStores;
+                    InspectorTest.expectThat(databaseWithObjectStores.name === &quot;CompleteDatabase&quot;, &quot;Database name should be 'EmptyDatabase'.&quot;);
+                    InspectorTest.expectThat(databaseWithObjectStores.version === 456, &quot;Database version should be 456.&quot;);
+                    InspectorTest.expectThat(databaseWithObjectStores.objectStores.length === 3, &quot;Database should have 3 object stores.&quot;);
</ins><span class="cx"> 
</span><del>-                InspectorTest.expectThat(objectStores[0].name === &quot;Empty&quot;, &quot;Object store should have name 'Empty'.&quot;);
-                InspectorTest.expectThat(objectStores[0].keyPath.type === &quot;null&quot;, &quot;Object store keypath is null.&quot;);
-                InspectorTest.expectThat(!objectStores[0].autoIncrement, &quot;Object store should not autoIncrement.&quot;);
-                InspectorTest.expectThat(!objectStores[0].indexes.length, &quot;Object store should have no indexes.&quot;);
</del><ins>+                    InspectorTest.expectThat(objectStores[0].name === &quot;Empty&quot;, &quot;Object store should have name 'Empty'.&quot;);
+                    InspectorTest.expectThat(objectStores[0].keyPath.type === &quot;null&quot;, &quot;Object store keypath is null.&quot;);
+                    InspectorTest.expectThat(!objectStores[0].autoIncrement, &quot;Object store should not autoIncrement.&quot;);
+                    InspectorTest.expectThat(!objectStores[0].indexes.length, &quot;Object store should have no indexes.&quot;);
</ins><span class="cx"> 
</span><del>-                InspectorTest.expectThat(objectStores[1].name === &quot;Reviewers&quot;, &quot;Object store should have name 'Reviewers'.&quot;);
-                InspectorTest.expectThat(objectStores[1].keyPath.type === &quot;null&quot;, &quot;Object store keypath is null.&quot;);
-                InspectorTest.expectThat(objectStores[1].autoIncrement, &quot;Object store should autoIncrement.&quot;);
-                InspectorTest.expectThat(objectStores[1].indexes.length === 2, &quot;Object store should have 2 indexes.&quot;);
-                InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[1].indexes[0]));
-                InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[1].indexes[1]));
</del><ins>+                    InspectorTest.expectThat(objectStores[1].name === &quot;Reviewers&quot;, &quot;Object store should have name 'Reviewers'.&quot;);
+                    InspectorTest.expectThat(objectStores[1].keyPath.type === &quot;null&quot;, &quot;Object store keypath is null.&quot;);
+                    InspectorTest.expectThat(objectStores[1].autoIncrement, &quot;Object store should autoIncrement.&quot;);
+                    InspectorTest.expectThat(objectStores[1].indexes.length === 2, &quot;Object store should have 2 indexes.&quot;);
+                    InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[1].indexes[0]));
+                    InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[1].indexes[1]));
</ins><span class="cx"> 
</span><del>-                InspectorTest.expectThat(objectStores[2].name === &quot;Stats&quot;, &quot;Object store should have name 'Stats'.&quot;);
-                InspectorTest.expectThat(objectStores[2].keyPath.type === &quot;string&quot;, &quot;Object store keypath is string type.&quot;);
-                InspectorTest.expectThat(objectStores[2].keyPath.string === &quot;name&quot;, &quot;Object store keypath is 'name''.&quot;);
-                InspectorTest.expectThat(!objectStores[2].autoIncrement, &quot;Object store should not autoIncrement.&quot;);
-                InspectorTest.expectThat(objectStores[2].indexes.length === 2, &quot;Object store should have 2 indexes.&quot;);
-                InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[2].indexes[0]));
-                InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[2].indexes[1]));
</del><ins>+                    InspectorTest.expectThat(objectStores[2].name === &quot;Stats&quot;, &quot;Object store should have name 'Stats'.&quot;);
+                    InspectorTest.expectThat(objectStores[2].keyPath.type === &quot;string&quot;, &quot;Object store keypath is string type.&quot;);
+                    InspectorTest.expectThat(objectStores[2].keyPath.string === &quot;name&quot;, &quot;Object store keypath is 'name''.&quot;);
+                    InspectorTest.expectThat(!objectStores[2].autoIncrement, &quot;Object store should not autoIncrement.&quot;);
+                    InspectorTest.expectThat(objectStores[2].indexes.length === 2, &quot;Object store should have 2 indexes.&quot;);
+                    InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[2].indexes[0]));
+                    InspectorTest.log(&quot;INDEX: &quot; + JSON.stringify(objectStores[2].indexes[1]));
</ins><span class="cx"> 
</span><del>-                resolve();
</del><ins>+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbrequestDatabaseNameshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/requestDatabaseNames.html        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -37,11 +37,13 @@
</span><span class="cx">         description: &quot;Create a first database.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('Database1')&quot;);
</span><del>-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(names.length === 1, &quot;A single IndexedDB database should exist.&quot;);
-                InspectorTest.log(JSON.stringify(names));
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 1, &quot;A single IndexedDB database should exist.&quot;);
+                    InspectorTest.log(JSON.stringify(names));
+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="lines">@@ -51,11 +53,13 @@
</span><span class="cx">         description: &quot;Create a second database.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('Database2')&quot;);
</span><del>-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(names.length === 2, &quot;Two IndexedDB databases should exist.&quot;);
-                InspectorTest.log(JSON.stringify(names));
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 2, &quot;Two IndexedDB databases should exist.&quot;);
+                    InspectorTest.log(JSON.stringify(names));
+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="lines">@@ -65,11 +69,13 @@
</span><span class="cx">         description: &quot;Create a third database with a unicode name.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('\u124d')&quot;);
</span><del>-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(names.length === 3, &quot;Three IndexedDB databases should exist.&quot;);
-                InspectorTest.log(JSON.stringify(names));
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 3, &quot;Three IndexedDB databases should exist.&quot;);
+                    InspectorTest.log(JSON.stringify(names));
+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span><span class="lines">@@ -79,11 +85,13 @@
</span><span class="cx">         description: &quot;Create a fourth database with a unicode name.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span><span class="cx">             InspectorTest.evaluateInPage(&quot;createEmptyDatabase('\ud800\udf46')&quot;);
</span><del>-            IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
-                InspectorTest.expectNoError(error);
-                InspectorTest.expectThat(names.length === 4, &quot;Four IndexedDB databases should exist.&quot;);
-                InspectorTest.log(JSON.stringify(names));
-                resolve();
</del><ins>+            InspectorTest.singleFireEventListener(&quot;DatabaseCreated&quot;, (event) =&gt; {
+                IndexedDBAgent.requestDatabaseNames(WebInspector.frameResourceManager.mainFrame.securityOrigin, (error, names) =&gt; {
+                    InspectorTest.expectNoError(error);
+                    InspectorTest.expectThat(names.length === 4, &quot;Four IndexedDB databases should exist.&quot;);
+                    InspectorTest.log(JSON.stringify(names));
+                    resolve();
+                });
</ins><span class="cx">             });
</span><span class="cx">         }
</span><span class="cx">     });
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorindexeddbresourcesutilitiesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/indexeddb/resources/utilities.js (205085 => 205086)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/indexeddb/resources/utilities.js        2016-08-27 22:13:44 UTC (rev 205085)
+++ trunk/LayoutTests/inspector/indexeddb/resources/utilities.js        2016-08-28 00:10:29 UTC (rev 205086)
</span><span class="lines">@@ -9,6 +9,7 @@
</span><span class="cx">         console.log(`Created Database '${name}'`);
</span><span class="cx">         let db = event.target.result;
</span><span class="cx">         db.close();
</span><ins>+        TestPage.dispatchEventToFrontend(&quot;DatabaseCreated&quot;);
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -16,6 +17,7 @@
</span><span class="cx">     let request = window.indexedDB.open(name, version);
</span><span class="cx">     request.addEventListener(&quot;success&quot;, function(event) {
</span><span class="cx">         console.log(`Created Database '${name}'`);
</span><ins>+        TestPage.dispatchEventToFrontend(&quot;DatabaseCreated&quot;);
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     request.addEventListener(&quot;upgradeneeded&quot;, function(event) {
</span></span></pre>
</div>
</div>

</body>
</html>