Title: [192800] trunk
Revision
192800
Author
beid...@apple.com
Date
2015-11-30 10:21:16 -0800 (Mon, 30 Nov 2015)

Log Message

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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (192799 => 192800)


--- trunk/LayoutTests/ChangeLog	2015-11-30 18:15:02 UTC (rev 192799)
+++ trunk/LayoutTests/ChangeLog	2015-11-30 18:21:16 UTC (rev 192800)
@@ -1,3 +1,30 @@
+2015-11-30  Brady Eidson  <beid...@apple.com>
+
+        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:
+
 2015-11-30  Ryan Haddad  <ryanhad...@apple.com>
 
         Marking http/tests/cache/disk-cache/disk-cache-request-max-stale.html as flaky on Yosemite WK2

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (192799 => 192800)


--- 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)
@@ -75,10 +75,13 @@
 storage/indexeddb/mozilla/add-twice-failure.html [ Pass ]
 storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]
 storage/indexeddb/mozilla/bad-keypath.html [ Pass ]
+storage/indexeddb/mozilla/clear.html [ Pass ]
 storage/indexeddb/mozilla/create-index-unique.html [ Pass ]
 storage/indexeddb/mozilla/create-index-with-integer-keys.html [ Pass ]
 storage/indexeddb/mozilla/create-objectstore-basics.html [ Pass ]
 storage/indexeddb/mozilla/create-objectstore-null-name.html [ Pass ]
+storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Pass ]
+storage/indexeddb/mozilla/cursor-mutation.html [ Pass ]
 storage/indexeddb/mozilla/delete-result.html [ Pass ]
 storage/indexeddb/mozilla/event-source.html [ Pass ]
 storage/indexeddb/mozilla/global-data.html [ Pass ]
@@ -98,6 +101,7 @@
 storage/indexeddb/mozilla/readwrite-transactions.html [ Pass ]
 storage/indexeddb/mozilla/readyState.html [ Pass ]
 storage/indexeddb/mozilla/remove-index.html [ Pass ]
+storage/indexeddb/mozilla/remove-objectstore.html [ Pass ]
 storage/indexeddb/mozilla/versionchange-abort.html [ Pass ]
 
 # Fails with WebKit1 only.

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt (192799 => 192800)


--- 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)
@@ -77,13 +77,6 @@
 Cursor key is: foo
 Cursor value is: [object Object]
 Cursor primary key is: foo
-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
 Success iterating prev cursor
 Cursor is: [object IDBCursorWithValue]
 Cursor direction is: prev
@@ -161,13 +154,6 @@
 Cursor key is: 0
 Cursor value is: Record 0
 Cursor primary key is: 0
-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
 Initial upgrade versionchange transaction complete
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html (192799 => 192800)


--- 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)
@@ -32,19 +32,23 @@
 }
 
 var objectStore;
-
+var shouldStartPrevious = true;
 function setupRequest(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result) {
+            if (shouldStartPrevious) {
+                setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
+                shouldStartPrevious = false;
+            }
+            return;
+        }
+
         log("Success iterating " + request.result.direction + " cursor");
         logCursor(request.result);
-        if (request.result.key != undefined)
-            request.result.continue();
-        else if (request.result.direction == "next")
-            setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
-        // else
-        //     log("OKAY how?");
+        request.result.continue();
     }
+
     request._onerror_ = function(e) {
         log("Error iterating cursor");
         done();

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt (192799 => 192800)


--- 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)
@@ -46,13 +46,6 @@
 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
-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: next
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
 Cursor key is: 0
 Cursor value is: Record 0
 Cursor primary key is: 0
@@ -77,13 +70,6 @@
 Cursor key is: 9
 Cursor value is: Record 9
 Cursor primary key is: 9
-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
 Initial upgrade versionchange transaction complete
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html (192799 => 192800)


--- 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)
@@ -36,12 +36,13 @@
 function setupRequest1(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result) {
+            setupRequest2(objectStore.openCursor());
+            return;
+        }
         log("Success iterating cursor");
         logCursor(request.result);
