mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-05 09:52:54 +00:00
LibURL: Rename 'cannot have a base URL' to 'has an opaque path'
This follows a rename made in the URL specification.
This commit is contained in:
parent
6b85748f53
commit
3f73cd30a2
Notes:
github-actions[bot]
2025-04-06 12:28:23 +00:00
Author: https://github.com/shannonbooth
Commit: 3f73cd30a2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3847
Reviewed-by: https://github.com/trflynn89
8 changed files with 40 additions and 38 deletions
|
@ -646,7 +646,7 @@ constexpr bool is_double_dot_path_segment(StringView input)
|
|||
void Parser::shorten_urls_path(URL& url)
|
||||
{
|
||||
// 1. Assert: url does not have an opaque path.
|
||||
VERIFY(!url.cannot_be_a_base_url());
|
||||
VERIFY(!url.has_an_opaque_path());
|
||||
|
||||
// 2. Let path be url’s path.
|
||||
auto& path = url.m_data->paths;
|
||||
|
@ -892,7 +892,7 @@ Optional<URL> Parser::basic_parse(StringView raw_input, Optional<URL const&> bas
|
|||
}
|
||||
// 9. Otherwise, set url’s path to the empty string and set state to opaque path state.
|
||||
else {
|
||||
url->m_data->cannot_be_a_base_url = true;
|
||||
url->m_data->has_an_opaque_path = true;
|
||||
url->append_slash();
|
||||
state = State::OpaquePath;
|
||||
}
|
||||
|
@ -912,18 +912,18 @@ Optional<URL> Parser::basic_parse(StringView raw_input, Optional<URL const&> bas
|
|||
// -> no scheme state, https://url.spec.whatwg.org/#no-scheme-state
|
||||
case State::NoScheme:
|
||||
// 1. If base is null, or base has an opaque path and c is not U+0023 (#), missing-scheme-non-relative-URL validation error, return failure.
|
||||
if (!base_url.has_value() || (base_url->m_data->cannot_be_a_base_url && code_point != '#')) {
|
||||
if (!base_url.has_value() || (base_url->has_an_opaque_path() && code_point != '#')) {
|
||||
report_validation_error();
|
||||
return {};
|
||||
}
|
||||
// 2. Otherwise, if base has an opaque path and c is U+0023 (#), set url’s scheme to base’s scheme, url’s path to base’s path, url’s query
|
||||
// to base’s query,url’s fragment to the empty string, and set state to fragment state.
|
||||
else if (base_url->m_data->cannot_be_a_base_url && code_point == '#') {
|
||||
else if (base_url->has_an_opaque_path() && code_point == '#') {
|
||||
url->m_data->scheme = base_url->m_data->scheme;
|
||||
url->m_data->paths = base_url->m_data->paths;
|
||||
url->m_data->query = base_url->m_data->query;
|
||||
url->m_data->fragment = String {};
|
||||
url->m_data->cannot_be_a_base_url = true;
|
||||
url->m_data->has_an_opaque_path = true;
|
||||
state = State::Fragment;
|
||||
}
|
||||
// 3. Otherwise, if base’s scheme is not "file", set state to relative state and decrease pointer by 1.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue