IndexedDB 2.0: Support IDBObjectStore getAll/getAllKeys.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 23:43:50 +0000 (23:43 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Oct 2016 23:43:50 +0000 (23:43 +0000)
commit3cd2562c05a7153c706f3c78c6f2ed29e0663fec
tree2d011a3914325a2e4f700c82e899f8c9bda497de
parentc32903e365fd539295c9eaca5cc19d3a14f683a7
IndexedDB 2.0: Support IDBObjectStore getAll/getAllKeys.
<rdar://problem/28806934> and https://bugs.webkit.org/show_bug.cgi?id=164097

Reviewed by Darin Adler.

LayoutTests/imported/w3c:

* web-platform-tests/IndexedDB/idbobjectstore_getAll-expected.txt:
* web-platform-tests/IndexedDB/idbobjectstore_getAllKeys-expected.txt:

Source/WebCore:

Tests: storage/indexeddb/modern/idbobjectstore-getall-1-private.html
       storage/indexeddb/modern/idbobjectstore-getall-1.html
       storage/indexeddb/modern/idbobjectstore-getallkeys-1-private.html
       storage/indexeddb/modern/idbobjectstore-getallkeys-1.html
       Existing imported W3C tests.

- Add new objects for "IDBGetAllRequestData" and "IDBGetAllResult" to represent these
  new requests and responses.
- Add lots of boilerplate code to move these new objects around in the IDB machinery.
- Update "GetRecord" code to be shared with "GetAll" code where necessary.
- Other tweaks here and there.

* WebCore.xcodeproj/project.pbxproj:
* CMakeLists.txt:

* Modules/indexeddb/IDBGetAllResult.cpp: Added.
(WebCore::isolatedCopyOfVariant):
(WebCore::IDBGetAllResult::isolatedCopy):
(WebCore::IDBGetAllResult::addKey):
(WebCore::IDBGetAllResult::addValue):
(WebCore::IDBGetAllResult::keys):
(WebCore::IDBGetAllResult::values):
(WebCore::IDBGetAllResult::allBlobFilePaths):
* Modules/indexeddb/IDBGetAllResult.h: Added.
(WebCore::IDBGetAllResult::IDBGetAllResult):
(WebCore::IDBGetAllResult::type):
(WebCore::IDBGetAllResult::encode):
(WebCore::IDBGetAllResult::decode):

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::getAll):
(WebCore::IDBObjectStore::getAllKeys):
* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:

* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::setResult):
* Modules/indexeddb/IDBRequest.h:

* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::requestGetAllObjectStoreRecords):
(WebCore::IDBTransaction::getAllRecordsOnServer):
(WebCore::IDBTransaction::didGetAllRecordsOnServer):
* Modules/indexeddb/IDBTransaction.h:

* Modules/indexeddb/IndexedDB.h:

* Modules/indexeddb/client/IDBConnectionProxy.cpp:
(WebCore::IDBClient::IDBConnectionProxy::getAllRecords):
* Modules/indexeddb/client/IDBConnectionProxy.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::getAllRecords):
(WebCore::IDBClient::IDBConnectionToServer::didGetAllRecords):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/server/IDBBackingStore.h:

* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::didGetAllRecords):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::getAllRecords):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::getAllRecords):
* Modules/indexeddb/server/MemoryIDBBackingStore.h:

* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::getAllRecords):
* Modules/indexeddb/server/MemoryObjectStore.h:

* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::queryForGetAllRecords):
(WebCore::IDBServer::SQLiteIDBBackingStore::getAllRecords):
* Modules/indexeddb/server/SQLiteIDBBackingStore.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::hasAnyPendingCallbacks):
(WebCore::IDBServer::UniqueIDBDatabase::storeCallbackOrFireError):
(WebCore::IDBServer::UniqueIDBDatabase::getAllRecords):
(WebCore::IDBServer::UniqueIDBDatabase::performGetAllRecords):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformGetAllRecords):
(WebCore::IDBServer::UniqueIDBDatabase::performGetAllResultsCallback):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::getAllRecords):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBGetAllRecordsData.cpp: Added.
(WebCore::IDBGetAllRecordsData::isolatedCopy):
* Modules/indexeddb/shared/IDBGetAllRecordsData.h: Added.
(WebCore::IDBGetAllRecordsData::encode):
(WebCore::IDBGetAllRecordsData::decode):

* Modules/indexeddb/shared/IDBResultData.cpp:
(WebCore::IDBResultData::IDBResultData):
(WebCore::IDBResultData::getAllRecordsSuccess):
(WebCore::IDBResultData::getAllResult):
* Modules/indexeddb/shared/IDBResultData.h:
(WebCore::IDBResultData::encode):
(WebCore::IDBResultData::decode):

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didGetAllRecords):
(WebCore::InProcessIDBServer::getAllRecords):
* Modules/indexeddb/shared/InProcessIDBServer.h:

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

Source/WebKit2:

- Handle moving "Get All" requests to and from the DatabaseProcess.
- Handle the additional task of creating/passing Sandbox Extensions for
  referenced files when necessary.

* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp:
(WebKit::WebIDBConnectionToClient::handleGetResult):
(WebKit::WebIDBConnectionToClient::didGetAllRecords):
(WebKit::WebIDBConnectionToClient::getAllRecords):
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h:
* DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in:

* Shared/WebCoreArgumentCoders.h:

* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp:
(WebKit::WebIDBConnectionToServer::getAllRecords):
(WebKit::preregisterSandboxExtensionsIfNecessary):
(WebKit::WebIDBConnectionToServer::didGetAllRecords):
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h:
* WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in:

LayoutTests:

* storage/indexeddb/modern/idbobjectstore-getall-1-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-getall-1-private-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-getall-1-private.html: Added.
* storage/indexeddb/modern/idbobjectstore-getall-1.html: Added.
* storage/indexeddb/modern/idbobjectstore-getallkeys-1-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-getallkeys-1-private-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-getallkeys-1-private.html: Added.
* storage/indexeddb/modern/idbobjectstore-getallkeys-1.html: Added.
* storage/indexeddb/modern/resources/idbobjectstore-getall-1.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208194 268f45cc-cd09-0410-ab3c-d52691b4dbfc
65 files changed:
LayoutTests/ChangeLog
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_getAll-expected.txt
LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbobjectstore_getAllKeys-expected.txt
LayoutTests/storage/indexeddb/modern/idbobjectstore-getall-1-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getall-1-private-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getall-1-private.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getall-1.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getallkeys-1-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getallkeys-1-private-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getallkeys-1-private.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/idbobjectstore-getallkeys-1.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-getall-1.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/modern/resources/idbobjectstore-getallkeys-1.js [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBGetAllResult.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/IDBGetAllResult.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
Source/WebCore/Modules/indexeddb/IDBRequest.cpp
Source/WebCore/Modules/indexeddb/IDBRequest.h
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
Source/WebCore/Modules/indexeddb/IDBTransaction.h
Source/WebCore/Modules/indexeddb/IndexedDB.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h
Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h
Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
Source/WebCore/Modules/indexeddb/server/IDBServer.h
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h
Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.cpp [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBGetAllRecordsData.h [new file with mode: 0644]
Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp
Source/WebCore/Modules/indexeddb/shared/IDBResultData.h
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/IDBBindingUtilities.cpp
Source/WebCore/bindings/js/IDBBindingUtilities.h
Source/WebKit2/ChangeLog
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h
Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in
Source/WebKit2/Platform/IPC/ArgumentCoders.h
Source/WebKit2/Shared/WebCoreArgumentCoders.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in