-        if (request.result.key != undefined)
-            request.result.continue(request.result.key + 2);
-        else
-          setupRequest2(objectStore.openCursor());
+        request.result.continue(request.result.key + 2);
     }
     request._onerror_ = function(e) {
         log("Error iterating cursor");
@@ -52,10 +53,11 @@
 function setupRequest2(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result)
+            return;
         log("Success iterating cursor");
         logCursor(request.result);
-        if (request.result.key != undefined)
-            request.result.advance(3);        
+        request.result.advance(3);        
     }
     request._onerror_ = function(e) {
         log("Error iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt (192799 => 192800)


--- 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)
@@ -39,13 +39,6 @@
 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
-Success iterating cursor
-Cursor is: [object IDBCursorWithValue]
-Cursor direction is: prev
-Cursor source is: [object IDBObjectStore] (TestObjectStore)
 Cursor key is: 9
 Cursor value is: Record 9
 Cursor primary key is: 9
@@ -70,13 +63,6 @@
 Cursor key is: 0
 Cursor value is: Record 0
 Cursor primary key is: 0
-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
 Initial upgrade versionchange transaction complete
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html (192799 => 192800)


--- 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)
@@ -36,12 +36,13 @@
 function setupRequest1(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result) {
+            setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
+            return;
+        }
         log("Success iterating cursor");
         logCursor(request.result);
-        if (request.result.key != undefined)
-            request.result.continue(request.result.key - 2);
-        else
-          setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
+        request.result.continue(request.result.key - 2);
     }
     request._onerror_ = function(e) {
         log("Error iterating cursor");
@@ -52,10 +53,11 @@
 function setupRequest2(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result)
+            return;
         log("Success iterating cursor");
         logCursor(request.result);
-        if (request.result.key != undefined)
-            request.result.advance(3);        
+        request.result.advance(3);        
     }
     request._onerror_ = function(e) {
         log("Error iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt (192799 => 192800)


--- 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)
@@ -3,7 +3,6 @@
 Count is: 2
 Cursor at record: A / 1
 Cursor at record: A / 2
-Cursor at record: undefined / undefined
 Deleted the index
 Initial upgrade versionchange transaction complete
 Object store has indexes:

Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html (192799 => 192800)


--- 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)
@@ -33,14 +33,14 @@
     var cursorRequest = index.openCursor();
     cursorRequest._onsuccess_ = function() {
         var cursor = cursorRequest.result;
-        log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
-        
-        if (cursor.key != undefined)
-            cursor.continue();
-        else {
+        if (!cursor) {
             objectStore.deleteIndex("TestIndex1");
             log("Deleted the index");
+            return;
         }
+
+        log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
+        cursor.continue();
     }
     cursorRequest._onerror_ = function(e) {
         log("Unexpected error opening or iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt (192799 => 192800)


--- 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)
@@ -3,7 +3,6 @@
 Count is: 2
 Cursor at record: A / 1
 Cursor at record: A / 2
-Cursor at record: undefined / undefined
 Initial upgrade versionchange transaction complete
 Second upgrade needed: Old version - 1 New version - 2
 Deleted the index
@@ -13,7 +12,6 @@
 Count is: 2
 Cursor at record: A / 1
 Cursor at record: A / 2
-Cursor at record: undefined / undefined
 Third upgrade versionchange transaction complete
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html (192799 => 192800)


--- 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)
@@ -33,10 +33,11 @@
     var cursorRequest = index.openCursor();
     cursorRequest._onsuccess_ = function() {
         var cursor = cursorRequest.result;
+        if (!cursor)
+            return;
+
         log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
-        
-        if (cursor.key != undefined)
-            cursor.continue();
+        cursor.continue();
     }
     cursorRequest._onerror_ = function(e) {
         log("Unexpected error opening or iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt (192799 => 192800)


--- 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)
@@ -19,6 +19,5 @@
 Cursor at record: H / 16
 Cursor at record: I / 17
 Cursor at record: I / 18
-Cursor at record: undefined / undefined
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-4.html (192799 => 192800)


--- 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)
@@ -32,12 +32,13 @@
     var cursorRequest = index.openCursor();
     cursorRequest._onsuccess_ = function() {
         var cursor = cursorRequest.result;
+        if (!cursor) {
+            done();
+            return;
+        }
         log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
-        
-        if (cursor.key != undefined)
-            cursor.continue();
-        else
-            done();
+        cursor.continue();
+
     }
     cursorRequest._onerror_ = function(e) {
         log("Unexpected error opening or iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt (192799 => 192800)


--- 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)
@@ -76,12 +76,6 @@
 Cursor key is: D
 Cursor primary key is: 12
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index2, 'next')
 Success opening or iterating cursor
@@ -156,12 +150,6 @@
 Cursor key is: d
 Cursor primary key is: 12
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index1, 'nextunique')
 Success opening or iterating cursor
