RESOLVED FIXED 60197
IndexedDB result of deleting a record should be true or false
https://bugs.webkit.org/show_bug.cgi?id=60197
Summary IndexedDB result of deleting a record should be true or false
Mark Pilgrim (Google)
Reported 2011-05-04 12:09:14 PDT
Original test: http://mxr.mozilla.org/mozilla2.0/source/dom/indexedDB/test/test_odd_result_order.html?force=1 This test is adapted from a test in Mozilla's IndexedDB test suite. It checks that the result property of a request after an asychronous delete operation is either true (if the record existed and was deleted successfully) or false (if the record did not exist). WebKit fails this test. The result property is always null, regardless of whether the delete operation succeeded or failed. Citation: http://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html#dfn-steps-for-deleting-a-record-from-an-object-store "If no record exists with key key in store, then the result of this algorithm is false... [steps for successful deletion, and then] The result of this algorithm is true."
Attachments
test case (2.30 KB, text/html)
2011-05-04 12:10 PDT, Mark Pilgrim (Google)
no flags
Patch (13.47 KB, patch)
2011-05-16 15:05 PDT, Mark Pilgrim (Google)
no flags
Archive of layout-test-results from ec2-cr-linux-03 (1.20 MB, application/zip)
2011-05-16 18:09 PDT, WebKit Review Bot
no flags
Patch (14.73 KB, patch)
2011-05-16 19:21 PDT, Mark Pilgrim (Google)
no flags
Patch (14.73 KB, patch)
2011-05-18 14:45 PDT, Mark Pilgrim (Google)
no flags
Patch (10.32 KB, patch)
2011-10-24 17:24 PDT, Joshua Bell
no flags
Patch (14.16 KB, patch)
2011-10-25 12:10 PDT, Joshua Bell
no flags
Patch (14.06 KB, patch)
2011-10-25 15:10 PDT, Joshua Bell
no flags
Patch (14.07 KB, patch)
2011-10-25 18:09 PDT, Joshua Bell
no flags
Patch (13.98 KB, patch)
2011-10-28 14:37 PDT, Joshua Bell
no flags
Patch (14.38 KB, patch)
2011-11-03 10:24 PDT, Joshua Bell
no flags
Mark Pilgrim (Google)
Comment 1 2011-05-04 12:10:18 PDT
Created attachment 92294 [details] test case
Mark Pilgrim (Google)
Comment 2 2011-05-16 15:05:11 PDT
WebKit Review Bot
Comment 3 2011-05-16 18:09:51 PDT
Comment on attachment 93700 [details] Patch Attachment 93700 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/8707113 New failing tests: storage/indexeddb/objectstore-basics.html
WebKit Review Bot
Comment 4 2011-05-16 18:09:55 PDT
Created attachment 93723 [details] Archive of layout-test-results from ec2-cr-linux-03 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-03 Port: Chromium Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Mark Pilgrim (Google)
Comment 5 2011-05-16 19:21:51 PDT
Tony Chang
Comment 6 2011-05-17 09:44:28 PDT
Comment on attachment 93730 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=93730&action=review This looks fine to me, but dgrogan or others should also review. > Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp:300 > - callbacks->onError(IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the object store.")); > + callbacks->onError(SerializedScriptValue::create(v8::False()), IDBDatabaseError::create(IDBDatabaseException::NOT_FOUND_ERR, "Key does not exist in the object store.")); Did you mean to change the indention level here?
Mark Pilgrim (Google)
Comment 7 2011-05-17 10:09:27 PDT
(In reply to comment #6) > Did you mean to change the indention level here? Oops, no.
Mark Pilgrim (Google)
Comment 8 2011-05-18 14:45:19 PDT
Created attachment 93984 [details] Patch Fixes indentation.
David Levin
Comment 9 2011-05-18 17:27:04 PDT
Comment on attachment 93984 [details] Patch Patch doesn't apply but otherwise it looks fine to me.
David Grogan
Comment 10 2011-05-19 16:32:48 PDT
Comment on attachment 93984 [details] Patch unofficial r+ Thanks for fixing this.
Joshua Bell
Comment 11 2011-10-24 16:48:00 PDT
The current patches extend the error mechanism to include a value. That would require a two-sided commit to land. It also looks wrong - the IDB spec doesn't specify an error when you try and delete record that doesn't exist, but success with false result. So... we need a much simpler patch. I'll put it together.
Joshua Bell
Comment 12 2011-10-24 17:24:59 PDT
David Levin
Comment 13 2011-10-24 17:31:42 PDT
Comment on attachment 112285 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=112285&action=review It looks like you are calling a v8 bindings only method "trueValue" from generic code "Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp". > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1958 > + DEFINE_STATIC_LOCAL(RefPtr<SerializedScriptValue>, trueValue, (0)); Given that this function may be called from different threads (putting it on SerializedScriptValue implies that somewhat since it may be used from workers). This doesn't look like a safe way of doing this. Does the result really need to be cached? Is there some perf test that indicates this? (I see that nullValue does this, but I wonder why and I'm concerned about it as well.) If nothing else, we should add asserts in these methods to verify that they are only used on the main thread, but personally I'd prefer that these non-threadsafe methods not be in SerializedScriptValue (and if caching is needed perhaps it should happen in code that is known to be single threaded.) > Source/WebCore/bindings/v8/SerializedScriptValue.cpp:1959 > + if (!trueValue) { Prefer "fail fast": if (trueValue) return trueValue.get();
Joshua Bell
Comment 14 2011-10-25 10:34:32 PDT
+antonm I agree with all of levin's feedback. I was following the pattern used for nullValue and undefinedValue which it looks like came from antonm. Any comments?
David Levin
Comment 15 2011-10-25 10:42:24 PDT
(In reply to comment #14) > +antonm > > I agree with all of levin's feedback. I was following the pattern used for nullValue and undefinedValue which it looks like came from antonm. Any comments? The first change to do this was http://trac.webkit.org/changeset/66628 If you look at the associated bug, there is a comment explaining the static https://bugs.webkit.org/show_bug.cgi?id=41372#c18 I wish the static var was local to the history navigation, and there was an assert to verify that this is only called on the main thread. I would gladly r+ clean-ups to this. I think every other change just copied the pattern because it was already there.
Joshua Bell
Comment 16 2011-10-25 11:12:45 PDT
(In reply to comment #13) > (From update of attachment 112285 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=112285&action=review > > It looks like you are calling a v8 bindings only method "trueValue" from generic code "Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp". It's worse: undefinedValue() and createFromWire() are already in the WebCore/storage code but only implemented in the v8 version of SerializedScriptValue. Looking to see what it'd take to add those to the JS version.
David Levin
Comment 17 2011-10-25 11:20:27 PDT
(In reply to comment #16) > (In reply to comment #13) > > (From update of attachment 112285 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=112285&action=review > > > > It looks like you are calling a v8 bindings only method "trueValue" from generic code "Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp". > > It's worse: undefinedValue() and createFromWire() are already in the WebCore/storage code but only implemented in the v8 version of SerializedScriptValue. Looking to see what it'd take to add those to the JS version. So jsc must not use this at all?
Joshua Bell
Comment 18 2011-10-25 11:27:03 PDT
(In reply to comment #17) > (In reply to comment #16) > > (In reply to comment #13) > > > (From update of attachment 112285 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=112285&action=review > > > > > > It looks like you are calling a v8 bindings only method "trueValue" from generic code "Source/WebCore/storage/IDBObjectStoreBackendImpl.cpp". > > > > It's worse: undefinedValue() and createFromWire() are already in the WebCore/storage code but only implemented in the v8 version of SerializedScriptValue. Looking to see what it'd take to add those to the JS version. > > So jsc must not use this at all? Correct. This isn't the first place I've noticed where the code is effectively v8-only. It looks like there's been some effort to keep the INDEXED_DATABASE-wrapped code generic, but since it's not being built things slip through the cracks.
Joshua Bell
Comment 19 2011-10-25 11:56:45 PDT
Joshua Bell
Comment 20 2011-10-25 12:10:02 PDT
Joshua Bell
Comment 21 2011-10-25 12:13:12 PDT
Comment on attachment 112370 [details] Patch New patch - it leaves nullValue() alone for now but adds a FIXME, but eliminates the local statics for the other types. The JSC binding code is a shot in the dark; I don't have a build environment for it handy, so it's of dubious quality at best. Will give it a whirl tomorrow.
Early Warning System Bot
Comment 22 2011-10-25 12:22:04 PDT
Gyuyoung Kim
Comment 23 2011-10-25 12:36:10 PDT
Joshua Bell
Comment 24 2011-10-25 15:10:38 PDT
Early Warning System Bot
Comment 25 2011-10-25 15:34:29 PDT
Joshua Bell
Comment 26 2011-10-25 18:09:16 PDT
Adam Barth
Comment 27 2011-10-25 18:18:48 PDT
@jsbell: Ping me when this is ready for review (assuming Dave isn't interested in continuing to review).
David Levin
Comment 28 2011-10-25 18:22:56 PDT
(In reply to comment #27) > @jsbell: Ping me when this is ready for review (assuming Dave isn't interested in continuing to review). For the record, I'm fine with abarth reviewing (or doing a review myself. Either way it is ok with me :)
Early Warning System Bot
Comment 29 2011-10-25 18:23:15 PDT
Gyuyoung Kim
Comment 30 2011-10-25 18:33:48 PDT
Collabora GTK+ EWS bot
Comment 31 2011-10-26 02:04:41 PDT
Joshua Bell
Comment 32 2011-10-28 14:37:18 PDT
Joshua Bell
Comment 33 2011-11-03 10:24:36 PDT
Joshua Bell
Comment 34 2011-11-03 10:25:32 PDT
Comment on attachment 113517 [details] Patch Tweaked one more test. I believe this is ready to go, and we have consensus on the list.
Joshua Bell
Comment 35 2011-11-03 10:27:19 PDT
abarth@ or levin@, could you take another peek?
WebKit Review Bot
Comment 36 2011-11-03 12:41:48 PDT
Comment on attachment 113517 [details] Patch Clearing flags on attachment: 113517 Committed r99229: <http://trac.webkit.org/changeset/99229>
WebKit Review Bot
Comment 37 2011-11-03 12:41:57 PDT
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.