Jelajahi Sumber

Ladybird: Add `--force-new-process` option

This option skips attempting any chrome IPC which even with the
`--new-window` does not open a new browser process. This is annoying
when trying to compare browser options as opening a new window with
the currently running chrome ignores any options passed to the new
ladybird invocation.
MacDue 1 tahun lalu
induk
melakukan
b3f63f35e5
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      Ladybird/Qt/main.cpp

+ 3 - 1
Ladybird/Qt/main.cpp

@@ -105,6 +105,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     bool log_all_js_exceptions = false;
     bool enable_idl_tracing = false;
     bool new_window = false;
+    bool force_new_process = false;
 
     Core::ArgsParser args_parser;
     args_parser.set_general_help("The Ladybird web browser :^)");
@@ -121,10 +122,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
     args_parser.add_option(enable_idl_tracing, "Enable IDL tracing", "enable-idl-tracing");
     args_parser.add_option(expose_internals_object, "Expose internals object", "expose-internals-object");
     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.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;
     }