LibURL+LibWeb: Make URL::Origin default constructor private

Instead, porting over all users to use the newly created
Origin::create_opaque factory function. This also requires porting
over some users of Origin to avoid default construction.
This commit is contained in:
Shannon Booth 2025-06-15 19:08:58 +12:00 committed by Jelle Raaijmakers
commit e0d7278820
Notes: github-actions[bot] 2025-06-17 18:55:18 +00:00
16 changed files with 70 additions and 66 deletions

View file

@ -45,7 +45,7 @@ public:
[[nodiscard]] Vector<GC::Ref<Directives::Directive>> const& directives() const { return m_directives; }
[[nodiscard]] Disposition disposition() const { return m_disposition; }
[[nodiscard]] Source source() const { return m_source; }
[[nodiscard]] URL::Origin const& self_origin() const { return m_self_origin; }
[[nodiscard]] URL::Origin const& self_origin() const { return m_self_origin.value(); }
[[nodiscard]] String const& pre_parsed_policy_string(Badge<Violation>) const { return m_pre_parsed_policy_string; }
[[nodiscard]] bool contains_directive_with_name(StringView name) const;
@ -81,7 +81,7 @@ private:
// Spec Note: This is needed to facilitate the 'self' checks of local scheme documents/workers that have inherited
// their policy but have an opaque origin. Most of the time this will simply be the environment settings
// objects origin.
URL::Origin m_self_origin;
Optional<URL::Origin> m_self_origin;
// This is used for reporting which policy was violated. It's not exactly specified, only linking to an ABNF grammar
// definition. WebKit and Blink return the original string that was parsed, whereas Firefox seems to try and return