mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
4d22358e05
This will be used to transfer information about the parent context to DedicatedWorkers and future out-of-process Worker/Worklet implementations for fetching purposes. In order to properly check same-origin and other policies, we need to know more about the outside settings than we were previously passing to the WebWorker process.
30 lines
668 B
C++
30 lines
668 B
C++
/*
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibIPC/Decoder.h>
|
|
#include <LibIPC/Encoder.h>
|
|
#include <LibWeb/HTML/PolicyContainers.h>
|
|
|
|
namespace IPC {
|
|
|
|
template<>
|
|
ErrorOr<void> encode(IPC::Encoder& encoder, Web::HTML::PolicyContainer const& policy_container)
|
|
{
|
|
TRY(encode(encoder, policy_container.referrer_policy));
|
|
|
|
return {};
|
|
}
|
|
|
|
template<>
|
|
ErrorOr<Web::HTML::PolicyContainer> decode(IPC::Decoder& decoder)
|
|
{
|
|
auto referrer_policy = TRY(decoder.decode<Web::ReferrerPolicy::ReferrerPolicy>());
|
|
|
|
return Web::HTML::PolicyContainer { .referrer_policy = referrer_policy };
|
|
}
|
|
|
|
}
|