blob: 4412444e75812a96a96f3d349d3ecbef79311af5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
/*
* Copyright (c) 2022, Ben Abraham <ben.d.abraham@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/URL.h>
#include <LibWeb/Bindings/DedicatedWorkerExposedInterfaces.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
class WorkerEnvironmentSettingsObject final
: public EnvironmentSettingsObject {
JS_CELL(WindowEnvironmentSettingsObject, EnvironmentSettingsObject);
public:
WorkerEnvironmentSettingsObject(NonnullOwnPtr<JS::ExecutionContext> execution_context)
: EnvironmentSettingsObject(move(execution_context))
{
}
static JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> setup(NonnullOwnPtr<JS::ExecutionContext> execution_context /* FIXME: null or an environment reservedEnvironment, a URL topLevelCreationURL, and an origin topLevelOrigin */)
{
auto realm = execution_context->realm;
VERIFY(realm);
auto settings_object = realm->heap().allocate<WorkerEnvironmentSettingsObject>(*realm, move(execution_context)).release_allocated_value_but_fixme_should_propagate_errors();
settings_object->target_browsing_context = nullptr;
auto intrinsics = realm->heap().allocate<Bindings::Intrinsics>(*realm, *realm).release_allocated_value_but_fixme_should_propagate_errors();
auto host_defined = make<Bindings::HostDefined>(settings_object, intrinsics);
realm->set_host_defined(move(host_defined));
// FIXME: Shared workers should use the shared worker method
Bindings::add_dedicated_worker_exposed_interfaces(realm->global_object());
return settings_object;
}
virtual ~WorkerEnvironmentSettingsObject() override = default;
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
DeprecatedString api_url_character_encoding() override { return m_api_url_character_encoding; }
AK::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 { TODO(); }
private:
DeprecatedString m_api_url_character_encoding;
AK::URL m_url;
HTML::Origin m_origin;
HTML::PolicyContainer m_policy_container;
};
}
|