mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
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:
parent
5deb8ba2f8
commit
e0d7278820
Notes:
github-actions[bot]
2025-06-17 18:55:18 +00:00
Author: https://github.com/shannonbooth
Commit: e0d7278820
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5094
Reviewed-by: https://github.com/gmta ✅
16 changed files with 70 additions and 66 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue