codebytere

#50807: fix: devtools re-attaches on open when previously detached

Merged
Created: Apr 8, 2026, 6:07:05 AM
Merged: Apr 8, 2026, 10:36:48 AM
5 comments
Target: main

Description of Change

Closes #50788

PR #50646 added a dock state allowlist in SetDockState() that collapsed any non-matching value to "right". WebContents::OpenDevTools passes an empty string when no mode option is given, which is the sentinel LoadCompleted() uses to restore currentDockState from prefs. The allowlist clobbered that sentinel to "right", so previously-undocked devtools would flash detached and then snap back to the right dock.

Preserve the empty string through SetDockState() so the pref-restore path runs; still reject any non-empty invalid value to keep the JS-injection guard from #50646 intact.

Checklist

Release Notes

Notes: Fixed an issue where DevTools would re-attach to the window when opened after previously being detached.

Backports

39-x-y
Merged
PR Number
#50818
Merged At
Apr 8, 2026, 1:48:37 PM
Released In
v39.8.8
Release Date
Apr 15, 2026, 7:07:42 PM
40-x-y
Merged
PR Number
#50817
Merged At
Apr 8, 2026, 1:48:32 PM
Released In
v40.9.0
Release Date
Apr 14, 2026, 11:18:31 PM
41-x-y
Merged
PR Number
#50816
Merged At
Apr 8, 2026, 1:06:40 PM
Released In
v41.2.1
Release Date
Apr 15, 2026, 4:16:37 PM
42-x-y
Merged
PR Number
#50815
Merged At
Apr 8, 2026, 2:12:11 PM
Released In
v42.0.0-beta.2
Release Date
Apr 10, 2026, 10:27:42 AM

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

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