1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 00:57:43 +00:00

LibWeb: Serialize and pass to the WebWorker the current ESO

This allows the initial fetch() in the run a worker AO to use the proper
values from the outside settings.
This commit is contained in:
Andrew Kaster 2024-03-05 09:42:10 -07:00 committed by Andreas Kling
parent 4d22358e05
commit b5acc5f2df
12 changed files with 92 additions and 13 deletions

View file

@ -0,0 +1,39 @@
/*
* Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/PolicyContainers.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/SerializedEnvironmentSettingsObject.h>
namespace Web::HTML {
class EnvironmentSettingsSnapshot final
: public EnvironmentSettingsObject {
JS_CELL(EnvironmentSettingsSnapshot, EnvironmentSettingsObject);
JS_DECLARE_ALLOCATOR(EnvironmentSettingsSnapshot);
public:
EnvironmentSettingsSnapshot(NonnullOwnPtr<JS::ExecutionContext>, SerializedEnvironmentSettingsObject const&);
virtual ~EnvironmentSettingsSnapshot() override;
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
String api_url_character_encoding() override { return m_api_url_character_encoding; }
URL api_base_url() override { return m_url; }
Origin origin() override { return m_origin; }
PolicyContainer policy_container() override { return m_policy_container; }
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override { return CanUseCrossOriginIsolatedAPIs::No; }
private:
String m_api_url_character_encoding;
URL m_url;
HTML::Origin m_origin;
HTML::PolicyContainer m_policy_container;
};
}