RESOLVED FIXED 76952
IndexedDB: IDBCursor.update() should raise exception if key changed
https://bugs.webkit.org/show_bug.cgi?id=76952
Summary IndexedDB: IDBCursor.update() should raise exception if key changed
Joshua Bell
Reported 2012-01-24 15:33:32 PST
IDBObjectStoreBackendImpl.cpp: During the async task execution, this is run: if (putMode == CursorUpdate && !keyPathKey->isEqual(key)) { callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::DATA_ERR, "The key fetched from the keyPath does not match the key of the cursor.")); return 0; } Per spec, this should synchronously raise an exception during the put() call instead.
Attachments
Patch (15.67 KB, patch)
2012-01-30 15:16 PST, Joshua Bell
no flags
Joshua Bell
Comment 1 2012-01-24 15:47:35 PST
... and while there, move all of the key selection (and value updating) logic into put(), rather than the putInternal async task, to match recent discussion on public-webapps. The async task should be handed the final value and final key to insert with.
Joshua Bell
Comment 2 2012-01-25 11:44:02 PST
(In reply to comment #1) > ... and while there, move all of the key selection (and value updating) logic into put(), rather than the putInternal async task, to match recent discussion on public-webapps. > > The async task should be handed the final value and final key to insert with. Slight wrinkle - for generated keys (i.e. autoIncrement) the generation step should occur within the async task within the transaction. This may require that in put() we check to see if a value can be inserted (by inserting a dummy value?) and then in putInternal() we run the key generation step and actually insert the key.
Joshua Bell
Comment 3 2012-01-30 15:16:58 PST
Joshua Bell
Comment 4 2012-01-30 15:25:31 PST
Filed https://bugs.webkit.org/show_bug.cgi?id=77374 for the "the generation step should occur within the async task within the transaction" note.
Tony Chang
Comment 5 2012-01-30 15:55:22 PST
The change looks sane. If dgrogan or someone else can do an unofficial review, I can r+.
David Grogan
Comment 6 2012-01-30 18:50:30 PST
Comment on attachment 124610 [details] Patch LGTM
WebKit Review Bot
Comment 7 2012-01-31 13:45:43 PST
Comment on attachment 124610 [details] Patch Clearing flags on attachment: 124610 Committed r106387: <http://trac.webkit.org/changeset/106387>
WebKit Review Bot
Comment 8 2012-01-31 13:45:48 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.