chrome-devtools-frontend 1.0.1606789 → 1.0.1608453

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/docs/ui_engineering.md +2 -0
  2. package/eslint.config.mjs +2 -0
  3. package/front_end/core/common/VersionController.ts +18 -1
  4. package/front_end/core/host/UserMetrics.ts +0 -2
  5. package/front_end/core/platform/node/HostRuntime.ts +1 -1
  6. package/front_end/core/root/ExperimentNames.ts +0 -2
  7. package/front_end/core/sdk/AccessibilityModel.ts +13 -1
  8. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -13
  9. package/front_end/core/sdk/StorageBucketsModel.ts +0 -12
  10. package/front_end/entrypoints/main/MainImpl.ts +2 -11
  11. package/front_end/generated/InspectorBackendCommands.ts +3 -33
  12. package/front_end/generated/SupportedCSSProperties.js +8 -4
  13. package/front_end/generated/protocol-mapping.d.ts +7 -26
  14. package/front_end/generated/protocol-proxy-api.d.ts +5 -24
  15. package/front_end/generated/protocol.ts +2 -296
  16. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +38 -13
  17. package/front_end/{panels/profiler → models/heap_snapshot_model}/ChildrenProvider.ts +3 -4
  18. package/front_end/{panels/profiler → models/heap_snapshot_model}/HeapSnapshotProxy.ts +19 -36
  19. package/front_end/models/heap_snapshot_model/heap_snapshot_model.ts +4 -0
  20. package/front_end/models/javascript_metadata/NativeFunctions.js +0 -4
  21. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +53 -10
  22. package/front_end/panels/accessibility/accessibility.ts +0 -2
  23. package/front_end/panels/accessibility/accessibilitySidebarView.css +10 -0
  24. package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -5
  25. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +36 -17
  26. package/front_end/panels/ai_assistance/components/chatMessage.css +7 -0
  27. package/front_end/panels/ai_assistance/components/walkthroughView.css +39 -11
  28. package/front_end/panels/application/CrashReportContextView.ts +237 -0
  29. package/front_end/panels/application/IndexedDBModel.ts +0 -10
  30. package/front_end/panels/application/InterestGroupStorageModel.ts +0 -11
  31. package/front_end/panels/application/SharedStorageModel.ts +0 -11
  32. package/front_end/panels/application/WebMCPView.ts +271 -52
  33. package/front_end/panels/application/application.ts +2 -0
  34. package/front_end/panels/application/components/CrashReportContextGrid.ts +154 -0
  35. package/front_end/panels/application/components/components.ts +2 -0
  36. package/front_end/panels/application/webMCPView.css +95 -10
  37. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +12 -2
  38. package/front_end/panels/elements/AccessibilityTreeView.ts +10 -6
  39. package/front_end/panels/elements/ElementsPanel.ts +9 -50
  40. package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
  41. package/front_end/panels/elements/elements-meta.ts +1 -0
  42. package/front_end/panels/elements/elementsPanel.css +4 -14
  43. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +23 -13
  44. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +30 -30
  45. package/front_end/panels/profiler/HeapSnapshotView.ts +16 -13
  46. package/front_end/panels/profiler/profiler.ts +0 -4
  47. package/front_end/panels/snippets/SnippetsQuickOpen.ts +5 -5
  48. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -2
  49. package/front_end/panels/sources/sources-meta.ts +7 -7
  50. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +1 -3
  51. package/front_end/panels/timeline/ThirdPartyTreeView.ts +6 -1
  52. package/front_end/panels/timeline/ThreadAppender.ts +1 -3
  53. package/front_end/panels/timeline/TimelineController.ts +2 -2
  54. package/front_end/panels/timeline/TimelinePanel.ts +2 -4
  55. package/front_end/panels/timeline/TimelineTreeView.ts +32 -2
  56. package/front_end/panels/timeline/components/LiveMetricsView.ts +75 -54
  57. package/front_end/panels/timeline/components/timelineRangeSummaryView.css +8 -0
  58. package/front_end/panels/timeline/thirdPartyTreeView.css +0 -1
  59. package/front_end/panels/timeline/timeline-meta.ts +13 -0
  60. package/front_end/third_party/chromium/README.chromium +1 -1
  61. package/front_end/ui/legacy/TabbedPane.ts +3 -1
  62. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +3 -3
  63. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +2 -5
  64. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +4 -4
  65. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +5 -1
  66. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -3
  67. package/package.json +1 -1
  68. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +0 -653
