<!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>[192518] 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/192518">192518</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-17 11:41:26 -0800 (Tue, 17 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: Support IDBObjectStore.indexNames.
https://bugs.webkit.org/show_bug.cgi?id=151341

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (Covered by existing storage/indexeddb/modern/objectstore-attributes.html).

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::indexNames):
* Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
(WebCore::IDBObjectStoreInfo::indexNames):
* Modules/indexeddb/shared/IDBObjectStoreInfo.h:

LayoutTests:

* storage/indexeddb/modern/objectstore-attributes-expected.txt:
* storage/indexeddb/modern/objectstore-attributes.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernobjectstoreattributesexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernobjectstoreattributeshtml">trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/LayoutTests/ChangeLog        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-11-17  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Support IDBObjectStore.indexNames.
+        https://bugs.webkit.org/show_bug.cgi?id=151341
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/objectstore-attributes-expected.txt:
+        * storage/indexeddb/modern/objectstore-attributes.html:
+
</ins><span class="cx"> 2015-11-17  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, skip crashing mediastream tests
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernobjectstoreattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes-expected.txt        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -1,17 +1,30 @@
</span><del>-ALERT: First upgrade needed: Old version - 0 New version - 1
-ALERT: [object IDBTransaction] - versionchange
-ALERT: [object IDBDatabase]
-ALERT: TestObjectStore1
-ALERT: TestObjectStore2
-ALERT: true
-ALERT: false
-ALERT: foo
-ALERT: null
-ALERT: [object IDBTransaction]
-ALERT: [object IDBTransaction]
-ALERT: true
-ALERT: true
-ALERT: true
-ALERT: First version change transaction completed
-ALERT: Done
</del><span class="cx"> This test exercises the readonly attributes on an IDBObjectStore.
</span><ins>+First upgrade needed: Old version - 0 New version - 1
+[object IDBTransaction] - versionchange
+[object IDBDatabase]
+TestObjectStore1
+TestObjectStore2
+true
+false
+foo
+null
+[object IDBTransaction]
+[object IDBTransaction]
+true
+true
+true
+Object store has indexes:
+Bar index
+Foo index
+After adding another, object store now has indexes:
+Bar index
+Baz index
+Foo index
+First version change transaction completed
+In a new transaction, object store has indexes:
+Bar index
+Baz index
+Foo index
+readonly transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernobjectstoreattributeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/LayoutTests/storage/indexeddb/modern/objectstore-attributes.html        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -1,4 +1,5 @@
</span><del>-This test exercises the readonly attributes on an IDBObjectStore.
</del><ins>+This test exercises the readonly attributes on an IDBObjectStore.&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
</ins><span class="cx"> &lt;script&gt;
</span><span class="cx"> 
</span><span class="cx"> if (window.testRunner) {
</span><span class="lines">@@ -8,51 +9,99 @@
</span><span class="cx"> 
</span><span class="cx"> var request = window.indexedDB.open(&quot;ObjectStoreAttributesTestDatabase&quot;);
</span><span class="cx"> 
</span><ins>+function log(message)
+{
+    document.getElementById(&quot;logger&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
</ins><span class="cx"> function done()
</span><span class="cx"> {
</span><del>-    alert(&quot;Done&quot;);
</del><ins>+    log(&quot;Done&quot;);
</ins><span class="cx">     if (window.testRunner)
</span><span class="cx">         testRunner.notifyDone();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+var database;
+
</ins><span class="cx"> request.onupgradeneeded = function(event)
</span><span class="cx"> {
</span><del>-    alert(&quot;First upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
</del><ins>+    log(&quot;First upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
</ins><span class="cx">     
</span><span class="cx">     var tx = request.transaction;
</span><del>-    var db = event.target.result;
</del><ins>+    database = event.target.result;
</ins><span class="cx"> 
</span><del>-    alert(tx + &quot; - &quot; + tx.mode);
-    alert(db);
</del><ins>+    log(tx + &quot; - &quot; + tx.mode);
+    log(database);
</ins><span class="cx"> 
</span><del>-    var os1 = db.createObjectStore('TestObjectStore1', { autoIncrement: true , keyPath: &quot;foo&quot; });
-    var os2 = db.createObjectStore('TestObjectStore2', { autoIncrement: false });
</del><ins>+    var os1 = database.createObjectStore('TestObjectStore1', { autoIncrement: true , keyPath: &quot;foo&quot; });
+    var os2 = database.createObjectStore('TestObjectStore2', { autoIncrement: false });
</ins><span class="cx"> 
</span><del>-    alert(os1.name);
-    alert(os2.name);
-    alert(os1.autoIncrement);
-    alert(os2.autoIncrement);
-    alert(os1.keyPath);
-    alert(os2.keyPath);
-    alert(os1.transaction);
-    alert(os2.transaction);
-    alert(os1.transaction == tx);
-    alert(os2.transaction == tx);
-    alert(os1.transaction == os2.transaction);
</del><ins>+    log(os1.name);
+    log(os2.name);
+    log(os1.autoIncrement);
+    log(os2.autoIncrement);
+    log(os1.keyPath);
+    log(os2.keyPath);
+    log(os1.transaction);
+    log(os2.transaction);
+    log(os1.transaction == tx);
+    log(os2.transaction == tx);
+    log(os1.transaction == os2.transaction);
</ins><span class="cx">     
</span><ins>+    os2.createIndex(&quot;Foo index&quot;, &quot;foo&quot;);
+    os2.createIndex(&quot;Bar index&quot;, &quot;bar&quot;);
+    
+    var names = os2.indexNames;
+    log(&quot;Object store has indexes:&quot;)
+    for (var i = 0; i &lt; names.length; ++i)
+        log(names[i]);
+    
+    os2.createIndex(&quot;Baz index&quot;, &quot;baz&quot;);
+    log(&quot;After adding another, object store now has indexes:&quot;);
+    names = os2.indexNames;
+    for (var i = 0; i &lt; names.length; ++i)
+        log(names[i]);
+    
</ins><span class="cx">     tx.onabort = function(event) {
</span><del>-        alert(&quot;First version change transaction unexpected abort&quot;);
</del><ins>+        log(&quot;First version change transaction unexpected abort&quot;);
</ins><span class="cx">         done();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     tx.oncomplete = function(event) {
</span><del>-        alert(&quot;First version change transaction completed&quot;);
-        done();
</del><ins>+        log(&quot;First version change transaction completed&quot;);
+        continueTest();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     tx.onerror = function(event) {
</span><del>-        alert(&quot;First version change transaction unexpected error - &quot; + event);
</del><ins>+        log(&quot;First version change transaction unexpected error - &quot; + event);
</ins><span class="cx">         done();
</span><span class="cx">     }
</span><span class="cx"> }
</span><ins>+
+function continueTest()
+{
+    var transaction = database.transaction(&quot;TestObjectStore2&quot;, &quot;readonly&quot;);
+    var objectStore = transaction.objectStore(&quot;TestObjectStore2&quot;);
+    
+    log(&quot;In a new transaction, object store has indexes:&quot;);
+    var names = objectStore.indexNames;
+    for (var i = 0; i &lt; names.length; ++i)
+        log(names[i]);
+
+    transaction.onabort = function(event) {
+        log(&quot;readonly transaction unexpected abort&quot; + event);
+        done();
+    }
+
+    transaction.oncomplete = function(event) {
+        log(&quot;readonly transaction complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        log(&quot;readonly transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
</ins><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/Source/WebCore/ChangeLog        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-11-17  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: Support IDBObjectStore.indexNames.
+        https://bugs.webkit.org/show_bug.cgi?id=151341
+
+        Reviewed by Alex Christensen.
+
+        No new tests (Covered by existing storage/indexeddb/modern/objectstore-attributes.html).
+
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::indexNames):
+        * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
+        (WebCore::IDBObjectStoreInfo::indexNames):
+        * Modules/indexeddb/shared/IDBObjectStoreInfo.h:
+
</ins><span class="cx"> 2015-11-17  Sergio Villar Senin  &lt;svillar@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: contentSize &gt;= 0 in WebCore::RenderFlexibleBox::adjustChildSizeForMinAndMax
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -77,7 +77,12 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;DOMStringList&gt; IDBObjectStore::indexNames() const
</span><span class="cx"> {
</span><del>-    RELEASE_ASSERT_NOT_REACHED();
</del><ins>+    RefPtr&lt;DOMStringList&gt; indexNames = DOMStringList::create();
+    for (auto&amp; name : m_info.indexNames())
+        indexNames-&gt;append(name);
+    indexNames-&gt;sort();
+
+    return indexNames;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;WebCore::IDBTransaction&gt; IDBObjectStore::transaction()
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -89,6 +89,16 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Vector&lt;String&gt; IDBObjectStoreInfo::indexNames() const
+{
+    Vector&lt;String&gt; names;
+    names.reserveCapacity(m_indexMap.size());
+    for (auto&amp; index : m_indexMap.values())
+        names.uncheckedAppend(index.name());
+
+    return names;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBObjectStoreInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h (192517 => 192518)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h        2015-11-17 19:30:14 UTC (rev 192517)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h        2015-11-17 19:41:26 UTC (rev 192518)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx">     bool hasIndex(const String&amp; name) const;
</span><span class="cx">     IDBIndexInfo* infoForExistingIndex(const String&amp; name);
</span><span class="cx"> 
</span><ins>+    Vector&lt;String&gt; indexNames() const;
+
</ins><span class="cx"> private:
</span><span class="cx">     uint64_t m_identifier { 0 };
</span><span class="cx">     String m_name;
</span></span></pre>
</div>
</div>

</body>
</html>