Expand description
Fixed remote debugging ports for the real browser (issue #101).
A fixed, non-zero --remote-debugging-port is the only CDP transport that
leaves navigator.webdriver false without the unsupported
--disable-blink-features=AutomationControlled switch: Chromium’s
content/child/runtime_features.cc treats --remote-debugging-pipe and
--remote-debugging-port=0 as automation, but a specific port as a human
attaching a debugger.
The port is reserved by binding 127.0.0.1:0, reading the port the kernel
picked and closing the socket. Another process can take the port between
that close and Chrome’s bind, so the launcher confirms ownership and
retries.
Chrome only writes DevToolsActivePort into the profile for port 0 (see
chrome/browser/devtools/remote_debugging_server.cc), so for a fixed port
ownership is confirmed from the line Chromium prints to stderr when its
DevTools server starts:
DevTools listening on ws://127.0.0.1:<port>/devtools/browser/<id>When the loopback port is taken Chromium logs bind() failed: Address already in use and falls back to [::1]:<port>; when both fail it logs
Cannot start http server for devtools. Either outcome is reported as a
race. This mirrors js/src/browser/debugging-port.js.
Structs§
- DevTools
Listening - The
DevTools listening on ...announcement. - DevTools
Output - What the browser’s stderr says about its DevTools server so far.
- DevTools
Output Watcher - Collects a browser’s stderr so the launcher can confirm which process owns the debugging port.
- Port
Race Error - The reserved port was taken before the browser could bind it.
Enums§
- DevTools
Ownership - Whether the DevTools output proves the port is ours, proves a race, or is not conclusive yet.
Constants§
- LOOPBACK_
HOST - Interface the reserved port and the DevTools server are bound to.
Functions§
- assert_
fixed_ debugging_ port - Validate a caller-supplied debugging port; zero is refused on purpose, because port 0 makes Chrome enable AutomationControlled.
- classify_
dev_ tools_ ownership - Decide whether the DevTools output proves that
portbelongs to our browser, proves a race, or is not conclusive yet. - parse_
dev_ tools_ output - Parse Chromium’s DevTools startup output.
- reserve_
loopback_ port - Reserve a free loopback TCP port for
--remote-debugging-port.