mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-03 15:16:14 +00:00
LibURL: Replace Host's Empty state with making Url's Host optional
A couple of reasons: - Origin's Host (when in the tuple state) can't be null - There's an "empty host" concept in the spec which is NOT the same as a null Host, and that was confusing me.
This commit is contained in:
committed by
Andreas Kling
parent
8b984c0c57
commit
90e763de4c
@@ -167,7 +167,7 @@ String HTMLHyperlinkElementUtils::host() const
|
||||
auto const& url = m_url;
|
||||
|
||||
// 3. If url or url's host is null, return the empty string.
|
||||
if (!url.has_value() || url->host().has<Empty>())
|
||||
if (!url.has_value() || !url->host().has_value())
|
||||
return String {};
|
||||
|
||||
// 4. If url's port is null, return url's host, serialized.
|
||||
@@ -206,7 +206,8 @@ String HTMLHyperlinkElementUtils::hostname() const
|
||||
URL::URL url(href());
|
||||
|
||||
// 3. If url or url's host is null, return the empty string.
|
||||
if (url.host().has<Empty>())
|
||||
// FIXME: How can url be null here?
|
||||
if (!url.host().has_value())
|
||||
return String {};
|
||||
|
||||
// 4. Return url's host, serialized.
|
||||
|
||||
Reference in New Issue
Block a user