mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +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:
parent
c536f65160
commit
2066ed2318
Notes:
github-actions[bot]
2025-01-02 10:39:14 +00:00
Author: https://github.com/shannonbooth
Commit: 2066ed2318
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3070
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/konradekk
20 changed files with 503 additions and 44 deletions
38
Libraries/LibWeb/StorageAPI/StorageEndpoint.h
Normal file
38
Libraries/LibWeb/StorageAPI/StorageEndpoint.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2024-2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibWeb/StorageAPI/StorageType.h>
|
||||
|
||||
namespace Web::StorageAPI {
|
||||
|
||||
// https://storage.spec.whatwg.org/#storage-endpoint
|
||||
//
|
||||
// A storage endpoint is a local or session storage API that uses the infrastructure defined by this
|
||||
// standard, most notably storage bottles, to keep track of its storage needs.
|
||||
struct StorageEndpoint {
|
||||
// https://storage.spec.whatwg.org/#storage-endpoint-identifier
|
||||
// A storage endpoint has an identifier, which is a storage identifier.
|
||||
String identifier;
|
||||
|
||||
// https://storage.spec.whatwg.org/#storage-endpoint-types
|
||||
// A storage endpoint also has types, which is a set of storage types.
|
||||
// NOTE: We do not implement this as a set as it is not neccessary in the current implementation.
|
||||
StorageType type;
|
||||
|
||||
// https://storage.spec.whatwg.org/#storage-endpoint-quota
|
||||
// A storage endpoint also has a quota, which is null or a number representing a recommended quota (in bytes) for each storage bottle corresponding to this storage endpoint.
|
||||
Optional<u64> quota;
|
||||
|
||||
static ReadonlySpan<StorageEndpoint> registered_endpoints();
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue