2024-03-05 13:29:14 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/String.h>
|
|
|
|
|
#include <LibIPC/Forward.h>
|
2024-10-04 23:33:34 -03:00
|
|
|
#include <LibURL/Origin.h>
|
2024-03-18 00:22:27 -03:00
|
|
|
#include <LibURL/URL.h>
|
2025-07-19 23:35:33 -03:00
|
|
|
#include <LibWeb/Export.h>
|
2024-11-25 11:30:12 -03:00
|
|
|
#include <LibWeb/HTML/SerializedPolicyContainer.h>
|
2024-03-05 13:29:14 -03:00
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
2026-02-21 10:20:21 -03:00
|
|
|
enum class CanUseCrossOriginIsolatedAPIs : u8 {
|
2024-03-05 13:29:14 -03:00
|
|
|
No,
|
|
|
|
|
Yes,
|
|
|
|
|
};
|
|
|
|
|
|
2026-02-21 15:11:48 -03:00
|
|
|
struct SerializedDocument {
|
|
|
|
|
URL::URL url;
|
2026-02-24 17:33:31 -03:00
|
|
|
bool relevant_settings_object_is_secure_context { false };
|
2026-02-21 15:11:48 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct SerializedWindow {
|
|
|
|
|
SerializedDocument associated_document;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct SerializedWorkerGlobalScope {
|
2026-02-24 17:33:31 -03:00
|
|
|
bool relevant_settings_object_is_secure_context { false };
|
2026-02-21 15:11:48 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
using SerializedGlobal = Variant<SerializedWindow, SerializedWorkerGlobalScope>;
|
|
|
|
|
|
2024-03-05 13:29:14 -03:00
|
|
|
struct SerializedEnvironmentSettingsObject {
|
|
|
|
|
String id;
|
2024-03-18 00:22:27 -03:00
|
|
|
URL::URL creation_url;
|
2025-04-21 01:57:31 -03:00
|
|
|
Optional<URL::URL> top_level_creation_url;
|
2025-05-25 01:47:37 -03:00
|
|
|
Optional<URL::Origin> top_level_origin;
|
2024-03-05 13:29:14 -03:00
|
|
|
|
2024-03-18 00:22:27 -03:00
|
|
|
URL::URL api_base_url;
|
2024-10-04 23:33:34 -03:00
|
|
|
URL::Origin origin;
|
2025-08-07 11:03:05 -03:00
|
|
|
bool has_cross_site_ancestor;
|
2024-11-25 11:30:12 -03:00
|
|
|
SerializedPolicyContainer policy_container;
|
2024-03-05 13:29:14 -03:00
|
|
|
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability;
|
2025-01-07 07:08:14 -03:00
|
|
|
double time_origin;
|
2026-02-21 15:11:48 -03:00
|
|
|
SerializedGlobal global;
|
2024-03-05 13:29:14 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
|
|
2026-02-21 15:11:48 -03:00
|
|
|
template<>
|
|
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SerializedWindow const&);
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
WEB_API ErrorOr<Web::HTML::SerializedWindow> decode(Decoder&);
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SerializedWorkerGlobalScope const&);
|
|
|
|
|
|
|
|
|
|
template<>
|
|
|
|
|
WEB_API ErrorOr<Web::HTML::SerializedWorkerGlobalScope> decode(Decoder&);
|
|
|
|
|
|
2024-03-05 13:29:14 -03:00
|
|
|
template<>
|
2025-07-19 23:35:33 -03:00
|
|
|
WEB_API ErrorOr<void> encode(Encoder&, Web::HTML::SerializedEnvironmentSettingsObject const&);
|
2024-03-05 13:29:14 -03:00
|
|
|
|
|
|
|
|
template<>
|
2025-07-19 23:35:33 -03:00
|
|
|
WEB_API ErrorOr<Web::HTML::SerializedEnvironmentSettingsObject> decode(Decoder&);
|
2024-03-05 13:29:14 -03:00
|
|
|
|
|
|
|
|
}
|