mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibWeb: Correctly initialize Storage objects on the Document
Instead of storing all storage objects in static memory, we now follow the the spec by lazily creating a unique Storage object on each document object. Each Storage object now holds a 'proxy' to the underlying backing storage. For now, this proxy is simply a reference to the backing object. In the future, it will need to be some type of interface object that stores on a SQLite database or similar. Session storage is now correctly stored / tracked as part of the TraversableNavigable object. Local storage is still stored in a static map, but eventually this should be factored into something that is stored at the user agent level.
This commit is contained in:
committed by
Andreas Kling
parent
c536f65160
commit
2066ed2318
24
Libraries/LibWeb/StorageAPI/StorageEndpoint.cpp
Normal file
24
Libraries/LibWeb/StorageAPI/StorageEndpoint.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* 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>({
|
||||
{ "caches"_string, StorageType::Local, {} },
|
||||
{ "indexedDB"_string, StorageType::Local, {} },
|
||||
{ "localStorage"_string, StorageType::Local, 5 * MiB },
|
||||
{ "serviceWorkerRegistrations"_string, StorageType::Local, {} },
|
||||
{ "sessionStorage"_string, StorageType::Session, 5 * MiB },
|
||||
});
|
||||
return endpoints;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user