@@ -188,12 +176,6 @@
 Cursor key is: D
 Cursor primary key is: 10
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index2, 'nextunique')
 Success opening or iterating cursor
@@ -220,12 +202,6 @@
 Cursor key is: d
 Cursor primary key is: 10
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index1, 'prev')
 Success opening or iterating cursor
@@ -300,12 +276,6 @@
 Cursor key is: A
 Cursor primary key is: 1
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index2, 'prev')
 Success opening or iterating cursor
@@ -380,12 +350,6 @@
 Cursor key is: a
 Cursor primary key is: 1
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index1, 'prevunique')
 Success opening or iterating cursor
@@ -412,12 +376,6 @@
 Cursor key is: A
 Cursor primary key is: 3
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection(index2, 'prevunique')
 Success opening or iterating cursor
@@ -444,11 +402,5 @@
 Cursor key is: a
 Cursor primary key is: 3
 Cursor value is: [object Object]
-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
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html (192799 => 192800)


--- 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)
@@ -31,12 +31,13 @@
 function setupRequest(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result) {
+            startNextCursor();
+            return;
+        }
         log("Success opening or iterating cursor");
         logCursor(request.result);  
-        if (request.result.key != undefined)
-            request.result.continue();
-        else
-            startNextCursor();
+        request.result.continue();
     }
     request._onerror_ = function(e) {
         log("Unexpected error opening or iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt (192799 => 192800)


--- 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)
@@ -21,12 +21,6 @@
 Cursor key is: C
 Cursor primary key is: 9
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'D', true, true))
 Success opening or iterating cursor
@@ -35,12 +29,6 @@
 Cursor key is: C
 Cursor primary key is: 7
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'D', true, true))
 Success opening or iterating cursor
@@ -61,12 +49,6 @@
 Cursor key is: C
 Cursor primary key is: 7
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'D', true, true))
 Success opening or iterating cursor
@@ -75,12 +57,6 @@
 Cursor key is: C
 Cursor primary key is: 9
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('next', IDBKeyRange.bound('B', 'C'))
 Success opening or iterating cursor
@@ -119,12 +95,6 @@
 Cursor key is: C
 Cursor primary key is: 9
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'C'))
 Success opening or iterating cursor
@@ -139,12 +109,6 @@
 Cursor key is: C
 Cursor primary key is: 7
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'C'))
 Success opening or iterating cursor
@@ -183,12 +147,6 @@
 Cursor key is: B
 Cursor primary key is: 4
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'C'))
 Success opening or iterating cursor
@@ -203,12 +161,6 @@
 Cursor key is: B
 Cursor primary key is: 6
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('next', IDBKeyRange.upperBound('B'))
 Success opening or iterating cursor
@@ -247,12 +199,6 @@
 Cursor key is: B
 Cursor primary key is: 6
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.upperBound('B'))
 Success opening or iterating cursor
@@ -267,12 +213,6 @@
 Cursor key is: B
 Cursor primary key is: 4
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prev', IDBKeyRange.upperBound('B'))
 Success opening or iterating cursor
@@ -311,12 +251,6 @@
 Cursor key is: A
 Cursor primary key is: 1
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.upperBound('B'))
 Success opening or iterating cursor
@@ -331,12 +265,6 @@
 Cursor key is: A
 Cursor primary key is: 3
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('next', IDBKeyRange.lowerBound('C'))
 Success opening or iterating cursor
@@ -375,12 +303,6 @@
 Cursor key is: D
 Cursor primary key is: 12
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.lowerBound('C'))
 Success opening or iterating cursor
@@ -395,12 +317,6 @@
 Cursor key is: D
 Cursor primary key is: 10
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prev', IDBKeyRange.lowerBound('C'))
 Success opening or iterating cursor
@@ -439,12 +355,6 @@
 Cursor key is: C
 Cursor primary key is: 7
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.lowerBound('C'))
 Success opening or iterating cursor
@@ -459,12 +369,6 @@
 Cursor key is: C
 Cursor primary key is: 9
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('next', IDBKeyRange.only('B'))
 Success opening or iterating cursor
@@ -485,12 +389,6 @@
 Cursor key is: B
 Cursor primary key is: 6
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.only('B'))
 Success opening or iterating cursor
@@ -499,12 +397,6 @@
 Cursor key is: B
 Cursor primary key is: 4
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prev', IDBKeyRange.only('B'))
 Success opening or iterating cursor
@@ -525,12 +417,6 @@
 Cursor key is: B
 Cursor primary key is: 4
 Cursor value is: [object Object]
