RESOLVED FIXED 164359
IndexedDB 2.0: Support binary keys
https://bugs.webkit.org/show_bug.cgi?id=164359
Summary IndexedDB 2.0: Support binary keys
Brady Eidson
Reported 2016-11-02 23:12:46 PDT
IndexedDB 2.0: Support binary keys
Attachments
WIP (17.69 KB, patch)
2016-11-02 23:15 PDT, Brady Eidson
no flags
Patch (106.61 KB, patch)
2016-11-03 13:17 PDT, Brady Eidson
no flags
Patch (106.91 KB, patch)
2016-11-03 13:52 PDT, Brady Eidson
no flags
Brady Eidson
Comment 1 2016-11-02 23:13:26 PDT
Brady Eidson
Comment 2 2016-11-02 23:15:07 PDT
Created attachment 293750 [details] WIP This patch is most of the task, and the included layout test that does a lot of IDBKey creation and inspection actually works. Final bit is getting binary keys to actually work in the 2 backing stores which shouldn't actually be too difficult.
Brady Eidson
Comment 3 2016-11-03 13:17:59 PDT
Alex Christensen
Comment 4 2016-11-03 13:35:14 PDT
Comment on attachment 293794 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=293794&action=review r=me with comments Could we add two tests? 1) Use an array as a key to put a value in the database, change the original array, make sure that using the original array as a key returns no value to verify that the array was copied. 2) Use an array as a key to put a value in the database, use a different type of array or string with the same binary values. Such as [97, 98, 99, 100], "abcd", and [1633837924] with different types (Uint32Array/Uint8Array). I'm not sure if the type is supposed to be part of the key, or if the same bytes in different typed arrays (does endianness matter?) should be the same key. > Source/WTF/wtf/Hasher.h:248 > + size_t remainder = length % sizeof(UChar); > + for (size_t i = 0; i < remainder; ++i) Can this be just if (length % sizeof(UChar)) since sizeof(UChar) is 2? > Source/WebCore/bindings/js/IDBBindingUtilities.cpp:111 > + if (!data) > + return jsNull(); Is this correct? No exception? Can this be reached? > Source/WebCore/bindings/js/IDBBindingUtilities.cpp:116 > + if (!structure) > + return jsNull(); Ditto.
Brady Eidson
Comment 5 2016-11-03 13:44:51 PDT
(In reply to comment #4) > Comment on attachment 293794 [details] > > > Source/WebCore/bindings/js/IDBBindingUtilities.cpp:111 > > + if (!data) > > + return jsNull(); > > Is this correct? No exception? Can this be reached? Shouldn't happen, code that calls in doesn't expect for an exception. Can add an ASSERT. > > > Source/WebCore/bindings/js/IDBBindingUtilities.cpp:116 > > + if (!structure) > > + return jsNull(); > > Ditto. Out of my wheelhouse, I have no idea.
Brady Eidson
Comment 6 2016-11-03 13:52:26 PDT
Brady Eidson
Comment 7 2016-11-03 13:59:12 PDT
This patch won't pass tests, forgot to regenerate results. *sigh* New one coming
Brady Eidson
Comment 8 2016-11-03 14:51:37 PDT
The test failures on the bots are the results I forgot to update in this patch. Proper results landed with the patch in https://trac.webkit.org/changeset/208349
Ryan Haddad
Comment 9 2016-11-03 15:52:39 PDT
This change appears to have introduced an API test failure: https://build.webkit.org/builders/Apple%20Yosemite%20Release%20WK1%20(Tests)/builds/19500 FAIL WTF.StringHasher_hashMemory /Volumes/Data/slave/yosemite-release/build/Tools/TestWebKitAPI/Tests/WTF/StringHasher.cpp:430 Value of: StringHasher::hashMemory(0, 0) Actual: 82610334 Expected: emptyStringHash & 0xFFFFFF Which is: 15501470
Brady Eidson
Comment 10 2016-11-03 16:30:22 PDT
(In reply to comment #9) > This change appears to have introduced an API test failure: > > https://build.webkit.org/builders/Apple%20Yosemite%20Release%20WK1%20(Tests)/ > builds/19500 > > FAIL WTF.StringHasher_hashMemory > > /Volumes/Data/slave/yosemite-release/build/Tools/TestWebKitAPI/Tests/WTF/ > StringHasher.cpp:430 > Value of: StringHasher::hashMemory(0, 0) > Actual: 82610334 > Expected: emptyStringHash & 0xFFFFFF > Which is: 15501470 This is a behavior change, but it's unclear to me whether it's an important one. The test appears to be asserting that the hash of "'\0', length 1" should be equal to the hash of "nullptr, length 0" And I'm not sure why that assertion should hold.
Brady Eidson
Comment 11 2016-11-03 17:10:43 PDT
(In reply to comment #10) > (In reply to comment #9) > > This change appears to have introduced an API test failure: > > > > https://build.webkit.org/builders/Apple%20Yosemite%20Release%20WK1%20(Tests)/ > > builds/19500 > > > > FAIL WTF.StringHasher_hashMemory > > > > /Volumes/Data/slave/yosemite-release/build/Tools/TestWebKitAPI/Tests/WTF/ > > StringHasher.cpp:430 > > Value of: StringHasher::hashMemory(0, 0) > > Actual: 82610334 > > Expected: emptyStringHash & 0xFFFFFF > > Which is: 15501470 > > This is a behavior change, but it's unclear to me whether it's an important > one. > > The test appears to be asserting that the hash of "'\0', length 1" should be > equal to the hash of "nullptr, length 0" > > And I'm not sure why that assertion should hold. Filed https://bugs.webkit.org/show_bug.cgi?id=164390 to fix this
Note You need to log in before you can comment on or make changes to this bug.