Title: [197190] trunk/Source/WebCore
- Revision
- 197190
- Author
- [email protected]
- Date
- 2016-02-26 11:49:35 -0800 (Fri, 26 Feb 2016)
Log Message
Modern IDB: Using existing database info from SQLite backing store is busted.
<rdar://problem/24848143> and https://bugs.webkit.org/show_bug.cgi?id=154735
Reviewed by Alex Christensen.
No new tests.
Reproducing the bug requires having a known database on disk *before* launching the DatabaseProcess to
read in the existing IDBDatabaseInfo.
Our automated infrastructure currently has no way of testing this.
* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::openDatabase):
* Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): Do the optional migrate on
the IndexRecords table here; *every* time we open a SQLite backing store.
(WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): Deleted.
* Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
(WebCore::IDBDatabaseInfo::isolatedCopy): Copy the entire object, not just name/version.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (197189 => 197190)
--- trunk/Source/WebCore/ChangeLog 2016-02-26 19:47:33 UTC (rev 197189)
+++ trunk/Source/WebCore/ChangeLog 2016-02-26 19:49:35 UTC (rev 197190)
@@ -1,3 +1,26 @@
+2016-02-26 Brady Eidson <[email protected]>
+
+ Modern IDB: Using existing database info from SQLite backing store is busted.
+ <rdar://problem/24848143> and https://bugs.webkit.org/show_bug.cgi?id=154735
+
+ Reviewed by Alex Christensen.
+
+ No new tests.
+
+ Reproducing the bug requires having a known database on disk *before* launching the DatabaseProcess to
+ read in the existing IDBDatabaseInfo.
+
+ Our automated infrastructure currently has no way of testing this.
+
+ * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+ (WebCore::IDBClient::IDBConnectionToServer::openDatabase):
+ * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
+ (WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo): Do the optional migrate on
+ the IndexRecords table here; *every* time we open a SQLite backing store.
+ (WebCore::IDBServer::SQLiteIDBBackingStore::createAndPopulateInitialDatabaseInfo): Deleted.
+ * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+ (WebCore::IDBDatabaseInfo::isolatedCopy): Copy the entire object, not just name/version.
+
2016-02-25 Gavin Barraclough <[email protected]>
RefCounter value changed callback should be called on all changes (not just zero edge).
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (197189 => 197190)
--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2016-02-26 19:47:33 UTC (rev 197189)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp 2016-02-26 19:49:35 UTC (rev 197190)
@@ -76,7 +76,7 @@
void IDBConnectionToServer::openDatabase(IDBOpenDBRequest& request)
{
- LOG(IndexedDB, "IDBConnectionToServer::openDatabase - %s", request.databaseIdentifier().debugString().utf8().data());
+ LOG(IndexedDB, "IDBConnectionToServer::openDatabase - %s (%" PRIu64 ")", request.databaseIdentifier().debugString().utf8().data(), request.version());
ASSERT(!m_openDBRequestMap.contains(request.resourceIdentifier()));
m_openDBRequestMap.set(request.resourceIdentifier(), &request);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp (197189 => 197190)
--- trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-02-26 19:47:33 UTC (rev 197189)
+++ trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp 2016-02-26 19:49:35 UTC (rev 197190)
@@ -372,12 +372,6 @@
return nullptr;
}
- if (!ensureValidIndexRecordsTable()) {
- LOG_ERROR("Could not create IndexRecords table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
- m_sqliteDB = nullptr;
- return nullptr;
- }
-
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);")) {
LOG_ERROR("Could not create KeyGenerators table in database (%i) - %s", m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg());
m_sqliteDB = nullptr;
@@ -594,6 +588,12 @@
return *m_databaseInfo;
}
+ if (!ensureValidIndexRecordsTable()) {
+ LOG_ERROR("Error creating or migrating Index Records table in database");
+ m_sqliteDB = nullptr;
+ return *m_databaseInfo;
+ }
+
auto databaseInfo = extractExistingDatabaseInfo();
if (!databaseInfo)
databaseInfo = createAndPopulateInitialDatabaseInfo();
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (197189 => 197190)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp 2016-02-26 19:47:33 UTC (rev 197189)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp 2016-02-26 19:49:35 UTC (rev 197190)
@@ -46,7 +46,11 @@
info.m_name = m_name.isolatedCopy();
info.m_version = m_version;
+ info.m_maxObjectStoreID = m_maxObjectStoreID;
+ for (auto entry : m_objectStoreMap)
+ info.m_objectStoreMap.set(entry.key, entry.value.isolatedCopy());
+
return info;
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes