Changeset 195443 in webkit


Ignore:
Timestamp:
Jan 21, 2016 10:39:57 PM (8 years ago)
Author:
beidson@apple.com
Message:

Modern IDB: Support populating/extracting database metadata with SQLite backend.
Source/WebCore:

Nhttps://bugs.webkit.org/show_bug.cgi?id=153318

Reviewed by Alex Christensen.

No new tests (Covered by current tests).

  • CMakeLists.txt:
  • WebCore.xcodeproj/project.pbxproj:
  • Modules/indexeddb/client/IDBDatabaseImpl.cpp:

(WebCore::IDBClient::IDBDatabase::willAbortTransaction): Committing transactions can abort if the commit

ends in error.

  • Modules/indexeddb/client/IDBTransactionImpl.cpp:

(WebCore::IDBClient::IDBTransaction::didCommit): Before a committing transaction is aborted, notify the

IDBDatabase that it aborted.

Copied over from WK2:

  • Modules/indexeddb/server/IDBSerialization.cpp: Added.

(WebCore::serializeIDBKeyPath):
(WebCore::deserializeIDBKeyPath):
(WebCore::serializeIDBKeyData):
(WebCore::deserializeIDBKeyData):

  • Modules/indexeddb/server/IDBSerialization.h: Added.
  • Modules/indexeddb/server/IDBServer.cpp:

(WebCore::IDBServer::IDBServer::createBackingStore): Optionally create a SQLite backing store.

Mostly copied over verbatim from WebKit2's UniqueIDBDatabaseBackingStoreSQLite.cpp:

  • Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:

