|Summary:||IndexedDB does not update r/w index cursors that are mutated during iteration|
|Product:||WebKit||Reporter:||Mark Pilgrim (Google) <pilgrim>|
|Component:||New Bugs||Assignee:||Joshua Bell <jsbell>|
|Severity:||Normal||CC:||dgrogan, fishd, hans, jsbell, pilgrim, tony, webkit.review.bot|
|Version:||528+ (Nightly build)|
Description Mark Pilgrim (Google) 2011-04-29 13:25:32 PDT
Original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_cursor_mutation.html?raw=1 Ported test: see attachment The scenario here is that you have an object store with data in it, and an index on one of the fields. (In the attached test, the index is an alphabetical index of first names.) You open a read/write transaction and use it to open a cursor on the index. While iterating through the cursor (in alphabetical order), you mutate the object store to add another row whose values would not yet have shown up in iteration. Expected result: the index cursor should automatically update to include the new row when it eventually comes up in the alphabetical order (of the index). The mutation occurs before the added name would have appeared in the cursor iteration, thus the iteration should eventually find it. Actual result: WebKit's behavior is to skip over the row that was added during iteration. Iteration of the index cursor continues in the expected (alphabetical) order through the original data in the object store, but the added row is never found.
Comment 1 Mark Pilgrim (Google) 2011-04-29 13:26:41 PDT
Created attachment 91723 [details] Test case
Comment 2 Mark Pilgrim (Google) 2011-04-29 13:27:45 PDT
Not a patch, just a test case. Removed spurious review flag.
Comment 3 David Grogan 2011-04-29 14:11:40 PDT
Just curious, do we correctly handle this case if the cursor is iterating over an objectstore rather than an index?
Comment 5 Hans Wennborg 2011-05-03 03:00:09 PDT
(In reply to comment #4) > Yes, see bug 59933. Hmm, that's interesting. Thanks for finding this.
Comment 6 Joshua Bell 2011-12-07 13:38:13 PST
Created attachment 118266 [details] updated test case No repro for me. This may have been fixed with the move to LevelDB. The attached test case was a bit crufty; I dusted it off (attached) and it works fine.
Comment 7 Joshua Bell 2011-12-07 13:40:36 PST
On further thought, we should probably pull in this test, but perhaps keep it closer to the original moz test than my edit.
Comment 9 Joshua Bell 2012-01-27 15:37:48 PST
Comment on attachment 124384 [details] Patch Dusted off the original patch a bit. Still passes as expected.
Comment 11 WebKit Review Bot 2012-01-27 16:05:10 PST
Comment on attachment 124384 [details] Patch Clearing flags on attachment: 124384 Committed r106165: <http://trac.webkit.org/changeset/106165>
Comment 12 WebKit Review Bot 2012-01-27 16:05:15 PST
All reviewed patches have been landed. Closing bug.