IndexedDB 2.0: Support binary keys.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Nov 2016 21:47:21 +0000 (21:47 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Nov 2016 21:47:21 +0000 (21:47 +0000)
commit92248cdecdf6446dfb04ff0ae01ef0a0941eecc6
tree398776ecd9fd181cba33e152b56b8465dd580708
parent8020d6a22f3deade2002c08bc7548fc053fb8fb3
IndexedDB 2.0: Support binary keys.
<rdar://problem/28806927> and https://bugs.webkit.org/show_bug.cgi?id=164359

Reviewed by Alex Christensen.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idb_binary_key_conversion-expected.txt:
* web-platform-tests/IndexedDB/idbfactory_cmp3-expected.txt:
* web-platform-tests/IndexedDB/idbfactory_cmp4-expected.txt:

Source/WebCore:

Tests: storage/indexeddb/modern/binary-keys-1-private.html
       storage/indexeddb/modern/binary-keys-1.html
       Changes to other existing tests.

* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::createBinary):
(WebCore::IDBKey::IDBKey):
(WebCore::IDBKey::compare):
* Modules/indexeddb/IDBKey.h:
(WebCore::IDBKey::binary):
(WebCore::compareBinaryKeyData):

* Modules/indexeddb/IDBKeyData.cpp:
(WebCore::IDBKeyData::IDBKeyData):
(WebCore::IDBKeyData::maybeCreateIDBKey):
(WebCore::IDBKeyData::isolatedCopy):
(WebCore::IDBKeyData::encode):
(WebCore::IDBKeyData::decode):
(WebCore::IDBKeyData::compare):
(WebCore::IDBKeyData::loggingString):
(WebCore::IDBKeyData::operator==):
* Modules/indexeddb/IDBKeyData.h:
(WebCore::IDBKeyData::hash):
(WebCore::IDBKeyData::encode):
(WebCore::IDBKeyData::decode):

* Modules/indexeddb/IndexedDB.h: Add new enum for the new key type.

* bindings/js/IDBBindingUtilities.cpp:
(WebCore::toJS):
(WebCore::createIDBKeyFromValue):

* platform/ThreadSafeDataBuffer.h:
(WebCore::ThreadSafeDataBufferImpl::ThreadSafeDataBufferImpl):
(WebCore::ThreadSafeDataBuffer::copyData):
(WebCore::ThreadSafeDataBuffer::size):
(WebCore::ThreadSafeDataBuffer::operator==):
(WebCore::ThreadSafeDataBuffer::ThreadSafeDataBuffer):

Source/WTF:

* wtf/Hasher.h:
(WTF::StringHasher::hashMemory): Teach hashMemory() to handle buffers with odd lengths.

LayoutTests:

* storage/indexeddb/factory-cmp-expected.txt:
* storage/indexeddb/factory-cmp-private-expected.txt:
* storage/indexeddb/key-type-binary-expected.txt:
* storage/indexeddb/key-type-binary-private-expected.txt:
* storage/indexeddb/modern/binary-keys-1-expected.txt: Added.
* storage/indexeddb/modern/binary-keys-1-private-expected.txt: Added.
* storage/indexeddb/modern/binary-keys-1-private.html: Added.
* storage/indexeddb/modern/binary-keys-1.html: Added.
* storage/indexeddb/modern/resources/binary-keys-1.js: Added.
* storage/indexeddb/resources/factory-cmp.js:
* storage/indexeddb/resources/key-type-binary.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208349 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idb_binary_key_conversion-expected.txt
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_cmp3-expected.txt
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_cmp4-expected.txt
LayoutTests/storage/indexeddb/factory-cmp-expected.txt
LayoutTests/storage/indexeddb/factory-cmp-private-expected.txt
LayoutTests/storage/indexeddb/key-type-binary-expected.txt
LayoutTests/storage/indexeddb/key-type-binary-private-expected.txt
LayoutTests/storage/indexeddb/modern/binary-keys-1-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/binary-keys-1-private-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/binary-keys-1-private.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/binary-keys-1.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/resources/binary-keys-1.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/resources/factory-cmp.js
LayoutTests/storage/indexeddb/resources/key-type-binary.js
Source/WTF/ChangeLog
Source/WTF/wtf/Hasher.h
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBKey.cpp
Source/WebCore/Modules/indexeddb/IDBKey.h
Source/WebCore/Modules/indexeddb/IDBKeyData.cpp
Source/WebCore/Modules/indexeddb/IDBKeyData.h
Source/WebCore/Modules/indexeddb/IndexedDB.h
Source/WebCore/bindings/js/IDBBindingUtilities.cpp
Source/WebCore/platform/ThreadSafeDataBuffer.h