mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 15:43:20 +00:00
LibWebView: Add a command line flag to enable the HTTP disk cache
This adds a RequestServerOptions structure to hold this option and the only other RS option we currently have (certificates).
This commit is contained in:
parent
3516a2344f
commit
42eaea1043
Notes:
github-actions[bot]
2025-10-14 11:41:44 +00:00
Author: https://github.com/trflynn89
Commit: 42eaea1043
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6435
4 changed files with 26 additions and 3 deletions
|
@ -117,6 +117,7 @@ ErrorOr<void> Application::initialize(Main::Arguments const& arguments)
|
|||
bool disable_site_isolation = false;
|
||||
bool enable_idl_tracing = false;
|
||||
bool disable_http_cache = false;
|
||||
bool enable_http_disk_cache = false;
|
||||
bool enable_autoplay = false;
|
||||
bool expose_internals_object = false;
|
||||
bool force_cpu_painting = false;
|
||||
|
@ -164,6 +165,7 @@ ErrorOr<void> Application::initialize(Main::Arguments const& arguments)
|
|||
args_parser.add_option(disable_site_isolation, "Disable site isolation", "disable-site-isolation");
|
||||
args_parser.add_option(enable_idl_tracing, "Enable IDL tracing", "enable-idl-tracing");
|
||||
args_parser.add_option(disable_http_cache, "Disable HTTP cache", "disable-http-cache");
|
||||
args_parser.add_option(enable_http_disk_cache, "Enable HTTP disk cache", "enable-http-disk-cache");
|
||||
args_parser.add_option(enable_autoplay, "Enable multimedia autoplay", "enable-autoplay");
|
||||
args_parser.add_option(expose_internals_object, "Expose internals object", "expose-internals-object");
|
||||
args_parser.add_option(force_cpu_painting, "Force CPU painting", "force-cpu-painting");
|
||||
|
@ -228,7 +230,6 @@ ErrorOr<void> Application::initialize(Main::Arguments const& arguments)
|
|||
.urls = sanitize_urls(raw_urls, m_settings.new_tab_page_url()),
|
||||
.raw_urls = move(raw_urls),
|
||||
.headless_mode = headless_mode,
|
||||
.certificates = move(certificates),
|
||||
.new_window = new_window ? NewWindow::Yes : NewWindow::No,
|
||||
.force_new_process = force_new_process ? ForceNewProcess::Yes : ForceNewProcess::No,
|
||||
.allow_popups = allow_popups ? AllowPopups::Yes : AllowPopups::No,
|
||||
|
@ -252,6 +253,11 @@ ErrorOr<void> Application::initialize(Main::Arguments const& arguments)
|
|||
if (webdriver_content_ipc_path.has_value())
|
||||
m_browser_options.webdriver_content_ipc_path = *webdriver_content_ipc_path;
|
||||
|
||||
m_request_server_options = {
|
||||
.certificates = move(certificates),
|
||||
.enable_http_disk_cache = enable_http_disk_cache ? EnableHTTPDiskCache::Yes : EnableHTTPDiskCache::No,
|
||||
};
|
||||
|
||||
m_web_content_options = {
|
||||
.command_line = MUST(String::join(' ', m_arguments.strings)),
|
||||
.executable_path = MUST(String::from_byte_string(MUST(Core::System::current_executable_path()))),
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
static Settings& settings() { return the().m_settings; }
|
||||
|
||||
static BrowserOptions const& browser_options() { return the().m_browser_options; }
|
||||
static RequestServerOptions const& request_server_options() { return the().m_request_server_options; }
|
||||
static WebContentOptions& web_content_options() { return the().m_web_content_options; }
|
||||
|
||||
static Requests::RequestClient& request_server_client() { return *the().m_request_server_client; }
|
||||
|
@ -174,6 +175,7 @@ private:
|
|||
|
||||
Main::Arguments m_arguments;
|
||||
BrowserOptions m_browser_options;
|
||||
RequestServerOptions m_request_server_options;
|
||||
WebContentOptions m_web_content_options;
|
||||
|
||||
RefPtr<Requests::RequestClient> m_request_server_client;
|
||||
|
|
|
@ -201,17 +201,23 @@ ErrorOr<NonnullRefPtr<Web::HTML::WebWorkerClient>> launch_web_worker_process(Web
|
|||
|
||||
ErrorOr<NonnullRefPtr<Requests::RequestClient>> launch_request_server_process()
|
||||
{
|
||||
auto const& request_server_options = Application::request_server_options();
|
||||
|
||||
Vector<ByteString> arguments;
|
||||
|
||||
for (auto const& certificate : WebView::Application::browser_options().certificates)
|
||||
for (auto const& certificate : request_server_options.certificates)
|
||||
arguments.append(ByteString::formatted("--certificate={}", certificate));
|
||||
|
||||
if (request_server_options.enable_http_disk_cache == EnableHTTPDiskCache::Yes)
|
||||
arguments.append("--enable-http-disk-cache"sv);
|
||||
|
||||
if (auto server = mach_server_name(); server.has_value()) {
|
||||
arguments.append("--mach-server-name"sv);
|
||||
arguments.append(server.value());
|
||||
}
|
||||
|
||||
auto client = TRY(launch_server_process<Requests::RequestClient>("RequestServer"sv, move(arguments)));
|
||||
|
||||
WebView::Application::settings().dns_settings().visit(
|
||||
[](WebView::SystemDNS) {},
|
||||
[&](WebView::DNSOverTLS const& dns_over_tls) {
|
||||
|
|
|
@ -74,7 +74,6 @@ struct BrowserOptions {
|
|||
Optional<HeadlessMode> headless_mode;
|
||||
int window_width { 800 };
|
||||
int window_height { 600 };
|
||||
Vector<ByteString> certificates {};
|
||||
NewWindow new_window { NewWindow::No };
|
||||
ForceNewProcess force_new_process { ForceNewProcess::No };
|
||||
AllowPopups allow_popups { AllowPopups::No };
|
||||
|
@ -87,6 +86,16 @@ struct BrowserOptions {
|
|||
Optional<u16> devtools_port;
|
||||
};
|
||||
|
||||
enum class EnableHTTPDiskCache {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
struct RequestServerOptions {
|
||||
Vector<ByteString> certificates;
|
||||
EnableHTTPDiskCache enable_http_disk_cache { EnableHTTPDiskCache::No };
|
||||
};
|
||||
|
||||
enum class IsLayoutTestMode {
|
||||
No,
|
||||
Yes,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue