Skip to content

Commit a6ddc94

Browse files
legendecasDevtools-frontend LUCI CQ
authored andcommitted
Avoid show (empty) for node targets in the isolate selector
The main target created for a node process in `front_end/entrypoints/js_app/js_app.ts` is not assigned with a URL. Format the title with its name `main`. Bug: 400292281 Change-Id: If57717bcacc5891c36f0c2df8e7b0902becb1e4b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6318319 Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]> Reviewed-by: Philip Pfaffe <[email protected]>
1 parent f0d4be2 commit a6ddc94

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

front_end/panels/profiler/IsolateSelector.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,17 @@ export class ListItem {
272272

273273
updateTitle(): void {
274274
const modelCountByName = new Map<string, number>();
275+
const targetManager = SDK.TargetManager.TargetManager.instance();
275276
for (const model of this.isolate.models()) {
276277
const target = model.target();
277-
const name = SDK.TargetManager.TargetManager.instance().primaryPageTarget() !== target ? target.name() : '';
278+
const isPrimaryPageTarget = targetManager.primaryPageTarget() === target;
279+
const name = target.name();
278280
const parsedURL = new Common.ParsedURL.ParsedURL(target.inspectedURL());
279281
const domain = parsedURL.isValid ? parsedURL.domain() : '';
280-
const title =
281-
target.decorateLabel(domain && name ? `${domain}: ${name}` : name || domain || i18nString(UIStrings.empty));
282+
// If it is primary page target, omit `domain` in the title.
283+
// Otherwise show its `domain` and `name` as title if available.
284+
const title = target.decorateLabel(
285+
domain && !isPrimaryPageTarget ? `${domain}: ${name}` : name || domain || i18nString(UIStrings.empty));
282286
modelCountByName.set(title, (modelCountByName.get(title) || 0) + 1);
283287
}
284288
this.nameDiv.removeChildren();

0 commit comments

Comments
 (0)