LibWeb: Navigate to changed url in Location::set_hash()

This step assumes copyURL is modified in place, while
`URL::Parser::basic_parse()` returns it as a result.

> 6. Basic URL parse input, with copyURL as url and fragment state as
  state override.

So copyURL has to be reassigned to navigate to new url on step 8:

> 8. Location-object navigate this to copyURL.
This commit is contained in:
Aliaksandr Kalenik 2024-04-15 04:22:03 +02:00 committed by Alexander Kalenik
parent 037b395b5d
commit efefd44a9f

View file

@ -336,7 +336,7 @@ WebIDL::ExceptionOr<void> Location::set_hash(String const& value)
copy_url.set_fragment(String {});
// 6. Basic URL parse input, with copyURL as url and fragment state as state override.
auto result_url = URL::Parser::basic_parse(input, {}, copy_url, URL::Parser::State::Fragment);
copy_url = URL::Parser::basic_parse(input, {}, copy_url, URL::Parser::State::Fragment);
// 7. If copyURL's fragment is this's url's fragment, then return.
if (copy_url.fragment() == this->url().fragment())