From 5004257d58f35d6c32eaf5a0a4afd7f42fc7d049 Mon Sep 17 00:00:00 2001
From: Bjoern Esswein <692-bessw@users.noreply.gl.kwarc.info>
Date: Sun, 22 Sep 2024 21:25:52 +0200
Subject: [PATCH] Use --headless=old to stop chrome from displaying things like
 the first run popup

---
 Runtime/ChromeDevtools/Browser.cs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Runtime/ChromeDevtools/Browser.cs b/Runtime/ChromeDevtools/Browser.cs
index 2c17105..b295502 100644
--- a/Runtime/ChromeDevtools/Browser.cs
+++ b/Runtime/ChromeDevtools/Browser.cs
@@ -72,6 +72,7 @@ namespace bessw.Unity.WebView.ChromeDevTools
                     $"--user-data-dir={Path.Join(Application.temporaryCachePath, "BrowserView")}",
                     $"--remote-debugging-port={debugPort}",
                     $"--remote-allow-origins=http://localhost:{debugPort}",
+                    // might not be needed with headless=old
                     "--hide-crash-restore-bubble",
                     "--disable-first-run-ui",
                     "--no-first-run",
@@ -90,7 +91,9 @@ namespace bessw.Unity.WebView.ChromeDevTools
                 // set headlessBrowser to false to see the browser window
                 if (headless)
                 {
-                    browserProcess.StartInfo.Arguments = string.Concat(browserProcess.StartInfo.Arguments, " --headless=new");
+                    // --headless=old should be sufficient for rendering web pages,
+                    // --headless=new has the drawback that it still opens the first run popup, the crash restore bubble, etc.
+                    browserProcess.StartInfo.Arguments = string.Concat(browserProcess.StartInfo.Arguments, " --headless=old");
                 }
                 else
                 {
-- 
GitLab