Documentation
¶
Overview ¶
Package browserprobe smoke-tests a browser binary by actually launching it headless, rather than trusting a `--version` string.
A `--version` check (or a bare PATH lookup) only proves the file exists and can print a banner. It does NOT prove the browser can render: some distro Chromium builds print a version but then SIGTRAP during real headless startup (observed with Debian's Chromium 150 on a KVM guest), and a downloaded Chrome can be missing a runtime shared library. Those failures only surface when a scan tries to spider, long after `doctor` reported the browser green. Launchable() closes that gap by performing the same remote-debugging handshake the spider relies on.
Index ¶
Constants ¶
const DefaultTimeout = 30 * time.Second
DefaultTimeout bounds a single launch probe. A healthy browser exposes its DevTools endpoint in ~1-2s; a broken one dies almost immediately. The cap only matters for a binary that hangs without ever crashing or serving.
Variables ¶
This section is empty.
Functions ¶
func FirstLine ¶
FirstLine returns the first non-empty line of s, trimmed. go-rod's launch error embeds the browser's multi-line stderr (often led by benign crashpad cpufreq noise); the first line — "launcher Failed to get the debug url: ..." — is the actionable part and keeps doctor/log output readable.
func Launchable ¶
Launchable reports whether the browser binary at binPath can actually start headless and expose a DevTools endpoint. It returns nil when the browser came up, or a trimmed error describing why it did not. It launches a throwaway headless instance in an isolated, self-cleaning user-data dir with the same critical flags the spider uses (--no-sandbox, --disable-dev-shm-usage), waits for the DevTools URL, then kills the process. Bounded by DefaultTimeout.
The remote-debugging handshake — not `--dump-dom` or `--version` — is the reliable discriminator: a working Chrome for Testing can hang on --dump-dom in a minimal VM (blocked on dbus/UPower) while still serving DevTools instantly, whereas a genuinely broken Chromium never serves at all.
Types ¶
This section is empty.