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

@ -15,10 +15,6 @@ namespace URL {
class Origin {
public:
// FIXME: This should be generating a unique origin identifer that can be used for equality checks.
// Probably we should remove the default constructor, and instead expose this as a factory method.
Origin() = default;
Origin(Optional<String> const& scheme, Host const& host, Optional<u16> port)
: m_state(State {
.scheme = scheme,
@ -28,6 +24,8 @@ public:
{
}
static Origin create_opaque();
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-opaque
bool is_opaque() const { return !m_state.has_value(); }
@ -102,6 +100,8 @@ public:
bool operator==(Origin const& other) const { return is_same_origin(other); }
private:
Origin() = default;
struct State {
Optional<String> scheme;
Host host;