<!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>[208261] 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/208261">208261</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-11-01 16:51:54 -0700 (Tue, 01 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
<rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294
Reviewed by Alex Christensen.
LayoutTests/imported/w3c:
* web-platform-tests/IndexedDB/idbindex_getAll-expected.txt:
* web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt:
Source/WebCore:
Tests: storage/indexeddb/modern/idbindex-getall-1-private.html
storage/indexeddb/modern/idbindex-getall-1.html
storage/indexeddb/modern/idbindex-getallkeys-1-private.html
storage/indexeddb/modern/idbindex-getallkeys-1.html
Existing imported W3C tests.
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::getAll):
(WebCore::IDBIndex::getAllKeys):
* Modules/indexeddb/IDBIndex.h:
* Modules/indexeddb/IDBIndex.idl:
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::create):
(WebCore::IDBRequest::createIndexGet):
(WebCore::IDBRequest::createCount): Deleted.
(WebCore::IDBRequest::createGet): Deleted.
* Modules/indexeddb/IDBRequest.h:
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::requestGetAllIndexRecords):
(WebCore::IDBTransaction::requestIndexRecord):
(WebCore::IDBTransaction::requestCount):
* Modules/indexeddb/IDBTransaction.h:
* Modules/indexeddb/server/IndexValueStore.cpp:
(WebCore::IDBServer::IndexValueStore::allValuesForKey):
* Modules/indexeddb/server/IndexValueStore.h:
* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords):
* Modules/indexeddb/server/MemoryIndex.cpp:
(WebCore::IDBServer::MemoryIndex::getAllRecords):
* Modules/indexeddb/server/MemoryIndex.h:
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords):
(WebCore::IDBServer::queryForGetAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords):
(WebCore::IDBServer::queryForGetAllRecords): Deleted.
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:
LayoutTests:
* resources/js-test.js:
(areObjectsEqual):
* storage/indexeddb/modern/idbindex-getall-1-expected.txt: Added.
* storage/indexeddb/modern/idbindex-getall-1-private-expected.txt: Added.
* storage/indexeddb/modern/idbindex-getall-1-private.html: Added.
* storage/indexeddb/modern/idbindex-getall-1.html: Added.
* storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt: Added.
* storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt: Added.
* storage/indexeddb/modern/idbindex-getallkeys-1-private.html: Added.
* storage/indexeddb/modern/idbindex-getallkeys-1.html: Added.
* storage/indexeddb/modern/resources/idbindex-getall-1.js: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbindex_getAllexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAll-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbindex_getAllKeysexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt</a></li>
<li><a href="#trunkLayoutTestsresourcesjstestjs">trunk/LayoutTests/resources/js-test.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexcpp">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexh">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBIndexidl">trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequestcpp">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBRequesth">trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactionh">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIndexValueStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIndexValueStoreh">trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIndexh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverSQLiteIDBBackingStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverSQLiteIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetall1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetall1privateexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetall1privatehtml">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetall1html">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1privateexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1privatehtml">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1html">trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesidbindexgetall1js">trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getall-1.js</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcesidbindexgetallkeys1js">trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getallkeys-1.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/LayoutTests/ChangeLog        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-11-01 Brady Eidson <beidson@apple.com>
+
+ IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
+ <rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294
+
+ Reviewed by Alex Christensen.
+
+ * resources/js-test.js:
+ (areObjectsEqual):
+
+ * storage/indexeddb/modern/idbindex-getall-1-expected.txt: Added.
+ * storage/indexeddb/modern/idbindex-getall-1-private-expected.txt: Added.
+ * storage/indexeddb/modern/idbindex-getall-1-private.html: Added.
+ * storage/indexeddb/modern/idbindex-getall-1.html: Added.
+ * storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt: Added.
+ * storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt: Added.
+ * storage/indexeddb/modern/idbindex-getallkeys-1-private.html: Added.
+ * storage/indexeddb/modern/idbindex-getallkeys-1.html: Added.
+ * storage/indexeddb/modern/resources/idbindex-getall-1.js: Added.
+
</ins><span class="cx"> 2016-11-01 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] Media Controller: Airplay support
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-11-01 Brady Eidson <beidson@apple.com>
+
+ IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
+ <rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294
+
+ Reviewed by Alex Christensen.
+
+ * web-platform-tests/IndexedDB/idbindex_getAll-expected.txt:
+ * web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt:
+
</ins><span class="cx"> 2016-11-01 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Rebase test after r208239
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbindex_getAllexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAll-expected.txt (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAll-expected.txt        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAll-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><span class="cx">
</span><del>-FAIL Single item get index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Empty object store index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get all keys index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL maxCount=10 index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get bound range index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get bound range with maxCount index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get upper excluded index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get lower excluded index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Get bound range (generated) with maxCount index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Non existent key index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL maxCount=0 index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Retrieve multiEntry key index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
-FAIL Retrieve one key multiple values index.getAll is not a function. (In 'index.getAll(range, maxCount)', 'index.getAll' is undefined)
</del><ins>+PASS Single item get
+PASS Empty object store
+PASS Get all keys
+PASS maxCount=10
+PASS Get bound range
+PASS Get bound range with maxCount
+PASS Get upper excluded
+PASS Get lower excluded
+PASS Get bound range (generated) with maxCount
+PASS Non existent key
+PASS maxCount=0
+PASS Retrieve multiEntry key
+PASS Retrieve one key multiple values
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbindex_getAllKeysexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex_getAllKeys-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1,15 +1,15 @@
</span><span class="cx">
</span><del>-FAIL Single item get index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Empty object store index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get all keys index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get all generated keys index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL maxCount=10 index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get bound range index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get bound range with maxCount index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get upper excluded index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get lower excluded index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Get bound range (generated) with maxCount index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Non existent key index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL maxCount=0 index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
-FAIL Retrieve multiEntry keys index.getAllKeys is not a function. (In 'index.getAllKeys(range, maxCount)', 'index.getAllKeys' is undefined)
</del><ins>+PASS Single item get
+PASS Empty object store
+PASS Get all keys
+PASS Get all generated keys
+PASS maxCount=10
+PASS Get bound range
+PASS Get bound range with maxCount
+PASS Get upper excluded
+PASS Get lower excluded
+PASS Get bound range (generated) with maxCount
+PASS Non existent key
+PASS maxCount=0
+PASS Retrieve multiEntry keys
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsresourcesjstestjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/js-test.js (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/js-test.js        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/LayoutTests/resources/js-test.js        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -711,6 +711,34 @@
</span><span class="cx"> testRunner.notifyDone();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function areObjectsEqual(a, b) {
+        for (var property in a) {
+                if (!b.hasOwnProperty(property))
+                        return false;
+
+                switch (typeof (a[property])) {
+                case 'function':
+                        if (typeof b[property] == 'undefined' || a[property].toString() != b[property].toString())
+                                return false;
+                        break;
+                case 'object':
+                        if (!areObjectsEqual(a, b))
+                                return false;
+                        break;
+                default:
+                        if (a[property] != b[property])
+                                return false;
+                }
+        }
+
+        for (var property in b) {
+                if (!a.hasOwnProperty(property))
+                        return false;
+        }
+        
+        return true;
+};
+
</ins><span class="cx"> function startWorker(testScriptURL)
</span><span class="cx"> {
</span><span class="cx"> self.jsTestIsAsync = true;
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetall1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-expected.txt (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+Test IDBIndex.getAll()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS: Good index count
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetall1privateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private-expected.txt (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+Test IDBIndex.getAll()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS: Good index count
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Correct value
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct value
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetall1privatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private.html (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1-private.html        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+
+<script src="resources/idbindex-getall-1.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetall1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1.html (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getall-1.html        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+
+<script src="resources/idbindex-getall-1.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+Test IDBIndex.getAll()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS: Good index count
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1privateexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private-expected.txt        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+Test IDBIndex.getAll()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+PASS: Good index count
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Correct key
+PASS: Got an array object
+PASS: Correct length
+PASS: Correct key
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1privatehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private.html (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1-private.html        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+<html>
+<head>
+<script>
+enablePrivateBrowsing = true;
+</script>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+
+<script src="resources/idbindex-getallkeys-1.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbindexgetallkeys1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1.html (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1.html         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbindex-getallkeys-1.html        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+<html>
+<head>
+<script src="../../../resources/js-test.js"></script>
+<script src="../resources/shared.js"></script>
+</head>
+<body>
+
+<script src="resources/idbindex-getallkeys-1.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesidbindexgetall1js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getall-1.js (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getall-1.js         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getall-1.js        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+// Adapted from a Mozilla test placed in the public domain.
+// Taken from git repository https://github.com/mozilla/gecko-dev.git and the path ./dom/indexedDB/test/unit/test_index_getAll.js
+
+description("Test IDBIndex.getAll()");
+
+function continueWithEvent(event)
+{
+ testGenerator.next(event);
+}
+
+function log(msg)
+{
+        document.body.innerHTML += msg + "<br>";
+}
+
+function is(a, b, pass)
+{
+ if (areObjectsEqual(a, b))
+ log("PASS: " + pass);
+ else
+ log("FAIL: " + a + " should be " + b + " but is not.");
+}
+
+function* testSteps()
+{
+ const name = window.location.pathname;
+ const objectStoreName = "People";
+
+ let objectStoreData = [
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } }
+ ];
+
+ let indexData = [
+ { name: "name", keyPath: "name", options: { unique: true } },
+ { name: "height", keyPath: "height", options: { unique: false } },
+ { name: "weight", keyPath: "weight", options: { unique: false } }
+ ];
+
+ let objectStoreDataNameSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } }
+ ];
+
+ let objectStoreDataWeightSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
+ ];
+
+ let objectStoreDataHeightSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
+ ];
+        
+ let request = indexedDB.deleteDatabase(name);
+        request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ request = indexedDB.open(name, 1);
+ request.onerror = finishJSTest;
+ request.onupgradeneeded = continueWithEvent;
+ event = yield;
+
+ let db = event.target.result;
+        event.target.transaction.oncomplete = continueWithEvent;
+ let objectStore = db.createObjectStore(objectStoreName);
+
+ // First, add all our data to the object store.
+ let addedData = 0;
+ for (let i in objectStoreData) {
+ request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
+ request.onerror = finishJSTest;
+ request.onsuccess = function(event) {
+ if (++addedData == objectStoreData.length) {
+ testGenerator.next(event);
+ }
+ }
+ }
+ yield;
+
+ // Now create the indexes.
+ for (let i in indexData) {
+ objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);
+ }
+
+ is(objectStore.indexNames.length, indexData.length, "Good index count");
+ yield; // Completion of version change transaction
+
+ objectStore = db.transaction(objectStoreName).objectStore(objectStoreName);
+ request = objectStore.index("height").getAll(65);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+        
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll(65, 0);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll(65, null);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll(65, undefined);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll();
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, objectStoreDataHeightSort.length, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[i].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll(null, 4);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 4, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[i].value, "Correct value");
+ }
+
+ request = objectStore.index("height").getAll(65, 1);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 1, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].value, "Correct value");
+ }
+
+ finishJSTest();
+ yield;
+}
+
+var testGenerator = testSteps();
+testGenerator.next();
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcesidbindexgetallkeys1js"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getallkeys-1.js (0 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getallkeys-1.js         (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/idbindex-getallkeys-1.js        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -0,0 +1,196 @@
</span><ins>+// Adapted from a Mozilla test placed in the public domain.
+// Taken from git repository https://github.com/mozilla/gecko-dev.git and the path ./dom/indexedDB/test/unit/test_index_getAllKeys.js
+
+description("Test IDBIndex.getAll()");
+
+function continueWithEvent(event)
+{
+ testGenerator.next(event);
+}
+
+function log(msg)
+{
+        document.body.innerHTML += msg + "<br>";
+}
+
+function is(a, b, pass)
+{
+ if (a === b)
+ log("PASS: " + pass);
+ else
+ log("FAIL: " + a + " should be " + b + " but is not.");
+}
+
+function* testSteps()
+{
+ const name = window.location.pathname;
+ const objectStoreName = "People";
+
+ let objectStoreData = [
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } }
+ ];
+
+ let indexData = [
+ { name: "name", keyPath: "name", options: { unique: true } },
+ { name: "height", keyPath: "height", options: { unique: false } },
+ { name: "weight", keyPath: "weight", options: { unique: false } }
+ ];
+
+ let objectStoreDataNameSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } }
+ ];
+
+ let objectStoreDataWeightSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
+ ];
+
+ let objectStoreDataHeightSort = [
+ { key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
+ { key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
+ { key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
+ { key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
+ { key: "237-23-7737", value: { name: "Pat", height: 65 } },
+ { key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
+ ];
+        
+ let request = indexedDB.deleteDatabase(name);
+        request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ request = indexedDB.open(name, 1);
+ request.onerror = finishJSTest;
+ request.onupgradeneeded = continueWithEvent;
+ event = yield;
+
+ let db = event.target.result;
+        event.target.transaction.oncomplete = continueWithEvent;
+ let objectStore = db.createObjectStore(objectStoreName);
+
+ // First, add all our data to the object store.
+ let addedData = 0;
+ for (let i in objectStoreData) {
+ request = objectStore.add(objectStoreData[i].value, objectStoreData[i].key);
+ request.onerror = finishJSTest;
+ request.onsuccess = function(event) {
+ if (++addedData == objectStoreData.length) {
+ testGenerator.next(event);
+ }
+ }
+ }
+ yield;
+
+ // Now create the indexes.
+ for (let i in indexData) {
+ objectStore.createIndex(indexData[i].name, indexData[i].keyPath, indexData[i].options);
+ }
+
+ is(objectStore.indexNames.length, indexData.length, "Good index count");
+ yield; // Completion of version change transaction
+
+ objectStore = db.transaction(objectStoreName).objectStore(objectStoreName);
+ request = objectStore.index("height").getAllKeys(65);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+        
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys(65, 0);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys(65, null);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys(65, undefined);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 2, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys();
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, objectStoreDataHeightSort.length, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[i].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys(null, 4);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 4, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[i].key, "Correct key");
+ }
+
+ request = objectStore.index("height").getAllKeys(65, 1);
+ request.onerror = finishJSTest;
+ request.onsuccess = continueWithEvent;
+ event = yield;
+
+ is(event.target.result instanceof Array, true, "Got an array object");
+ is(event.target.result.length, 1, "Correct length");
+
+ for (let i in event.target.result) {
+ is(event.target.result[i], objectStoreDataHeightSort[parseInt(i) + 3].key, "Correct key");
+ }
+
+ finishJSTest();
+ yield;
+}
+
+var testGenerator = testSteps();
+testGenerator.next();
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/ChangeLog        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2016-11-01 Brady Eidson <beidson@apple.com>
+
+ IndexedDB 2.0: Support IDBIndex getAll/getAllKeys.
+ <rdar://problem/28806933> and https://bugs.webkit.org/show_bug.cgi?id=164294
+
+ Reviewed by Alex Christensen.
+
+ Tests: storage/indexeddb/modern/idbindex-getall-1-private.html
+ storage/indexeddb/modern/idbindex-getall-1.html
+ storage/indexeddb/modern/idbindex-getallkeys-1-private.html
+ storage/indexeddb/modern/idbindex-getallkeys-1.html
+ Existing imported W3C tests.
+
+ * Modules/indexeddb/IDBIndex.cpp:
+ (WebCore::IDBIndex::getAll):
+ (WebCore::IDBIndex::getAllKeys):
+ * Modules/indexeddb/IDBIndex.h:
+ * Modules/indexeddb/IDBIndex.idl:
+
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::create):
+ (WebCore::IDBRequest::createIndexGet):
+ (WebCore::IDBRequest::createCount): Deleted.
+ (WebCore::IDBRequest::createGet): Deleted.
+ * Modules/indexeddb/IDBRequest.h:
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::requestGetAllIndexRecords):
+ (WebCore::IDBTransaction::requestIndexRecord):
+ (WebCore::IDBTransaction::requestCount):
+ * Modules/indexeddb/IDBTransaction.h:
+
+ * Modules/indexeddb/server/IndexValueStore.cpp:
+ (WebCore::IDBServer::IndexValueStore::allValuesForKey):
+ * Modules/indexeddb/server/IndexValueStore.h:
+
+ * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+ (WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords):
+
+ * Modules/indexeddb/server/MemoryIndex.cpp:
+ (WebCore::IDBServer::MemoryIndex::getAllRecords):
+ * Modules/indexeddb/server/MemoryIndex.h:
+
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords):
+ (WebCore::IDBServer::queryForGetAllObjectStoreRecords):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::getAllObjectStoreRecords):
+ (WebCore::IDBServer::SQLiteIDBBackingStore::getAllIndexRecords):
+ (WebCore::IDBServer::queryForGetAllRecords): Deleted.
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
+
</ins><span class="cx"> 2016-11-01 Ryosuke Niwa <rniwa@webkit.org>
</span><span class="cx">
</span><span class="cx"> Remove CUSTOM_ELEMENTS build flag
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -308,6 +308,52 @@
</span><span class="cx"> return transaction.requestGetKey(execState, *this, range);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, RefPtr<IDBKeyRange> range, Optional<uint32_t> count)
+{
+ LOG(IndexedDB, "IDBIndex::getAll");
+ ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
+
+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'getAll' on 'IDBIndex': The index or its object store has been deleted.") };
+
+ if (!m_objectStore.transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'getAll' on 'IDBIndex': The transaction is inactive or finished.") };
+
+ return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, range.get(), IndexedDB::GetAllType::Values, count);
+}
+
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAll(ExecState& execState, JSValue key, Optional<uint32_t> count)
+{
+ auto onlyResult = IDBKeyRange::only(execState, key);
+ if (onlyResult.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'getAll' on 'IDBIndex': The parameter is not a valid key.") };
+
+ return getAll(execState, onlyResult.releaseReturnValue(), count);
+}
+
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, RefPtr<IDBKeyRange> range, Optional<uint32_t> count)
+{
+ LOG(IndexedDB, "IDBIndex::getAllKeys");
+ ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
+
+ if (m_deleted || m_objectStore.isDeleted())
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'getAllKeys' on 'IDBIndex': The index or its object store has been deleted.") };
+
+ if (!m_objectStore.transaction().isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'getAllKeys' on 'IDBIndex': The transaction is inactive or finished.") };
+
+ return m_objectStore.transaction().requestGetAllIndexRecords(execState, *this, range.get(), IndexedDB::GetAllType::Keys, count);
+}
+
+ExceptionOr<Ref<IDBRequest>> IDBIndex::getAllKeys(ExecState& execState, JSValue key, Optional<uint32_t> count)
+{
+ auto onlyResult = IDBKeyRange::only(execState, key);
+ if (onlyResult.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'getAllKeys' on 'IDBIndex': The parameter is not a valid key.") };
+
+ return getAllKeys(execState, onlyResult.releaseReturnValue(), count);
+}
+
</ins><span class="cx"> void IDBIndex::markAsDeleted()
</span><span class="cx"> {
</span><span class="cx"> ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -70,6 +70,11 @@
</span><span class="cx"> ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, IDBKeyRange*);
</span><span class="cx"> ExceptionOr<Ref<IDBRequest>> getKey(JSC::ExecState&, JSC::JSValue key);
</span><span class="cx">
</span><ins>+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, RefPtr<IDBKeyRange>, Optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAll(JSC::ExecState&, JSC::JSValue key, Optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, RefPtr<IDBKeyRange>, Optional<uint32_t> count);
+ ExceptionOr<Ref<IDBRequest>> getAllKeys(JSC::ExecState&, JSC::JSValue key, Optional<uint32_t> count);
+
</ins><span class="cx"> const IDBIndexInfo& info() const { return m_info; }
</span><span class="cx">
</span><span class="cx"> void markAsDeleted();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBIndexidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -46,6 +46,10 @@
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest get(any key);
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest getKey(IDBKeyRange? key);
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest getKey(any key);
</span><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest getAll(optional IDBKeyRange? range = null, [EnforceRange] optional unsigned long count);
+ [CallWith=ScriptState, MayThrowException] IDBRequest getAll(any key, [EnforceRange] optional unsigned long count);
+ [CallWith=ScriptState, MayThrowException] IDBRequest getAllKeys(optional IDBKeyRange? range = null, [EnforceRange] optional unsigned long count);
+ [CallWith=ScriptState, MayThrowException] IDBRequest getAllKeys(any key, [EnforceRange] optional unsigned long count);
</ins><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest count(optional IDBKeyRange? range = null);
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest count(any key);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -63,12 +63,12 @@
</span><span class="cx"> return adoptRef(*new IDBRequest(context, cursor, transaction));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<IDBRequest> IDBRequest::createCount(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
</del><ins>+Ref<IDBRequest> IDBRequest::create(ScriptExecutionContext& context, IDBIndex& index, IDBTransaction& transaction)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new IDBRequest(context, index, transaction));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<IDBRequest> IDBRequest::createGet(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
</del><ins>+Ref<IDBRequest> IDBRequest::createIndexGet(ScriptExecutionContext& context, IDBIndex& index, IndexedDB::IndexRecordType requestedRecordType, IDBTransaction& transaction)
</ins><span class="cx"> {
</span><span class="cx"> return adoptRef(*new IDBRequest(context, index, requestedRecordType, transaction));
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBRequesth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -57,8 +57,8 @@
</span><span class="cx"> public:
</span><span class="cx"> static Ref<IDBRequest> create(ScriptExecutionContext&, IDBObjectStore&, IDBTransaction&);
</span><span class="cx"> static Ref<IDBRequest> create(ScriptExecutionContext&, IDBCursor&, IDBTransaction&);
</span><del>- static Ref<IDBRequest> createCount(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
- static Ref<IDBRequest> createGet(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
</del><ins>+ static Ref<IDBRequest> create(ScriptExecutionContext&, IDBIndex&, IDBTransaction&);
+ static Ref<IDBRequest> createIndexGet(ScriptExecutionContext&, IDBIndex&, IndexedDB::IndexRecordType, IDBTransaction&);
</ins><span class="cx">
</span><span class="cx"> const IDBResourceIdentifier& resourceIdentifier() const { return m_resourceIdentifier; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -747,6 +747,24 @@
</span><span class="cx"> return request;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBRequest> IDBTransaction::requestGetAllIndexRecords(JSC::ExecState& state, IDBIndex& index, const IDBKeyRangeData& keyRangeData, IndexedDB::GetAllType getAllType, Optional<uint32_t> count)
+{
+ LOG(IndexedDB, "IDBTransaction::requestGetAllIndexRecords");
+ ASSERT(isActive());
+ ASSERT(currentThread() == m_database->originThreadID());
+
+ ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
+
+ auto request = IDBRequest::create(*scriptExecutionContext(), index, *this);
+ addRequest(request.get());
+
+ IDBGetAllRecordsData getAllRecordsData { keyRangeData, getAllType, count, index.objectStore().info().identifier(), index.info().identifier() };
+
+ scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetAllRecordsOnServer, &IDBTransaction::getAllRecordsOnServer, getAllRecordsData));
+
+ return request;
+}
+
</ins><span class="cx"> void IDBTransaction::getAllRecordsOnServer(IDBClient::TransactionOperation& operation, const IDBGetAllRecordsData& getAllRecordsData)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::getAllRecordsOnServer");
</span><span class="lines">@@ -822,7 +840,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
</span><span class="cx">
</span><del>- auto request = IDBRequest::createGet(*scriptExecutionContext(), index, type, *this);
</del><ins>+ auto request = IDBRequest::createIndexGet(*scriptExecutionContext(), index, type, *this);
</ins><span class="cx"> addRequest(request.get());
</span><span class="cx">
</span><span class="cx"> IDBGetRecordData getRecordData = { range };
</span><span class="lines">@@ -894,7 +912,7 @@
</span><span class="cx">
</span><span class="cx"> ASSERT_UNUSED(state, scriptExecutionContext() == scriptExecutionContextFromExecState(&state));
</span><span class="cx">
</span><del>- auto request = IDBRequest::createCount(*scriptExecutionContext(), index, *this);
</del><ins>+ auto request = IDBRequest::create(*scriptExecutionContext(), index, *this);
</ins><span class="cx"> addRequest(request.get());
</span><span class="cx">
</span><span class="cx"> scheduleOperation(IDBClient::createTransactionOperation(*this, request.get(), &IDBTransaction::didGetCountOnServer, &IDBTransaction::getCountOnServer, range));
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -115,6 +115,7 @@
</span><span class="cx"> Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> Ref<IDBRequest> requestGetRecord(JSC::ExecState&, IDBObjectStore&, const IDBGetRecordData&);
</span><span class="cx"> Ref<IDBRequest> requestGetAllObjectStoreRecords(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&, IndexedDB::GetAllType, Optional<uint32_t> count);
</span><ins>+ Ref<IDBRequest> requestGetAllIndexRecords(JSC::ExecState&, IDBIndex&, const IDBKeyRangeData&, IndexedDB::GetAllType, Optional<uint32_t> count);
</ins><span class="cx"> Ref<IDBRequest> requestDeleteRecord(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&);
</span><span class="cx"> Ref<IDBRequest> requestClearObjectStore(JSC::ExecState&, IDBObjectStore&);
</span><span class="cx"> Ref<IDBRequest> requestCount(JSC::ExecState&, IDBObjectStore&, const IDBKeyRangeData&);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIndexValueStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -51,6 +51,19 @@
</span><span class="cx"> return entry->getLowest();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Vector<IDBKeyData> IndexValueStore::allValuesForKey(const IDBKeyData& key, uint32_t limit) const
+{
+ const auto& entry = m_records.get(key);
+ if (!entry)
+ return { };
+
+ Vector<IDBKeyData> results;
+ for (auto iterator = entry->begin(); results.size() < limit && iterator.isValid(); ++iterator)
+ results.append(iterator.key());
+
+ return results;
+}
+
</ins><span class="cx"> uint64_t IndexValueStore::countForKey(const IDBKeyData& key) const
</span><span class="cx"> {
</span><span class="cx"> const auto& entry = m_records.get(key);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIndexValueStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> IndexValueStore(bool unique);
</span><span class="cx">
</span><span class="cx"> const IDBKeyData* lowestValueForKey(const IDBKeyData&) const;
</span><ins>+ Vector<IDBKeyData> allValuesForKey(const IDBKeyData&, uint32_t limit) const;
</ins><span class="cx"> uint64_t countForKey(const IDBKeyData&) const;
</span><span class="cx"> IDBKeyData lowestKeyWithRecordInRange(const IDBKeyRangeData&) const;
</span><span class="cx"> bool contains(const IDBKeyData&) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -375,11 +375,19 @@
</span><span class="cx"> if (!m_transactions.contains(transactionIdentifier))
</span><span class="cx"> return { IDBDatabaseException::UnknownError, ASCIILiteral("No backing store transaction found to get all records") };
</span><span class="cx">
</span><del>- MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(getAllRecordsData.objectStoreIdentifier);
</del><ins>+ auto* objectStore = m_objectStoresByIdentifier.get(getAllRecordsData.objectStoreIdentifier);
</ins><span class="cx"> if (!objectStore)
</span><span class="cx"> return { IDBDatabaseException::UnknownError, ASCIILiteral("No backing store object store found") };
</span><span class="cx">
</span><del>- objectStore->getAllRecords(getAllRecordsData.keyRangeData, getAllRecordsData.count, getAllRecordsData.getAllType, result);
</del><ins>+ if (getAllRecordsData.indexIdentifier) {
+ auto* index = objectStore->indexForIdentifier(getAllRecordsData.indexIdentifier);
+ if (!index)
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("No backing store index found") };
+
+ index->getAllRecords(getAllRecordsData.keyRangeData, getAllRecordsData.count, getAllRecordsData.getAllType, result);
+ } else
+ objectStore->getAllRecords(getAllRecordsData.keyRangeData, getAllRecordsData.count, getAllRecordsData.getAllType, result);
+
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx">
</span><span class="cx"> #include "IDBError.h"
</span><ins>+#include "IDBGetAllResult.h"
</ins><span class="cx"> #include "IDBGetResult.h"
</span><span class="cx"> #include "IDBKeyRangeData.h"
</span><span class="cx"> #include "IndexKey.h"
</span><span class="lines">@@ -157,6 +158,45 @@
</span><span class="cx"> return count;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryIndex::getAllRecords(const IDBKeyRangeData& keyRangeData, Optional<uint32_t> count, IndexedDB::GetAllType type, IDBGetAllResult& result) const
+{
+ LOG(IndexedDB, "MemoryIndex::getAllRecords");
+
+ result = { type };
+
+ if (!m_records)
+ return;
+
+ uint32_t targetCount;
+ if (count && count.value())
+ targetCount = count.value();
+ else
+ targetCount = std::numeric_limits<uint32_t>::max();
+
+ IDBKeyRangeData range = keyRangeData;
+ uint32_t currentCount = 0;
+ while (currentCount < targetCount) {
+ auto key = m_records->lowestKeyWithRecordInRange(range);
+ if (key.isNull())
+ return;
+
+ range.lowerKey = key;
+ range.lowerOpen = true;
+
+ auto allValues = m_records->allValuesForKey(key, targetCount - currentCount);
+ for (auto& keyValue : allValues) {
+ if (type == IndexedDB::GetAllType::Keys) {
+ IDBKeyData keyCopy { keyValue };
+ result.addKey(WTFMove(keyCopy));
+ } else
+ result.addValue(m_objectStore.valueForKeyRange(keyValue));
+ }
+
+ currentCount += allValues.size();
+ }
+}
+
+
</ins><span class="cx"> IDBError MemoryIndex::putIndexKey(const IDBKeyData& valueKey, const IndexKey& indexKey)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "MemoryIndex::provisionalPutIndexKey");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIndexh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">
</span><span class="cx"> class IDBCursorInfo;
</span><span class="cx"> class IDBError;
</span><ins>+class IDBGetAllResult;
</ins><span class="cx"> class IDBGetResult;
</span><span class="cx"> class IDBKeyData;
</span><span class="cx"> class IndexKey;
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx"> struct IDBKeyRangeData;
</span><span class="cx">
</span><span class="cx"> namespace IndexedDB {
</span><ins>+enum class GetAllType;
</ins><span class="cx"> enum class IndexRecordType;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -66,6 +68,7 @@
</span><span class="cx">
</span><span class="cx"> IDBGetResult getResultForKeyRange(IndexedDB::IndexRecordType, const IDBKeyRangeData&) const;
</span><span class="cx"> uint64_t countForKeyRange(const IDBKeyRangeData&);
</span><ins>+ void getAllRecords(const IDBKeyRangeData&, Optional<uint32_t> count, IndexedDB::GetAllType, IDBGetAllResult&) const;
</ins><span class="cx">
</span><span class="cx"> IDBError putIndexKey(const IDBKeyData&, const IndexKey&);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverSQLiteIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -1878,8 +1878,13 @@
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static const ASCIILiteral& queryForGetAllRecords(const IDBGetAllRecordsData& getAllRecordsData)
</del><ins>+IDBError SQLiteIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result)
</ins><span class="cx"> {
</span><ins>+ return getAllRecordsData.indexIdentifier ? getAllIndexRecords(transactionIdentifier, getAllRecordsData, result) : getAllObjectStoreRecords(transactionIdentifier, getAllRecordsData, result);
+}
+
+static const ASCIILiteral& queryForGetAllObjectStoreRecords(const IDBGetAllRecordsData& getAllRecordsData)
+{
</ins><span class="cx"> static NeverDestroyed<const ASCIILiteral> lowerOpenUpperOpenKey("SELECT key FROM Records WHERE objectStoreID = ? AND key > CAST(? AS TEXT) AND key < CAST(? AS TEXT) ORDER BY key;");
</span><span class="cx"> static NeverDestroyed<const ASCIILiteral> lowerOpenUpperClosedKey("SELECT key FROM Records WHERE objectStoreID = ? AND key > CAST(? AS TEXT) AND key <= CAST(? AS TEXT) ORDER BY key;");
</span><span class="cx"> static NeverDestroyed<const ASCIILiteral> lowerClosedUpperOpenKey("SELECT key FROM Records WHERE objectStoreID = ? AND key >= CAST(? AS TEXT) AND key < CAST(? AS TEXT) ORDER BY key;");
</span><span class="lines">@@ -1912,9 +1917,9 @@
</span><span class="cx"> return lowerClosedUpperClosedValue.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-IDBError SQLiteIDBBackingStore::getAllRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result)
</del><ins>+IDBError SQLiteIDBBackingStore::getAllObjectStoreRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result)
</ins><span class="cx"> {
</span><del>- LOG(IndexedDB, "SQLiteIDBBackingStore::getAllRecords");
</del><ins>+ LOG(IndexedDB, "SQLiteIDBBackingStore::getAllObjectStoreRecords");
</ins><span class="cx">
</span><span class="cx"> ASSERT(m_sqliteDB);
</span><span class="cx"> ASSERT(m_sqliteDB->isOpen());
</span><span class="lines">@@ -1943,7 +1948,7 @@
</span><span class="cx"> return { IDBDatabaseException::UnknownError, ASCIILiteral("Unable to serialize upper IDBKey in lookup range") };
</span><span class="cx"> }
</span><span class="cx">
</span><del>- SQLiteStatement sql(*m_sqliteDB, queryForGetAllRecords(getAllRecordsData));
</del><ins>+ SQLiteStatement sql(*m_sqliteDB, queryForGetAllObjectStoreRecords(getAllRecordsData));
</ins><span class="cx"> if (sql.prepare() != SQLITE_OK
</span><span class="cx"> || sql.bindInt64(1, getAllRecordsData.objectStoreIdentifier) != SQLITE_OK
</span><span class="cx"> || sql.bindBlob(2, lowerBuffer->data(), lowerBuffer->size()) != SQLITE_OK
</span><span class="lines">@@ -1954,11 +1959,14 @@
</span><span class="cx">
</span><span class="cx"> result = { getAllRecordsData.getAllType };
</span><span class="cx">
</span><ins>+ uint32_t targetResults;
+ if (getAllRecordsData.count && getAllRecordsData.count.value())
+ targetResults = getAllRecordsData.count.value();
+ else
+ targetResults = std::numeric_limits<uint32_t>::max();
+
</ins><span class="cx"> int sqlResult = sql.step();
</span><span class="cx"> uint32_t returnedResults = 0;
</span><del>- uint32_t targetResults = getAllRecordsData.count ? getAllRecordsData.count.value() : 0;
- if (!targetResults)
- targetResults = std::numeric_limits<uint32_t>::max();
</del><span class="cx">
</span><span class="cx"> while (sqlResult == SQLITE_ROW && returnedResults < targetResults) {
</span><span class="cx"> if (getAllRecordsData.getAllType == IndexedDB::GetAllType::Values) {
</span><span class="lines">@@ -2004,6 +2012,54 @@
</span><span class="cx"> return { IDBDatabaseException::UnknownError, ASCIILiteral("Error looking up record in object store by key range") };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+IDBError SQLiteIDBBackingStore::getAllIndexRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData& getAllRecordsData, IDBGetAllResult& result)
+{
+ LOG(IndexedDB, "SQLiteIDBBackingStore::getAllIndexRecords - %s", getAllRecordsData.keyRangeData.loggingString().utf8().data());
+
+ ASSERT(m_sqliteDB);
+ ASSERT(m_sqliteDB->isOpen());
+
+ auto* transaction = m_transactions.get(transactionIdentifier);
+ if (!transaction || !transaction->inProgress()) {
+ LOG_ERROR("Attempt to get all index records from database without an in-progress transaction");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to get all index records from database without an in-progress transaction") };
+ }
+
+ auto cursor = transaction->maybeOpenBackingStoreCursor(getAllRecordsData.objectStoreIdentifier, getAllRecordsData.indexIdentifier, getAllRecordsData.keyRangeData);
+ if (!cursor) {
+ LOG_ERROR("Cannot open cursor to perform index gets in database");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Cannot open cursor to perform index gets in database") };
+ }
+
+ if (cursor->didError()) {
+ LOG_ERROR("Cursor failed while looking up index records in database");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Cursor failed while looking up index records in database") };
+ }
+
+ result = { getAllRecordsData.getAllType };
+ uint32_t currentCount = 0;
+ uint32_t targetCount = getAllRecordsData.count ? getAllRecordsData.count.value() : 0;
+ if (!targetCount)
+ targetCount = std::numeric_limits<uint32_t>::max();
+ while (!cursor->didComplete() && !cursor->didError() && currentCount < targetCount) {
+ if (getAllRecordsData.getAllType == IndexedDB::GetAllType::Keys) {
+ IDBKeyData keyCopy = cursor->currentPrimaryKey();
+ result.addKey(WTFMove(keyCopy));
+ } else
+ result.addValue(cursor->currentValue() ? *cursor->currentValue() : IDBValue());
+
+ ++currentCount;
+ cursor->advance(1);
+ }
+
+ if (cursor->didError()) {
+ LOG_ERROR("Cursor failed while looking up index records in database");
+ return { IDBDatabaseException::UnknownError, ASCIILiteral("Cursor failed while looking up index records in database") };
+ }
+
+ return { };
+}
+
</ins><span class="cx"> IDBError SQLiteIDBBackingStore::getIndexRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, uint64_t indexID, IndexedDB::IndexRecordType type, const IDBKeyRangeData& range, IDBGetResult& getResult)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "SQLiteIDBBackingStore::getIndexRecord - %s", range.loggingString().utf8().data());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverSQLiteIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h (208260 => 208261)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h        2016-11-01 23:39:11 UTC (rev 208260)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h        2016-11-01 23:51:54 UTC (rev 208261)
</span><span class="lines">@@ -114,6 +114,9 @@
</span><span class="cx">
</span><span class="cx"> IDBError deleteUnusedBlobFileRecords(SQLiteIDBTransaction&);
</span><span class="cx">
</span><ins>+ IDBError getAllObjectStoreRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue);
+ IDBError getAllIndexRecords(const IDBResourceIdentifier& transactionIdentifier, const IDBGetAllRecordsData&, IDBGetAllResult& outValue);
+
</ins><span class="cx"> JSC::VM& vm();
</span><span class="cx"> JSC::JSGlobalObject& globalObject();
</span><span class="cx"> void initializeVM();
</span></span></pre>
</div>
</div>
</body>
</html>