fix(detect): use system Chrome on Windows to stop GPU crash-loop window (#372)

On Windows, `impeccable detect <url>` flashed a persistent black window during
scans. The scan uses puppeteer's bundled Chrome, which runs from an untrusted
user-cache path; Windows blocks its GPU process, so it crash-loops and flashes a
compositor surface on every retry. It is not a real application window (not in
Alt+Tab, not clickable, invisible to window enumeration) and not malware.

Prefer the system-installed Chrome via channel:'chrome' on Windows, which runs
from a trusted location with a healthy GPU: no crash loop, no window. Fall back
to the bundled browser when Chrome is not installed. Scoped to Windows only, so
mac and linux keep the pinned bundled build for consistent measurement. Both
render on hardware GPU, so contrast measurement is unaffected.

Also routes both launch sites through one helper and fixes a pre-existing bug
where detectUrl hardcoded headless:true instead of honoring options.headless.

Tests: new tests/detect-url-launch.test.mjs covers the launch choice per
platform (Windows prefers channel:'chrome' and falls back to bundled;
non-Windows never attempts it), wired into the detector suite. Verified on
Windows 11 / Chrome 150: zero GPU crashes, window gone, findings unchanged.

This change was prepared with AI assistance.
This commit is contained in:
Vinaywho
2026-07-22 20:29:18 +05:30
parent 386f9883cf
commit 33d7684c06
3 changed files with 108 additions and 4 deletions
+2 -1
View File
@@ -86,13 +86,14 @@ export const SUITES = {
/^scripts\/(benchmark-detector|build-browser-detector|build-extension)\.js$/,
/^site\/(pages\/detector|public\/antipattern|data\/anti-patterns-catalog\.js)/,
/^tests\/design-system\.test\.mjs$/,
/^tests\/(detect-antipatterns|inline-ignores|extension-build|fixtures\/antipatterns)/,
/^tests\/(detect-antipatterns|detect-url-launch|inline-ignores|extension-build|fixtures\/antipatterns)/,
],
commands: [
{
runner: 'bun',
files: [
'tests/detect-antipatterns.test.js',
'tests/detect-url-launch.test.mjs',
'tests/inline-ignores.test.mjs',
'tests/lib/detector-bundle.test.js',
],