<!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>[192800] 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/192800">192800</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-30 10:21:16 -0800 (Mon, 30 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
https://bugs.webkit.org/show_bug.cgi?id=151630

Reviewed by Andy Estes.

Source/WebCore:

No new tests (At least 4 failing tests now pass, and 9 other incorrect tests updated).

* Modules/indexeddb/IDBGetResult.cpp:
(WebCore::IDBGetResult::isolatedCopy):
* Modules/indexeddb/IDBGetResult.h:
(WebCore::IDBGetResult::IDBGetResult):
(WebCore::IDBGetResult::isDefined):

* Modules/indexeddb/client/IDBRequestImpl.cpp:
(WebCore::IDBClient::IDBRequest::didOpenOrIterateCursor): If the IDBGetResult is undefined,
  do not expose the cursor as the result property of the IDBRequest.

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/modern/cursor-2-expected.txt:
* storage/indexeddb/modern/cursor-2.html:
* storage/indexeddb/modern/cursor-3-expected.txt:
* storage/indexeddb/modern/cursor-3.html:
* storage/indexeddb/modern/cursor-4-expected.txt:
* storage/indexeddb/modern/cursor-4.html:
* storage/indexeddb/modern/deleteindex-1-expected.txt:
* storage/indexeddb/modern/deleteindex-1.html:
* storage/indexeddb/modern/deleteindex-2-expected.txt:
* storage/indexeddb/modern/deleteindex-2.html:
* storage/indexeddb/modern/index-4-expected.txt:
* storage/indexeddb/modern/index-4.html:
* storage/indexeddb/modern/index-cursor-1-expected.txt:
* storage/indexeddb/modern/index-cursor-1.html:
* storage/indexeddb/modern/index-cursor-2-expected.txt:
* storage/indexeddb/modern/index-cursor-2.html:
* storage/indexeddb/modern/index-cursor-3-expected.txt:
* storage/indexeddb/modern/index-cursor-3.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor2html">trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor3expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor3html">trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor4expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderncursor4html">trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex1html">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndeleteindex2html">trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindex4expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindex4html">trunk/LayoutTests/storage/indexeddb/modern/index-4.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor1html">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor2html">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor3expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernindexcursor3html">trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBGetResultcpp">trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBGetResulth">trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/ChangeLog        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-11-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
+        https://bugs.webkit.org/show_bug.cgi?id=151630
+
+        Reviewed by Andy Estes.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/modern/cursor-2-expected.txt:
+        * storage/indexeddb/modern/cursor-2.html:
+        * storage/indexeddb/modern/cursor-3-expected.txt:
+        * storage/indexeddb/modern/cursor-3.html:
+        * storage/indexeddb/modern/cursor-4-expected.txt:
+        * storage/indexeddb/modern/cursor-4.html:
+        * storage/indexeddb/modern/deleteindex-1-expected.txt:
+        * storage/indexeddb/modern/deleteindex-1.html:
+        * storage/indexeddb/modern/deleteindex-2-expected.txt:
+        * storage/indexeddb/modern/deleteindex-2.html:
+        * storage/indexeddb/modern/index-4-expected.txt:
+        * storage/indexeddb/modern/index-4.html:
+        * storage/indexeddb/modern/index-cursor-1-expected.txt:
+        * storage/indexeddb/modern/index-cursor-1.html:
+        * storage/indexeddb/modern/index-cursor-2-expected.txt:
+        * storage/indexeddb/modern/index-cursor-2.html:
+        * storage/indexeddb/modern/index-cursor-3-expected.txt:
+        * storage/indexeddb/modern/index-cursor-3.html:
+
</ins><span class="cx"> 2015-11-30  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking http/tests/cache/disk-cache/disk-cache-request-max-stale.html as flaky on Yosemite WK2
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -75,10 +75,13 @@
</span><span class="cx"> storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/bad-keypath.html [ Pass ]
</span><ins>+storage/indexeddb/mozilla/clear.html [ Pass ]
</ins><span class="cx"> storage/indexeddb/mozilla/create-index-unique.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/create-index-with-integer-keys.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/create-objectstore-basics.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/create-objectstore-null-name.html [ Pass ]
</span><ins>+storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Pass ]
+storage/indexeddb/mozilla/cursor-mutation.html [ Pass ]
</ins><span class="cx"> storage/indexeddb/mozilla/delete-result.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/event-source.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/global-data.html [ Pass ]
</span><span class="lines">@@ -98,6 +101,7 @@
</span><span class="cx"> storage/indexeddb/mozilla/readwrite-transactions.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/readyState.html [ Pass ]
</span><span class="cx"> storage/indexeddb/mozilla/remove-index.html [ Pass ]
</span><ins>+storage/indexeddb/mozilla/remove-objectstore.html [ Pass ]
</ins><span class="cx"> storage/indexeddb/mozilla/versionchange-abort.html [ Pass ]
</span><span class="cx"> 
</span><span class="cx"> # Fails with WebKit1 only.
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -77,13 +77,6 @@
</span><span class="cx"> Cursor key is: foo
</span><span class="cx"> Cursor value is: [object Object]
</span><span class="cx"> Cursor primary key is: foo
</span><del>-Success iterating next cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: next
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
</del><span class="cx"> Success iterating prev cursor
</span><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prev
</span><span class="lines">@@ -161,13 +154,6 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor value is: Record 0
</span><span class="cx"> Cursor primary key is: 0
</span><del>-Success iterating prev cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: prev
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
</del><span class="cx"> Initial upgrade versionchange transaction complete
</span><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -32,19 +32,23 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> var objectStore;
</span><del>-
</del><ins>+var shouldStartPrevious = true;
</ins><span class="cx"> function setupRequest(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result) {
+            if (shouldStartPrevious) {
+                setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), &quot;prev&quot;));
+                shouldStartPrevious = false;
+            }
+            return;
+        }
+
</ins><span class="cx">         log(&quot;Success iterating &quot; + request.result.direction + &quot; cursor&quot;);
</span><span class="cx">         logCursor(request.result);
</span><del>-        if (request.result.key != undefined)
-            request.result.continue();
-        else if (request.result.direction == &quot;next&quot;)
-            setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), &quot;prev&quot;));
-        // else
-        //     log(&quot;OKAY how?&quot;);
</del><ins>+        request.result.continue();
</ins><span class="cx">     }
</span><ins>+
</ins><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Error iterating cursor&quot;);
</span><span class="cx">         done();
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor3expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -46,13 +46,6 @@
</span><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: next
</span><span class="cx"> Cursor source is: [object IDBObjectStore] (TestObjectStore)
</span><del>-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: next
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
</del><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor value is: Record 0
</span><span class="cx"> Cursor primary key is: 0
</span><span class="lines">@@ -77,13 +70,6 @@
</span><span class="cx"> Cursor key is: 9
</span><span class="cx"> Cursor value is: Record 9
</span><span class="cx"> Cursor primary key is: 9
</span><del>-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: next
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
</del><span class="cx"> Initial upgrade versionchange transaction complete
</span><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor3html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -36,12 +36,13 @@
</span><span class="cx"> function setupRequest1(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result) {
+            setupRequest2(objectStore.openCursor());
+            return;
+        }
</ins><span class="cx">         log(&quot;Success iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);
</span><del>-        if (request.result.key != undefined)
-            request.result.continue(request.result.key + 2);
-        else
-          setupRequest2(objectStore.openCursor());
</del><ins>+        request.result.continue(request.result.key + 2);
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Error iterating cursor&quot;);
</span><span class="lines">@@ -52,10 +53,11 @@
</span><span class="cx"> function setupRequest2(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result)
+            return;
</ins><span class="cx">         log(&quot;Success iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);
</span><del>-        if (request.result.key != undefined)
-            request.result.advance(3);        
</del><ins>+        request.result.advance(3);        
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Error iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor4expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -39,13 +39,6 @@
</span><span class="cx"> Cursor is: [object IDBCursorWithValue]
</span><span class="cx"> Cursor direction is: prev
</span><span class="cx"> Cursor source is: [object IDBObjectStore] (TestObjectStore)
</span><del>-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: prev
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
</del><span class="cx"> Cursor key is: 9
</span><span class="cx"> Cursor value is: Record 9
</span><span class="cx"> Cursor primary key is: 9
</span><span class="lines">@@ -70,13 +63,6 @@
</span><span class="cx"> Cursor key is: 0
</span><span class="cx"> Cursor value is: Record 0
</span><span class="cx"> Cursor primary key is: 0
</span><del>-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: prev
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
-Cursor key is: undefined
-Cursor value is: undefined
-Cursor primary key is: undefined
</del><span class="cx"> Initial upgrade versionchange transaction complete
</span><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderncursor4html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -36,12 +36,13 @@
</span><span class="cx"> function setupRequest1(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result) {
+            setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), &quot;prev&quot;));
+            return;
+        }
</ins><span class="cx">         log(&quot;Success iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);
</span><del>-        if (request.result.key != undefined)
-            request.result.continue(request.result.key - 2);
-        else
-          setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), &quot;prev&quot;));
</del><ins>+        request.result.continue(request.result.key - 2);
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Error iterating cursor&quot;);
</span><span class="lines">@@ -52,10 +53,11 @@
</span><span class="cx"> function setupRequest2(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result)
+            return;
</ins><span class="cx">         log(&quot;Success iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);
</span><del>-        if (request.result.key != undefined)
-            request.result.advance(3);        
</del><ins>+        request.result.advance(3);        
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Error iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -3,7 +3,6 @@
</span><span class="cx"> Count is: 2
</span><span class="cx"> Cursor at record: A / 1
</span><span class="cx"> Cursor at record: A / 2
</span><del>-Cursor at record: undefined / undefined
</del><span class="cx"> Deleted the index
</span><span class="cx"> Initial upgrade versionchange transaction complete
</span><span class="cx"> Object store has indexes:
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex1html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -33,14 +33,14 @@
</span><span class="cx">     var cursorRequest = index.openCursor();
</span><span class="cx">     cursorRequest.onsuccess = function() {
</span><span class="cx">         var cursor = cursorRequest.result;
</span><del>-        log(&quot;Cursor at record: &quot; + cursor.key + &quot; / &quot; + cursor.primaryKey);
-        
-        if (cursor.key != undefined)
-            cursor.continue();
-        else {
</del><ins>+        if (!cursor) {
</ins><span class="cx">             objectStore.deleteIndex(&quot;TestIndex1&quot;);
</span><span class="cx">             log(&quot;Deleted the index&quot;);
</span><ins>+            return;
</ins><span class="cx">         }
</span><ins>+
+        log(&quot;Cursor at record: &quot; + cursor.key + &quot; / &quot; + cursor.primaryKey);
+        cursor.continue();
</ins><span class="cx">     }
</span><span class="cx">     cursorRequest.onerror = function(e) {
</span><span class="cx">         log(&quot;Unexpected error opening or iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -3,7 +3,6 @@
</span><span class="cx"> Count is: 2
</span><span class="cx"> Cursor at record: A / 1
</span><span class="cx"> Cursor at record: A / 2
</span><del>-Cursor at record: undefined / undefined
</del><span class="cx"> Initial upgrade versionchange transaction complete
</span><span class="cx"> Second upgrade needed: Old version - 1 New version - 2
</span><span class="cx"> Deleted the index
</span><span class="lines">@@ -13,7 +12,6 @@
</span><span class="cx"> Count is: 2
</span><span class="cx"> Cursor at record: A / 1
</span><span class="cx"> Cursor at record: A / 2
</span><del>-Cursor at record: undefined / undefined
</del><span class="cx"> Third upgrade versionchange transaction complete
</span><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndeleteindex2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -33,10 +33,11 @@
</span><span class="cx">     var cursorRequest = index.openCursor();
</span><span class="cx">     cursorRequest.onsuccess = function() {
</span><span class="cx">         var cursor = cursorRequest.result;
</span><ins>+        if (!cursor)
+            return;
+
</ins><span class="cx">         log(&quot;Cursor at record: &quot; + cursor.key + &quot; / &quot; + cursor.primaryKey);
</span><del>-        
-        if (cursor.key != undefined)
-            cursor.continue();
</del><ins>+        cursor.continue();
</ins><span class="cx">     }
</span><span class="cx">     cursorRequest.onerror = function(e) {
</span><span class="cx">         log(&quot;Unexpected error opening or iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindex4expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -19,6 +19,5 @@
</span><span class="cx"> Cursor at record: H / 16
</span><span class="cx"> Cursor at record: I / 17
</span><span class="cx"> Cursor at record: I / 18
</span><del>-Cursor at record: undefined / undefined
</del><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindex4html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-4.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-4.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-4.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -32,12 +32,13 @@
</span><span class="cx">     var cursorRequest = index.openCursor();
</span><span class="cx">     cursorRequest.onsuccess = function() {
</span><span class="cx">         var cursor = cursorRequest.result;
</span><ins>+        if (!cursor) {
+            done();
+            return;
+        }
</ins><span class="cx">         log(&quot;Cursor at record: &quot; + cursor.key + &quot; / &quot; + cursor.primaryKey);
</span><del>-        
-        if (cursor.key != undefined)
-            cursor.continue();
-        else
-            done();
</del><ins>+        cursor.continue();
+
</ins><span class="cx">     }
</span><span class="cx">     cursorRequest.onerror = function(e) {
</span><span class="cx">         log(&quot;Unexpected error opening or iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor1expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -76,12 +76,6 @@
</span><span class="cx"> Cursor key is: D
</span><span class="cx"> Cursor primary key is: 12
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index2, 'next')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -156,12 +150,6 @@
</span><span class="cx"> Cursor key is: d
</span><span class="cx"> Cursor primary key is: 12
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex2
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index1, 'nextunique')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -188,12 +176,6 @@
</span><span class="cx"> Cursor key is: D
</span><span class="cx"> Cursor primary key is: 10
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index2, 'nextunique')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -220,12 +202,6 @@
</span><span class="cx"> Cursor key is: d
</span><span class="cx"> Cursor primary key is: 10
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex2
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index1, 'prev')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -300,12 +276,6 @@
</span><span class="cx"> Cursor key is: A
</span><span class="cx"> Cursor primary key is: 1
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index2, 'prev')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -380,12 +350,6 @@
</span><span class="cx"> Cursor key is: a
</span><span class="cx"> Cursor primary key is: 1
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex2
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index1, 'prevunique')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -412,12 +376,6 @@
</span><span class="cx"> Cursor key is: A
</span><span class="cx"> Cursor primary key is: 3
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index2, 'prevunique')
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -444,11 +402,5 @@
</span><span class="cx"> Cursor key is: a
</span><span class="cx"> Cursor primary key is: 3
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex2
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor1html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -31,12 +31,13 @@
</span><span class="cx"> function setupRequest(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result) {
+            startNextCursor();
+            return;
+        }
</ins><span class="cx">         log(&quot;Success opening or iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);  
</span><del>-        if (request.result.key != undefined)
-            request.result.continue();
-        else
-            startNextCursor();
</del><ins>+        request.result.continue();
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Unexpected error opening or iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor2expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -21,12 +21,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 9
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'D', true, true))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -35,12 +29,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 7
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'D', true, true))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -61,12 +49,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 7
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'D', true, true))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -75,12 +57,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 9
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('next', IDBKeyRange.bound('B', 'C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -119,12 +95,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 9
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -139,12 +109,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 7
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -183,12 +147,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 4
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -203,12 +161,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 6
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('next', IDBKeyRange.upperBound('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -247,12 +199,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 6
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.upperBound('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -267,12 +213,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 4
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prev', IDBKeyRange.upperBound('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -311,12 +251,6 @@
</span><span class="cx"> Cursor key is: A
</span><span class="cx"> Cursor primary key is: 1
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.upperBound('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -331,12 +265,6 @@
</span><span class="cx"> Cursor key is: A
</span><span class="cx"> Cursor primary key is: 3
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('next', IDBKeyRange.lowerBound('C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -375,12 +303,6 @@
</span><span class="cx"> Cursor key is: D
</span><span class="cx"> Cursor primary key is: 12
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.lowerBound('C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -395,12 +317,6 @@
</span><span class="cx"> Cursor key is: D
</span><span class="cx"> Cursor primary key is: 10
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prev', IDBKeyRange.lowerBound('C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -439,12 +355,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 7
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.lowerBound('C'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -459,12 +369,6 @@
</span><span class="cx"> Cursor key is: C
</span><span class="cx"> Cursor primary key is: 9
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('next', IDBKeyRange.only('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -485,12 +389,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 6
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.only('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -499,12 +397,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 4
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prev', IDBKeyRange.only('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -525,12 +417,6 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 4
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.only('B'))
</span><span class="cx"> Success opening or iterating cursor
</span><span class="lines">@@ -539,11 +425,5 @@
</span><span class="cx"> Cursor key is: B
</span><span class="cx"> Cursor primary key is: 6
</span><span class="cx"> Cursor value is: [object Object]
</span><del>-Success opening or iterating cursor
-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor2html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -31,12 +31,13 @@
</span><span class="cx"> function setupRequest(request)
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><ins>+        if (!request.result) {
+            startNextCursor();
+            return;
+        }
</ins><span class="cx">         log(&quot;Success opening or iterating cursor&quot;);
</span><span class="cx">         logCursor(request.result);  
</span><del>-        if (request.result.key != undefined)
-            request.result.continue();
-        else
-            startNextCursor();
</del><ins>+        request.result.continue();
</ins><span class="cx">     }
</span><span class="cx">     request.onerror = function(e) {
</span><span class="cx">         log(&quot;Unexpected error opening or iterating cursor&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor3expectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -83,11 +83,6 @@
</span><span class="cx"> Cursor value is: [object Object]
</span><span class="cx"> Deleted key 18 from object store
</span><span class="cx"> Success opening or iterating cursor
</span><del>-Cursor direction is: next
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index, 'prev')
</span><span class="cx"> 
</span><span class="lines">@@ -171,11 +166,6 @@
</span><span class="cx"> Cursor value is: [object Object]
</span><span class="cx"> Deleted key 1 from object store
</span><span class="cx"> Success opening or iterating cursor
</span><del>-Cursor direction is: prev
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index, 'nextunique')
</span><span class="cx"> 
</span><span class="lines">@@ -241,11 +231,6 @@
</span><span class="cx"> Deleted key 18 from object store
</span><span class="cx"> Deleted key 1 from object store
</span><span class="cx"> Success opening or iterating cursor
</span><del>-Cursor direction is: nextunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> 
</span><span class="cx"> Starting a new cursor: testCursorDirection(index, 'prevunique')
</span><span class="cx"> 
</span><span class="lines">@@ -310,10 +295,5 @@
</span><span class="cx"> Cursor value is: [object Object]
</span><span class="cx"> Deleted key 1 from object store
</span><span class="cx"> Success opening or iterating cursor
</span><del>-Cursor direction is: prevunique
-Cursor source is: TestIndex1
-Cursor key is: undefined
-Cursor primary key is: undefined
-Cursor value is: undefined
</del><span class="cx"> Done
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernindexcursor3html"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -35,9 +35,10 @@
</span><span class="cx"> {
</span><span class="cx">     request.onsuccess = function() {
</span><span class="cx">         log(&quot;Success opening or iterating cursor&quot;);
</span><del>-        logCursor(request.result);
</del><ins>+        if (request.result)
+            logCursor(request.result);
</ins><span class="cx"> 
</span><del>-        if (request.iteratedOnce) {
</del><ins>+        if (request.result &amp;&amp; request.iteratedOnce) {
</ins><span class="cx">             var primaryKey = request.result.primaryKey;
</span><span class="cx">             if (primaryKey) {
</span><span class="cx">                 objectStore.delete(primaryKey).onsuccess = function() {
</span><span class="lines">@@ -79,7 +80,7 @@
</span><span class="cx">      
</span><span class="cx">         request.iteratedOnce = true;
</span><span class="cx"> 
</span><del>-        if (request.result.key != undefined)
</del><ins>+        if (request.result)
</ins><span class="cx">             request.result.continue();
</span><span class="cx">         else
</span><span class="cx">             startNextCursor();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/Source/WebCore/ChangeLog        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2015-11-30  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
+        https://bugs.webkit.org/show_bug.cgi?id=151630
+
+        Reviewed by Andy Estes.
+
+        No new tests (At least 4 failing tests now pass, and 9 other incorrect tests updated).
+
+        * Modules/indexeddb/IDBGetResult.cpp:
+        (WebCore::IDBGetResult::isolatedCopy):
+        * Modules/indexeddb/IDBGetResult.h:
+        (WebCore::IDBGetResult::IDBGetResult):
+        (WebCore::IDBGetResult::isDefined):
+
+        * Modules/indexeddb/client/IDBRequestImpl.cpp:
+        (WebCore::IDBClient::IDBRequest::didOpenOrIterateCursor): If the IDBGetResult is undefined,
+          do not expose the cursor as the result property of the IDBRequest.
+
+2015-11-30  Brady Eidson  &lt;beidson@apple.com&gt;
+
</ins><span class="cx">         Modern IDB: Support keyPath injection into object store records.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=151640
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBGetResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     result.m_keyData = m_keyData.isolatedCopy();
</span><span class="cx">     result.m_primaryKeyData = m_primaryKeyData.isolatedCopy();
</span><span class="cx">     result.m_keyPath = m_keyPath.isolatedCopy();
</span><ins>+    result.m_isDefined = m_isDefined;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBGetResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> class IDBGetResult {
</span><span class="cx"> public:
</span><span class="cx">     IDBGetResult()
</span><ins>+        : m_isDefined(false)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -90,6 +91,7 @@
</span><span class="cx">     const IDBKeyData&amp; keyData() const { return m_keyData; }
</span><span class="cx">     const IDBKeyData&amp; primaryKeyData() const { return m_primaryKeyData; }
</span><span class="cx">     const IDBKeyPath&amp; keyPath() const { return m_keyPath; }
</span><ins>+    bool isDefined() const { return m_isDefined; }
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: When removing LegacyIDB, remove these setters.
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=150854
</span><span class="lines">@@ -106,6 +108,7 @@
</span><span class="cx">     IDBKeyData m_keyData;
</span><span class="cx">     IDBKeyData m_primaryKeyData;
</span><span class="cx">     IDBKeyPath m_keyPath;
</span><ins>+    bool m_isDefined { true };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBRequestImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (192799 => 192800)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp        2015-11-30 18:21:16 UTC (rev 192800)
</span><span class="lines">@@ -324,10 +324,14 @@
</span><span class="cx"> void IDBRequest::didOpenOrIterateCursor(const IDBResultData&amp; resultData)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_pendingCursor);
</span><del>-    if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess)
</del><ins>+    m_result = nullptr;
+
+    if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
</ins><span class="cx">         m_pendingCursor-&gt;setGetResult(*this, resultData.getResult());
</span><ins>+        if (resultData.getResult().isDefined())
+            m_result = IDBAny::create(*m_pendingCursor);
+    }
</ins><span class="cx"> 
</span><del>-    m_result = IDBAny::create(*m_pendingCursor);
</del><span class="cx">     m_pendingCursor = nullptr;
</span><span class="cx"> 
</span><span class="cx">     requestCompleted(resultData);
</span></span></pre>
</div>
</div>

</body>
</html>