LibWeb: Make StorageKey serializable over IPC
This commit is contained in:
parent
aca463883f
commit
98ca5e0635
2 changed files with 30 additions and 0 deletions
|
|
@ -4,6 +4,8 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibIPC/Decoder.h>
|
||||
#include <LibIPC/Encoder.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/HTML/Scripting/Environments.h>
|
||||
#include <LibWeb/StorageAPI/StorageKey.h>
|
||||
|
|
@ -51,3 +53,21 @@ StorageKey obtain_a_storage_key_for_non_storage_purposes(HTML::Environment const
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
ErrorOr<void> encode(Encoder& encoder, Web::StorageAPI::StorageKey const& key)
|
||||
{
|
||||
TRY(encoder.encode(key.origin));
|
||||
return {};
|
||||
}
|
||||
|
||||
template<>
|
||||
ErrorOr<Web::StorageAPI::StorageKey> decode(Decoder& decoder)
|
||||
{
|
||||
auto origin = TRY(decoder.decode<URL::Origin>());
|
||||
return Web::StorageAPI::StorageKey { move(origin) };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,3 +51,13 @@ struct Traits<Web::StorageAPI::StorageKey> : public DefaultTraits<Web::StorageAP
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
namespace IPC {
|
||||
|
||||
template<>
|
||||
WEB_API ErrorOr<void> encode(Encoder&, Web::StorageAPI::StorageKey const&);
|
||||
|
||||
template<>
|
||||
WEB_API ErrorOr<Web::StorageAPI::StorageKey> decode(Decoder&);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue