UI/AppKit: Port --force-new-process option from Qt chrome

This commit is contained in:
Sebastian Zaha 2024-07-09 15:38:58 +02:00 committed by Andrew Kaster
commit 7604d15b99
Notes: sideshowbarker 2024-07-18 00:41:35 +09:00

View file

@ -88,6 +88,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool log_all_js_exceptions = false;
bool enable_http_cache = false;
bool new_window = false;
bool force_new_process = false;
bool allow_popups = false;
Core::ArgsParser args_parser;
@ -100,11 +101,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
args_parser.add_option(log_all_js_exceptions, "Log all JavaScript exceptions", "log-all-js-exceptions");
args_parser.add_option(enable_http_cache, "Enable HTTP cache", "enable-http-cache");
args_parser.add_option(new_window, "Force opening in a new window", "new-window", 'n');
args_parser.add_option(force_new_process, "Force creation of new browser/chrome process", "force-new-process");
args_parser.add_option(allow_popups, "Disable popup blocking by default", "allow-popups");
args_parser.parse(arguments);
WebView::ChromeProcess chrome_process;
if (TRY(chrome_process.connect(raw_urls, new_window)) == WebView::ChromeProcess::ProcessDisposition::ExitProcess) {
if (!force_new_process && TRY(chrome_process.connect(raw_urls, new_window)) == WebView::ChromeProcess::ProcessDisposition::ExitProcess) {
outln("Opening in existing process");
return 0;
}