LibWeb: Make PolicyContainer GC allocated

This is required to store Content Security Policies, as their
Directives are implemented as subclasses with overridden virtual
functions. Thus, they cannot be stored as generic Directive classes, as
it'll lose the ability to call overridden functions when they are
copied.
This commit is contained in:
Luke Wilde 2024-11-25 14:30:12 +00:00 committed by Sam Atkins
commit cae0ab2139
Notes: github-actions[bot] 2025-02-21 12:55:13 +00:00
43 changed files with 381 additions and 130 deletions

View file

@ -548,8 +548,8 @@ public:
void set_active_sandboxing_flag_set(HTML::SandboxingFlagSet);
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-policy-container
HTML::PolicyContainer policy_container() const;
void set_policy_container(HTML::PolicyContainer);
GC::Ref<HTML::PolicyContainer> policy_container() const;
void set_policy_container(GC::Ref<HTML::PolicyContainer>);
Vector<GC::Root<HTML::Navigable>> descendant_navigables();
Vector<GC::Root<HTML::Navigable>> const descendant_navigables() const;
@ -635,7 +635,7 @@ public:
u32 unload_counter() const { return m_unload_counter; }
HTML::SourceSnapshotParams snapshot_source_snapshot_params() const;
GC::Ref<HTML::SourceSnapshotParams> snapshot_source_snapshot_params() const;
void update_for_history_step_application(GC::Ref<HTML::SessionHistoryEntry>, bool do_not_reactivate, size_t script_history_length, size_t script_history_index, Optional<Bindings::NavigationType> navigation_type, Optional<Vector<GC::Ref<HTML::SessionHistoryEntry>>> entries_for_navigation_api = {}, GC::Ptr<HTML::SessionHistoryEntry> previous_entry_for_activation = {}, bool update_navigation_api = true);
@ -1018,7 +1018,7 @@ private:
HTML::SandboxingFlagSet m_active_sandboxing_flag_set;
// https://html.spec.whatwg.org/multipage/dom.html#concept-document-policy-container
HTML::PolicyContainer m_policy_container;
mutable GC::Ptr<HTML::PolicyContainer> m_policy_container;
// https://html.spec.whatwg.org/multipage/interaction.html#visibility-state
HTML::VisibilityState m_visibility_state { HTML::VisibilityState::Hidden };