#50807: fix: devtools re-attaches on open when previously detached
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
- PR description included
- I have built and tested this PR
-
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 DevTools would re-attach to the window when opened after previously being detached.
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