LibWebView+UI: Migrate Ladybird's command line flags to LibWebView

Currently, if we want to add a new e.g. WebContent command line option,
we have to add it to all of Qt, AppKit, and headless-browser. (Or worse,
we only add it to one of these, and we have feature disparity).

To prevent this, this moves command line flags to WebView::Application.
The flags are assigned to ChromeOptions and WebContentOptions structs.
Each chrome can still add its platform-specific options; for example,
the Qt chrome has a flag to enable Qt networking.

There should be no behavior change here, other than that AppKit will now
support command line flags that were previously only supported by Qt.
This commit is contained in:
Timothy Flynn 2024-07-30 14:01:05 -04:00 committed by Andreas Kling
commit 5f8d852dae
Notes: github-actions[bot] 2024-08-01 09:39:41 +00:00
35 changed files with 427 additions and 440 deletions

View file

@ -72,6 +72,22 @@ Optional<URL::URL> sanitize_url(StringView url, Optional<StringView> search_engi
return result;
}
Vector<URL::URL> sanitize_urls(ReadonlySpan<ByteString> raw_urls, URL::URL const& new_tab_page_url)
{
Vector<URL::URL> sanitized_urls;
sanitized_urls.ensure_capacity(raw_urls.size());
for (auto const& raw_url : raw_urls) {
if (auto url = sanitize_url(raw_url); url.has_value())
sanitized_urls.unchecked_append(url.release_value());
}
if (sanitized_urls.is_empty())
sanitized_urls.append(new_tab_page_url);
return sanitized_urls;
}
static URLParts break_file_url_into_parts(URL::URL const& url, StringView url_string)
{
auto scheme = url_string.substring_view(0, url.scheme().bytes_as_string_view().length() + "://"sv.length());