Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0b14bbfbe8eb9328030475669ced789fd2a0a5e7
https://github.com/WebKit/WebKit/commit/0b14bbfbe8eb9328030475669ced789fd2a0a5e7
Author: Rupin Mittal <[email protected]>
Date: 2026-04-02 (Thu, 02 Apr 2026)
Changed paths:
A
LayoutTests/http/tests/IndexedDB/idbindex-getAllRecords-prev-private-expected.txt
A LayoutTests/http/tests/IndexedDB/idbindex-getAllRecords-prev-private.html
M Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp
Log Message:
-----------
[IndexedDB API] SQLiteMemoryIDBBackingStore is never used
https://bugs.webkit.org/show_bug.cgi?id=311327
rdar://173917907
Reviewed by Sihui Liu.
https://commits.webkit.org/307572@main added SQLiteMemoryIDBBackingStore, which
uses SQLite's in-memory database (":memory:") for private browsing instead of
the custom MemoryIDBBackingStore.
It added the 'IndexedDBSQLiteMemoryBackingStoreEnabled' preference to control
this and enabled it by default.
But in private mode in Safari, we're still using MemoryIDBBackingStore.
In private mode, IDBStorageManager::createBackingStore() decides which backing
store to use based on NetworkStorageManager::useSQLiteMemoryBackingStore(). This
returns true if m_useSQLiteMemoryBackingStore is true. This flag is only set to
true in one place:
NetworkStorageManager::updateSharedPreferencesForConnection().
This function is only called when a preference is changed from false to true.
1. WebPageProxy::preferencesDidChange
2. WebProcessProxy::updateSharedPreferences
3. updateSharedPreferencesForWebProcess()
* Only if preference changed from false to true, do we call:
4. WebProcessProxy::sharedPreferencesDidChange
5. NetworkProcess::sharedPreferencesForWebProcessDidChange
6. NetworkConnectionToWebProcess::updateSharedPreferencesForWebProcess
7. NetworkStorageManager::updateSharedPreferencesForConnection
* Sets m_useSQLiteMemoryBackingStore
Since the preference is true by default, it never changes from false to true. So
m_useSQLiteMemoryBackingStore is never true and we continue using
MemoryIDBBackingStore.
To fix this, we ensure that the first time NetworkStorageManager is told of the
preferences, it sets m_useSQLiteMemoryBackingStore to true if the preference is
on. This happens in
NetworkStorageManager::startReceivingMessageFromConnection().
Also, in NetworkStorageManager::updateSharedPreferencesForConnection(), we
should
only set m_useSQLiteMemoryBackingStore to true if the connection for which these
new preferences have arrived actually exists.
This is covered by an IndexedDB test. We recently added support for
IDBIndex::getAllRecords(). This allows us to traverse the records in the backing
store in different directions (like reverse direction if direction is set to
"prev"). This functionality has been implemented in SQLiteIDBBackingStore but
not
in MemoryIDBBackingStore because we expect to use SQLiteMemoryIDBBackingStore.
The test runs in private mode. If we're using SQLiteMemoryIDBBackingStore, it
should pass, if we're using MemoryIDBBackingStore, it will not.
*
LayoutTests/http/tests/IndexedDB/idbindex-getAllRecords-prev-private-expected.txt:
Added.
* LayoutTests/http/tests/IndexedDB/idbindex-getAllRecords-prev-private.html:
Added.
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::startReceivingMessageFromConnection):
(WebKit::NetworkStorageManager::updateSharedPreferencesForConnection):
Canonical link: https://commits.webkit.org/310461@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications