LibWeb/HTML: Store the type of the storage object

This will be needed by the storage broadcast implementation to perform
different steps if the object is for session storage.
This commit is contained in:
Shannon Booth 2024-12-23 22:32:49 +13:00 committed by Andreas Kling
parent f3ecd23a21
commit bbf4739c8e
Notes: github-actions[bot] 2025-01-02 10:39:40 +00:00
3 changed files with 18 additions and 7 deletions

View file

@ -453,7 +453,7 @@ WebIDL::ExceptionOr<GC::Ref<Storage>> Window::local_storage()
// FIXME: Implement according to spec.
static HashMap<URL::Origin, GC::Root<Storage>> local_storage_per_origin;
auto storage = local_storage_per_origin.ensure(associated_document().origin(), [this]() -> GC::Root<Storage> {
return Storage::create(realm(), quota_bytes);
return Storage::create(realm(), Storage::Type::Local, quota_bytes);
});
return GC::Ref { *storage };
}
@ -467,7 +467,7 @@ WebIDL::ExceptionOr<GC::Ref<Storage>> Window::session_storage()
// FIXME: Implement according to spec.
static HashMap<URL::Origin, GC::Root<Storage>> session_storage_per_origin;
auto storage = session_storage_per_origin.ensure(associated_document().origin(), [this]() -> GC::Root<Storage> {
return Storage::create(realm(), quota_bytes);
return Storage::create(realm(), Storage::Type::Session, quota_bytes);
});
return GC::Ref { *storage };
}