mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: devtools re-attaches on open when previously detached (#50818)
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. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -400,7 +400,7 @@ void InspectableWebContents::SetDockState(const std::string& state) {
|
||||
can_dock_ = false;
|
||||
} else {
|
||||
can_dock_ = true;
|
||||
dock_state_ = IsValidDockState(state) ? state : "right";
|
||||
dock_state_ = (state.empty() || IsValidDockState(state)) ? state : "right";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user