@@ -215,9 +215,6 @@ export class SharedStorageModel extends SDK.SDKModel.SDKModel<EventTypes> implem
215
215
  _event: Protocol.Storage.SharedStorageWorkletOperationExecutionFinishedEvent): void {
216
216
  }
217
217
 
218
- attributionReportingTriggerRegistered(_event: Protocol.Storage.AttributionReportingTriggerRegisteredEvent): void {
219
- }
220
-
221
218
  indexedDBListUpdated(_event: Protocol.Storage.IndexedDBListUpdatedEvent): void {
222
219
  }
223
220
 
@@ -245,14 +242,6 @@ export class SharedStorageModel extends SDK.SDKModel.SDKModel<EventTypes> implem
245
242
 
246
243
  storageBucketDeleted(_event: Protocol.Storage.StorageBucketDeletedEvent): void {
247
244
  }
248
-
249
- attributionReportingSourceRegistered(_event: Protocol.Storage.AttributionReportingSourceRegisteredEvent): void {
250
- }
251
- attributionReportingReportSent(_event: Protocol.Storage.AttributionReportingReportSentEvent): void {
252
- }
253
- attributionReportingVerboseDebugReportSent(_event: Protocol.Storage.AttributionReportingVerboseDebugReportSentEvent):
254
- void {
255
- }
256
245
  }
257
246
 
258
247
  SDK.SDKModel.SDKModel.register(SharedStorageModel, {capabilities: SDK.Target.Capability.STORAGE, autostart: false});
@@ -4,21 +4,27 @@
4
4
 
5
5
  import '../../ui/components/icon_button/icon_button.js';
6
6
  import '../../ui/components/lists/lists.js';
7
+ import '../../ui/components/node_text/node_text.js';
7
8
  import '../../ui/legacy/components/data_grid/data_grid.js';
8
9
  import '../../ui/legacy/legacy.js';
9
10
 
11
+ import * as Common from '../../core/common/common.js';
10
12
  import * as i18n from '../../core/i18n/i18n.js';
11
13
  import * as Platform from '../../core/platform/platform.js';
12
14
  import * as SDK from '../../core/sdk/sdk.js';
13
15
  import * as Protocol from '../../generated/protocol.js';
16
+ import type * as StackTrace from '../../models/stack_trace/stack_trace.js';
14
17
  import * as WebMCP from '../../models/web_mcp/web_mcp.js';
15
18
  import * as Adorners from '../../ui/components/adorners/adorners.js';
16
19
  import * as Buttons from '../../ui/components/buttons/buttons.js';
17
20
  import type * as IconButton from '../../ui/components/icon_button/icon_button.js';
21
+ import type * as NodeText from '../../ui/components/node_text/node_text.js';
22
+ import * as Components from '../../ui/legacy/components/utils/utils.js';
18
23
  import * as UI from '../../ui/legacy/legacy.js';
19
24
  import {
20
25
  Directives,
21
26
  html,
27
+ nothing,
22
28
  render,
23
29
  } from '../../ui/lit/lit.js';
