mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Make StorageKey serializable over IPC
This commit is contained in:
committed by
Shannon Booth
parent
aca463883f
commit
98ca5e0635
Notes:
github-actions[bot]
2026-04-14 16:44:37 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/98ca5e06357 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8865
@@ -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) };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user