mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibURL: Add helper for getting array of the special schemes
This is useful for iterating over all of the special schemes, as needed in the URLPattern implementation.
This commit is contained in:
parent
e3ef6d3aee
commit
45d852d14b
Notes:
github-actions[bot]
2025-04-06 12:27:44 +00:00
Author: https://github.com/shannonbooth
Commit: 45d852d14b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3847
Reviewed-by: https://github.com/trflynn89
2 changed files with 16 additions and 1 deletions
|
@ -207,9 +207,23 @@ URL create_with_data(StringView mime_type, StringView payload, bool is_base64)
|
|||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#special-scheme
|
||||
ReadonlySpan<StringView> special_schemes()
|
||||
{
|
||||
static auto const schemes = to_array<StringView>({
|
||||
"ftp"sv,
|
||||
"file"sv,
|
||||
"http"sv,
|
||||
"https"sv,
|
||||
"ws"sv,
|
||||
"wss"sv,
|
||||
});
|
||||
return schemes;
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#is-special
|
||||
bool is_special_scheme(StringView scheme)
|
||||
{
|
||||
return scheme.is_one_of("ftp", "file", "http", "https", "ws", "wss");
|
||||
return special_schemes().contains_slow(scheme);
|
||||
}
|
||||
|
||||
// https://url.spec.whatwg.org/#url-path-serializer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue