Bug 53690 - IndexedDB: Cursors should skip deleted entries
Summary: IndexedDB: Cursors should skip deleted entries
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Hans Wennborg
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-03 10:05 PST by Hans Wennborg
Modified: 2011-02-09 02:33 PST (History)
3 users (show)

See Also:


Attachments
Patch (11.46 KB, patch)
2011-02-03 10:07 PST, Hans Wennborg
no flags Details | Formatted Diff | Diff
Patch (14.23 KB, patch)
2011-02-04 09:04 PST, Hans Wennborg
jorlow: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Wennborg 2011-02-03 10:05:09 PST
IndexedDB: Cursors should skip deleted entries
Comment 1 Hans Wennborg 2011-02-03 10:07:54 PST
Created attachment 81073 [details]
Patch
Comment 2 Jeremy Orlow 2011-02-03 14:45:43 PST
Comment on attachment 81073 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=81073&action=review

Maybe you should make your test function a bit more generic and then you can specifically test more corner cases: the first element, the last, the current, the previous, a couple previous, the next, and a couple later.  (The last is all you test now.)  I don't think it'll take too much time and it'll definitely make this more robust in the future.

Looks great though.

> Source/WebCore/storage/IDBCursorBackendImpl.cpp:104
> +

newline seems kinda useless....you could even use a ternary operator if you wanted...don't care much either way tho
Comment 3 Hans Wennborg 2011-02-04 09:03:53 PST
(In reply to comment #2)
> (From update of attachment 81073 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=81073&action=review
> 
> Maybe you should make your test function a bit more generic and then you can specifically test more corner cases: the first element, the last, the current, the previous, a couple previous, the next, and a couple later.  (The last is all you test now.)  I don't think it'll take too much time and it'll definitely make this more robust in the future.

You're right. Trying to make the test a bit more generic and less spaghetti.

> 
> Looks great though.
> 
> > Source/WebCore/storage/IDBCursorBackendImpl.cpp:104
> > +
> 
> newline seems kinda useless....you could even use a ternary operator if you wanted...don't care much either way tho

Done.
Comment 4 Hans Wennborg 2011-02-04 09:04:19 PST
Created attachment 81226 [details]
Patch
Comment 5 Jeremy Orlow 2011-02-04 10:44:03 PST
Comment on attachment 81226 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=81226&action=review

This test should also verify that anything not deleted is seen while iterating.  r=me assuming you do that.

> LayoutTests/storage/indexeddb/cursor-skip-deleted.html:61
> +    resetObjectStore(); // No callback; let the setVersion transaction complete.

Seems cleaner to pass in an empty function here...you probably don't even need a comment then.

> LayoutTests/storage/indexeddb/cursor-skip-deleted.html:140
> +                   {id: 15, targets: [13,14]}

while you're at it, might as well throw a few more interesting combinations in.  :-)

> LayoutTests/storage/indexeddb/cursor-skip-deleted.html:169
> +    testCursor(deletes, "trans.objectStore('store').index('nameIndex').openCursor(webkitIDBKeyRange.lowerBound('Alpha'))", function() { resetObjectStore(); });

why do a final reset?
Comment 6 Hans Wennborg 2011-02-09 02:33:50 PST
Committed r78035: <http://trac.webkit.org/changeset/78035>