2022-02-17 13:31:09 +01:00
/*
* Copyright ( c ) 2022 , Ben Abraham < ben . d . abraham @ gmail . com >
*
* SPDX - License - Identifier : BSD - 2 - Clause
*/
# pragma once
2024-03-18 16:22:27 +13:00
# include <LibURL/URL.h>
2022-02-17 13:31:09 +01:00
# include <LibWeb/DOM/Document.h>
# include <LibWeb/Forward.h>
namespace Web : : HTML {
class WorkerEnvironmentSettingsObject final
2022-09-24 15:39:23 -06:00
: public EnvironmentSettingsObject {
2024-05-15 14:55:09 -06:00
JS_CELL ( WorkerEnvironmentSettingsObject , EnvironmentSettingsObject ) ;
2023-11-19 19:47:52 +01:00
JS_DECLARE_ALLOCATOR ( WorkerEnvironmentSettingsObject ) ;
2022-09-24 15:39:23 -06:00
2022-02-17 13:31:09 +01:00
public :
2023-11-08 11:47:41 -07:00
WorkerEnvironmentSettingsObject ( NonnullOwnPtr < JS : : ExecutionContext > execution_context , JS : : NonnullGCPtr < WorkerGlobalScope > global_scope )
2022-08-04 21:30:33 +02:00
: EnvironmentSettingsObject ( move ( execution_context ) )
2023-11-08 11:47:41 -07:00
, m_global_scope ( global_scope )
2022-02-17 13:31:09 +01:00
{
}
2023-12-15 13:43:39 +01:00
static JS : : NonnullGCPtr < WorkerEnvironmentSettingsObject > setup ( JS : : NonnullGCPtr < Page > page , NonnullOwnPtr < JS : : ExecutionContext > execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */ ) ;
2022-02-17 13:31:09 +01:00
virtual ~ WorkerEnvironmentSettingsObject ( ) override = default ;
2022-09-05 12:19:41 +02:00
JS : : GCPtr < DOM : : Document > responsible_document ( ) override { return nullptr ; }
2023-12-24 15:44:50 +13:00
String api_url_character_encoding ( ) override { return m_api_url_character_encoding ; }
2024-05-23 11:46:41 +01:00
URL : : URL api_base_url ( ) override ;
Origin origin ( ) override ;
PolicyContainer policy_container ( ) override ;
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability ( ) override ;
2022-02-17 13:31:09 +01:00
private :
2023-11-08 11:47:41 -07:00
virtual void visit_edges ( JS : : Cell : : Visitor & ) override ;
2023-12-24 15:44:50 +13:00
String m_api_url_character_encoding ;
2022-09-05 12:19:41 +02:00
HTML : : Origin m_origin ;
2023-11-08 11:47:41 -07:00
JS : : NonnullGCPtr < WorkerGlobalScope > m_global_scope ;
2022-02-17 13:31:09 +01:00
} ;
}