mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
AK: Write scheme state of URL parsing closer to spec steps
The main change here is that we now follow the spec by asserting the URL is not special. Previously I could not find a way to enable this without getting assertions when browsing the web - but that seems to no longer be the case (probably from some other fixes which have since been made).
This commit is contained in:
parent
23e82114b4
commit
f53dfdd6ac
1 changed files with 8 additions and 9 deletions
|
@ -875,18 +875,17 @@ URL URLParser::basic_parse(StringView raw_input, Optional<URL> const& base_url,
|
|||
state = State::File;
|
||||
}
|
||||
// 6. Otherwise, if url is special, base is non-null, and base’s scheme is url’s scheme:
|
||||
// 7. Otherwise, if url is special, set state to special authority slashes state.
|
||||
// FIXME: Write this block closer to spec text.
|
||||
else if (url->is_special()) {
|
||||
// FIXME: 1. Assert: base is is special (and therefore does not have an opaque path).
|
||||
else if (url->is_special() && base_url.has_value() && base_url->scheme() == url->m_scheme) {
|
||||
// 1. Assert: base is is special (and therefore does not have an opaque path).
|
||||
VERIFY(base_url->is_special());
|
||||
|
||||
// 2. Set state to special relative or authority state.
|
||||
if (base_url.has_value() && base_url->m_scheme == url->m_scheme)
|
||||
state = State::SpecialRelativeOrAuthority;
|
||||
else
|
||||
state = State::SpecialAuthoritySlashes;
|
||||
state = State::SpecialRelativeOrAuthority;
|
||||
}
|
||||
// 7. Otherwise, if url is special, set state to special authority slashes state.
|
||||
else if (url->is_special()) {
|
||||
state = State::SpecialAuthoritySlashes;
|
||||
}
|
||||
|
||||
// 8. Otherwise, if remaining starts with an U+002F (/), set state to path or authority state and increase pointer by 1.
|
||||
else if (get_remaining().starts_with("/"sv)) {
|
||||
state = State::PathOrAuthority;
|
||||
|
|
Loading…
Add table
Reference in a new issue