24
30
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
@@ -47,6 +53,18 @@ const UIStrings = {
47
53
  * @description Text to display when no calls have been made
48
54
  */
49
55
  noCallsPlaceholder: 'Start interacting with your `WebMCP` agent to see real-time tool calls and executions here.',
56
+ /**
57
+ * @description Text for the header of the tool details section
58
+ */
59
+ toolDetails: 'Details',
60
+ /**
61
+ * @description Text for the link to reveal the tool's DOM node in the Elements panel
62
+ */
63
+ viewInElementsPanel: 'View in Elements panel',
64
+ /**
65
+ * @description Text for the frame of a tool
66
+ */
67
+ frame: 'Frame',
50
68
  /**
51
69
  * @description Text for the name of a tool call
52
70
  */
@@ -71,6 +89,10 @@ const UIStrings = {
71
89
  * @description Tooltip for the clear log button
72
90
  */
73
91
  clearLog: 'Clear log',
92
+ /**
93
+ * @description Text to close something
94
+ */
95
+ close: 'Close',
74
96
  /**
75
97
  * @description Placeholder for the filter input
76
98
  */
@@ -134,6 +156,7 @@ const UIStrings = {
134
156
  } as const;
135
157
  const str_ = i18n.i18n.registerUIStrings('panels/application/WebMCPView.ts', UIStrings);
136
158
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
159
+ const {widget} = UI.Widget;
137
160
 
138
161
  export interface FilterState {
139
162
  text: string;
@@ -159,6 +182,10 @@ export interface FilterMenuButtons {
159
182
  }
160
183
  export interface ViewInput {
161
184
  tools: WebMCP.WebMCPModel.Tool[];
185
+ selectedTool: WebMCP.WebMCPModel.Tool|null;
186
+ onToolSelect: (tool: WebMCP.WebMCPModel.Tool|null) => void;
187
+ selectedCall: WebMCP.WebMCPModel.Call|null;
188
+ onCallSelect: (call: WebMCP.WebMCPModel.Call|null) => void;
162
189
  filters: FilterState;
163
190
  filterButtons: FilterMenuButtons;
164
191
  onClearLogClick: () => void;
@@ -271,6 +298,7 @@ function getIconGroupsFromStats(toolStats: ReturnType<typeof calculateToolStats>
271
298
  }
272
299
  return groups;
273
300
  }
301
+
274
302
  export const DEFAULT_VIEW: View = (input, output, target) => {
275
303
  const tools = input.tools;
276
304
  const stats = calculateToolStats(input.toolCalls);
@@ -332,36 +360,67 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
332
360
  </devtools-toolbar>
333
361
  </div>
334
362
  ${input.toolCalls.length > 0 ? html`
335
- <devtools-data-grid striped>
336
- <table>
337
- <tr>
338
- <th id="name" weight="20">
339
- ${i18nString(UIStrings.name)}
340
- </th>
341
- <th id="status" weight="20">${i18nString(UIStrings.status)}</th>
342
- <th id="input" weight="30">${i18nString(UIStrings.input)}</th>
343
- <th id="output" weight="30">${i18nString(UIStrings.output)}</th>
344
- </tr>
345
- ${Directives.repeat(input.toolCalls, call => call.invocationId + '-' + (call.result?.status ?? ''), call => html`
346
- <tr class=${
347
- call.result?.status === Protocol.WebMCP.InvocationStatus.Error ? 'status-error' :
348
- call.result?.status === Protocol.WebMCP.InvocationStatus.Canceled ? 'status-cancelled' : ''
349
- }>
363
+ <devtools-split-view name="webmcp-call-split-view"
364
+ direction="column"
365
+ sidebar-position="second"
366
+ sidebar-visibility=${input.selectedCall ? 'show' : 'hidden'}>
367
+ <div slot="main" style="display: flex; flex-direction: column; overflow: hidden; height: 100%;">
368
+ <devtools-data-grid striped .template=${html`
369
+ <table>
350
370
  <style>${webMCPViewStyles}</style>
351
- <td>${call.tool.name}</td>
352
- <td>
353
- <div class="status-cell">
354
- ${iconName(call) ? html`<devtools-icon class="small" name=${iconName(call)}></devtools-icon>`
355
- : ''}
356
- <span>${statusString(call)}</span>
357
- </div>
358
- </td>
359
- <td>${call.input}</td>
360
- <td>${call.result?.output ? JSON.stringify(call.result.output) : call.result?.errorText ?? ''}</td>
361
- </tr>
362
- `)}
363
- </table>
364
- </devtools-data-grid>
371
+ <tr>
372
+ <th id="name" weight="20">
373
+ ${i18nString(UIStrings.name)}
374
+ </th>
375
+ <th id="status" weight="20">${i18nString(UIStrings.status)}</th>
376
+ ${!input.selectedCall ? html`
377
+ <th id="input" weight="30">${i18nString(UIStrings.input)}</th>
378
+ <th id="output" weight="30">${i18nString(UIStrings.output)}</th>
379
+ ` : nothing}
380
+ </tr>
381
+ ${Directives.repeat(input.toolCalls, call => call.invocationId + '-' + (call.result?.status ?? ''),
382
+ call => html`
383
+ <tr class=${Directives.classMap({
384
+ 'status-error': call.result?.status === Protocol.WebMCP.InvocationStatus.Error,
385
+ 'status-cancelled': call.result?.status === Protocol.WebMCP.InvocationStatus.Canceled,
386
+ selected: call === input.selectedCall,
387
+ })} @click=${() => input.onCallSelect(call)}>
388
+ <td>${call.tool.name}</td>
389
+ <td>
390
+ <div class="status-cell">
391
+ ${iconName(call) ? html`<devtools-icon class="small" name=${iconName(call)}></devtools-icon>`
392
+ : ''}
393
+ <span>${statusString(call)}</span>
394
+ </div>
395
+ </td>
396
+ ${!input.selectedCall ? html`
397
+ <td>${call.input}</td>
398
+ <td>${call.result?.output ? JSON.stringify(call.result.output)
399
+ : call.result?.errorText ?? ''}</td>
400
+ ` : nothing}
401
+ </tr>
402
+ `)}
403
+ </table>`}>
404
+ </devtools-data-grid>
405
+ </div>
406
+ <div slot="sidebar" style="height: 100%; display: flex; flex-direction: column; overflow: hidden;">
407
+ <devtools-tabbed-pane class="call-details-tabbed-pane">
408
+ <devtools-button
409
+ slot="left"
410
+ .iconName=${'cross'}
411
+ .size=${Buttons.Button.Size.SMALL}
412
+ .variant=${Buttons.Button.Variant.ICON}
413
+ title=${i18nString(UIStrings.close)}
414
+ @click=${() => input.onCallSelect(null)}
415
+ ></devtools-button>
416
+ <devtools-widget
417
+ id="details"
418
+ title=${i18nString(UIStrings.toolDetails)}
419
+ ${widget(ToolDetailsWidget, {tool: input.selectedCall?.tool})}>
420
+ </devtools-widget>
421
+ </devtools-tabbed-pane>
422
+ </div>
423
+ </devtools-split-view>
365
424
  <div class="webmcp-toolbar-container" role="toolbar">
366
425
  <devtools-toolbar class="webmcp-toolbar" role="presentation" wrappable>
367
426
  <span class="toolbar-text">${i18nString(UIStrings.totalCalls, {PH1: stats.total})}</span>
@@ -379,30 +438,50 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
379
438
  text: i18nString(UIStrings.noCallsPlaceholder)})}
380
439
  `}
381
440
  </div>
382
- <div slot="sidebar" class="tool-list">
383
- <div class="section-title">${i18nString(UIStrings.toolRegistry)}</div>
384
- ${tools.length === 0 ? html`
385
- ${UI.Widget.widget(UI.EmptyWidget.EmptyWidget, {header: i18nString(UIStrings.noToolsPlaceholderTitle),
386
- text: i18nString(UIStrings.noToolsPlaceholder)})}
387
- ` : html`
388
- <devtools-list>
389
- ${tools.map(tool => {
390
- const toolStats = calculateToolStats(input.toolCalls.filter(c => c.tool === tool));
391
- const groups = getIconGroupsFromStats(toolStats);
392
- return html`
393
- <div class="tool-item">
394
- <div class="tool-name-container">
395
- <div class="tool-name source-code">${tool.name}</div>
396
- ${groups.length > 0 ? html`<icon-button .data=${
397
- {groups, compact: false} as IconButton.IconButton.IconButtonData}></icon-button>` : ''}
441
+ <devtools-split-view slot="sidebar"
442
+ direction="column"
443
+ sidebar-position="second"
444
+ name="webmcp-details-split-view"
445
+ sidebar-visibility=${input.selectedTool ? 'show' : 'hidden'}>
446
+ <div slot="main" class="tool-list">
447
+ <div class="section-title">${i18nString(UIStrings.toolRegistry)}</div>
448
+ ${tools.length === 0 ? html`
449
+ ${UI.Widget.widget(UI.EmptyWidget.EmptyWidget, {header: i18nString(UIStrings.noToolsPlaceholderTitle),
450
+ text: i18nString(UIStrings.noToolsPlaceholder)})}
451
+ ` : html`
452
+ <devtools-list>
453
+ ${tools.map(tool => {
454
+ const toolStats = calculateToolStats(input.toolCalls.filter(c => c.tool === tool));
455
+ const groups = getIconGroupsFromStats(toolStats);
456
+ return html`
457
+ <div class=${Directives.classMap({'tool-item': true, selected: tool === input.selectedTool})}
458
+ @click=${() => input.onToolSelect(tool)}>
459
+ <div class="tool-name-container">
460
+ <div class="tool-name source-code">${tool.name}</div>
461
+ ${groups.length > 0 ? html`<icon-button .data=${
462
+ {groups, compact: false} as IconButton.IconButton.IconButtonData}></icon-button>` : ''}
463
+ </div>
464
+ <div class="tool-description">${tool.description}</div>
398
465
  </div>
399
- <div class="tool-description">${tool.description}</div>
400
- </div>
401
- `;
402
- })}
403
- </devtools-list>
404
- `}
405
- </div>
466
+ `;
467
+ })}
468
+ </devtools-list>
469
+ `}
470
+ </div>
471
+ <div slot="sidebar" class="tool-details">
472
+ <div class="section-title">
473
+ <devtools-button
474
+ .iconName=${'cross'}
475
+ .size=${Buttons.Button.Size.SMALL}
476
+ .variant=${Buttons.Button.Variant.ICON}
477
+ title=${i18nString(UIStrings.close)}
478
+ @click=${() => input.onToolSelect(null)}
479
+ ></devtools-button>
480
+ <span>${i18nString(UIStrings.toolDetails)}</span>
481
+ </div>
482
+ ${widget(ToolDetailsWidget, {tool: input.selectedTool})}
483
+ </div>
484
+ </devtools-split-view>
406
485
  </devtools-split-view>
407
486
  `, target);
408
487
  // clang-format on
@@ -410,6 +489,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
410
489
 
411
490
  export class WebMCPView extends UI.Widget.VBox {
412
491
  readonly #view: View;
492
+ #selectedTool: WebMCP.WebMCPModel.Tool|null = null;
493
+ #selectedCall: WebMCP.WebMCPModel.Call|null = null;
413
494
 
414
495
  #filterState: FilterState = {
415
496
  text: '',
@@ -553,6 +634,16 @@ export class WebMCPView extends UI.Widget.VBox {
553
634
  const filteredCalls = filterToolCalls(toolCalls, this.#filterState);
554
635
  const input: ViewInput = {
555
636
  tools: this.#getTools(),
637
+ selectedTool: this.#selectedTool,
638
+ onToolSelect: tool => {
639
+ this.#selectedTool = tool;
640
+ this.requestUpdate();
641
+ },
642
+ selectedCall: this.#selectedCall,
643
+ onCallSelect: call => {
644
+ this.#selectedCall = call;
645
+ this.requestUpdate();
646
+ },
556
647
  toolCalls: filteredCalls,
557
648
  filters: this.#filterState,
558
649
  filterButtons: this.#filterButtons,
@@ -562,3 +653,131 @@ export class WebMCPView extends UI.Widget.VBox {
562
653
  this.#view(input, {}, this.contentElement);
563
654
  }
564
655
  }
656
+
657
+ export interface ToolDetailsViewInput {
658
+ tool: WebMCP.WebMCPModel.Tool|null|undefined;
659
+ origin: SDK.DOMModel.DOMNode|StackTrace.StackTrace.StackTrace|undefined;
660
+ highlightNode: (node: SDK.DOMModel.DOMNode) => void;
661
+ clearHighlight: () => void;
662
+ revealNode: (node: SDK.DOMModel.DOMNode) => void;
663
+ }
664
+
665
+ // clang-format off
666
+ const TOOL_DETAILS_VIEW = (input: ToolDetailsViewInput, output: undefined, target: HTMLElement): void => {
667
+ if (!input.tool) {
668
+ render(nothing, target);
669
+ return;
670
+ }
671
+ const tool = input.tool;
672
+ const origin = input.origin;
673
+ render(html`
674
+ <style>${webMCPViewStyles}</style>
675
+ <div class="tool-details-grid">
676
+ <div class="label">Name</div>
677
+ <div class="value source-code">${tool.name}</div>
678
+ <div class="label">Description</div>
679
+ <div class="value">${tool.description}</div>
680
+ ${tool.frame ? html`
681
+ <div class="label">${i18nString(UIStrings.frame)}</div>
682
+ <div class="value">${Components.Linkifier.Linkifier.linkifyRevealable(tool.frame, tool.frame.displayName())}</div>
683
+ ` : nothing}
684
+ ${origin instanceof SDK.DOMModel.DOMNode ? html`
685
+ <div class="label">Origin</div>
686
+ <div class="value tool-origin-container">
687
+ <span
688
+ class="node-text-container source-code tool-origin-node"
689
+ data-label="true"
690
+ @mouseenter=${() => input.highlightNode(origin)}
691
+ @mouseleave=${input.clearHighlight}>
692
+ <devtools-node-text .data=${{
693
+ nodeId: origin.getAttribute('id') || undefined,
694
+ nodeTitle: origin.nodeNameInCorrectCase(),
695
+ nodeClasses: origin.getAttribute('class')?.split(/\s+/).filter(s => Boolean(s))
696
+ } as NodeText.NodeText.NodeTextData}>
697
+ </devtools-node-text>
698
+ </span>
699
+ <devtools-button class="show-element"
700
+ .title=${i18nString(UIStrings.viewInElementsPanel)}
701
+ aria-label=${i18nString(UIStrings.viewInElementsPanel)}
702
+ .iconName=${'select-element'}
703
+ .jslogContext=${'elements.select-element'}
704
+ .size=${Buttons.Button.Size.SMALL}
705
+ .variant=${Buttons.Button.Variant.ICON}
706
+ @click=${() => input.revealNode(origin)}
707
+ ></devtools-button>
708
+ </div>` : origin ? html`
709
+ <div class="label">Origin</div>
710
+ <div class="value">
711
+ ${widget(Components.JSPresentationUtils.StackTracePreviewContent,
712
+ {stackTrace: origin, options: { expandable: true}})}
713
+ </div>` : nothing}
714
+ </div>
715
+ `, target);
716
+ };
717
+ // clang-format on
718
+
719
+ export class ToolDetailsWidget extends UI.Widget.Widget {
720
+ #tool: WebMCP.WebMCPModel.Tool|null|undefined = null;
721
+ #origin: SDK.DOMModel.DOMNode|StackTrace.StackTrace.StackTrace|undefined;
722
+
723
+ #view: typeof TOOL_DETAILS_VIEW;
724
+
725
+ constructor(element?: HTMLElement, view: typeof TOOL_DETAILS_VIEW = TOOL_DETAILS_VIEW) {
726
+ super(element);
727
+ this.#view = view;
728
+ }
729
+
730
+ set tool(tool: WebMCP.WebMCPModel.Tool|null|undefined) {
731
+ if (this.#tool === tool) {
732
+ return;
733
+ }
734
+ this.#tool = tool;
735
+ this.#origin = undefined;
736
+
737
+ if (this.#tool) {
738
+ void this.#setToolOrigin(this.#tool);
739
+ }
740
+ this.requestUpdate();
741
+ }
742
+
743
+ async #setToolOrigin(tool: WebMCP.WebMCPModel.Tool): Promise<void> {
744
+ const origin = await (tool.node ? tool.node.resolvePromise() : tool.stackTrace);
745
+ if (this.#tool === tool && origin) {
746
+ this.#origin = origin;
747
+ this.requestUpdate();
748
+ }
749
+ }
750
+
751
+ get tool(): WebMCP.WebMCPModel.Tool|null|undefined {
752
+ return this.#tool;
753
+ }
754
+
755
+ #highlightNode = (node: SDK.DOMModel.DOMNode): void => {
756
+ node.highlight();
757
+ };
758
+
759
+ #clearHighlight = (): void => {
760
+ SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
761
+ };
762
+
763
+ #revealNode = (node: SDK.DOMModel.DOMNode): void => {
764
+ void Common.Revealer.reveal(node);
765
+ void node.scrollIntoView();
766
+ };
767
+
768
+ override performUpdate(): void {
769
+ const viewInput = {
770
+ tool: this.#tool,
771
+ origin: this.#origin,
772
+ highlightNode: this.#highlightNode,
773
+ clearHighlight: this.#clearHighlight,
774
+ revealNode: this.#revealNode,
775
+ };
776
+ this.#view(viewInput, undefined, this.contentElement);
777
+ }
778
+
779
+ override wasShown(): void {
780
+ super.wasShown();
781
+ this.requestUpdate();
782
+ }
783
+ }
@@ -8,6 +8,7 @@ import * as BackgroundServiceModel from './BackgroundServiceModel.js';
8
8
  import * as BackgroundServiceView from './BackgroundServiceView.js';
9
9
  import * as BounceTrackingMitigationsTreeElement from './BounceTrackingMitigationsTreeElement.js';
10
10
  import * as CookieItemsView from './CookieItemsView.js';
11
+ import * as CrashReportContextView from './CrashReportContextView.js';
11
12
  import * as DeviceBoundSessionsModel from './DeviceBoundSessionsModel.js';
12
13
  import * as DeviceBoundSessionsTreeElement from './DeviceBoundSessionsTreeElement.js';
13
14
  import * as DeviceBoundSessionsView from './DeviceBoundSessionsView.js';
@@ -50,6 +51,7 @@ export {
50
51
  BackgroundServiceView,
51
52
  BounceTrackingMitigationsTreeElement,
52
53
  CookieItemsView,
54
+ CrashReportContextView,
53
55
  DeviceBoundSessionsModel,
54
56
  DeviceBoundSessionsTreeElement,
55
57
  DeviceBoundSessionsView,
@@ -0,0 +1,154 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import '../../../ui/legacy/components/data_grid/data_grid.js';
6
+
7
+ import * as Host from '../../../core/host/host.js';
8
+ import * as i18n from '../../../core/i18n/i18n.js';
9
+ import type * as TextUtils from '../../../models/text_utils/text_utils.js';
10
+ import * as UI from '../../../ui/legacy/legacy.js';
11
+ import {html, render} from '../../../ui/lit/lit.js';
12
+
13
+ const UIStrings = {
14
+ /**
15
+ * @description Text in Crash Report Context Items View of the Application panel
16
+ */
17
+ key: 'Key',
18
+ /**
19
+ * @description Text in Crash Report Context Items View of the Application panel
20
+ */
21
+ value: 'Value',
22
+ /**
23
+ * @description Context menu item to copy the key of a context entry
24
+ */
25
+ copyKey: 'Copy key',
26
+ /**
27
+ * @description Context menu item to copy the value of a context entry
28
+ */
29
+ copyValue: 'Copy value',
30
+ } as const;
31
+ const str_ = i18n.i18n.registerUIStrings('panels/application/components/CrashReportContextGrid.ts', UIStrings);
32
+ export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
33
+
34
+ export interface CrashReportContextGridData {
35
+ entries: Array<{key: string, value: string}>;
36
+ selectedKey?: string;
37
+ filters?: TextUtils.TextUtils.ParsedFilter[];
38
+ }
39
+
40
+ export interface ViewInput {
41
+ entries: Array<{key: string, value: string}>;
42
+ selectedKey?: string;
43
+ onSelect: (key: string) => void;
44
+ onContextMenu: (e: Event, key: string, value: string) => void;
45
+ }
46
+
47
+ export const DEFAULT_VIEW = (input: ViewInput, output: undefined, target: HTMLElement|ShadowRoot): void => {
48
+ // clang-format off
49
+ render(
50
+ html`
51
+ <style>
52
+ :host {
53
+ display: block;
54
+ }
55
+
56
+ div {
57
+ overflow: auto;
58
+ }
59
+
60
+ td {
61
+ white-space: nowrap;
62
+ overflow: hidden;
63
+ text-overflow: ellipsis;
64
+ }
65
+ </style>
66
+ <style>${UI.inspectorCommonStyles}</style>
67
+ <div>
68
+ <devtools-data-grid striped inline>
69
+ <table>
70
+ <thead>
71
+ <tr>
72
+ <th id="key" weight="50">${i18nString(UIStrings.key)}</th>
73
+ <th id="value" weight="50">${i18nString(UIStrings.value)}</th>
74
+ </tr>
75
+ </thead>
76
+ <tbody>
77
+ ${input.entries.map(entry => html`
78
+ <tr class=${input.selectedKey === entry.key ? 'selected' : ''}
79
+ @select=${() => input.onSelect(entry.key)}
80
+ @contextmenu=${(e: Event) => input.onContextMenu(e, entry.key, entry.value)}>
81
+ <td title=${entry.key}>${entry.key}</td>
82
+ <td title=${entry.value}>${entry.value}</td>
83
+ </tr>
84
+ `)}
85
+ </tbody>
86
+ </table>
87
+ </devtools-data-grid>
88
+ </div>
89
+ `,
90
+ target);
91
+ // clang-format on
92
+ };
93
+
94
+ type View = (input: ViewInput, output: undefined, target: HTMLElement|ShadowRoot) => void;
95
+
96
+ export class CrashReportContextGrid extends UI.Widget.Widget {
97
+ #entries: Array<{key: string, value: string}> = [];
98
+ #filteredEntries: Array<{key: string, value: string}> = [];
99
+ #selectedKey?: string;
100
+ #filters: TextUtils.TextUtils.ParsedFilter[] = [];
101
+ readonly #view: View;
102
+
103
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
104
+ super(element, {useShadowDom: true});
105
+ this.#view = view;
106
+ }
107
+
108
+ set data(data: CrashReportContextGridData) {
109
+ this.#entries = data.entries;
110
+ this.#selectedKey = data.selectedKey;
111
+ this.#filters = data.filters || [];
112
+ this.requestUpdate();
113
+ }
114
+
115
+ #computeFilteredEntries(): void {
116
+ if (this.#filters.length === 0) {
117
+ this.#filteredEntries = this.#entries;
118
+ return;
119
+ }
120
+ this.#filteredEntries = this.#entries.filter(entry => {
121
+ return this.#filters.every(filter => {
122
+ const regex = filter.regex;
123
+ if (!regex) {
124
+ return true;
125
+ }
126
+ const matches = regex.test(entry.key) || regex.test(entry.value);
127
+ return filter.negative ? !matches : matches;
128
+ });
129
+ });
130
+ }
131
+
132
+ #onContextMenu(e: Event, key: string, value: string): void {
133
+ const customEvent = e as CustomEvent<UI.ContextMenu.ContextMenu>;
134
+ const contextMenu = customEvent.detail;
135
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.copyKey), () => {
136
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(key);
137
+ }, {jslogContext: 'copy-key'});
138
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.copyValue), () => {
139
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(value);
140
+ }, {jslogContext: 'copy-value'});
141
+ }
142
+
143
+ override performUpdate(): void {
144
+ this.#computeFilteredEntries();
145
+ this.#view(
146
+ {
147
+ entries: this.#filteredEntries,
148
+ selectedKey: this.#selectedKey,
149
+ onSelect: (key: string) => this.element.dispatchEvent(new CustomEvent('select', {detail: key})),
150
+ onContextMenu: (e: Event, key: string, value: string) => this.#onContextMenu(e, key, value),
151
+ },
152
+ undefined, this.contentElement);
153
+ }
154
+ }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as BackForwardCacheView from './BackForwardCacheView.js';
6
6
  import * as BounceTrackingMitigationsView from './BounceTrackingMitigationsView.js';
7
+ import * as CrashReportContextGrid from './CrashReportContextGrid.js';
7
8
  import * as EndpointsGrid from './EndpointsGrid.js';
8
9
  import * as InterestGroupAccessGrid from './InterestGroupAccessGrid.js';
9
10
  import * as PermissionsPolicySection from './PermissionsPolicySection.js';
@@ -18,6 +19,7 @@ import * as TrustTokensView from './TrustTokensView.js';
18
19
  export {
19
20
  BackForwardCacheView,
20
21
  BounceTrackingMitigationsView,
22
+ CrashReportContextGrid,
21
23
  EndpointsGrid,
22
24
  InterestGroupAccessGrid,
23
25
  PermissionsPolicySection,