#51959: fix: devTools network events dropped on RenderFrameHost swap
Description of Change
When a debugger is attached to a WebContents (e.g. via webContents.debugger), Debugger::RenderFrameHostChanged unconditionally called DisconnectWebContents followed by ConnectWebContents on every primary main-frame RenderFrameHost change.
That disconnect/reconnect round-trip resets the DevTools session's mojo receiver DevToolsSession::AttachToAgent, discarding any protocol notifications already queued on the pipe.
Since Chromium 148 enabled RenderDocument with the all-frames level by default on desktop https://chromium-review.googlesource.com/c/chromium/src/+/7534620, the main-frame RenderFrameHost now changes on every navigation, so this dropped the bulk of a page's network requests from the DevTools Network panel on each load whenever a debugger was attached.
RenderFrameDevToolsAgentHost already follows primary main-frame RenderFrameHost changes within the same WebContents on its own, so the manual reconnect is redundant. Only disconnect/reconnect when the WebContents actually changed, which the agent host does not track.
Release Notes
Notes: Fixed DevTools Network panel missing most requests after navigating when webContents.debugger is attached.
Backports
Semver Impact
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron