mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-03 14:50:18 +00:00
LibWeb/HTML: Enforce quota limit for local and session storage
Fixes a timeout/crash for the two commited WPT tests.
This commit is contained in:
parent
e767029e24
commit
f3ecd23a21
Notes:
github-actions[bot]
2025-01-02 10:39:50 +00:00
Author: https://github.com/shannonbooth
Commit: f3ecd23a21
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3070
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/konradekk
7 changed files with 74 additions and 8 deletions
|
@ -18,7 +18,7 @@ class Storage : public Bindings::PlatformObject {
|
|||
GC_DECLARE_ALLOCATOR(Storage);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static GC::Ref<Storage> create(JS::Realm&);
|
||||
[[nodiscard]] static GC::Ref<Storage> create(JS::Realm&, u64 quota_bytes);
|
||||
~Storage();
|
||||
|
||||
size_t length() const;
|
||||
|
@ -33,7 +33,7 @@ public:
|
|||
void dump() const;
|
||||
|
||||
private:
|
||||
explicit Storage(JS::Realm&);
|
||||
explicit Storage(JS::Realm&, u64 quota_limit);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
|
@ -49,6 +49,8 @@ private:
|
|||
void broadcast(StringView key, StringView old_value, StringView new_value);
|
||||
|
||||
OrderedHashMap<String, String> m_map;
|
||||
u64 m_quota_bytes { 0 };
|
||||
u64 m_stored_bytes { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue