mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:48:11 +00:00
LibWeb: Add facilities to serialize EnvironmentSettingsObjects
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.
This commit is contained in:
parent
c79bac70f4
commit
4d22358e05
11 changed files with 198 additions and 5 deletions
29
Userland/Libraries/LibWeb/HTML/PolicyContainers.cpp
Normal file
29
Userland/Libraries/LibWeb/HTML/PolicyContainers.cpp
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* 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 };
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue