Everywhere: Implement persistence of localStorage using sqlite

This change follows the pattern of our cookies persistence
implementation: the "browser" process is responsible for interacting
with the sqlite database, and WebContent communicates all storage
operations via IPC.

The new database table uses (storage_endpoint, storage_key, bottle_key)
as the primary key. This design follows concepts from the
https://storage.spec.whatwg.org/ and is intended to support reuse of the
persistence layer for other APIs (e.g., CacheStorage, IndexedDB). For
now, `storage_endpoint` is always "localStorage", `storage_key` is the
website's origin, and `bottle_key` is the name of the localStorage key.
This commit is contained in:
Aliaksandr Kalenik 2025-06-08 23:35:46 +02:00 committed by Alexander Kalenik
commit 84b9224121
Notes: github-actions[bot] 2025-06-12 15:05:54 +00:00
24 changed files with 694 additions and 118 deletions

View file

@ -22,6 +22,7 @@
#include <LibWebView/Process.h>
#include <LibWebView/ProcessManager.h>
#include <LibWebView/Settings.h>
#include <LibWebView/StorageJar.h>
namespace WebView {
@ -46,6 +47,7 @@ public:
static ImageDecoderClient::Client& image_decoder_client() { return *the().m_image_decoder_client; }
static CookieJar& cookie_jar() { return *the().m_cookie_jar; }
static StorageJar& storage_jar() { return *the().m_storage_jar; }
static ProcessManager& process_manager() { return *the().m_process_manager; }
@ -138,6 +140,7 @@ private:
RefPtr<Database> m_database;
OwnPtr<CookieJar> m_cookie_jar;
OwnPtr<StorageJar> m_storage_jar;
OwnPtr<Core::TimeZoneWatcher> m_time_zone_watcher;