-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
 
 Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.only('B'))
 Success opening or iterating cursor
@@ -539,11 +425,5 @@
 Cursor key is: B
 Cursor primary key is: 6
 Cursor value is: [object Object]
-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
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html (192799 => 192800)


--- 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)
@@ -31,12 +31,13 @@
 function setupRequest(request)
 {
     request._onsuccess_ = function() {
+        if (!request.result) {
+            startNextCursor();
+            return;
+        }
         log("Success opening or iterating cursor");
         logCursor(request.result);  
-        if (request.result.key != undefined)
-            request.result.continue();
-        else
-            startNextCursor();
+        request.result.continue();
     }
     request._onerror_ = function(e) {
         log("Unexpected error opening or iterating cursor");

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt (192799 => 192800)


--- 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)
@@ -83,11 +83,6 @@
 Cursor value is: [object Object]
 Deleted key 18 from object store
 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
 
 Starting a new cursor: testCursorDirection(index, 'prev')
 
@@ -171,11 +166,6 @@
 Cursor value is: [object Object]
 Deleted key 1 from object store
 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
 
 Starting a new cursor: testCursorDirection(index, 'nextunique')
 
@@ -241,11 +231,6 @@
 Deleted key 18 from object store
 Deleted key 1 from object store
 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
 
 Starting a new cursor: testCursorDirection(index, 'prevunique')
 
@@ -310,10 +295,5 @@
 Cursor value is: [object Object]
 Deleted key 1 from object store
 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
 Done
 

Modified: trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html (192799 => 192800)


--- 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)
@@ -35,9 +35,10 @@
 {
     request._onsuccess_ = function() {
         log("Success opening or iterating cursor");
-        logCursor(request.result);
+        if (request.result)
+            logCursor(request.result);
 
-        if (request.iteratedOnce) {
+        if (request.result && request.iteratedOnce) {
             var primaryKey = request.result.primaryKey;
             if (primaryKey) {
                 objectStore.delete(primaryKey)._onsuccess_ = function() {
@@ -79,7 +80,7 @@
      
         request.iteratedOnce = true;
 
-        if (request.result.key != undefined)
+        if (request.result)
             request.result.continue();
         else
             startNextCursor();

Modified: trunk/Source/WebCore/ChangeLog (192799 => 192800)


--- 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)
@@ -1,5 +1,24 @@
 2015-11-30  Brady Eidson  <beid...@apple.com>
 
+        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  <beid...@apple.com>
+
         Modern IDB: Support keyPath injection into object store records.
         https://bugs.webkit.org/show_bug.cgi?id=151640
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp (192799 => 192800)


--- 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)
@@ -45,6 +45,7 @@
     result.m_keyData = m_keyData.isolatedCopy();
     result.m_primaryKeyData = m_primaryKeyData.isolatedCopy();
     result.m_keyPath = m_keyPath.isolatedCopy();
+    result.m_isDefined = m_isDefined;
     return result;
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h (192799 => 192800)


--- 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)
@@ -39,6 +39,7 @@
 class IDBGetResult {
 public:
     IDBGetResult()
+        : m_isDefined(false)
     {
     }
 
@@ -90,6 +91,7 @@
     const IDBKeyData& keyData() const { return m_keyData; }
     const IDBKeyData& primaryKeyData() const { return m_primaryKeyData; }
     const IDBKeyPath& keyPath() const { return m_keyPath; }
+    bool isDefined() const { return m_isDefined; }
 
     // FIXME: When removing LegacyIDB, remove these setters.
     // https://bugs.webkit.org/show_bug.cgi?id=150854
@@ -106,6 +108,7 @@
     IDBKeyData m_keyData;
     IDBKeyData m_primaryKeyData;
     IDBKeyPath m_keyPath;
+    bool m_isDefined { true };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp (192799 => 192800)


--- 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)
@@ -324,10 +324,14 @@
 void IDBRequest::didOpenOrIterateCursor(const IDBResultData& resultData)
 {
     ASSERT(m_pendingCursor);
-    if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess)
+    m_result = nullptr;
+
+    if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
         m_pendingCursor->setGetResult(*this, resultData.getResult());
+        if (resultData.getResult().isDefined())
+            m_result = IDBAny::create(*m_pendingCursor);
+    }
 
-    m_result = IDBAny::create(*m_pendingCursor);
     m_pendingCursor = nullptr;
 
     requestCompleted(resultData);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to