LibWeb: Make a bunch of CSP classes not realm associated

These are not associated with a javascript realm, so to avoid
confusion about which realm these need to be created in, make
all of these objects a GC::Cell, and deal with the fallout.
This commit is contained in:
Shannon Booth 2025-04-26 11:35:51 +12:00 committed by Andreas Kling
parent 04fde1c550
commit 8a3c66d8a6
Notes: github-actions[bot] 2025-04-28 10:42:23 +00:00
20 changed files with 91 additions and 92 deletions

View file

@ -173,9 +173,9 @@ GC::Ref<CSS::FontFaceSet> WorkerGlobalScope::fonts()
GC::Ref<PolicyContainer> WorkerGlobalScope::policy_container() const
{
auto& realm = this->realm();
auto& heap = this->heap();
if (!m_policy_container) {
m_policy_container = realm.create<PolicyContainer>(realm);
m_policy_container = heap.allocate<PolicyContainer>(heap);
}
return *m_policy_container;
}
@ -195,7 +195,7 @@ void WorkerGlobalScope::initialize_policy_container(GC::Ref<Fetch::Infrastructur
// 2. Otherwise, set workerGlobalScope's policy container to the result of creating a policy container from a fetch
// response given response and environment.
m_policy_container = create_a_policy_container_from_a_fetch_response(realm, response, environment);
m_policy_container = create_a_policy_container_from_a_fetch_response(realm.heap(), response, environment);
}
// https://w3c.github.io/webappsec-csp/#run-global-object-csp-initialization