#47434: fix: crash calling Fetch.continueResponse with WebContentsView
Description of Change
Closes #46109
Fixes an issue where calling Fetch.continueResponse via debugger with WebContentsView could cause a crash. Some light investigation showed that RenderFrameDevToolsAgentHost::{Connect|Disconnect}WebContents() relied on the primary main frame of the passed webContents to attach, but it might be the case that the RenderFrameHost at hand is not in its primary main frame. If the new RenderFrameHost is not the primary main frame, we don't want to reconnect otherwise we'll end up potentially trying to reconnect to a RenderFrameHost that already has a DevToolsAgentHost associated with it.
See also this known bug in Chromium.
Checklist
- PR description included and stakeholders cc'd
-
npm testpasses - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense.
Release Notes
Notes: Fixed an issue where calling Fetch.continueResponse via debugger with WebContentsView could cause a crash.
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