(WebCore::IDBServer::idbKeyCollate):
(WebCore::IDBServer::v1RecordsTableSchema):
(WebCore::IDBServer::v1RecordsTableSchemaAlternate):
(WebCore::IDBServer::v2RecordsTableSchema):
(WebCore::IDBServer::v2RecordsTableSchemaAlternate):
(WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
(WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidRecordsTable):
(WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
(WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction):
(WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
(WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
(WebCore::IDBServer::SQLiteIDBBackingStore::unregisterCursor):

  • Modules/indexeddb/server/SQLiteIDBBackingStore.h:

Copied over from WK2:

  • Modules/indexeddb/server/SQLiteIDBCursor.cpp: Added.

(WebCore::IDBServer::SQLiteIDBCursor::maybeCreate):
(WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
(WebCore::IDBServer::buildIndexStatement):
(WebCore::IDBServer::buildObjectStoreStatement):
(WebCore::IDBServer::SQLiteIDBCursor::establishStatement):
(WebCore::IDBServer::SQLiteIDBCursor::createSQLiteStatement):
(WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
(WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
(WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
(WebCore::IDBServer::SQLiteIDBCursor::advance):
(WebCore::IDBServer::SQLiteIDBCursor::advanceUnique):
(WebCore::IDBServer::SQLiteIDBCursor::advanceOnce):
(WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
(WebCore::IDBServer::SQLiteIDBCursor::iterate):

  • Modules/indexeddb/server/SQLiteIDBCursor.h: Added.

(WebCore::IDBServer::SQLiteIDBCursor::identifier):
(WebCore::IDBServer::SQLiteIDBCursor::transaction):
(WebCore::IDBServer::SQLiteIDBCursor::objectStoreID):
(WebCore::IDBServer::SQLiteIDBCursor::currentKey):
(WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
(WebCore::IDBServer::SQLiteIDBCursor::currentValueBuffer):
(WebCore::IDBServer::SQLiteIDBCursor::didError):

Copied over from WK2:

  • Modules/indexeddb/server/SQLiteIDBTransaction.cpp: Added.

(WebCore::IDBServer::SQLiteIDBTransaction::SQLiteIDBTransaction):
(WebCore::IDBServer::SQLiteIDBTransaction::~SQLiteIDBTransaction):
(WebCore::IDBServer::SQLiteIDBTransaction::begin):
(WebCore::IDBServer::SQLiteIDBTransaction::commit):
(WebCore::IDBServer::SQLiteIDBTransaction::reset):
(WebCore::IDBServer::SQLiteIDBTransaction::rollback):
(WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenCursor):
(WebCore::IDBServer::SQLiteIDBTransaction::closeCursor):
(WebCore::IDBServer::SQLiteIDBTransaction::notifyCursorsOfChanges):
(WebCore::IDBServer::SQLiteIDBTransaction::clearCursors):
(WebCore::IDBServer::SQLiteIDBTransaction::inProgress):

  • Modules/indexeddb/server/SQLiteIDBTransaction.h: Added.

(WebCore::IDBServer::SQLiteIDBTransaction::transactionIdentifier):
(WebCore::IDBServer::SQLiteIDBTransaction::mode):
(WebCore::IDBServer::SQLiteIDBTransaction::sqliteTransaction):

  • page/Page.cpp:

(WebCore::Page::setSessionID): If the new SessionID is different from the last one,

clear the IDBConnectionToServer.

(WebCore::Page::idbConnection): Always ask the DatabaseProvider; It handles whether or not

the session is ephemeral.

LayoutTests:

https://bugs.webkit.org/show_bug.cgi?id=153318

Reviewed by Alex Christensen.

  • platform/mac-wk1/TestExpectations: Skip all of the tests that run against the SQLite backend and currently fail (which is most of them!)
Location:
trunk
Files:
6 added
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r195442 r195443  
     12016-01-21  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Support populating/extracting database metadata with SQLite backend.
     4        https://bugs.webkit.org/show_bug.cgi?id=153318
     5
     6        Reviewed by Alex Christensen.
     7
     8        * platform/mac-wk1/TestExpectations: Skip all of the tests that run against the
     9          SQLite backend and currently fail (which is most of them!)
     10
    1112016-01-21  Nikita Vasilyev  <nvasilyev@apple.com>
    212
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r195394 r195443  
    244244# Lacking WK1 TestRunner API that evaluates JavaScript through JSC APIs and not WebCore APIs
    245245inspector/script-profiler/event-type-API.html
     246
     247########################################
     248### START OF (3) IndexedDB failures with SQLite
     249
     250# SQLite backend tests with text failures
     251crypto/subtle/rsa-indexeddb-non-exportable.html [ Failure ]
     252fast/history/page-cache-indexed-opened-db.html [ Failure ]
     253imported/w3c/indexeddb/close-in-upgradeneeded.html [ Failure ]
     254imported/w3c/indexeddb/cursor-overloads.htm [ Failure ]
     255imported/w3c/indexeddb/idbcursor-direction-index-keyrange.htm [ Failure ]
     256imported/w3c/indexeddb/idbcursor-direction-index.htm [ Failure ]
     257imported/w3c/indexeddb/idbcursor-direction-objectstore-keyrange.htm [ Failure ]
     258imported/w3c/indexeddb/idbcursor-direction-objectstore.htm [ Failure ]
     259imported/w3c/indexeddb/idbcursor-direction.htm [ Failure ]
     260imported/w3c/indexeddb/idbcursor-key.htm [ Failure ]
     261imported/w3c/indexeddb/idbcursor-primarykey.htm [ Failure ]
     262imported/w3c/indexeddb/idbcursor-reused.htm [ Failure ]
     263imported/w3c/indexeddb/idbcursor_advance_index.htm [ Failure ]
     264imported/w3c/indexeddb/idbcursor_advance_index2.htm [ Failure ]
     265imported/w3c/indexeddb/idbcursor_advance_index3.htm [ Failure ]
     266imported/w3c/indexeddb/idbcursor_advance_index5.htm [ Failure ]
     267imported/w3c/indexeddb/idbcursor_advance_index6.htm [ Failure ]
     268imported/w3c/indexeddb/idbcursor_advance_index7.htm [ Failure ]
     269imported/w3c/indexeddb/idbcursor_advance_index8.htm [ Failure ]
     270imported/w3c/indexeddb/idbcursor_advance_index9.htm [ Failure ]
     271imported/w3c/indexeddb/idbcursor_advance_objectstore.htm [ Failure ]
     272imported/w3c/indexeddb/idbcursor_advance_objectstore2.htm [ Failure ]
     273imported/w3c/indexeddb/idbcursor_advance_objectstore3.htm [ Failure ]
     274imported/w3c/indexeddb/idbcursor_advance_objectstore4.htm [ Failure ]
     275imported/w3c/indexeddb/idbcursor_advance_objectstore5.htm [ Failure ]
     276imported/w3c/indexeddb/idbcursor_continue_index.htm [ Failure ]
     277imported/w3c/indexeddb/idbcursor_continue_index2.htm [ Failure ]
     278imported/w3c/indexeddb/idbcursor_continue_index3.htm [ Failure ]
     279imported/w3c/indexeddb/idbcursor_continue_index4.htm [ Failure ]
     280imported/w3c/indexeddb/idbcursor_continue_index5.htm [ Failure ]
     281imported/w3c/indexeddb/idbcursor_continue_index6.htm [ Failure ]
     282imported/w3c/indexeddb/idbcursor_continue_index7.htm [ Failure ]
     283imported/w3c/indexeddb/idbcursor_continue_index8.htm [ Failure ]
     284imported/w3c/indexeddb/idbcursor_continue_invalid.htm [ Failure ]
     285imported/w3c/indexeddb/idbcursor_continue_objectstore.htm [ Failure ]
     286imported/w3c/indexeddb/idbcursor_continue_objectstore2.htm [ Failure ]
     287imported/w3c/indexeddb/idbcursor_continue_objectstore3.htm [ Failure ]
     288imported/w3c/indexeddb/idbcursor_continue_objectstore4.htm [ Failure ]
     289imported/w3c/indexeddb/idbcursor_continue_objectstore5.htm [ Failure ]
     290imported/w3c/indexeddb/idbcursor_continue_objectstore6.htm [ Failure ]
     291imported/w3c/indexeddb/idbcursor_delete_index.htm [ Failure ]
     292imported/w3c/indexeddb/idbcursor_delete_index2.htm [ Failure ]
     293imported/w3c/indexeddb/idbcursor_delete_index3.htm [ Failure ]
     294imported/w3c/indexeddb/idbcursor_delete_index4.htm [ Failure ]
     295imported/w3c/indexeddb/idbcursor_delete_index5.htm [ Failure ]
     296imported/w3c/indexeddb/idbcursor_delete_objectstore.htm [ Failure ]
     297imported/w3c/indexeddb/idbcursor_delete_objectstore2.htm [ Failure ]
     298imported/w3c/indexeddb/idbcursor_delete_objectstore3.htm [ Failure ]
     299imported/w3c/indexeddb/idbcursor_delete_objectstore4.htm [ Failure ]
     300imported/w3c/indexeddb/idbcursor_delete_objectstore5.htm [ Failure ]
     301imported/w3c/indexeddb/idbcursor_iterating.htm [ Failure ]
     302imported/w3c/indexeddb/idbcursor_iterating_index.htm [ Failure ]
     303imported/w3c/indexeddb/idbcursor_iterating_index2.htm [ Failure ]
     304imported/w3c/indexeddb/idbcursor_iterating_objectstore.htm [ Failure ]
     305imported/w3c/indexeddb/idbcursor_iterating_objectstore2.htm [ Failure ]
     306imported/w3c/indexeddb/idbcursor_update_index.htm [ Failure ]
     307imported/w3c/indexeddb/idbcursor_update_index2.htm [ Failure ]
     308imported/w3c/indexeddb/idbcursor_update_index3.htm [ Failure ]
     309imported/w3c/indexeddb/idbcursor_update_index4.htm [ Failure ]
     310imported/w3c/indexeddb/idbcursor_update_index5.htm [ Failure ]
     311imported/w3c/indexeddb/idbcursor_update_index6.htm [ Failure ]
     312imported/w3c/indexeddb/idbcursor_update_index7.htm [ Failure ]
     313imported/w3c/indexeddb/idbcursor_update_objectstore.htm [ Failure ]
     314imported/w3c/indexeddb/idbcursor_update_objectstore2.htm [ Failure ]
     315imported/w3c/indexeddb/idbcursor_update_objectstore3.htm [ Failure ]
     316imported/w3c/indexeddb/idbcursor_update_objectstore4.htm [ Failure ]
     317imported/w3c/indexeddb/idbcursor_update_objectstore5.htm [ Failure ]
     318imported/w3c/indexeddb/idbcursor_update_objectstore6.htm [ Failure ]
     319imported/w3c/indexeddb/idbcursor_update_objectstore7.htm [ Failure ]
     320imported/w3c/indexeddb/idbcursor_update_objectstore8.htm [ Failure ]
     321imported/w3c/indexeddb/idbdatabase_close.htm [ Failure ]
     322imported/w3c/indexeddb/idbdatabase_close2.htm [ Failure ]
     323imported/w3c/indexeddb/idbdatabase_createObjectStore-createIndex-emptyname.htm [ Failure ]
     324imported/w3c/indexeddb/idbdatabase_createObjectStore.htm [ Failure ]
     325imported/w3c/indexeddb/idbdatabase_createObjectStore10-1000ends.htm [ Failure ]
     326imported/w3c/indexeddb/idbdatabase_createObjectStore10-emptyname.htm [ Failure ]
     327imported/w3c/indexeddb/idbdatabase_createObjectStore2.htm [ Failure ]
     328imported/w3c/indexeddb/idbdatabase_createObjectStore3.htm [ Failure ]
     329imported/w3c/indexeddb/idbdatabase_createObjectStore5.htm [ Failure ]
     330imported/w3c/indexeddb/idbdatabase_deleteObjectStore2.htm [ Failure ]
     331imported/w3c/indexeddb/idbdatabase_deleteObjectStore4-not_reused.htm [ Failure ]
     332imported/w3c/indexeddb/idbdatabase_transaction.htm [ Failure ]
     333imported/w3c/indexeddb/idbdatabase_transaction2.htm [ Failure ]
     334imported/w3c/indexeddb/idbdatabase_transaction3.htm [ Failure ]
     335imported/w3c/indexeddb/idbdatabase_transaction4.htm [ Failure ]
     336imported/w3c/indexeddb/idbdatabase_transaction5.htm [ Failure ]
     337imported/w3c/indexeddb/idbfactory_deleteDatabase.htm [ Failure ]
     338imported/w3c/indexeddb/idbfactory_deleteDatabase2.htm [ Failure ]
     339imported/w3c/indexeddb/idbfactory_deleteDatabase3.htm [ Failure ]
     340imported/w3c/indexeddb/idbfactory_deleteDatabase4.htm [ Failure ]
     341imported/w3c/indexeddb/idbfactory_open.htm [ Failure ]
     342imported/w3c/indexeddb/idbfactory_open10.htm [ Failure ]
     343imported/w3c/indexeddb/idbfactory_open11.htm [ Failure ]
     344imported/w3c/indexeddb/idbfactory_open2.htm [ Failure ]
     345imported/w3c/indexeddb/idbfactory_open3.htm [ Failure ]
     346imported/w3c/indexeddb/idbfactory_open4.htm [ Failure ]
     347imported/w3c/indexeddb/idbfactory_open5.htm [ Failure ]
     348imported/w3c/indexeddb/idbfactory_open6.htm [ Failure ]
     349imported/w3c/indexeddb/idbfactory_open7.htm [ Failure ]
     350imported/w3c/indexeddb/idbindex-multientry.htm [ Failure ]
     351imported/w3c/indexeddb/idbindex_count.htm [ Failure ]
     352imported/w3c/indexeddb/idbindex_count2.htm [ Failure ]
     353imported/w3c/indexeddb/idbindex_count3.htm [ Failure ]
     354imported/w3c/indexeddb/idbindex_count4.htm [ Failure ]
     355imported/w3c/indexeddb/idbindex_get.htm [ Failure ]
     356imported/w3c/indexeddb/idbindex_get2.htm [ Failure ]
     357imported/w3c/indexeddb/idbindex_get3.htm [ Failure ]
     358imported/w3c/indexeddb/idbindex_get4.htm [ Failure ]
     359imported/w3c/indexeddb/idbindex_getKey.htm [ Failure ]
     360imported/w3c/indexeddb/idbindex_getKey2.htm [ Failure ]
     361imported/w3c/indexeddb/idbindex_getKey3.htm [ Failure ]
     362imported/w3c/indexeddb/idbindex_getKey4.htm [ Failure ]
     363imported/w3c/indexeddb/idbindex_indexNames.htm [ Failure ]
     364imported/w3c/indexeddb/idbobjectstore_add.htm [ Failure ]
     365imported/w3c/indexeddb/idbobjectstore_add14.htm [ Failure ]
     366imported/w3c/indexeddb/idbobjectstore_add15.htm [ Failure ]
     367imported/w3c/indexeddb/idbobjectstore_add16.htm [ Failure ]
     368imported/w3c/indexeddb/idbobjectstore_add2.htm [ Failure ]
     369imported/w3c/indexeddb/idbobjectstore_add3.htm [ Failure ]
     370imported/w3c/indexeddb/idbobjectstore_add4.htm [ Failure ]
     371imported/w3c/indexeddb/idbobjectstore_add5.htm [ Failure ]
     372imported/w3c/indexeddb/idbobjectstore_add6.htm [ Failure ]
     373imported/w3c/indexeddb/idbobjectstore_add7.htm [ Failure ]
     374imported/w3c/indexeddb/idbobjectstore_add8.htm [ Failure ]
     375imported/w3c/indexeddb/idbobjectstore_clear.htm [ Failure ]
     376imported/w3c/indexeddb/idbobjectstore_clear2.htm [ Failure ]
     377imported/w3c/indexeddb/idbobjectstore_clear3.htm [ Failure ]
     378imported/w3c/indexeddb/idbobjectstore_clear4.htm [ Failure ]
     379imported/w3c/indexeddb/idbobjectstore_count.htm [ Failure ]
     380imported/w3c/indexeddb/idbobjectstore_count2.htm [ Failure ]
     381imported/w3c/indexeddb/idbobjectstore_count3.htm [ Failure ]
     382imported/w3c/indexeddb/idbobjectstore_count4.htm [ Failure ]
     383imported/w3c/indexeddb/idbobjectstore_createIndex12.htm [ Failure ]
     384imported/w3c/indexeddb/idbobjectstore_createIndex13.htm [ Failure ]
     385imported/w3c/indexeddb/idbobjectstore_createIndex2.htm [ Failure ]
     386imported/w3c/indexeddb/idbobjectstore_createIndex3-usable-right-away.htm [ Failure ]
     387imported/w3c/indexeddb/idbobjectstore_createIndex4-deleteIndex-event_order.htm [ Failure ]
     388imported/w3c/indexeddb/idbobjectstore_createIndex5-emptykeypath.htm [ Failure ]
     389imported/w3c/indexeddb/idbobjectstore_createIndex6-event_order.htm [ Failure ]
     390imported/w3c/indexeddb/idbobjectstore_createIndex7-event_order.htm [ Failure ]
     391imported/w3c/indexeddb/idbobjectstore_createIndex8-valid_keys.htm [ Failure ]
     392imported/w3c/indexeddb/idbobjectstore_createIndex9-emptyname.htm [ Failure ]
     393imported/w3c/indexeddb/idbobjectstore_delete.htm [ Failure ]
     394imported/w3c/indexeddb/idbobjectstore_delete2.htm [ Failure ]
     395imported/w3c/indexeddb/idbobjectstore_delete3.htm [ Failure ]
     396imported/w3c/indexeddb/idbobjectstore_delete4.htm [ Failure ]
     397imported/w3c/indexeddb/idbobjectstore_delete5.htm [ Failure ]
     398imported/w3c/indexeddb/idbobjectstore_delete6.htm [ Failure ]
     399imported/w3c/indexeddb/idbobjectstore_delete7.htm [ Failure ]
     400imported/w3c/indexeddb/idbobjectstore_deleteIndex.htm [ Failure ]
     401imported/w3c/indexeddb/idbobjectstore_deleted.htm [ Failure ]
     402imported/w3c/indexeddb/idbobjectstore_get.htm [ Failure ]
     403imported/w3c/indexeddb/idbobjectstore_get2.htm [ Failure ]
     404imported/w3c/indexeddb/idbobjectstore_get3.htm [ Failure ]
     405imported/w3c/indexeddb/idbobjectstore_get4.htm [ Failure ]
     406imported/w3c/indexeddb/idbobjectstore_get5.htm [ Failure ]
     407imported/w3c/indexeddb/idbobjectstore_get6.htm [ Failure ]
     408imported/w3c/indexeddb/idbobjectstore_get7.htm [ Failure ]
     409imported/w3c/indexeddb/idbobjectstore_index.htm [ Failure ]
     410imported/w3c/indexeddb/idbobjectstore_openCursor.htm [ Failure ]
     411imported/w3c/indexeddb/idbobjectstore_put.htm [ Failure ]
     412imported/w3c/indexeddb/idbobjectstore_put14.htm [ Failure ]
     413imported/w3c/indexeddb/idbobjectstore_put15.htm [ Failure ]
     414imported/w3c/indexeddb/idbobjectstore_put16.htm [ Failure ]
     415imported/w3c/indexeddb/idbobjectstore_put2.htm [ Failure ]
     416imported/w3c/indexeddb/idbobjectstore_put3.htm [ Failure ]
     417imported/w3c/indexeddb/idbobjectstore_put4.htm [ Failure ]
     418imported/w3c/indexeddb/idbobjectstore_put5.htm [ Failure ]
     419imported/w3c/indexeddb/idbobjectstore_put6.htm [ Failure ]
     420imported/w3c/indexeddb/idbobjectstore_put7.htm [ Failure ]
     421imported/w3c/indexeddb/idbobjectstore_put8.htm [ Failure ]
     422imported/w3c/indexeddb/idbtransaction-oncomplete.htm [ Failure ]
     423imported/w3c/indexeddb/idbtransaction_abort.htm [ Failure ]
     424imported/w3c/indexeddb/idbversionchangeevent.htm [ Failure ]
     425imported/w3c/indexeddb/index_sort_order.htm [ Failure ]
     426imported/w3c/indexeddb/key_valid.html [ Failure ]
     427imported/w3c/indexeddb/keygenerator-constrainterror.htm [ Failure ]
     428imported/w3c/indexeddb/keygenerator-overflow.htm [ Failure ]
     429imported/w3c/indexeddb/keygenerator.htm [ Failure ]
     430imported/w3c/indexeddb/keyorder.htm [ Failure ]
     431imported/w3c/indexeddb/keypath_maxsize.htm [ Failure ]
     432imported/w3c/indexeddb/list_ordering.htm [ Failure ]
     433imported/w3c/indexeddb/objectstore_keyorder.htm [ Failure ]
     434imported/w3c/indexeddb/request_bubble-and-capture.htm [ Failure ]
     435imported/w3c/indexeddb/string-list-ordering.htm [ Failure ]
     436imported/w3c/indexeddb/transaction-create_in_versionchange.htm [ Failure ]
     437imported/w3c/indexeddb/transaction-lifetime-blocked.htm [ Failure ]
     438imported/w3c/indexeddb/transaction-lifetime.htm [ Failure ]
     439imported/w3c/indexeddb/transaction-requestqueue.htm [ Failure ]
     440imported/w3c/indexeddb/transaction_bubble-and-capture.htm [ Failure ]
     441imported/w3c/indexeddb/value.htm [ Failure ]
     442imported/w3c/indexeddb/value_recursive.htm [ Failure ]
     443imported/w3c/indexeddb/writer-starvation.htm [ Failure ]
     444storage/indexeddb/aborted-versionchange-closes.html [ Failure ]
     445storage/indexeddb/basics.html [ Failure ]
     446storage/indexeddb/closed-cursor.html [ Failure ]
     447storage/indexeddb/create-and-remove-object-store.html [ Failure ]
     448storage/indexeddb/create-object-store-options.html [ Failure ]
     449storage/indexeddb/createIndex-after-failure.html [ Failure ]
     450storage/indexeddb/cursor-added-bug.html [ Failure ]
     451storage/indexeddb/cursor-advance.html [ Failure ]
     452storage/indexeddb/cursor-basics.html [ Failure ]
     453storage/indexeddb/cursor-cast.html [ Failure ]
     454storage/indexeddb/cursor-continue-dir.html [ Failure ]
     455storage/indexeddb/cursor-continue-validity.html [ Failure ]
     456storage/indexeddb/cursor-continue.html [ Failure ]
     457storage/indexeddb/cursor-delete.html [ Failure ]
     458storage/indexeddb/cursor-finished.html [ Failure ]
     459storage/indexeddb/cursor-inconsistency.html [ Failure ]
     460storage/indexeddb/cursor-index-delete.html [ Failure ]
     461storage/indexeddb/cursor-key-order.html [ Failure ]
     462storage/indexeddb/cursor-overloads.html [ Failure ]
     463storage/indexeddb/cursor-prev-no-duplicate.html [ Failure ]
     464storage/indexeddb/cursor-primary-key-order.html [ Failure ]
     465storage/indexeddb/cursor-properties.html [ Failure ]
     466storage/indexeddb/cursor-reverse-bug.html [ Failure ]
     467storage/indexeddb/cursor-skip-deleted.html [ Failure ]
     468storage/indexeddb/cursor-update-value-argument-required.html [ Failure ]
     469storage/indexeddb/cursor-update.html [ Failure ]
     470storage/indexeddb/cursor-value.html [ Failure ]
     471storage/indexeddb/database-basics.html [ Failure ]
     472storage/indexeddb/database-close.html [ Failure ]
     473storage/indexeddb/database-closepending-flag.html [ Failure ]
     474storage/indexeddb/database-deletepending-flag.html [ Failure ]
     475storage/indexeddb/database-odd-names.html [ Failure ]
     476storage/indexeddb/database-wrapper.html [ Failure ]
     477storage/indexeddb/delete-in-upgradeneeded-close-in-open-success.html [ Failure ]
     478storage/indexeddb/delete-range.html [ Failure ]
     479storage/indexeddb/deleteIndex.html [ Failure ]
     480storage/indexeddb/deleted-objects.html [ Failure ]
     481storage/indexeddb/deletedatabase-blocked.html [ Failure ]
     482storage/indexeddb/deletedatabase-delayed-by-open-and-versionchange.html [ Failure ]
     483storage/indexeddb/deletedatabase-not-blocked.html [ Failure ]
     484storage/indexeddb/deletedatabase-transaction.html [ Failure ]
     485storage/indexeddb/dont-wedge.html [ Failure ]
     486storage/indexeddb/duplicates.html [ Failure ]
     487storage/indexeddb/error-causes-abort-by-default.html [ Failure ]
     488storage/indexeddb/exception-in-event-aborts.html [ Failure ]
     489storage/indexeddb/exceptions.html [ Failure ]
     490storage/indexeddb/factory-deletedatabase.html [ Failure ]
     491storage/indexeddb/get-keyrange.html [ Failure ]
     492storage/indexeddb/index-basics.html [ Failure ]
     493storage/indexeddb/index-count.html [ Failure ]
     494storage/indexeddb/index-cursor.html [ Failure ]
     495storage/indexeddb/index-duplicate-keypaths.html [ Failure ]
     496storage/indexeddb/index-multientry.html [ Failure ]
     497storage/indexeddb/index-population.html [ Failure ]
     498storage/indexeddb/index-unique.html [ Failure ]
     499storage/indexeddb/intversion-blocked.html [ Failure ]
     500storage/indexeddb/intversion-close-between-events.html [ Failure ]
     501storage/indexeddb/intversion-close-in-oncomplete.html [ Failure ]
     502storage/indexeddb/intversion-close-in-upgradeneeded.html [ Failure ]
     503storage/indexeddb/intversion-encoding.html [ Failure ]
     504storage/indexeddb/intversion-gated-on-delete.html [ Failure ]
     505storage/indexeddb/intversion-long-queue.html [ Failure ]
     506storage/indexeddb/intversion-omit-parameter.html [ Failure ]
     507storage/indexeddb/intversion-open-in-upgradeneeded.html [ Failure ]
     508storage/indexeddb/intversion-open-with-version.html [ Failure ]
     509storage/indexeddb/intversion-pending-version-changes-ascending.html [ Failure ]
     510storage/indexeddb/intversion-pending-version-changes-descending.html [ Failure ]
     511storage/indexeddb/intversion-pending-version-changes-same.html [ Failure ]
     512storage/indexeddb/intversion-persistence.html [ Failure ]
     513storage/indexeddb/intversion-revert-on-abort.html [ Failure ]
     514storage/indexeddb/intversion-two-opens-no-versions.html [ Failure ]
     515storage/indexeddb/intversion-upgrades.html [ Failure ]
     516storage/indexeddb/key-generator.html [ Failure ]
     517storage/indexeddb/key-sort-order-across-types.html [ Failure ]
     518storage/indexeddb/key-sort-order-date.html [ Failure ]
     519storage/indexeddb/key-type-array.html [ Failure ]
     520storage/indexeddb/key-type-binary.html [ Failure ]
     521storage/indexeddb/key-type-infinity.html [ Failure ]
     522storage/indexeddb/keypath-arrays.html [ Failure ]
     523storage/indexeddb/keypath-edges.html [ Failure ]
     524storage/indexeddb/keypath-fetch-key.html [ Failure ]
     525storage/indexeddb/keypath-intrinsic-properties.html [ Failure ]
     526storage/indexeddb/lazy-index-population.html [ Failure ]
     527storage/indexeddb/lazy-index-types.html [ Failure ]
     528storage/indexeddb/list-ordering.html [ Failure ]
     529storage/indexeddb/metadata-race.html [ Failure ]
     530storage/indexeddb/metadata.html [ Failure ]
     531storage/indexeddb/modern/abort-objectstore-info.html [ Failure ]
     532storage/indexeddb/modern/abort-requests-cancelled.html [ Failure ]
     533storage/indexeddb/modern/aborted-put.html [ Failure ]
     534storage/indexeddb/modern/autoincrement-abort.html [ Failure ]
     535storage/indexeddb/modern/basic-add.html [ Failure ]
     536storage/indexeddb/modern/basic-put.html [ Failure ]
     537storage/indexeddb/modern/blocked-open-db-requests.html [ Failure ]
     538storage/indexeddb/modern/create-index-failures.html [ Failure ]
     539storage/indexeddb/modern/createobjectstore-basic.html [ Failure ]
     540storage/indexeddb/modern/createobjectstore-failures.html [ Failure ]
     541storage/indexeddb/modern/cursor-1.html [ Failure ]
     542storage/indexeddb/modern/cursor-2.html [ Failure ]
     543storage/indexeddb/modern/cursor-3.html [ Failure ]
     544storage/indexeddb/modern/cursor-4.html [ Failure ]
     545storage/indexeddb/modern/cursor-5.html [ Failure ]
     546storage/indexeddb/modern/cursor-6.html [ Failure ]
     547storage/indexeddb/modern/cursor-7.html [ Failure ]
     548storage/indexeddb/modern/cursor-8.html [ Failure ]
     549storage/indexeddb/modern/date-basic.html [ Failure ]
     550storage/indexeddb/modern/deletedatabase-1.html [ Failure ]
     551storage/indexeddb/modern/deletedatabase-2.html [ Failure ]
     552storage/indexeddb/modern/deleteindex-1.html [ Failure ]
     553storage/indexeddb/modern/deleteindex-2.html [ Failure ]
     554storage/indexeddb/modern/deleteobjectstore-1.html [ Failure ]
     555storage/indexeddb/modern/double-open.html [ Failure ]
     556storage/indexeddb/modern/get-index-failures.html [ Failure ]
     557storage/indexeddb/modern/get-keyrange.html [ Failure ]
     558storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html [ Failure ]
     559storage/indexeddb/modern/idbdatabase-transaction-failures.html [ Failure ]
     560storage/indexeddb/modern/idbindex-properties-basic.html [ Failure ]
     561storage/indexeddb/modern/idbobjectstore-clear-1.html [ Failure ]
     562storage/indexeddb/modern/idbobjectstore-clear-2.html [ Failure ]
     563storage/indexeddb/modern/idbobjectstore-count-1.html [ Failure ]
     564storage/indexeddb/modern/idbobjectstore-count-failures.html [ Failure ]
     565storage/indexeddb/modern/idbobjectstore-delete-1.html [ Failure ]
     566storage/indexeddb/modern/idbobjectstore-delete-2.html [ Failure ]
     567storage/indexeddb/modern/idbobjectstore-delete-failures.html [ Failure ]
     568storage/indexeddb/modern/idbobjectstore-get-failures.html [ Failure ]
     569storage/indexeddb/modern/idbobjectstore-put-and-clear-failures.html [ Failure ]
     570storage/indexeddb/modern/index-1.html [ Failure ]
     571storage/indexeddb/modern/index-2.html [ Failure ]
     572storage/indexeddb/modern/index-3.html [ Failure ]
     573storage/indexeddb/modern/index-4.html [ Failure ]
     574storage/indexeddb/modern/index-5.html [ Failure ]
     575storage/indexeddb/modern/index-cursor-1.html [ Failure ]
     576storage/indexeddb/modern/index-cursor-2.html [ Failure ]
     577storage/indexeddb/modern/index-cursor-3.html [ Failure ]
     578storage/indexeddb/modern/index-get-count-basic.html [ Failure ]
     579storage/indexeddb/modern/index-get-count-failures.html [ Failure ]
     580storage/indexeddb/modern/keypath-basic.html [ Failure ]
     581storage/indexeddb/modern/memory-index-not-deleted-with-objectstore.html [ Failure ]
     582storage/indexeddb/modern/objectstore-attributes.html [ Failure ]
     583storage/indexeddb/modern/objectstore-cursor-advance-failures.html [ Failure ]
     584storage/indexeddb/modern/objectstore-cursor-continue-failures.html [ Failure ]
     585storage/indexeddb/modern/opencursor-failures.html [ Failure ]
     586storage/indexeddb/modern/opendatabase-success-after-versionchange.html [ Failure ]
     587storage/indexeddb/modern/opendatabase-versions.html [ Failure ]
     588storage/indexeddb/modern/request-readystate.html [ Failure ]
     589storage/indexeddb/modern/transaction-scheduler-1.html [ Failure ]
     590storage/indexeddb/modern/transaction-scheduler-2.html [ Failure ]
     591storage/indexeddb/modern/transaction-scheduler-3.html [ Failure ]
     592storage/indexeddb/modern/transaction-scheduler-4.html [ Failure ]
     593storage/indexeddb/modern/transaction-scheduler-5.html [ Failure ]
     594storage/indexeddb/modern/transaction-scheduler-6.html [ Failure ]
     595storage/indexeddb/modern/transactions-stop-on-navigation.html [ Failure ]
     596storage/indexeddb/modern/versionchange-abort-then-reopen.html [ Failure ]
     597storage/indexeddb/modern/versionchange-event.html [ Failure ]
     598storage/indexeddb/mozilla/add-twice-failure.html [ Failure ]
     599storage/indexeddb/mozilla/autoincrement-indexes.html [ Failure ]
     600storage/indexeddb/mozilla/bad-keypath.html [ Failure ]
     601storage/indexeddb/mozilla/clear.html [ Failure ]
     602storage/indexeddb/mozilla/create-index-with-integer-keys.html [ Failure ]
     603storage/indexeddb/mozilla/cursor-mutation-objectstore-only.html [ Failure ]
     604storage/indexeddb/mozilla/cursor-mutation.html [ Failure ]
     605storage/indexeddb/mozilla/cursor-update-updates-indexes.html [ Failure ]
     606storage/indexeddb/mozilla/cursors.html [ Failure ]
     607storage/indexeddb/mozilla/delete-result.html [ Failure ]
     608storage/indexeddb/mozilla/event-source.html [ Failure ]
     609storage/indexeddb/mozilla/global-data.html [ Failure ]
     610storage/indexeddb/mozilla/index-prev-no-duplicate.html [ Failure ]
     611storage/indexeddb/mozilla/indexes.html [ Failure ]
     612storage/indexeddb/mozilla/key-requirements.html [ Failure ]
     613storage/indexeddb/mozilla/object-cursors.html [ Failure ]
     614storage/indexeddb/mozilla/object-identity.html [ Failure ]
     615storage/indexeddb/mozilla/object-store-inline-autoincrement-key-added-on-put.html [ Failure ]
     616storage/indexeddb/mozilla/object-store-remove-values.html [ Failure ]
     617storage/indexeddb/mozilla/odd-result-order.html [ Failure ]
     618storage/indexeddb/mozilla/open-database-null-name.html [ Failure ]
     619storage/indexeddb/mozilla/put-get-values.html [ Failure ]
     620storage/indexeddb/mozilla/readonly-transactions.html [ Failure ]
     621storage/indexeddb/mozilla/readwrite-transactions.html [ Failure ]
     622storage/indexeddb/mozilla/readyState.html [ Failure ]
     623storage/indexeddb/mozilla/remove-objectstore.html [ Failure ]
     624storage/indexeddb/mutating-cursor.html [ Failure ]
     625storage/indexeddb/noblobs.html [ Failure ]
     626storage/indexeddb/object-lookups-in-versionchange.html [ Failure ]
     627storage/indexeddb/objectstore-autoincrement.html [ Failure ]
     628storage/indexeddb/objectstore-basics.html [ Failure ]
     629storage/indexeddb/objectstore-clear.html [ Failure ]
     630storage/indexeddb/objectstore-count.html [ Failure ]
     631storage/indexeddb/objectstore-cursor.html [ Failure ]
     632storage/indexeddb/objectstore-removeobjectstore.html [ Failure ]
     633storage/indexeddb/odd-strings.html [ Failure ]
     634storage/indexeddb/open-cursor.html [ Failure ]
     635storage/indexeddb/open-during-transaction.html [ Failure ]
     636storage/indexeddb/open-ordering.html [ Failure ]
     637storage/indexeddb/opencursor-key.html [ Failure ]
     638storage/indexeddb/optional-arguments.html [ Failure ]
     639storage/indexeddb/pending-activity.html [ Failure ]
     640storage/indexeddb/persistence.html [ Failure ]
     641storage/indexeddb/prefetch-bugfix-108071.html [ Failure ]
     642storage/indexeddb/prefetch-invalidation.html [ Failure ]
     643storage/indexeddb/prefetch-race.html [ Failure ]
     644storage/indexeddb/queued-commands.html [ Failure ]
     645storage/indexeddb/readonly.html [ Failure ]
     646storage/indexeddb/request-continue-abort.html [ Failure ]
     647storage/indexeddb/request-event-propagation.html [ Failure ]
     648storage/indexeddb/request-result-cache.html [ Failure ]
     649storage/indexeddb/set_version_blocked.html [ Failure ]
     650storage/indexeddb/setversion-blocked-by-versionchange-close.html [ Failure ]
     651storage/indexeddb/setversion-not-blocked.html [ Failure ]
     652storage/indexeddb/structured-clone.html [ Failure ]
     653storage/indexeddb/transaction-abort.html [ Failure ]
     654storage/indexeddb/transaction-active-flag.html [ Failure ]
     655storage/indexeddb/transaction-after-close.html [ Failure ]
     656storage/indexeddb/transaction-and-objectstore-calls.html [ Failure ]
     657storage/indexeddb/transaction-basics.html [ Failure ]
     658storage/indexeddb/transaction-complete-with-js-recursion-cross-frame.html [ Failure ]
     659storage/indexeddb/transaction-complete-with-js-recursion.html [ Failure ]
     660storage/indexeddb/transaction-coordination-across-databases.html [ Failure ]
     661storage/indexeddb/transaction-coordination-within-database.html [ Failure ]
     662storage/indexeddb/transaction-crash-on-abort.html [ Failure ]
     663storage/indexeddb/transaction-error.html [ Failure ]
     664storage/indexeddb/transaction-event-propagation.html [ Failure ]
     665storage/indexeddb/transaction-ordering.html [ Failure ]
     666storage/indexeddb/transaction-overlapping.html [ Failure ]
     667storage/indexeddb/transaction-read-only.html [ Failure ]
     668storage/indexeddb/transaction-readwrite-exclusive.html [ Failure ]
     669storage/indexeddb/transaction-rollback.html [ Failure ]
     670storage/indexeddb/transaction-scope-sequencing.html [ Failure ]
     671storage/indexeddb/unblocked-version-changes.html [ Failure ]
     672storage/indexeddb/value-undefined.html [ Failure ]
     673storage/indexeddb/values-odd-types.html [ Failure ]
     674storage/indexeddb/version-change-abort.html [ Failure ]
     675storage/indexeddb/version-change-event.html [ Failure ]
     676storage/indexeddb/version-change-exclusive.html [ Failure ]
     677storage/indexeddb/versionchangerequest-activedomobject.html [ Failure ]
     678
     679#SQLite backend tests that timeout
     680crypto/subtle/rsa-indexeddb.html [ Skip ]
     681imported/w3c/indexeddb/idbcursor-advance-continue-async.htm [ Skip ]
     682imported/w3c/indexeddb/idbcursor-advance-invalid.htm [ Skip ]
     683imported/w3c/indexeddb/idbcursor-advance.htm [ Skip ]
     684imported/w3c/indexeddb/idbcursor-continue.htm [ Skip ]
     685imported/w3c/indexeddb/idbcursor-source.htm [ Skip ]
     686imported/w3c/indexeddb/idbfactory_open12.htm [ Skip ]
     687imported/w3c/indexeddb/idbindex-multientry-big.htm [ Skip ]
     688imported/w3c/indexeddb/idbobjectstore_openCursor_invalid.htm [ Skip ]
     689imported/w3c/indexeddb/keypath.htm [ Skip ]
     690storage/indexeddb/primary-key-unique-to-objectstore.html [ Skip ]
     691
     692### END OF (3) IndexedDB failures with SQLite
     693########################################
  • trunk/Source/WebCore/CMakeLists.txt

    r195169 r195443  
    875875
    876876    Modules/indexeddb/server/IDBConnectionToClient.cpp
     877    Modules/indexeddb/server/IDBSerialization.cpp
    877878    Modules/indexeddb/server/IDBServer.cpp
    878879    Modules/indexeddb/server/IndexValueEntry.cpp
     
    886887    Modules/indexeddb/server/MemoryObjectStoreCursor.cpp
    887888    Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
     889    Modules/indexeddb/server/SQLiteIDBCursor.cpp
     890    Modules/indexeddb/server/SQLiteIDBTransaction.cpp
    888891    Modules/indexeddb/server/ServerOpenDBRequest.cpp
    889892    Modules/indexeddb/server/UniqueIDBDatabase.cpp
  • trunk/Source/WebCore/ChangeLog

    r195441 r195443  
     12016-01-21  Brady Eidson  <beidson@apple.com>
     2
     3        Modern IDB: Support populating/extracting database metadata with SQLite backend.
     4        Nhttps://bugs.webkit.org/show_bug.cgi?id=153318
     5
     6        Reviewed by Alex Christensen.
     7
     8        No new tests (Covered by current tests).
     9
     10        * CMakeLists.txt:
     11        * WebCore.xcodeproj/project.pbxproj:
     12
     13        * Modules/indexeddb/client/IDBDatabaseImpl.cpp:
     14        (WebCore::IDBClient::IDBDatabase::willAbortTransaction): Committing transactions can abort if the commit
     15          ends in error.
     16
     17        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
     18        (WebCore::IDBClient::IDBTransaction::didCommit): Before a committing transaction is aborted, notify the
     19          IDBDatabase that it aborted.
     20
     21        Copied over from WK2:
     22        * Modules/indexeddb/server/IDBSerialization.cpp: Added.
     23        (WebCore::serializeIDBKeyPath):
     24        (WebCore::deserializeIDBKeyPath):
     25        (WebCore::serializeIDBKeyData):
     26        (WebCore::deserializeIDBKeyData):
     27        * Modules/indexeddb/server/IDBSerialization.h: Added.
     28
     29        * Modules/indexeddb/server/IDBServer.cpp:
     30        (WebCore::IDBServer::IDBServer::createBackingStore): Optionally create a SQLite backing store.
     31       
     32        Mostly copied over verbatim from WebKit2's UniqueIDBDatabaseBackingStoreSQLite.cpp:
     33        * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
     34        (WebCore::IDBServer::idbKeyCollate):
     35        (WebCore::IDBServer::v1RecordsTableSchema):
     36        (WebCore::IDBServer::v1RecordsTableSchemaAlternate):
     37        (WebCore::IDBServer::v2RecordsTableSchema):
     38        (WebCore::IDBServer::v2RecordsTableSchemaAlternate):
     39        (WebCore::IDBServer::createOrMigrateRecordsTableIfNecessary):
     40        (WebCore::IDBServer::SQLiteIDBBackingStore::ensureValidRecordsTable):
     41        (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo):
     42        (WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
     43        (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
     44        (WebCore::IDBServer::SQLiteIDBBackingStore::beginTransaction):
     45        (WebCore::IDBServer::SQLiteIDBBackingStore::abortTransaction):
     46        (WebCore::IDBServer::SQLiteIDBBackingStore::commitTransaction):
     47        (WebCore::IDBServer::SQLiteIDBBackingStore::createObjectStore):
     48        (WebCore::IDBServer::SQLiteIDBBackingStore::unregisterCursor):
     49        * Modules/indexeddb/server/SQLiteIDBBackingStore.h:
     50       
     51        Copied over from WK2:
     52        * Modules/indexeddb/server/SQLiteIDBCursor.cpp: Added.
     53        (WebCore::IDBServer::SQLiteIDBCursor::maybeCreate):
     54        (WebCore::IDBServer::SQLiteIDBCursor::SQLiteIDBCursor):
     55        (WebCore::IDBServer::buildIndexStatement):
     56        (WebCore::IDBServer::buildObjectStoreStatement):
     57        (WebCore::IDBServer::SQLiteIDBCursor::establishStatement):
     58        (WebCore::IDBServer::SQLiteIDBCursor::createSQLiteStatement):
     59        (WebCore::IDBServer::SQLiteIDBCursor::objectStoreRecordsChanged):
     60        (WebCore::IDBServer::SQLiteIDBCursor::resetAndRebindStatement):
     61        (WebCore::IDBServer::SQLiteIDBCursor::bindArguments):
     62        (WebCore::IDBServer::SQLiteIDBCursor::advance):
     63        (WebCore::IDBServer::SQLiteIDBCursor::advanceUnique):
     64        (WebCore::IDBServer::SQLiteIDBCursor::advanceOnce):
     65        (WebCore::IDBServer::SQLiteIDBCursor::internalAdvanceOnce):
     66        (WebCore::IDBServer::SQLiteIDBCursor::iterate):
     67        * Modules/indexeddb/server/SQLiteIDBCursor.h: Added.
     68        (WebCore::IDBServer::SQLiteIDBCursor::identifier):
     69        (WebCore::IDBServer::SQLiteIDBCursor::transaction):
     70        (WebCore::IDBServer::SQLiteIDBCursor::objectStoreID):
     71        (WebCore::IDBServer::SQLiteIDBCursor::currentKey):
     72        (WebCore::IDBServer::SQLiteIDBCursor::currentPrimaryKey):
     73        (WebCore::IDBServer::SQLiteIDBCursor::currentValueBuffer):
     74        (WebCore::IDBServer::SQLiteIDBCursor::didError):
     75
     76        Copied over from WK2:
     77        * Modules/indexeddb/server/SQLiteIDBTransaction.cpp: Added.
     78        (WebCore::IDBServer::SQLiteIDBTransaction::SQLiteIDBTransaction):
     79        (WebCore::IDBServer::SQLiteIDBTransaction::~SQLiteIDBTransaction):
     80        (WebCore::IDBServer::SQLiteIDBTransaction::begin):
     81        (WebCore::IDBServer::SQLiteIDBTransaction::commit):
     82        (WebCore::IDBServer::SQLiteIDBTransaction::reset):
     83        (WebCore::IDBServer::SQLiteIDBTransaction::rollback):
     84        (WebCore::IDBServer::SQLiteIDBTransaction::maybeOpenCursor):
     85        (WebCore::IDBServer::SQLiteIDBTransaction::closeCursor):
     86        (WebCore::IDBServer::SQLiteIDBTransaction::notifyCursorsOfChanges):
     87        (WebCore::IDBServer::SQLiteIDBTransaction::clearCursors):
     88        (WebCore::IDBServer::SQLiteIDBTransaction::inProgress):
     89        * Modules/indexeddb/server/SQLiteIDBTransaction.h: Added.
     90        (WebCore::IDBServer::SQLiteIDBTransaction::transactionIdentifier):
     91        (WebCore::IDBServer::SQLiteIDBTransaction::mode):
     92        (WebCore::IDBServer::SQLiteIDBTransaction::sqliteTransaction):
     93
     94        * page/Page.cpp:
     95        (WebCore::Page::setSessionID): If the new SessionID is different from the last one,
     96          clear the IDBConnectionToServer.
     97        (WebCore::Page::idbConnection): Always ask the DatabaseProvider; It handles whether or not
     98          the session is ephemeral.
     99
    11002016-01-21  Alex Christensen  <achristensen@webkit.org>
    2101
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBDatabaseImpl.cpp

    r194671 r195443  
    331331
    332332    auto refTransaction = m_activeTransactions.take(transaction.info().identifier());
     333    if (!refTransaction)
     334        refTransaction = m_committingTransactions.take(transaction.info().identifier());
     335
    333336    ASSERT(refTransaction);
    334337    m_abortingTransactions.set(transaction.info().identifier(), WTFMove(refTransaction));
  • trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp

    r194587 r195443  
    387387        m_database->didCommitTransaction(*this);
    388388        fireOnComplete();
    389     } else
     389    } else {
     390        m_database->willAbortTransaction(*this);
    390391        notifyDidAbort(error);
     392    }
    391393
    392394    finishAbortOrCommit();
  • trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp

    r195090 r195443  
    118118    ASSERT(!isMainThread());
    119119
    120     // FIXME: Once the SQLite backing store is functional, conditionally make either a Memory or SQLite backing store.
    121 
    122     return MemoryIDBBackingStore::create(identifier);
     120    if (m_databaseDirectoryPath.isEmpty())
     121        return MemoryIDBBackingStore::create(identifier);
     122
     123    return std::make_unique<SQLiteIDBBackingStore>(identifier, m_databaseDirectoryPath);
    123124}
    124125
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp

    r195090 r195443  
    3232#include "IDBDatabaseException.h"
    3333#include "IDBKeyData.h"
     34#include "IDBSerialization.h"
     35#include "IDBTransactionInfo.h"
    3436#include "Logging.h"
    3537#include "SQLiteDatabase.h"
    3638#include "SQLiteFileSystem.h"
     39#include "SQLiteIDBCursor.h"
     40#include "SQLiteStatement.h"
     41#include "SQLiteTransaction.h"
    3742#include <wtf/NeverDestroyed.h>
    3843
     
    4045namespace IDBServer {
    4146
     47// Current version of the metadata schema being used in the metadata database.
     48static const int currentMetadataVersion = 1;
     49
     50static int idbKeyCollate(int aLength, const void* aBuffer, int bLength, const void* bBuffer)
     51{
     52    IDBKeyData a, b;
     53    if (!deserializeIDBKeyData(static_cast<const uint8_t*>(aBuffer), aLength, a)) {
     54        LOG_ERROR("Unable to deserialize key A in collation function.");
     55
     56        // There's no way to indicate an error to SQLite - we have to return a sorting decision.
     57        // We arbitrarily choose "A > B"
     58        return 1;
     59    }
     60    if (!deserializeIDBKeyData(static_cast<const uint8_t*>(bBuffer), bLength, b)) {
     61        LOG_ERROR("Unable to deserialize key B in collation function.");
     62
     63        // There's no way to indicate an error to SQLite - we have to return a sorting decision.
     64        // We arbitrarily choose "A > B"
     65        return 1;
     66    }
     67
     68    return a.compare(b);
     69}
     70
     71static const String v1RecordsTableSchema(const String& tableName)
     72{
     73    return makeString("CREATE TABLE ", tableName, " (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value NOT NULL ON CONFLICT FAIL)");
     74}
     75
     76static const String& v1RecordsTableSchema()
     77{
     78    static NeverDestroyed<WTF::String> v1RecordsTableSchemaString(v1RecordsTableSchema("Records"));
     79    return v1RecordsTableSchemaString;
     80}
     81
     82static const String& v1RecordsTableSchemaAlternate()
     83{
     84    static NeverDestroyed<WTF::String> v1RecordsTableSchemaString(v1RecordsTableSchema("\"Records\""));
     85    return v1RecordsTableSchemaString;
     86}
     87
     88static const String v2RecordsTableSchema(const String& tableName)
     89{
     90    return makeString("CREATE TABLE ", tableName, " (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL)");
     91}
     92
     93static const String& v2RecordsTableSchema()
     94{
     95    static NeverDestroyed<WTF::String> v2RecordsTableSchemaString(v2RecordsTableSchema("Records"));
     96    return v2RecordsTableSchemaString;
     97}
     98
     99static const String& v2RecordsTableSchemaAlternate()
     100{
     101    static NeverDestroyed<WTF::String> v2RecordsTableSchemaString(v2RecordsTableSchema("\"Records\""));
     102    return v2RecordsTableSchemaString;
     103}
     104
    42105SQLiteIDBBackingStore::SQLiteIDBBackingStore(const IDBDatabaseIdentifier& identifier, const String& databaseRootDirectory)
    43106    : m_identifier(identifier)
     
    50113    if (m_sqliteDB)
    51114        m_sqliteDB->close();
     115}
     116
     117static bool createOrMigrateRecordsTableIfNecessary(SQLiteDatabase& database)
     118{
     119    String currentSchema;
     120    {
     121        // Fetch the schema for an existing records table.
     122        SQLiteStatement statement(database, "SELECT type, sql FROM sqlite_master WHERE tbl_name='Records'");
     123        if (statement.prepare() != SQLITE_OK) {
     124            LOG_ERROR("Unable to prepare statement to fetch schema for the Records table.");
     125            return false;
     126        }
     127
     128        int sqliteResult = statement.step();
     129
     130        // If there is no Records table at all, create it and then bail.
     131        if (sqliteResult == SQLITE_DONE) {
     132            if (!database.executeCommand(v2RecordsTableSchema())) {
     133                LOG_ERROR("Could not create Records table in database (%i) - %s", database.lastError(), database.lastErrorMsg());
     134                return false;
     135            }
     136
     137            return true;
     138        }
     139
     140        if (sqliteResult != SQLITE_ROW) {
     141            LOG_ERROR("Error executing statement to fetch schema for the Records table.");
     142            return false;
     143        }
     144
     145        currentSchema = statement.getColumnText(1);
     146    }
     147
     148    ASSERT(!currentSchema.isEmpty());
     149
     150    // If the schema in the backing store is the current schema, we're done.
     151    if (currentSchema == v2RecordsTableSchema() || currentSchema == v2RecordsTableSchemaAlternate())
     152        return true;
     153
     154    // If the record table is not the current schema then it must be one of the previous schemas.
     155    // If it is not then the database is in an unrecoverable state and this should be considered a fatal error.
     156    if (currentSchema != v1RecordsTableSchema() && currentSchema != v1RecordsTableSchemaAlternate())
     157        RELEASE_ASSERT_NOT_REACHED();
     158
     159    SQLiteTransaction transaction(database);
     160    transaction.begin();
     161
     162    // Create a temporary table with the correct schema and migrate all existing content over.
     163    if (!database.executeCommand(v2RecordsTableSchema("_Temp_Records"))) {
     164        LOG_ERROR("Could not create temporary records table in database (%i) - %s", database.lastError(), database.lastErrorMsg());
     165        return false;
     166    }
     167
     168    if (!database.executeCommand("INSERT INTO _Temp_Records SELECT * FROM Records")) {
     169        LOG_ERROR("Could not migrate existing Records content (%i) - %s", database.lastError(), database.lastErrorMsg());
     170        return false;
     171    }
     172
     173    if (!database.executeCommand("DROP TABLE Records")) {
     174        LOG_ERROR("Could not drop existing Records table (%i) - %s", database.lastError(), database.lastErrorMsg());
     175        return false;
     176    }
     177
     178    if (!database.executeCommand("ALTER TABLE _Temp_Records RENAME TO Records")) {
     179        LOG_ERROR("Could not rename temporary Records table (%i) - %s", database.lastError(), database.lastErrorMsg());
     180        return false;
     181    }
     182
     183    transaction.commit();
     184
     185    return true;
     186}
     187
     188bool SQLiteIDBBackingStore::ensureValidRecordsTable()
     189{
     190    ASSERT(m_sqliteDB);
     191    ASSERT(m_sqliteDB->isOpen());
     192
     193    if (!createOrMigrateRecordsTableIfNecessary(*m_sqliteDB))
     194        return false;
     195
     196    // Whether the updated records table already existed or if it was just created and the data migrated over,
     197    // make sure the uniqueness index exists.
     198    if (!m_sqliteDB->executeCommand("CREATE UNIQUE INDEX IF NOT EXISTS RecordsIndex ON Records (objectStoreID, key);")) {
     199        LOG_ERROR("Could not create RecordsIndex on Records table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     200        return false;
     201    }
     202
     203    return true;
     204}
     205
     206std::unique_ptr<IDBDatabaseInfo> SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo()
     207{
     208    ASSERT(m_sqliteDB);
     209    ASSERT(m_sqliteDB->isOpen());
     210
     211    if (!m_sqliteDB->executeCommand("CREATE TABLE IDBDatabaseInfo (key TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, value TEXT NOT NULL ON CONFLICT FAIL);")) {
     212        LOG_ERROR("Could not create IDBDatabaseInfo table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     213        m_sqliteDB = nullptr;
     214        return nullptr;
     215    }
     216
     217    if (!m_sqliteDB->executeCommand("CREATE TABLE ObjectStoreInfo (id INTEGER PRIMARY KEY NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT FAIL, name TEXT NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT FAIL, keyPath BLOB NOT NULL ON CONFLICT FAIL, autoInc INTEGER NOT NULL ON CONFLICT FAIL, maxIndexID INTEGER NOT NULL ON CONFLICT FAIL);")) {
     218        LOG_ERROR("Could not create ObjectStoreInfo table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     219        m_sqliteDB = nullptr;
     220        return nullptr;
     221    }
     222
     223    if (!m_sqliteDB->executeCommand("CREATE TABLE IndexInfo (id INTEGER NOT NULL ON CONFLICT FAIL, name TEXT NOT NULL ON CONFLICT FAIL, objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, keyPath BLOB NOT NULL ON CONFLICT FAIL, isUnique INTEGER NOT NULL ON CONFLICT FAIL, multiEntry INTEGER NOT NULL ON CONFLICT FAIL);")) {
     224        LOG_ERROR("Could not create IndexInfo table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     225        m_sqliteDB = nullptr;
     226        return nullptr;
     227    }
     228
     229    if (!m_sqliteDB->executeCommand("CREATE TABLE IndexRecords (indexID INTEGER NOT NULL ON CONFLICT FAIL, objectStoreID INTEGER NOT NULL ON CONFLICT FAIL, key TEXT COLLATE IDBKEY NOT NULL ON CONFLICT FAIL, value NOT NULL ON CONFLICT FAIL);")) {
     230        LOG_ERROR("Could not create IndexRecords table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     231        m_sqliteDB = nullptr;
     232        return nullptr;
     233    }
     234
     235    if (!m_sqliteDB->executeCommand("CREATE TABLE KeyGenerators (objectStoreID INTEGER NOT NULL ON CONFLICT FAIL UNIQUE ON CONFLICT REPLACE, currentKey INTEGER NOT NULL ON CONFLICT FAIL);")) {
     236        LOG_ERROR("Could not create KeyGenerators table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     237        m_sqliteDB = nullptr;
     238        return nullptr;
     239    }
     240
     241    {
     242        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("INSERT INTO IDBDatabaseInfo VALUES ('MetadataVersion', ?);"));
     243        if (sql.prepare() != SQLITE_OK
     244            || sql.bindInt(1, currentMetadataVersion) != SQLITE_OK
     245            || sql.step() != SQLITE_DONE) {
     246            LOG_ERROR("Could not insert database metadata version into IDBDatabaseInfo table (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     247            m_sqliteDB = nullptr;
     248            return nullptr;
     249        }
     250    }
     251    {
     252        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("INSERT INTO IDBDatabaseInfo VALUES ('DatabaseName', ?);"));
     253        if (sql.prepare() != SQLITE_OK
     254            || sql.bindText(1, m_identifier.databaseName()) != SQLITE_OK
     255            || sql.step() != SQLITE_DONE) {
     256            LOG_ERROR("Could not insert database name into IDBDatabaseInfo table (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     257            m_sqliteDB = nullptr;
     258            return nullptr;
     259        }
     260    }
     261    {
     262        // Database versions are defined to be a uin64_t in the spec but sqlite3 doesn't support native binding of unsigned integers.
     263        // Therefore we'll store the version as a String.
     264        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("INSERT INTO IDBDatabaseInfo VALUES ('DatabaseVersion', ?);"));
     265        if (sql.prepare() != SQLITE_OK
     266            || sql.bindText(1, String::number(0)) != SQLITE_OK
     267            || sql.step() != SQLITE_DONE) {
     268            LOG_ERROR("Could not insert default version into IDBDatabaseInfo table (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     269            m_sqliteDB = nullptr;
     270            return nullptr;
     271        }
     272    }
     273
     274    if (!m_sqliteDB->executeCommand(ASCIILiteral("INSERT INTO IDBDatabaseInfo VALUES ('MaxObjectStoreID', 1);"))) {
     275        LOG_ERROR("Could not insert default version into IDBDatabaseInfo table (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
     276        m_sqliteDB = nullptr;
     277        return nullptr;
     278    }
     279
     280    // This initial database info matches the default values we just put into the metadata database.
     281    return std::make_unique<IDBDatabaseInfo>(m_identifier.databaseName(), 0);
     282}
     283
     284std::unique_ptr<IDBDatabaseInfo> SQLiteIDBBackingStore::extractExistingDatabaseInfo()
     285{
     286    ASSERT(m_sqliteDB);
     287
     288    if (!m_sqliteDB->tableExists(ASCIILiteral("IDBDatabaseInfo")))
     289        return nullptr;
     290
     291    String databaseName;
     292    {
     293        SQLiteStatement sql(*m_sqliteDB, "SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseName';");
     294        if (sql.isColumnNull(0))
     295            return nullptr;
     296        databaseName = sql.getColumnText(0);
     297        if (databaseName != m_identifier.databaseName()) {
     298            LOG_ERROR("Database name in the info database ('%s') does not match the expected name ('%s')", databaseName.utf8().data(), m_identifier.databaseName().utf8().data());
     299            return nullptr;
     300        }
     301    }
     302    uint64_t databaseVersion;
     303    {
     304        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT value FROM IDBDatabaseInfo WHERE key = 'DatabaseVersion';"));
     305        if (sql.isColumnNull(0))
     306            return nullptr;
     307        String stringVersion = sql.getColumnText(0);
     308        bool ok;
     309        databaseVersion = stringVersion.toUInt64Strict(&ok);
     310        if (!ok) {
     311            LOG_ERROR("Database version on disk ('%s') does not cleanly convert to an unsigned 64-bit integer version", stringVersion.utf8().data());
     312            return nullptr;
     313        }
     314    }
     315
     316    auto databaseInfo = std::make_unique<IDBDatabaseInfo>(databaseName, databaseVersion);
     317
     318    {
     319        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT id, name, keyPath, autoInc, maxIndexID FROM ObjectStoreInfo;"));
     320        if (sql.prepare() != SQLITE_OK)
     321            return nullptr;
     322
     323        int result = sql.step();
     324        while (result == SQLITE_ROW) {
     325            uint64_t objectStoreID = sql.getColumnInt64(0);
     326            String objectStoreName = sql.getColumnText(1);
     327
     328            Vector<char> keyPathBuffer;
     329            sql.getColumnBlobAsVector(2, keyPathBuffer);
     330
     331            IDBKeyPath objectStoreKeyPath;
     332            if (!deserializeIDBKeyPath(reinterpret_cast<const uint8_t*>(keyPathBuffer.data()), keyPathBuffer.size(), objectStoreKeyPath)) {
     333                LOG_ERROR("Unable to extract key path from database");
     334                return nullptr;
     335            }
     336
     337            bool autoIncrement = sql.getColumnInt(3);
     338
     339            databaseInfo->addExistingObjectStore({ objectStoreID, objectStoreName, objectStoreKeyPath, autoIncrement });
     340
     341            result = sql.step();
     342        }
     343
     344        if (result != SQLITE_DONE) {
     345            LOG_ERROR("Error fetching object store info from database on disk");
     346            return nullptr;
     347        }
     348    }
     349
     350    {
     351        SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT id, name, objectStoreID, keyPath, isUnique, multiEntry FROM IndexInfo;"));
     352        if (sql.prepare() != SQLITE_OK)
     353            return nullptr;
     354
     355        int result = sql.step();
     356        while (result == SQLITE_ROW) {
     357            uint64_t indexID = sql.getColumnInt64(0);
     358            String indexName = sql.getColumnText(1);
     359            uint64_t objectStoreID = sql.getColumnInt64(2);
     360
     361            Vector<char> keyPathBuffer;
     362            sql.getColumnBlobAsVector(3, keyPathBuffer);
     363
     364            IDBKeyPath indexKeyPath;
     365            if (!deserializeIDBKeyPath(reinterpret_cast<const uint8_t*>(keyPathBuffer.data()), keyPathBuffer.size(), indexKeyPath)) {
     366                LOG_ERROR("Unable to extract key path from database");
     367                return nullptr;
     368            }
     369
     370            bool unique = sql.getColumnInt(4);
     371            bool multiEntry = sql.getColumnInt(5);
     372
     373            auto objectStore = databaseInfo->infoForExistingObjectStore(objectStoreID);
     374            if (!objectStore) {
     375                LOG_ERROR("Found index referring to a non-existant object store");
     376                return nullptr;
     377            }
     378
     379            objectStore->addExistingIndex({ indexID, objectStoreID, indexName, indexKeyPath, unique, multiEntry });
     380
     381            result = sql.step();
     382        }
     383
     384        if (result != SQLITE_DONE) {
     385            LOG_ERROR("Error fetching index info from database on disk");
     386            return nullptr;
     387        }
     388    }
     389
     390    return databaseInfo;
    52391}
    53392
     
    74413        return *m_databaseInfo;
    75414
    76     // FIXME: Support populating new SQLite files and pulling DatabaseInfo from existing SQLite files.
    77     // Doing so will make a new m_databaseInfo which overrides the default one we created up above.
     415    m_sqliteDB->setCollationFunction("IDBKEY", [this](int aLength, const void* a, int bLength, const void* b) {
     416        return idbKeyCollate(aLength, a, bLength, b);
     417    });
     418
     419    if (!ensureValidRecordsTable()) {
     420        LOG_ERROR("Error creating or migrating Records table in database");
     421        m_sqliteDB = nullptr;
     422        return *m_databaseInfo;
     423    }
     424
     425    auto databaseInfo = extractExistingDatabaseInfo();
     426    if (!databaseInfo)
     427        databaseInfo = createAndPopulateInitialDatabaseInfo();
     428
     429    if (!databaseInfo)
     430        LOG_ERROR("Unable to establish IDB database at path '%s'", dbFilename.utf8().data());
     431    else
     432        m_databaseInfo = WTFMove(databaseInfo);
    78433
    79434    return *m_databaseInfo;
    80435}
    81436
    82 IDBError SQLiteIDBBackingStore::beginTransaction(const IDBTransactionInfo&)
    83 {
    84     return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
    85 }
    86 
    87 IDBError SQLiteIDBBackingStore::abortTransaction(const IDBResourceIdentifier&)
    88 {
    89     return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
    90 }
    91 
    92 IDBError SQLiteIDBBackingStore::commitTransaction(const IDBResourceIdentifier&)
    93 {
    94     return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
    95 }
    96 
    97 IDBError SQLiteIDBBackingStore::createObjectStore(const IDBResourceIdentifier&, const IDBObjectStoreInfo&)
    98 {
     437IDBError SQLiteIDBBackingStore::beginTransaction(const IDBTransactionInfo& info)
     438{
     439    LOG(IndexedDB, "SQLiteIDBBackingStore::beginTransaction - %s", info.identifier().loggingString().utf8().data());
     440    UNUSED_PARAM(info);
     441
     442    return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
     443}
     444
     445IDBError SQLiteIDBBackingStore::abortTransaction(const IDBResourceIdentifier& identifier)
     446{
     447    LOG(IndexedDB, "SQLiteIDBBackingStore::abortTransaction - %s", identifier.loggingString().utf8().data());
     448    UNUSED_PARAM(identifier);
     449
     450    return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
     451}
     452
     453IDBError SQLiteIDBBackingStore::commitTransaction(const IDBResourceIdentifier& identifier)
     454{
     455    LOG(IndexedDB, "SQLiteIDBBackingStore::commitTransaction - %s", identifier.loggingString().utf8().data());
     456    UNUSED_PARAM(identifier);
     457
     458    return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
     459}
     460
     461IDBError SQLiteIDBBackingStore::createObjectStore(const IDBResourceIdentifier&, const IDBObjectStoreInfo& info)
     462{
     463    LOG(IndexedDB, "SQLiteIDBBackingStore::createObjectStore - adding OS %s with ID %" PRIu64, info.name().utf8().data(), info.identifier());
     464    UNUSED_PARAM(info);
     465
    99466    return { IDBDatabaseException::UnknownError, ASCIILiteral("Not implemented") };
    100467}
     
    190557}
    191558
     559void SQLiteIDBBackingStore::unregisterCursor(SQLiteIDBCursor& cursor)
     560{
     561    ASSERT(m_cursors.contains(cursor.identifier()));
     562    m_cursors.remove(cursor.identifier());
     563}
     564
    192565} // namespace IDBServer
    193566} // namespace WebCore
  • trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h

    r195090 r195443  
    3232#include "IDBDatabaseIdentifier.h"
    3333#include "IDBDatabaseInfo.h"
     34#include "IDBResourceIdentifier.h"
     35#include "SQLiteIDBTransaction.h"
     36#include <wtf/HashMap.h>
    3437
    3538namespace WebCore {
     
    3841
    3942namespace IDBServer {
     43
     44class SQLiteIDBCursor;
    4045
    4146class SQLiteIDBBackingStore : public IDBBackingStore {
     
    6974    virtual void deleteBackingStore() override final;
    7075
     76    void unregisterCursor(SQLiteIDBCursor&);
     77
    7178private:
     79    bool ensureValidRecordsTable();
     80    std::unique_ptr<IDBDatabaseInfo> createAndPopulateInitialDatabaseInfo();
     81    std::unique_ptr<IDBDatabaseInfo> extractExistingDatabaseInfo();
     82
    7283    IDBDatabaseIdentifier m_identifier;
    7384    std::unique_ptr<IDBDatabaseInfo> m_databaseInfo;
    7485
    7586    std::unique_ptr<SQLiteDatabase> m_sqliteDB;
     87
     88    HashMap<IDBResourceIdentifier, std::unique_ptr<SQLiteIDBTransaction>> m_transactions;
     89    HashMap<IDBResourceIdentifier, SQLiteIDBCursor*> m_cursors;
    7690
    7791    String m_absoluteDatabaseDirectory;
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r195412 r195443  
    19331933                510D4A37103165EE0049EA54 /* SocketStreamHandleBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A31103165EE0049EA54 /* SocketStreamHandleBase.h */; };
    19341934                510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; };
     1935                511EC1271C50AACA0032F983 /* IDBSerialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EC1251C50AA570032F983 /* IDBSerialization.cpp */; };
     1936                511EC1281C50AACA0032F983 /* IDBSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 511EC1261C50AA570032F983 /* IDBSerialization.h */; };
     1937                511EC12B1C50ABBF0032F983 /* SQLiteIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EC1291C50ABBA0032F983 /* SQLiteIDBTransaction.cpp */; };
     1938                511EC12C1C50ABBF0032F983 /* SQLiteIDBTransaction.h in Headers */ = {isa = PBXBuildFile; fileRef = 511EC12A1C50ABBA0032F983 /* SQLiteIDBTransaction.h */; };
     1939                511EC12F1C50ABF50032F983 /* SQLiteIDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EC12D1C50ABEC0032F983 /* SQLiteIDBCursor.cpp */; };
     1940                511EC1301C50ABF50032F983 /* SQLiteIDBCursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 511EC12E1C50ABEC0032F983 /* SQLiteIDBCursor.h */; };
    19351941                511EF2C017F0FD3500E4FA16 /* JSIDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2A817F0FC4800E4FA16 /* JSIDBAny.cpp */; };
    19361942                511EF2C117F0FD3500E4FA16 /* JSIDBCursor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2A917F0FC4800E4FA16 /* JSIDBCursor.cpp */; };
     
    93709376                510D4A31103165EE0049EA54 /* SocketStreamHandleBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleBase.h; sourceTree = "<group>"; };
    93719377                510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleClient.h; sourceTree = "<group>"; };
     9378                511EC1251C50AA570032F983 /* IDBSerialization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSerialization.cpp; sourceTree = "<group>"; };
     9379                511EC1261C50AA570032F983 /* IDBSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSerialization.h; sourceTree = "<group>"; };
     9380                511EC1291C50ABBA0032F983 /* SQLiteIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteIDBTransaction.cpp; sourceTree = "<group>"; };
     9381                511EC12A1C50ABBA0032F983 /* SQLiteIDBTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteIDBTransaction.h; sourceTree = "<group>"; };
     9382                511EC12D1C50ABEC0032F983 /* SQLiteIDBCursor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteIDBCursor.cpp; sourceTree = "<group>"; };
     9383                511EC12E1C50ABEC0032F983 /* SQLiteIDBCursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLiteIDBCursor.h; sourceTree = "<group>"; };
    93729384                511EC1A5188DACA400BA3EB6 /* IDBKeyData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBKeyData.h; sourceTree = "<group>"; };
    93739385                511EC1A7188DAE7B00BA3EB6 /* IDBKeyData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBKeyData.cpp; sourceTree = "<group>"; };
     
    1697016982                                510A58FE1BB07AA500C19282 /* IDBConnectionToClient.h */,
    1697116983                                516D7D6E1BB5F06500AF7C77 /* IDBConnectionToClientDelegate.h */,
     16984                                511EC1251C50AA570032F983 /* IDBSerialization.cpp */,
     16985                                511EC1261C50AA570032F983 /* IDBSerialization.h */,
    1697216986                                510A58EF1BAB720F00C19282 /* IDBServer.cpp */,
    1697316987                                510A58F01BAB720F00C19282 /* IDBServer.h */,
     
    1699217006                                512BDB481C456FAB006494DF /* SQLiteIDBBackingStore.cpp */,
    1699317007                                512BDB491C456FAB006494DF /* SQLiteIDBBackingStore.h */,
     17008                                511EC12D1C50ABEC0032F983 /* SQLiteIDBCursor.cpp */,
     17009                                511EC12E1C50ABEC0032F983 /* SQLiteIDBCursor.h */,
     17010                                511EC1291C50ABBA0032F983 /* SQLiteIDBTransaction.cpp */,
     17011                                511EC12A1C50ABBA0032F983 /* SQLiteIDBTransaction.h */,
    1699417012                                516F7F6B1C31C79D00F111DC /* ServerOpenDBRequest.cpp */,
    1699517013                                516F7F6C1C31C79D00F111DC /* ServerOpenDBRequest.h */,
     
    2663426652                                1A762C7A0A074F2600989F5B /* JSXPathResult.h in Headers */,
    2663526653                                BCEFE1EB0DCA5F6400739219 /* JSXSLTProcessor.h in Headers */,
     26654                                511EC1301C50ABF50032F983 /* SQLiteIDBCursor.h in Headers */,
    2663626655                                85031B440A44EFC700F992E0 /* KeyboardEvent.h in Headers */,
    2663726656                                1AE00D59182DAC8D00087DD7 /* KeyedCoding.h in Headers */,
     
    2734027359                                078E094417D16E1C00420AA1 /* RTCSessionDescriptionRequest.h in Headers */,
    2734127360                                078E092A17D14D1C00420AA1 /* RTCStatsReport.h in Headers */,
     27361                                511EC1281C50AACA0032F983 /* IDBSerialization.h in Headers */,
    2734227362                                078E094517D16E1C00420AA1 /* RTCStatsRequest.h in Headers */,
    2734327363                                078E092C17D14D1C00420AA1 /* RTCStatsResponse.h in Headers */,
     
    2764827668                                B22279A80D00BF220071B782 /* SVGCursorElement.h in Headers */,
    2764927669                                B22279AE0D00BF220071B782 /* SVGDefsElement.h in Headers */,
     27670                                511EC12C1C50ABBF0032F983 /* SQLiteIDBTransaction.h in Headers */,
    2765027671                                B22279B10D00BF220071B782 /* SVGDescElement.h in Headers */,
    2765127672                                B22279B40D00BF220071B782 /* SVGDocument.h in Headers */,
     
    3000830029                                BCD9C2C00C17B69E005C90A2 /* JSNamedNodeMap.cpp in Sources */,
    3000930030                                BCD9C2630C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp in Sources */,
     30031                                511EC1271C50AACA0032F983 /* IDBSerialization.cpp in Sources */,
    3001030032                                A9D247F70D757E3400FDF959 /* JSNavigator.cpp in Sources */,
    3001130033                                073BE34017D17E01002BD431 /* JSNavigatorUserMedia.cpp in Sources */,
     
    3121431236                                B2227A050D00BF220071B782 /* SVGFETileElement.cpp in Sources */,
    3121531237                                B2227A080D00BF220071B782 /* SVGFETurbulenceElement.cpp in Sources */,
     31238                                511EC12B1C50ABBF0032F983 /* SQLiteIDBTransaction.cpp in Sources */,
    3121631239                                845E72FB0FD2623900A87D79 /* SVGFilter.cpp in Sources */,
    3121731240                                081EBF3A0FD34F4100DA7559 /* SVGFilterBuilder.cpp in Sources */,
     
    3145531478                                CD8B5A42180D149A008B8E65 /* VideoTrackPrivateMediaSourceAVFObjC.mm in Sources */,
    3145631479                                CEF418CE1179678C009D112C /* ViewportArguments.cpp in Sources */,
     31480                                511EC12F1C50ABF50032F983 /* SQLiteIDBCursor.cpp in Sources */,
    3145731481                                26F9A83818A046AC00AEB88A /* ViewportConfiguration.cpp in Sources */,
    3145831482                                3FFFF9AD159D9B060020BBD5 /* ViewportStyleResolver.cpp in Sources */,
  • trunk/Source/WebCore/page/Page.cpp

    r194589 r195443  
    17361736    ASSERT(sessionID.isValid());
    17371737
     1738    if (sessionID != m_sessionID)
     1739        m_idbIDBConnectionToServer = nullptr;
     1740
    17381741    bool privateBrowsingStateChanged = (sessionID.isEphemeral() != m_sessionID.isEphemeral());
    17391742
     
    18371840IDBClient::IDBConnectionToServer& Page::idbConnection()
    18381841{
    1839     if (!m_idbIDBConnectionToServer) {
    1840         if (usesEphemeralSession()) {
    1841             auto inProcessServer = InProcessIDBServer::create();
    1842             m_idbIDBConnectionToServer = &inProcessServer->connectionToServer();
    1843         } else
    1844             m_idbIDBConnectionToServer = &databaseProvider().idbConnectionToServerForSession(m_sessionID);
    1845     }
     1842    if (!m_idbIDBConnectionToServer)
     1843        m_idbIDBConnectionToServer = &databaseProvider().idbConnectionToServerForSession(m_sessionID);
    18461844   
    18471845    return *m_idbIDBConnectionToServer;
Note: See TracChangeset for help on using the changeset viewer.