mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-22 17:01:54 +00:00
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.
25 lines
907 B
C++
25 lines
907 B
C++
/*
|
|
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
|
* Copyright (c) 2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/StorageAPI/StorageEndpoint.h>
|
|
|
|
namespace Web::StorageAPI {
|
|
|
|
ReadonlySpan<StorageEndpoint> StorageEndpoint::registered_endpoints()
|
|
{
|
|
// https://storage.spec.whatwg.org/#registered-storage-endpoints
|
|
static auto const endpoints = to_array<StorageEndpoint>({
|
|
{ StorageEndpointType::Caches, StorageType::Local, {} },
|
|
{ StorageEndpointType::IndexedDB, StorageType::Local, {} },
|
|
{ StorageEndpointType::LocalStorage, StorageType::Local, LOCAL_STORAGE_QUOTA },
|
|
{ StorageEndpointType::ServiceWorkerRegistrations, StorageType::Local, {} },
|
|
{ StorageEndpointType::SessionStorage, StorageType::Session, SESSION_STORAGE_QUOTA },
|
|
});
|
|
return endpoints;
|
|
}
|
|
|
|
}
|