Changeset 192800 in webkit


Ignore:
Timestamp:
Nov 30, 2015 10:21:16 AM (8 years ago)
Author:
beidson@apple.com
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:
Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r192799 r192800  
     12015-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=151630
     5
     6        Reviewed by Andy Estes.
     7
     8        * platform/mac-wk1/TestExpectations:
     9        * storage/indexeddb/modern/cursor-2-expected.txt:
     10        * storage/indexeddb/modern/cursor-2.html:
     11        * storage/indexeddb/modern/cursor-3-expected.txt:
     12        * storage/indexeddb/modern/cursor-3.html:
     13        * storage/indexeddb/modern/cursor-4-expected.txt:
     14        * storage/indexeddb/modern/cursor-4.html:
     15        * storage/indexeddb/modern/deleteindex-1-expected.txt:
     16        * storage/indexeddb/modern/deleteindex-1.html:
     17        * storage/indexeddb/modern/deleteindex-2-expected.txt:
     18        * storage/indexeddb/modern/deleteindex-2.html:
     19        * storage/indexeddb/modern/index-4-expected.txt:
     20        * storage/indexeddb/modern/index-4.html:
     21        * storage/indexeddb/modern/index-cursor-1-expected.txt:
     22        * storage/indexeddb/modern/index-cursor-1.html:
     23        * storage/indexeddb/modern/index-cursor-2-expected.txt:
     24        * storage/indexeddb/modern/index-cursor-2.html:
     25        * storage/indexeddb/modern/index-cursor-3-expected.txt:
     26        * storage/indexeddb/modern/index-cursor-3.html:
     27
    1282015-11-30  Ryan Haddad  <ryanhaddad@apple.com>
    229
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r192798 r192800  
    7676storage/indexeddb/mozilla/autoincrement-indexes.html [ Pass ]
    7777storage/indexeddb/mozilla/bad-keypath.html [ Pass ]
     78storage/indexeddb/mozilla/clear.html [ Pass ]
    7879storage/indexeddb/mozilla/create-index-unique.html [ Pass ]
    7980storage/indexeddb/mozilla/create-index-with-integer-keys.html [ Pass ]
    8081storage/indexeddb/mozilla/create-objectstore-basics.html [ Pass ]
    8182storage/indexeddb/mozilla/create-objectstore-null-name.html [ Pass ]
     83storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Pass ]
     84storage/indexeddb/mozilla/cursor-mutation.html [ Pass ]
    8285storage/indexeddb/mozilla/delete-result.html [ Pass ]
    8386storage/indexeddb/mozilla/event-source.html [ Pass ]
     
    99102storage/indexeddb/mozilla/readyState.html [ Pass ]
    100103storage/indexeddb/mozilla/remove-index.html [ Pass ]
     104storage/indexeddb/mozilla/remove-objectstore.html [ Pass ]
    101105storage/indexeddb/mozilla/versionchange-abort.html [ Pass ]
    102106
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-2-expected.txt

    r192490 r192800  
    7878Cursor value is: [object Object]
    7979Cursor primary key is: foo
    80 Success iterating next cursor
    81 Cursor is: [object IDBCursorWithValue]
    82 Cursor direction is: next
    83 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    84 Cursor key is: undefined
    85 Cursor value is: undefined
    86 Cursor primary key is: undefined
    8780Success iterating prev cursor
    8881Cursor is: [object IDBCursorWithValue]
     
    162155Cursor value is: Record 0
    163156Cursor primary key is: 0
    164 Success iterating prev cursor
    165 Cursor is: [object IDBCursorWithValue]
    166 Cursor direction is: prev
    167 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    168 Cursor key is: undefined
    169 Cursor value is: undefined
    170 Cursor primary key is: undefined
    171157Initial upgrade versionchange transaction complete
    172158Done
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-2.html

    r192490 r192800  
    3333
    3434var objectStore;
    35 
     35var shouldStartPrevious = true;
    3636function setupRequest(request)
    3737{
    3838    request.onsuccess = function() {
     39        if (!request.result) {
     40            if (shouldStartPrevious) {
     41                setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
     42                shouldStartPrevious = false;
     43            }
     44            return;
     45        }
     46
    3947        log("Success iterating " + request.result.direction + " cursor");
    4048        logCursor(request.result);
    41         if (request.result.key != undefined)
    42             request.result.continue();
    43         else if (request.result.direction == "next")
    44             setupRequest(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
    45         // else
    46         //     log("OKAY how?");
     49        request.result.continue();
    4750    }
     51
    4852    request.onerror = function(e) {
    4953        log("Error iterating cursor");
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-3-expected.txt

    r192490 r192800  
    4747Cursor direction is: next
    4848Cursor source is: [object IDBObjectStore] (TestObjectStore)
    49 Cursor key is: undefined
    50 Cursor value is: undefined
    51 Cursor primary key is: undefined
    52 Success iterating cursor
    53 Cursor is: [object IDBCursorWithValue]
    54 Cursor direction is: next
    55 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    5649Cursor key is: 0
    5750Cursor value is: Record 0
     
    7871Cursor value is: Record 9
    7972Cursor primary key is: 9
    80 Success iterating cursor
    81 Cursor is: [object IDBCursorWithValue]
    82 Cursor direction is: next
    83 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    84 Cursor key is: undefined
    85 Cursor value is: undefined
    86 Cursor primary key is: undefined
    8773Initial upgrade versionchange transaction complete
    8874Done
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-3.html

    r192490 r192800  
    3737{
    3838    request.onsuccess = function() {
     39        if (!request.result) {
     40            setupRequest2(objectStore.openCursor());
     41            return;
     42        }
    3943        log("Success iterating cursor");
    4044        logCursor(request.result);
    41         if (request.result.key != undefined)
    42             request.result.continue(request.result.key + 2);
    43         else
    44           setupRequest2(objectStore.openCursor());
     45        request.result.continue(request.result.key + 2);
    4546    }
    4647    request.onerror = function(e) {
     
    5354{
    5455    request.onsuccess = function() {
     56        if (!request.result)
     57            return;
    5558        log("Success iterating cursor");
    5659        logCursor(request.result);
    57         if (request.result.key != undefined)
    58             request.result.advance(3);       
     60        request.result.advance(3);       
    5961    }
    6062    request.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-4-expected.txt

    r192490 r192800  
    4040Cursor direction is: prev
    4141Cursor source is: [object IDBObjectStore] (TestObjectStore)
    42 Cursor key is: undefined
    43 Cursor value is: undefined
    44 Cursor primary key is: undefined
    45 Success iterating cursor
    46 Cursor is: [object IDBCursorWithValue]
    47 Cursor direction is: prev
    48 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    4942Cursor key is: 9
    5043Cursor value is: Record 9
     
    7164Cursor value is: Record 0
    7265Cursor primary key is: 0
    73 Success iterating cursor
    74 Cursor is: [object IDBCursorWithValue]
    75 Cursor direction is: prev
    76 Cursor source is: [object IDBObjectStore] (TestObjectStore)
    77 Cursor key is: undefined
    78 Cursor value is: undefined
    79 Cursor primary key is: undefined
    8066Initial upgrade versionchange transaction complete
    8167Done
  • trunk/LayoutTests/storage/indexeddb/modern/cursor-4.html

    r192490 r192800  
    3737{
    3838    request.onsuccess = function() {
     39        if (!request.result) {
     40            setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
     41            return;
     42        }
    3943        log("Success iterating cursor");
    4044        logCursor(request.result);
    41         if (request.result.key != undefined)
    42             request.result.continue(request.result.key - 2);
    43         else
    44           setupRequest2(objectStore.openCursor(IDBKeyRange.lowerBound(-Infinity), "prev"));
     45        request.result.continue(request.result.key - 2);
    4546    }
    4647    request.onerror = function(e) {
     
    5354{
    5455    request.onsuccess = function() {
     56        if (!request.result)
     57            return;
    5558        log("Success iterating cursor");
    5659        logCursor(request.result);
    57         if (request.result.key != undefined)
    58             request.result.advance(3);       
     60        request.result.advance(3);       
    5961    }
    6062    request.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1-expected.txt

    r192645 r192800  
    44Cursor at record: A / 1
    55Cursor at record: A / 2
    6 Cursor at record: undefined / undefined
    76Deleted the index
    87Initial upgrade versionchange transaction complete
  • trunk/LayoutTests/storage/indexeddb/modern/deleteindex-1.html

    r192645 r192800  
    3434    cursorRequest.onsuccess = function() {
    3535        var cursor = cursorRequest.result;
    36         log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
    37        
    38         if (cursor.key != undefined)
    39             cursor.continue();
    40         else {
     36        if (!cursor) {
    4137            objectStore.deleteIndex("TestIndex1");
    4238            log("Deleted the index");
     39            return;
    4340        }
     41
     42        log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
     43        cursor.continue();
    4444    }
    4545    cursorRequest.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2-expected.txt

    r192645 r192800  
    44Cursor at record: A / 1
    55Cursor at record: A / 2
    6 Cursor at record: undefined / undefined
    76Initial upgrade versionchange transaction complete
    87Second upgrade needed: Old version - 1 New version - 2
     
    1413Cursor at record: A / 1
    1514Cursor at record: A / 2
    16 Cursor at record: undefined / undefined
    1715Third upgrade versionchange transaction complete
    1816Done
  • trunk/LayoutTests/storage/indexeddb/modern/deleteindex-2.html

    r192645 r192800  
    3434    cursorRequest.onsuccess = function() {
    3535        var cursor = cursorRequest.result;
     36        if (!cursor)
     37            return;
     38
    3639        log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
    37        
    38         if (cursor.key != undefined)
    39             cursor.continue();
     40        cursor.continue();
    4041    }
    4142    cursorRequest.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/index-4-expected.txt

    r192618 r192800  
    2020Cursor at record: I / 17
    2121Cursor at record: I / 18
    22 Cursor at record: undefined / undefined
    2322Done
    2423
  • trunk/LayoutTests/storage/indexeddb/modern/index-4.html

    r192618 r192800  
    3333    cursorRequest.onsuccess = function() {
    3434        var cursor = cursorRequest.result;
     35        if (!cursor) {
     36            done();
     37            return;
     38        }
    3539        log("Cursor at record: " + cursor.key + " / " + cursor.primaryKey);
    36        
    37         if (cursor.key != undefined)
    38             cursor.continue();
    39         else
    40             done();
     40        cursor.continue();
     41
    4142    }
    4243    cursorRequest.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1-expected.txt

    r192610 r192800  
    7777Cursor primary key is: 12
    7878Cursor value is: [object Object]
    79 Success opening or iterating cursor
    80 Cursor direction is: next
    81 Cursor source is: TestIndex1
    82 Cursor key is: undefined
    83 Cursor primary key is: undefined
    84 Cursor value is: undefined
    8579
    8680Starting a new cursor: testCursorDirection(index2, 'next')
     
    157151Cursor primary key is: 12
    158152Cursor value is: [object Object]
    159 Success opening or iterating cursor
    160 Cursor direction is: next
    161 Cursor source is: TestIndex2
    162 Cursor key is: undefined
    163 Cursor primary key is: undefined
    164 Cursor value is: undefined
    165153
    166154Starting a new cursor: testCursorDirection(index1, 'nextunique')
     
    189177Cursor primary key is: 10
    190178Cursor value is: [object Object]
    191 Success opening or iterating cursor
    192 Cursor direction is: nextunique
    193 Cursor source is: TestIndex1
    194 Cursor key is: undefined
    195 Cursor primary key is: undefined
    196 Cursor value is: undefined
    197179
    198180Starting a new cursor: testCursorDirection(index2, 'nextunique')
     
    221203Cursor primary key is: 10
    222204Cursor value is: [object Object]
    223 Success opening or iterating cursor
    224 Cursor direction is: nextunique
    225 Cursor source is: TestIndex2
    226 Cursor key is: undefined
    227 Cursor primary key is: undefined
    228 Cursor value is: undefined
    229205
    230206Starting a new cursor: testCursorDirection(index1, 'prev')
     
    301277Cursor primary key is: 1
    302278Cursor value is: [object Object]
    303 Success opening or iterating cursor
    304 Cursor direction is: prev
    305 Cursor source is: TestIndex1
    306 Cursor key is: undefined
    307 Cursor primary key is: undefined
    308 Cursor value is: undefined
    309279
    310280Starting a new cursor: testCursorDirection(index2, 'prev')
     
    381351Cursor primary key is: 1
    382352Cursor value is: [object Object]
    383 Success opening or iterating cursor
    384 Cursor direction is: prev
    385 Cursor source is: TestIndex2
    386 Cursor key is: undefined
    387 Cursor primary key is: undefined
    388 Cursor value is: undefined
    389353
    390354Starting a new cursor: testCursorDirection(index1, 'prevunique')
     
    413377Cursor primary key is: 3
    414378Cursor value is: [object Object]
    415 Success opening or iterating cursor
    416 Cursor direction is: prevunique
    417 Cursor source is: TestIndex1
    418 Cursor key is: undefined
    419 Cursor primary key is: undefined
    420 Cursor value is: undefined
    421379
    422380Starting a new cursor: testCursorDirection(index2, 'prevunique')
     
    445403Cursor primary key is: 3
    446404Cursor value is: [object Object]
    447 Success opening or iterating cursor
    448 Cursor direction is: prevunique
    449 Cursor source is: TestIndex2
    450 Cursor key is: undefined
    451 Cursor primary key is: undefined
    452 Cursor value is: undefined
    453405Done
    454406
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-1.html

    r192610 r192800  
    3232{
    3333    request.onsuccess = function() {
     34        if (!request.result) {
     35            startNextCursor();
     36            return;
     37        }
    3438        log("Success opening or iterating cursor");
    3539        logCursor(request.result); 
    36         if (request.result.key != undefined)
    37             request.result.continue();
    38         else
    39             startNextCursor();
     40        request.result.continue();
    4041    }
    4142    request.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2-expected.txt

    r192610 r192800  
    2222Cursor primary key is: 9
    2323Cursor value is: [object Object]
    24 Success opening or iterating cursor
    25 Cursor direction is: next
    26 Cursor source is: TestIndex1
    27 Cursor key is: undefined
    28 Cursor primary key is: undefined
    29 Cursor value is: undefined
    3024
    3125Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'D', true, true))
     
    3630Cursor primary key is: 7
    3731Cursor value is: [object Object]
    38 Success opening or iterating cursor
    39 Cursor direction is: nextunique
    40 Cursor source is: TestIndex1
    41 Cursor key is: undefined
    42 Cursor primary key is: undefined
    43 Cursor value is: undefined
    4432
    4533Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'D', true, true))
     
    6250Cursor primary key is: 7
    6351Cursor value is: [object Object]
    64 Success opening or iterating cursor
    65 Cursor direction is: prev
    66 Cursor source is: TestIndex1
    67 Cursor key is: undefined
    68 Cursor primary key is: undefined
    69 Cursor value is: undefined
    7052
    7153Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'D', true, true))
     
    7658Cursor primary key is: 9
    7759Cursor value is: [object Object]
    78 Success opening or iterating cursor
    79 Cursor direction is: prevunique
    80 Cursor source is: TestIndex1
    81 Cursor key is: undefined
    82 Cursor primary key is: undefined
    83 Cursor value is: undefined
    8460
    8561Starting a new cursor: testCursorDirection('next', IDBKeyRange.bound('B', 'C'))
     
    12096Cursor primary key is: 9
    12197Cursor value is: [object Object]
    122 Success opening or iterating cursor
    123 Cursor direction is: next
    124 Cursor source is: TestIndex1
    125 Cursor key is: undefined
    126 Cursor primary key is: undefined
    127 Cursor value is: undefined
    12898
    12999Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.bound('B', 'C'))
     
    140110Cursor primary key is: 7
    141111Cursor value is: [object Object]
    142 Success opening or iterating cursor
    143 Cursor direction is: nextunique
    144 Cursor source is: TestIndex1
    145 Cursor key is: undefined
    146 Cursor primary key is: undefined
    147 Cursor value is: undefined
    148112
    149113Starting a new cursor: testCursorDirection('prev', IDBKeyRange.bound('B', 'C'))
     
    184148Cursor primary key is: 4
    185149Cursor value is: [object Object]
    186 Success opening or iterating cursor
    187 Cursor direction is: prev
    188 Cursor source is: TestIndex1
    189 Cursor key is: undefined
    190 Cursor primary key is: undefined
    191 Cursor value is: undefined
    192150
    193151Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.bound('B', 'C'))
     
    204162Cursor primary key is: 6
    205163Cursor value is: [object Object]
    206 Success opening or iterating cursor
    207 Cursor direction is: prevunique
    208 Cursor source is: TestIndex1
    209 Cursor key is: undefined
    210 Cursor primary key is: undefined
    211 Cursor value is: undefined
    212164
    213165Starting a new cursor: testCursorDirection('next', IDBKeyRange.upperBound('B'))
     
    248200Cursor primary key is: 6
    249201Cursor value is: [object Object]
    250 Success opening or iterating cursor
    251 Cursor direction is: next
    252 Cursor source is: TestIndex1
    253 Cursor key is: undefined
    254 Cursor primary key is: undefined
    255 Cursor value is: undefined
    256202
    257203Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.upperBound('B'))
     
    268214Cursor primary key is: 4
    269215Cursor value is: [object Object]
    270 Success opening or iterating cursor
    271 Cursor direction is: nextunique
    272 Cursor source is: TestIndex1
    273 Cursor key is: undefined
    274 Cursor primary key is: undefined
    275 Cursor value is: undefined
    276216
    277217Starting a new cursor: testCursorDirection('prev', IDBKeyRange.upperBound('B'))
     
    312252Cursor primary key is: 1
    313253Cursor value is: [object Object]
    314 Success opening or iterating cursor
    315 Cursor direction is: prev
    316 Cursor source is: TestIndex1
    317 Cursor key is: undefined
    318 Cursor primary key is: undefined
    319 Cursor value is: undefined
    320254
    321255Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.upperBound('B'))
     
    332266Cursor primary key is: 3
    333267Cursor value is: [object Object]
    334 Success opening or iterating cursor
    335 Cursor direction is: prevunique
    336 Cursor source is: TestIndex1
    337 Cursor key is: undefined
    338 Cursor primary key is: undefined
    339 Cursor value is: undefined
    340268
    341269Starting a new cursor: testCursorDirection('next', IDBKeyRange.lowerBound('C'))
     
    376304Cursor primary key is: 12
    377305Cursor value is: [object Object]
    378 Success opening or iterating cursor
    379 Cursor direction is: next
    380 Cursor source is: TestIndex1
    381 Cursor key is: undefined
    382 Cursor primary key is: undefined
    383 Cursor value is: undefined
    384306
    385307Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.lowerBound('C'))
     
    396318Cursor primary key is: 10
    397319Cursor value is: [object Object]
    398 Success opening or iterating cursor
    399 Cursor direction is: nextunique
    400 Cursor source is: TestIndex1
    401 Cursor key is: undefined
    402 Cursor primary key is: undefined
    403 Cursor value is: undefined
    404320
    405321Starting a new cursor: testCursorDirection('prev', IDBKeyRange.lowerBound('C'))
     
    440356Cursor primary key is: 7
    441357Cursor value is: [object Object]
    442 Success opening or iterating cursor
    443 Cursor direction is: prev
    444 Cursor source is: TestIndex1
    445 Cursor key is: undefined
    446 Cursor primary key is: undefined
    447 Cursor value is: undefined
    448358
    449359Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.lowerBound('C'))
     
    460370Cursor primary key is: 9
    461371Cursor value is: [object Object]
    462 Success opening or iterating cursor
    463 Cursor direction is: prevunique
    464 Cursor source is: TestIndex1
    465 Cursor key is: undefined
    466 Cursor primary key is: undefined
    467 Cursor value is: undefined
    468372
    469373Starting a new cursor: testCursorDirection('next', IDBKeyRange.only('B'))
     
    486390Cursor primary key is: 6
    487391Cursor value is: [object Object]
    488 Success opening or iterating cursor
    489 Cursor direction is: next
    490 Cursor source is: TestIndex1
    491 Cursor key is: undefined
    492 Cursor primary key is: undefined
    493 Cursor value is: undefined
    494392
    495393Starting a new cursor: testCursorDirection('nextunique', IDBKeyRange.only('B'))
     
    500398Cursor primary key is: 4
    501399Cursor value is: [object Object]
    502 Success opening or iterating cursor
    503 Cursor direction is: nextunique
    504 Cursor source is: TestIndex1
    505 Cursor key is: undefined
    506 Cursor primary key is: undefined
    507 Cursor value is: undefined
    508400
    509401Starting a new cursor: testCursorDirection('prev', IDBKeyRange.only('B'))
     
    526418Cursor primary key is: 4
    527419Cursor value is: [object Object]
    528 Success opening or iterating cursor
    529 Cursor direction is: prev
    530 Cursor source is: TestIndex1
    531 Cursor key is: undefined
    532 Cursor primary key is: undefined
    533 Cursor value is: undefined
    534420
    535421Starting a new cursor: testCursorDirection('prevunique', IDBKeyRange.only('B'))
     
    540426Cursor primary key is: 6
    541427Cursor value is: [object Object]
    542 Success opening or iterating cursor
    543 Cursor direction is: prevunique
    544 Cursor source is: TestIndex1
    545 Cursor key is: undefined
    546 Cursor primary key is: undefined
    547 Cursor value is: undefined
    548428Done
    549429
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-2.html

    r192610 r192800  
    3232{
    3333    request.onsuccess = function() {
     34        if (!request.result) {
     35            startNextCursor();
     36            return;
     37        }
    3438        log("Success opening or iterating cursor");
    3539        logCursor(request.result); 
    36         if (request.result.key != undefined)
    37             request.result.continue();
    38         else
    39             startNextCursor();
     40        request.result.continue();
    4041    }
    4142    request.onerror = function(e) {
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3-expected.txt

    r192610 r192800  
    8484Deleted key 18 from object store
    8585Success opening or iterating cursor
    86 Cursor direction is: next
    87 Cursor source is: TestIndex1
    88 Cursor key is: undefined
    89 Cursor primary key is: undefined
    90 Cursor value is: undefined
    9186
    9287Starting a new cursor: testCursorDirection(index, 'prev')
     
    172167Deleted key 1 from object store
    173168Success opening or iterating cursor
    174 Cursor direction is: prev
    175 Cursor source is: TestIndex1
    176 Cursor key is: undefined
    177 Cursor primary key is: undefined
    178 Cursor value is: undefined
    179169
    180170Starting a new cursor: testCursorDirection(index, 'nextunique')
     
    242232Deleted key 1 from object store
    243233Success opening or iterating cursor
    244 Cursor direction is: nextunique
    245 Cursor source is: TestIndex1
    246 Cursor key is: undefined
    247 Cursor primary key is: undefined
    248 Cursor value is: undefined
    249234
    250235Starting a new cursor: testCursorDirection(index, 'prevunique')
     
    311296Deleted key 1 from object store
    312297Success opening or iterating cursor
    313 Cursor direction is: prevunique
    314 Cursor source is: TestIndex1
    315 Cursor key is: undefined
    316 Cursor primary key is: undefined
    317 Cursor value is: undefined
    318298Done
    319299
  • trunk/LayoutTests/storage/indexeddb/modern/index-cursor-3.html

    r192610 r192800  
    3636    request.onsuccess = function() {
    3737        log("Success opening or iterating cursor");
    38         logCursor(request.result);
     38        if (request.result)
     39            logCursor(request.result);
    3940
    40         if (request.iteratedOnce) {
     41        if (request.result && request.iteratedOnce) {
    4142            var primaryKey = request.result.primaryKey;
    4243            if (primaryKey) {
     
    8081        request.iteratedOnce = true;
    8182
    82         if (request.result.key != undefined)
     83        if (request.result)
    8384            request.result.continue();
    8485        else
  • trunk/Source/WebCore/ChangeLog

    r192798 r192800  
     12015-11-30  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: openCursor() fix resulting in at least 4 more passing tests.
     4        https://bugs.webkit.org/show_bug.cgi?id=151630
     5
     6        Reviewed by Andy Estes.
     7
     8        No new tests (At least 4 failing tests now pass, and 9 other incorrect tests updated).
     9
     10        * Modules/indexeddb/IDBGetResult.cpp:
     11        (WebCore::IDBGetResult::isolatedCopy):
     12        * Modules/indexeddb/IDBGetResult.h:
     13        (WebCore::IDBGetResult::IDBGetResult):
     14        (WebCore::IDBGetResult::isDefined):
     15
     16        * Modules/indexeddb/client/IDBRequestImpl.cpp:
     17        (WebCore::IDBClient::IDBRequest::didOpenOrIterateCursor): If the IDBGetResult is undefined,
     18          do not expose the cursor as the result property of the IDBRequest.
     19
    1202015-11-30  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.cpp

    r192783 r192800  
    4646    result.m_primaryKeyData = m_primaryKeyData.isolatedCopy();
    4747    result.m_keyPath = m_keyPath.isolatedCopy();
     48    result.m_isDefined = m_isDefined;
    4849    return result;
    4950}
  • trunk/Source/WebCore/Modules/indexeddb/IDBGetResult.h

    r192783 r192800  
    4040public:
    4141    IDBGetResult()
     42        : m_isDefined(false)
    4243    {
    4344    }
     
    9192    const IDBKeyData& primaryKeyData() const { return m_primaryKeyData; }
    9293    const IDBKeyPath& keyPath() const { return m_keyPath; }
     94    bool isDefined() const { return m_isDefined; }
    9395
    9496    // FIXME: When removing LegacyIDB, remove these setters.
     
    107109    IDBKeyData m_primaryKeyData;
    108110    IDBKeyPath m_keyPath;
     111    bool m_isDefined { true };
    109112};
    110113
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBRequestImpl.cpp

    r192686 r192800  
    325325{
    326326    ASSERT(m_pendingCursor);
    327     if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess)
     327    m_result = nullptr;
     328
     329    if (resultData.type() == IDBResultType::IterateCursorSuccess || resultData.type() == IDBResultType::OpenCursorSuccess) {
    328330        m_pendingCursor->setGetResult(*this, resultData.getResult());
    329 
    330     m_result = IDBAny::create(*m_pendingCursor);
     331        if (resultData.getResult().isDefined())
     332            m_result = IDBAny::create(*m_pendingCursor);
     333    }
     334
    331335    m_pendingCursor = nullptr;
    332336
Note: See TracChangeset for help on using the changeset viewer.