mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02: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:
Notes:
github-actions[bot]
2025-04-06 12:27:44 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/45d852d14be Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3847 Reviewed-by: https://github.com/trflynn89
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user