Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 100933e0ca65e5c571d8077682b6625412adccb3
      
https://github.com/WebKit/WebKit/commit/100933e0ca65e5c571d8077682b6625412adccb3
  Author: Sihui Liu <[email protected]>
  Date:   2025-10-20 (Mon, 20 Oct 2025)

  Changed paths:
    M Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
    M Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h

  Log Message:
  -----------
  Make SQLiteIDBBackingStore avoid creating IDBDatabaseInfo table if it already 
exists
https://bugs.webkit.org/show_bug.cgi?id=301050
rdar://162949971

Reviewed by Basuke Suzuki and Per Arne Vollan.

When running API test IndexedDB.IndexedDBFileHashCollision, there is error log 
from libsqlite3.dylib saying table
IDBDatabaseInfo already exists. In current implementation of 
SQLiteIDBBackingStore::getOrEstablishDatabaseInfo, it tries
to read IDBDatabaseInfo table from database and validates some information 
(like database name) with
extractExistingDatabaseInfo. If read fails or validation fails, 
extractExistingDatabaseInfo returns nullptr. And when
getOrEstablishDatabaseInfo gets nullptr, it will invoke 
createAndPopulateInitialDatabaseInfo to create IDBDatabaseInfo
table. The issue is, if the nullptr is result from failed validation, then 
getOrEstablishDatabaseInfo should not try
creating the table (as the table exists but the information mismatches due to 
other issues, like hash collision in the
test).

To fix this, the patch makes extractExistingDatabaseInfo return 
Expected<std::unique_ptr<IDBDatabaseInfo>, IDBError>, so
that the caller getOrEstablishDatabaseInfo can distinguish between "table not 
exists" and "validation fails", and avoid
creating table if it is "validation fails".

* Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp:
(WebCore::IDBServer::SQLiteIDBBackingStore::extractExistingDatabaseInfo):
(WebCore::IDBServer::SQLiteIDBBackingStore::getOrEstablishDatabaseInfo):
* Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h:

Canonical link: https://commits.webkit.org/301850@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to