<!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>[207845] 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/207845">207845</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-10-25 14:42:57 -0700 (Tue, 25 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
<rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
Reviewed by Andy Estes.
LayoutTests/imported/w3c:
* web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt:
Source/WebCore:
No new tests (Covered by changes to existing tests)
* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::create):
* Modules/indexeddb/IDBCursor.h:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::openCursor):
(WebCore::IDBObjectStore::openKeyCursor):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::requestOpenCursor):
* Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
(WebCore::IDBServer::MemoryObjectStoreCursor::currentData): Only grab the current value
if the cursor is KeyAndValue.
* Modules/indexeddb/server/SQLiteIDBCursor.cpp:
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
(WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Only save off the data for an
object store cursor if it's both KeyAndValue.
* Modules/indexeddb/server/SQLiteIDBCursor.h:
* Modules/indexeddb/shared/IDBCursorInfo.cpp:
(WebCore::IDBCursorInfo::objectStoreCursor): Allow for a KeyOnly ObjectStoreCursor.
* Modules/indexeddb/shared/IDBCursorInfo.h:
LayoutTests:
* storage/indexeddb/modern/cursor-1-expected.txt:
* storage/indexeddb/modern/cursor-1-private-expected.txt:
* storage/indexeddb/modern/resources/cursor-1.js:</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="#trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbobjectstore_openKeyCursorexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor1privateexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/cursor-1-private-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernresourcescursor1js">trunk/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorcpp">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBCursorh">trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreCursorcpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverSQLiteIDBCursorcpp">trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverSQLiteIDBCursorh">trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfocpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfoh">trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/ChangeLog        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2016-10-25 Brady Eidson <beidson@apple.com>
+
+ IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
+ <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
+
+ Reviewed by Andy Estes.
+
+ * storage/indexeddb/modern/cursor-1-expected.txt:
+ * storage/indexeddb/modern/cursor-1-private-expected.txt:
+ * storage/indexeddb/modern/resources/cursor-1.js:
+
</ins><span class="cx"> 2016-10-25 Michael Catanzaro <mcatanzaro@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed GTK test gardening
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -1,5 +1,14 @@
</span><span class="cx"> 2016-10-25 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><ins>+ IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
+ <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
+
+ Reviewed by Andy Estes.
+
+ * web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt:
+
+2016-10-25 Brady Eidson <beidson@apple.com>
+
</ins><span class="cx"> IndexedDB 2.0: Support new IDBTransaction interfaces.
</span><span class="cx"> <rdar://problem/28806928> and https://bugs.webkit.org/show_bug.cgi?id=163927
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestsIndexedDBidbobjectstore_openKeyCursorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_openKeyCursor-expected.txt        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx">
</span><del>-FAIL IDBObjectStore.openKeyCursor() - forward iteration store.openKeyCursor is not a function. (In 'store.openKeyCursor()', 'store.openKeyCursor' is undefined)
-FAIL IDBObjectStore.openKeyCursor() - reverse iteration store.openKeyCursor is not a function. (In 'store.openKeyCursor(null, "prev")', 'store.openKeyCursor' is undefined)
-FAIL IDBObjectStore.openKeyCursor() - forward iteration with range store.openKeyCursor is not a function. (In 'store.openKeyCursor(IDBKeyRange.bound(4, 6))', 'store.openKeyCursor' is undefined)
-FAIL IDBObjectStore.openKeyCursor() - reverse iteration with range store.openKeyCursor is not a function. (In 'store.openKeyCursor(IDBKeyRange.bound(4, 6), "prev")', 'store.openKeyCursor' is undefined)
-FAIL IDBObjectStore.openKeyCursor() - invalid inputs assert_throws: openKeyCursor should throw on invalid number key function "function () { store.openKeyCursor(NaN); }" threw object "TypeError: store.openKeyCursor is not a function. (In 'st..." that is not a DOMException DataError: property "code" is equal to undefined, expected 0
</del><ins>+PASS IDBObjectStore.openKeyCursor() - forward iteration
+PASS IDBObjectStore.openKeyCursor() - reverse iteration
+PASS IDBObjectStore.openKeyCursor() - forward iteration with range
+PASS IDBObjectStore.openKeyCursor() - reverse iteration with range
+PASS IDBObjectStore.openKeyCursor() - invalid inputs
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-1-expected.txt        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -15,6 +15,12 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor primary key is: 0
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: next
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: 0
+Cursor primary key is: 0
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: next
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -33,6 +39,12 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor primary key is: 0
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: nextunique
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: 0
+Cursor primary key is: 0
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: nextunique
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -51,6 +63,12 @@
</span><span class="cx"> Cursor key is: foo
</span><span class="cx"> Cursor primary key is: foo
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: prev
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: foo
+Cursor primary key is: foo
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prev
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -69,6 +87,12 @@
</span><span class="cx"> Cursor key is: foo
</span><span class="cx"> Cursor primary key is: foo
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: prevunique
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: foo
+Cursor primary key is: foo
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prevunique
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor1privateexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-1-private-expected.txt (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-1-private-expected.txt        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-1-private-expected.txt        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -15,6 +15,12 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor primary key is: 0
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: next
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: 0
+Cursor primary key is: 0
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: next
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -33,6 +39,12 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor primary key is: 0
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: nextunique
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: 0
+Cursor primary key is: 0
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: nextunique
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -51,6 +63,12 @@
</span><span class="cx"> Cursor key is: foo
</span><span class="cx"> Cursor primary key is: foo
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: prev
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: foo
+Cursor primary key is: foo
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prev
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span><span class="lines">@@ -69,6 +87,12 @@
</span><span class="cx"> Cursor key is: foo
</span><span class="cx"> Cursor primary key is: foo
</span><span class="cx"> Success opening cursor
</span><ins>+Cursor is: [object IDBCursor]
+Cursor direction is: prevunique
+Cursor source is: [object IDBObjectStore] (TestObjectStore)
+Cursor key is: foo
+Cursor primary key is: foo
+Success opening cursor
</ins><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prevunique
</span><span class="cx"> Cursor source is: [object IDBIndex] (TestIndex1)
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernresourcescursor1js"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/LayoutTests/storage/indexeddb/modern/resources/cursor-1.js        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -44,6 +44,8 @@
</span><span class="cx"> var range = IDBKeyRange.lowerBound(-Infinity);
</span><span class="cx"> var request = objectStore.openCursor(range, direction);
</span><span class="cx"> setupRequest(request);
</span><ins>+ request = objectStore.openKeyCursor(range, direction);
+ setupRequest(request);
</ins><span class="cx"> request = index.openCursor(range, direction);
</span><span class="cx"> setupRequest(request);
</span><span class="cx"> request = index.openKeyCursor(range, direction);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/ChangeLog        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-10-25 Brady Eidson <beidson@apple.com>
+
+ IndexedDB 2.0: Support IDBObjectStore openKeyCursor.
+ <rdar://problem/28806930> and https://bugs.webkit.org/show_bug.cgi?id=163954
+
+ Reviewed by Andy Estes.
+
+ No new tests (Covered by changes to existing tests)
+
+ * Modules/indexeddb/IDBCursor.cpp:
+ (WebCore::IDBCursor::create):
+ * Modules/indexeddb/IDBCursor.h:
+
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::openCursor):
+ (WebCore::IDBObjectStore::openKeyCursor):
+ * Modules/indexeddb/IDBObjectStore.h:
+ * Modules/indexeddb/IDBObjectStore.idl:
+
+ * Modules/indexeddb/IDBTransaction.cpp:
+ (WebCore::IDBTransaction::requestOpenCursor):
+
+ * Modules/indexeddb/server/MemoryObjectStoreCursor.cpp:
+ (WebCore::IDBServer::MemoryObjectStoreCursor::currentData): Only grab the current value
+ if the cursor is KeyAndValue.
+
+ * Modules/indexeddb/server/SQLiteIDBCursor.cpp:
+ (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
+ (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce): Only save off the data for an
+ object store cursor if it's both KeyAndValue.
+ * Modules/indexeddb/server/SQLiteIDBCursor.h:
+
+ * Modules/indexeddb/shared/IDBCursorInfo.cpp:
+ (WebCore::IDBCursorInfo::objectStoreCursor): Allow for a KeyOnly ObjectStoreCursor.
+ * Modules/indexeddb/shared/IDBCursorInfo.h:
+
</ins><span class="cx"> 2016-10-25 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Support InputEvent.dataTransfer for the InputEvent spec
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -106,6 +106,11 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBObjectStore& objectStore, const IDBCursorInfo& info)
+{
+ return adoptRef(*new IDBCursor(transaction, objectStore, info));
+}
+
</ins><span class="cx"> Ref<IDBCursor> IDBCursor::create(IDBTransaction& transaction, IDBIndex& index, const IDBCursorInfo& info)
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(*new IDBCursor(transaction, index, info));
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBCursorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursor.h        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">
</span><span class="cx"> class IDBCursor : public ScriptWrappable, public RefCounted<IDBCursor>, public ActiveDOMObject {
</span><span class="cx"> public:
</span><ins>+ static Ref<IDBCursor> create(IDBTransaction&, IDBObjectStore&, const IDBCursorInfo&);
</ins><span class="cx"> static Ref<IDBCursor> create(IDBTransaction&, IDBIndex&, const IDBCursorInfo&);
</span><span class="cx">
</span><span class="cx"> static const AtomicString& directionNext();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx"> return m_info.autoIncrement();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, IDBKeyRange* range, const String& directionString)
</del><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openCursor(ExecState& execState, RefPtr<IDBKeyRange> range, const String& directionString)
</ins><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::openCursor");
</span><span class="cx"> ASSERT(currentThread() == m_transaction->database().originThreadID());
</span><span class="lines">@@ -165,7 +165,7 @@
</span><span class="cx"> if (!direction)
</span><span class="cx"> return Exception { TypeError };
</span><span class="cx">
</span><del>- auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range, direction.value());
</del><ins>+ auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range.get(), direction.value(), IndexedDB::CursorType::KeyAndValue);
</ins><span class="cx"> return m_transaction->requestOpenCursor(execState, *this, info);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -175,9 +175,37 @@
</span><span class="cx"> if (onlyResult.hasException())
</span><span class="cx"> return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openCursor' on 'IDBObjectStore': The parameter is not a valid key.") };
</span><span class="cx">
</span><del>- return openCursor(execState, onlyResult.releaseReturnValue().ptr(), direction);
</del><ins>+ return openCursor(execState, onlyResult.releaseReturnValue(), direction);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, RefPtr<IDBKeyRange> range, const String& directionString)
+{
+ LOG(IndexedDB, "IDBObjectStore::openCursor");
+ ASSERT(currentThread() == m_transaction->database().originThreadID());
+
+ if (m_deleted)
+ return Exception { IDBDatabaseException::InvalidStateError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBObjectStore': The object store has been deleted.") };
+
+ if (!m_transaction->isActive())
+ return Exception { IDBDatabaseException::TransactionInactiveError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBObjectStore': The transaction is inactive or finished.") };
+
+ auto direction = IDBCursor::stringToDirection(directionString);
+ if (!direction)
+ return Exception { TypeError };
+
+ auto info = IDBCursorInfo::objectStoreCursor(m_transaction.get(), m_info.identifier(), range.get(), direction.value(), IndexedDB::CursorType::KeyOnly);
+ return m_transaction->requestOpenCursor(execState, *this, info);
+}
+
+ExceptionOr<Ref<IDBRequest>> IDBObjectStore::openKeyCursor(ExecState& execState, JSValue key, const String& direction)
+{
+ auto onlyResult = IDBKeyRange::only(execState, key);
+ if (onlyResult.hasException())
+ return Exception { IDBDatabaseException::DataError, ASCIILiteral("Failed to execute 'openKeyCursor' on 'IDBObjectStore': The parameter is not a valid key or key range.") };
+
+ return openKeyCursor(execState, onlyResult.releaseReturnValue(), direction);
+}
+
</ins><span class="cx"> ExceptionOr<Ref<IDBRequest>> IDBObjectStore::get(ExecState& execState, JSValue key)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBObjectStore::get");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -72,8 +72,10 @@
</span><span class="cx"> bool multiEntry;
</span><span class="cx"> };
</span><span class="cx">
</span><del>- ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction);
</del><ins>+ ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, const String& direction);
</ins><span class="cx"> ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
</span><ins>+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, RefPtr<IDBKeyRange>, const String& direction);
+ ExceptionOr<Ref<IDBRequest>> openKeyCursor(JSC::ExecState&, JSC::JSValue key, const String& direction);
</ins><span class="cx"> ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, JSC::JSValue key);
</span><span class="cx"> ExceptionOr<Ref<IDBRequest>> get(JSC::ExecState&, IDBKeyRange*);
</span><span class="cx"> ExceptionOr<Ref<IDBRequest>> add(JSC::ExecState&, JSC::JSValue, JSC::JSValue key);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -45,6 +45,8 @@
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest clear();
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
</span><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBRequest openCursor(any key, optional DOMString direction = "next");
</span><ins>+ [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(optional IDBKeyRange? range = null, optional DOMString direction = "next");
+ [CallWith=ScriptState, MayThrowException] IDBRequest openKeyCursor(any key, optional DOMString direction = "next");
</ins><span class="cx"> [CallWith=ScriptState, MayThrowException] IDBIndex createIndex(DOMString name, (DOMString or sequence<DOMString>) keyPath, optional IDBIndexParameters options);
</span><span class="cx"> [MayThrowException] IDBIndex index(DOMString name);
</span><span class="cx"> [MayThrowException] void deleteIndex(DOMString name);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -731,6 +731,9 @@
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::requestOpenCursor");
</span><span class="cx"> ASSERT(currentThread() == m_database->originThreadID());
</span><span class="cx">
</span><ins>+ if (info.cursorType() == IndexedDB::CursorType::KeyOnly)
+ return doRequestOpenCursor(execState, IDBCursor::create(*this, objectStore, info));
+
</ins><span class="cx"> return doRequestOpenCursor(execState, IDBCursorWithValue::create(*this, objectStore, info));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStoreCursor.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -190,8 +190,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> m_currentPositionKey = **m_iterator;
</span><del>- IDBValue value = { m_objectStore.valueForKeyRange(m_currentPositionKey), { }, { } };
- data = { m_currentPositionKey, m_currentPositionKey, WTFMove(value) };
</del><ins>+ if (m_info.cursorType() == IndexedDB::CursorType::KeyOnly)
+ data = { m_currentPositionKey, m_currentPositionKey };
+ else {
+ IDBValue value = { m_objectStore.valueForKeyRange(m_currentPositionKey), { }, { } };
+ data = { m_currentPositionKey, m_currentPositionKey, WTFMove(value) };
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void MemoryObjectStoreCursor::incrementForwardIterator(std::set<IDBKeyData>& set, const IDBKeyData& key, uint32_t count)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverSQLiteIDBCursorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> , m_objectStoreID(info.objectStoreIdentifier())
</span><span class="cx"> , m_indexID(info.cursorSource() == IndexedDB::CursorSource::Index ? info.sourceIdentifier() : IDBIndexInfo::InvalidId)
</span><span class="cx"> , m_cursorDirection(info.cursorDirection())
</span><ins>+ , m_cursorType(info.cursorType())
</ins><span class="cx"> , m_keyRange(info.range())
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_objectStoreID);
</span><span class="lines">@@ -85,6 +86,7 @@
</span><span class="cx"> , m_objectStoreID(objectStoreID)
</span><span class="cx"> , m_indexID(indexID ? indexID : IDBIndexInfo::InvalidId)
</span><span class="cx"> , m_cursorDirection(IndexedDB::CursorDirection::Next)
</span><ins>+ , m_cursorType(IndexedDB::CursorType::KeyAndValue)
</ins><span class="cx"> , m_keyRange(range)
</span><span class="cx"> , m_backingStoreCursor(true)
</span><span class="cx"> {
</span><span class="lines">@@ -396,7 +398,8 @@
</span><span class="cx"> return AdvanceResult::Failure;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- m_currentValue = std::make_unique<IDBValue>(ThreadSafeDataBuffer::adoptVector(keyData), blobURLs, blobFilePaths);
</del><ins>+ if (m_cursorType == IndexedDB::CursorType::KeyAndValue)
+ m_currentValue = std::make_unique<IDBValue>(ThreadSafeDataBuffer::adoptVector(keyData), blobURLs, blobFilePaths);
</ins><span class="cx"> } else {
</span><span class="cx"> if (!deserializeIDBKeyData(keyData.data(), keyData.size(), m_currentPrimaryKey)) {
</span><span class="cx"> LOG_ERROR("Unable to deserialize value data from database while advancing index cursor");
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverSQLiteIDBCursorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBCursor.h        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -96,6 +96,7 @@
</span><span class="cx"> int64_t m_objectStoreID;
</span><span class="cx"> int64_t m_indexID { IDBIndexInfo::InvalidId };
</span><span class="cx"> IndexedDB::CursorDirection m_cursorDirection { IndexedDB::CursorDirection::Next };
</span><ins>+ IndexedDB::CursorType m_cursorType;
</ins><span class="cx"> IDBKeyRangeData m_keyRange;
</span><span class="cx">
</span><span class="cx"> IDBKeyData m_currentLowerKey;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfocpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.cpp        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -34,9 +34,9 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-IDBCursorInfo IDBCursorInfo::objectStoreCursor(IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction)
</del><ins>+IDBCursorInfo IDBCursorInfo::objectStoreCursor(IDBTransaction& transaction, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</ins><span class="cx"> {
</span><del>- return { transaction, objectStoreIdentifier, range, direction, IndexedDB::CursorType::KeyAndValue };
</del><ins>+ return { transaction, objectStoreIdentifier, range, direction, type };
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> IDBCursorInfo IDBCursorInfo::indexCursor(IDBTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData& range, IndexedDB::CursorDirection direction, IndexedDB::CursorType type)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBCursorInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h (207844 => 207845)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h        2016-10-25 21:31:14 UTC (rev 207844)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBCursorInfo.h        2016-10-25 21:42:57 UTC (rev 207845)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">
</span><span class="cx"> class IDBCursorInfo {
</span><span class="cx"> public:
</span><del>- static IDBCursorInfo objectStoreCursor(IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection);
</del><ins>+ static IDBCursorInfo objectStoreCursor(IDBTransaction&, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</ins><span class="cx"> static IDBCursorInfo indexCursor(IDBTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const IDBKeyRangeData&, IndexedDB::CursorDirection, IndexedDB::CursorType);
</span><span class="cx">
</span><span class="cx"> IDBResourceIdentifier identifier() const { return m_cursorIdentifier; }
</span></span></pre>
</div>
</div>
</body>
</html>