LibWeb: Teach AK how to hash StorageKeys

This commit is contained in:
Andrew Kaster 2024-10-07 20:17:58 -06:00 committed by Andrew Kaster
parent 2156de7172
commit f4f70068a8
Notes: github-actions[bot] 2024-10-09 21:59:41 +00:00

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/Optional.h>
#include <AK/Traits.h>
#include <LibURL/Origin.h>
#include <LibWeb/Forward.h>
@ -32,3 +33,13 @@ Optional<StorageKey> obtain_a_storage_key(HTML::Environment const&);
StorageKey obtain_a_storage_key_for_non_storage_purposes(HTML::Environment const&);
}
namespace AK {
template<>
struct Traits<Web::StorageAPI::StorageKey> : public DefaultTraits<Web::StorageAPI::StorageKey> {
static unsigned hash(Web::StorageAPI::StorageKey const& key)
{
return Traits<URL::Origin>::hash(key.origin);
}
};
}