mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 18:58:12 +00:00
LibWeb: Make the URL.port setter return after assigning the empty string
This matches the spec ("3. Otherwise, ...")
This commit is contained in:
parent
a7a3f41f67
commit
ba0c907a6f
1 changed files with 5 additions and 1 deletions
|
@ -186,9 +186,13 @@ void URL::set_port(String const& port)
|
|||
// 1. If this’s URL cannot have a username/password/port, then return.
|
||||
if (m_url.cannot_have_a_username_or_password_or_port())
|
||||
return;
|
||||
|
||||
// 2. If the given value is the empty string, then set this’s URL’s port to null.
|
||||
if (port.is_empty())
|
||||
if (port.is_empty()) {
|
||||
m_url.set_port({});
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. Otherwise, basic URL parse the given value with this’s URL as url and port state as state override.
|
||||
auto result_url = URLParser::parse(port, nullptr, m_url, URLParser::State::Port);
|
||||
if (result_url.is_valid())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue