fix: show 'Electron Isolated Context' in Dev Tools (#51078)

Because of a bug after the [upstream refactor][0] Dev Tools stopped
showing 'Electron Isolated Context' in the execution context selector.
'Electron Isolated Context' runs with origin set to `file://`. Since
domain name is empty for the origin the respective UI item in the
context selector is created with an empty `subtitle`. However, with the
upstream change items with either of `title` or `subtitle` are omitted
from rendering.

Here we float an [in-review patch][1] until it is fixed upstream.

[0]: dbb61cf4b2
[1]: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7761316

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Fedor Indutny <indutny@signal.org>
This commit is contained in:
trop[bot]
2026-04-16 15:21:47 -04:00
committed by GitHub
parent 17d5d26499
commit e59169714a
2 changed files with 26 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
chore_expose_ui_to_allow_electron_to_set_dock_side.patch
fix_prefer_browser_runtime_over_node_in_hostruntime_detection.patch
feat_allow_enabling_extension_panels_on_custom_protocols.patch
fix_context_selector_not_showing_execution_contexts.patch

View File

@@ -0,0 +1,25 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Fedor Indutny <indutny@signal.org>
Date: Tue, 14 Apr 2026 19:33:23 -0700
Subject: Fix context selector not showing execution contexts
When execution context's origin is `file://` - the `url.domain()` is an
empty string and the item's subtitle becomes falsy. Since we predicated
rendering of an item on presence of both title and subtitle - the items
were not rendered while still taking space in the dropdown.
Pending CL: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7761316
diff --git a/front_end/panels/console/ConsoleContextSelector.ts b/front_end/panels/console/ConsoleContextSelector.ts
index f933dbd6dbdfadd2ea8b78e473d9506350825037..09f590fff0263875b1727bdf7e8dd57a17603ee3 100644
--- a/front_end/panels/console/ConsoleContextSelector.ts
+++ b/front_end/panels/console/ConsoleContextSelector.ts
@@ -303,7 +303,7 @@ interface ViewInput {
type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
const DEFAULT_VIEW: View = (input, _output, target): void => {
- if (!input.title || !input.subtitle) {
+ if (!input.title && !input.subtitle) {
render(nothing, target);
return;
}