mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
LibWeb: Align worker ESO getters with the specification
The `api_base_url()` and `policy_container()` getters now get their respective objects from the global scope.
This commit is contained in:
parent
2d487ee5ab
commit
975a067f58
3 changed files with 31 additions and 6 deletions
|
@ -46,6 +46,30 @@ JS::NonnullGCPtr<WorkerEnvironmentSettingsObject> WorkerEnvironmentSettingsObjec
|
|||
return settings_object;
|
||||
}
|
||||
|
||||
URL::URL WorkerEnvironmentSettingsObject::api_base_url()
|
||||
{
|
||||
// Return worker global scope's url.
|
||||
return m_global_scope->url();
|
||||
}
|
||||
|
||||
Origin WorkerEnvironmentSettingsObject::origin()
|
||||
{
|
||||
// FIXME: Return a unique opaque origin if worker global scope's url's scheme is "data", and inherited origin otherwise.
|
||||
return m_origin;
|
||||
}
|
||||
|
||||
PolicyContainer WorkerEnvironmentSettingsObject::policy_container()
|
||||
{
|
||||
// Return worker global scope's policy container.
|
||||
return m_global_scope->policy_container();
|
||||
}
|
||||
|
||||
CanUseCrossOriginIsolatedAPIs WorkerEnvironmentSettingsObject::cross_origin_isolated_capability()
|
||||
{
|
||||
// FIXME: Return worker global scope's cross-origin isolated capability.
|
||||
return CanUseCrossOriginIsolatedAPIs::No;
|
||||
}
|
||||
|
||||
void WorkerEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -30,18 +30,16 @@ public:
|
|||
|
||||
JS::GCPtr<DOM::Document> responsible_document() override { return nullptr; }
|
||||
String api_url_character_encoding() override { return m_api_url_character_encoding; }
|
||||
URL::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; }
|
||||
URL::URL api_base_url() override;
|
||||
Origin origin() override;
|
||||
PolicyContainer policy_container() override;
|
||||
CanUseCrossOriginIsolatedAPIs cross_origin_isolated_capability() override;
|
||||
|
||||
private:
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
String m_api_url_character_encoding;
|
||||
URL::URL m_url;
|
||||
HTML::Origin m_origin;
|
||||
HTML::PolicyContainer m_policy_container;
|
||||
|
||||
JS::NonnullGCPtr<WorkerGlobalScope> m_global_scope;
|
||||
};
|
||||
|
|
|
@ -94,6 +94,8 @@ public:
|
|||
|
||||
Web::Page* page() { return m_page.ptr(); }
|
||||
|
||||
PolicyContainer policy_container() const { return m_policy_container; }
|
||||
|
||||
protected:
|
||||
explicit WorkerGlobalScope(JS::Realm&, JS::NonnullGCPtr<Web::Page>);
|
||||
|
||||
|
@ -129,6 +131,7 @@ private:
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-policy-container
|
||||
// A WorkerGlobalScope object has an associated policy container (a policy container). It is initially a new policy container.
|
||||
PolicyContainer m_policy_container;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#concept-workerglobalscope-embedder-policy
|
||||
// A WorkerGlobalScope object has an associated embedder policy (an embedder policy).
|
||||
|
|
Loading…
Add table
Reference in a new issue