chrome-devtools-frontend 1.0.1697998 → 1.0.1699061

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 (145) hide show
  1. package/.agents/skills/devtools-verification/SKILL.md +19 -0
  2. package/.agents/skills/{repro-flaky-tests → fix-tests}/SKILL.md +2 -2
  3. package/.agents/skills/version-control/SKILL.md +21 -9
  4. package/front_end/core/platform/HostRuntime.ts +12 -0
  5. package/front_end/core/platform/api/HostRuntime.ts +13 -0
  6. package/front_end/core/platform/browser/HostRuntime.ts +34 -0
  7. package/front_end/core/platform/node/HostRuntime.ts +40 -0
  8. package/front_end/core/sdk/AnimationModel.ts +12 -98
  9. package/front_end/core/sdk/CSSModel.ts +4 -2
  10. package/front_end/core/sdk/CSSPropertyParser.ts +4 -4
  11. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -44
  12. package/front_end/core/sdk/Connections.ts +6 -1
  13. package/front_end/core/sdk/ConsoleModel.ts +1 -12
  14. package/front_end/core/sdk/DOMModel.ts +6 -56
  15. package/front_end/core/sdk/DebuggerModel.ts +9 -8
  16. package/front_end/core/sdk/NetworkManager.ts +2 -2
  17. package/front_end/core/sdk/NetworkRequest.ts +1 -1
  18. package/front_end/core/sdk/OverlayModel.ts +11 -12
  19. package/front_end/core/sdk/PageFunctions.ts +187 -0
  20. package/front_end/core/sdk/Resource.ts +1 -1
  21. package/front_end/core/sdk/RuntimeModel.ts +1 -20
  22. package/front_end/core/sdk/Script.ts +21 -0
  23. package/front_end/core/sdk/SourceMap.ts +15 -2
  24. package/front_end/core/sdk/SourceMapCache.ts +13 -10
  25. package/front_end/core/sdk/SourceMapManager.ts +11 -9
  26. package/front_end/core/sdk/SourceMapScopeChainEntry.ts +109 -15
  27. package/front_end/core/sdk/SourceMapScopesInfo.ts +8 -2
  28. package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +635 -0
  29. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +26 -12
  30. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +16 -2
  31. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +4 -4
  32. package/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.ts +2 -0
  33. package/front_end/entrypoints/shell/shell.ts +1 -1
  34. package/front_end/models/ai_assistance/DOMHelpers.ts +95 -0
  35. package/front_end/models/ai_assistance/EvaluateAction.ts +5 -42
  36. package/front_end/models/ai_assistance/ExtensionScope.ts +2 -31
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +2 -1
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -4
  39. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  40. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +10 -7
  41. package/front_end/models/ai_assistance/contexts/FileContext.ts +2 -10
  42. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +3 -2
  43. package/front_end/models/ai_assistance/tools/ListSources.ts +21 -14
  44. package/front_end/models/bindings/CompilerScriptMapping.ts +3 -10
  45. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +48 -17
  46. package/front_end/models/bindings/ResourceScriptMapping.ts +2 -2
  47. package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
  48. package/front_end/models/comment_manager/CD4ABridge.ts +55 -12
  49. package/front_end/models/comment_manager/CommentManager.ts +46 -91
  50. package/front_end/models/comment_manager/CommentThread.ts +145 -0
  51. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  52. package/front_end/models/emulation/DeviceModeModel.ts +54 -1
  53. package/front_end/models/extensions/ExtensionAPI.ts +8 -6
  54. package/front_end/models/extensions/ExtensionEndpoint.ts +11 -8
  55. package/front_end/models/extensions/HostUrlPattern.ts +4 -3
  56. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +3 -2
  57. package/front_end/models/extensions/RecorderExtensionEndpoint.ts +2 -1
  58. package/front_end/models/formatter/FormatterWorkerPool.ts +4 -6
  59. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +55 -0
  60. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +18 -14
  61. package/front_end/models/issues_manager/CookieIssue.ts +0 -13
  62. package/front_end/models/issues_manager/IssuesManager.ts +5 -0
  63. package/front_end/models/issues_manager/WebInstallIssue.ts +63 -0
  64. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingId.md +3 -0
  65. package/front_end/models/issues_manager/descriptions/webInstallManifestMissingNameOrShortName.md +3 -0
  66. package/front_end/models/issues_manager/descriptions/webInstallManifestParsingOrNetworkError.md +3 -0
  67. package/front_end/models/issues_manager/descriptions/webInstallNoManifest.md +3 -0
  68. package/front_end/models/issues_manager/descriptions/webInstallStartUrlInvalid.md +3 -0
  69. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  70. package/front_end/models/source_map_scopes/NamesResolver.ts +11 -3
  71. package/front_end/models/source_map_scopes/ScopeChainModel.ts +10 -6
  72. package/front_end/models/workspace/UISourceCode.ts +20 -0
  73. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +281 -3
  74. package/front_end/panels/accessibility/accessibilityAnnouncementRecordingView.css +85 -0
  75. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -8
  76. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +4 -10
  77. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  78. package/front_end/panels/application/CrashReportContextView.ts +1 -1
  79. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  80. package/front_end/panels/application/KeyValueStorageItemsView.ts +1 -0
  81. package/front_end/panels/application/components/AdsView.ts +63 -1
  82. package/front_end/panels/application/components/adsView.css +11 -1
  83. package/front_end/{ui/comments → panels/common}/CommentThreadWidget.ts +5 -20
  84. package/front_end/{ui/comments → panels/common}/CommentsOverlayWidget.ts +39 -62
  85. package/front_end/{ui/comments → panels/common}/CommentsStatusBarPill.ts +5 -5
  86. package/front_end/panels/common/ExtensionServer.ts +2 -1
  87. package/front_end/{ui/comments → panels/common}/commentThreadWidget.css +0 -12
  88. package/front_end/{ui/comments → panels/common}/commentsOverlay.css +2 -1
  89. package/front_end/{ui/comments/comments-meta.ts → panels/common/common-meta.ts} +11 -11
  90. package/front_end/panels/common/common.ts +3 -0
  91. package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +3 -3
  92. package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
  93. package/front_end/panels/elements/ElementsPanel.ts +9 -5
  94. package/front_end/panels/elements/ElementsTreeElement.ts +11 -3
  95. package/front_end/panels/elements/ElementsTreeOutline.ts +69 -74
  96. package/front_end/panels/elements/PropertiesWidget.ts +11 -10
  97. package/front_end/panels/elements/PropertyRenderer.ts +29 -25
  98. package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -6
  99. package/front_end/panels/elements/elementsTreeOutline.css +11 -5
  100. package/front_end/panels/emulation/DeviceModeToolbar.ts +2 -3
  101. package/front_end/panels/event_listeners/EventListenersView.ts +33 -44
  102. package/front_end/panels/lighthouse/LighthouseController.ts +1 -1
  103. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -7
  104. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +5 -1
  105. package/front_end/panels/linear_memory_inspector/linear_memory_inspector-meta.ts +1 -1
  106. package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +1 -1
  107. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
  108. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
  109. package/front_end/panels/recorder/StepView.ts +19 -4
  110. package/front_end/panels/recorder/TimelineSection.ts +1 -1
  111. package/front_end/panels/recorder/stepView.css +1 -0
  112. package/front_end/panels/security/SecurityPanel.ts +5 -5
  113. package/front_end/panels/security/SecurityPanelSidebar.ts +2 -11
  114. package/front_end/panels/settings/BackendLinkingSettingsTab.ts +2 -1
  115. package/front_end/panels/settings/EditFileSystemView.ts +1 -1
  116. package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
  117. package/front_end/panels/sources/DebuggerPlugin.ts +2 -2
  118. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +11 -16
  119. package/front_end/panels/sources/sources-meta.ts +1 -1
  120. package/front_end/panels/timeline/components/DetailsView.ts +3 -3
  121. package/front_end/panels/timeline/components/OriginMap.ts +1 -1
  122. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -3
  123. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +0 -3
  124. package/front_end/third_party/chromium/README.chromium +1 -1
  125. package/front_end/ui/comments/CommentOverlayManager.ts +28 -110
  126. package/front_end/ui/comments/comments.ts +0 -6
  127. package/front_end/ui/components/buttons/Button.ts +19 -1
  128. package/front_end/ui/legacy/ContextMenu.ts +16 -1
  129. package/front_end/ui/legacy/PlusButton.ts +5 -6
  130. package/front_end/ui/legacy/Treeoutline.ts +6 -0
  131. package/front_end/ui/legacy/Widget.ts +33 -0
  132. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +3 -0
  133. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +14 -4
  134. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +36 -32
  135. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  136. package/package.json +1 -1
  137. package/.agents/skills/devtools-ci/SKILL.md +0 -65
  138. package/.agents/skills/evaluate-ai-css-completion/SKILL.md +0 -143
  139. package/.agents/skills/evaluate-ai-css-completion/scripts/evaluate.js +0 -104
  140. package/.agents/skills/fixing-skipped-tests/SKILL.md +0 -32
  141. package/.agents/skills/gerrit-cli/SKILL.md +0 -74
  142. package/.agents/skills/gerrit-cli/references/commands.md +0 -169
  143. package/.agents/skills/gerrit-cli/references/workflows.md +0 -63
  144. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +0 -85
  145. package/front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md +0 -4
@@ -78,7 +78,7 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
78
78
  @create=${input.onCreate}
79
79
  class="exclude-subfolders-table"
80
80
  parts="excluded-folder-row-with-error"
81
- inline striped>
81
+ inline striped deletable>
82
82
  <table>
83
83
  <thead>
84
84
  <tr>
@@ -79,7 +79,7 @@ const UIStrings = {
79
79
  * @description Error message that is displayed in UI when a file needed for debugging information for a call frame is missing
80
80
  * @example {src/myapp.debug.wasm.dwp} PH1
81
81
  */
82
- debugFileNotFound: 'Failed to load debug file "{PH1}".',
82
+ debugFileNotFound: 'Failed to load debug file "{PH1}"',
83
83
  /**
84
84
  * @description A context menu item in the call stack sidebar pane. "Restart" is a verb and
85
85
  * "frame" is a noun. "Frame" refers to an individual item in the call stack, i.e. a call frame.
@@ -138,7 +138,7 @@ const UIStrings = {
138
138
  * @description Error message that is displayed in UI when a file needed for debugging information for a call frame is missing.
139
139
  * @example {src/myapp.debug.wasm.dwp} PH1
140
140
  */
141
- debugFileNotFound: 'Failed to load debug file "{PH1}".',
141
+ debugFileNotFound: 'Failed to load debug file "{PH1}"',
142
142
  /**
143
143
  * @description Error message that is displayed when no debug info could be loaded.
144
144
  * @example {app.wasm} PH1
@@ -540,7 +540,7 @@ export class DebuggerPlugin extends Plugin {
540
540
  if (!url) {
541
541
  return;
542
542
  }
543
- scriptFile.addSourceMapURL(url);
543
+ scriptFile.addSourceMapURL(url, SDK.SourceMap.SourceMapProvenance.USER);
544
544
  }
545
545
 
546
546
  function addDebugInfoURL(
@@ -350,6 +350,7 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
350
350
  // clang-format off
351
351
  return html`<li
352
352
  class=${classMap({'watch-expression-tree-item': true, 'watch-expression-editing': e.editing })}
353
+ ?open=${Boolean(e.result?.expanded)}
353
354
  @keydown=${onExpressionKeydown.bind(undefined, e)}
354
355
  @expand=${(event: UI.TreeOutline.TreeViewElement.ExpandEvent) => input.onExpand(e, event.detail.expanded)}
355
356
  role=treeitem>
@@ -364,12 +365,8 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
364
365
  onContextMenu: (event: Event) => onContextMenu(e, event),
365
366
  })}></devtools-widget>
366
367
  ${e.editing || !e.result || e.exceptionDetails ||
367
- !e.result.hasChildren || e.result.object.customPreview() ? nothing : html`
368
- <ul role=group>
369
- ${ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement.createPropertyNodes(
370
- e.result.children ?? {}, false /* skipProto */, false /* skipGettersAndSetters */, input.linkifier).map(
371
- node => html`<devtools-tree-wrapper .treeElement=${node}></devtools-tree-wrapper>`)}
372
- </ul>`}
368
+ !e.result.hasChildren || e.result.object.customPreview() ? nothing :
369
+ ObjectUI.ObjectPropertiesSection.renderObjectTree(e.result, input.linkifier)}
373
370
  </li>`;
374
371
  // clang-format on
375
372
  };
@@ -552,10 +549,9 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.Ac
552
549
  this.saveExpressions();
553
550
  this.requestUpdate();
554
551
  },
555
- onExpand: async(e: WatchExpression, expanded: boolean): Promise<void> => {
556
- if (expanded) {
557
- await e.result?.populateChildrenIfNeeded();
558
- this.requestUpdate();
552
+ onExpand: (e: WatchExpression, expanded: boolean): void => {
553
+ if (e.result) {
554
+ e.result.expanded = expanded;
559
555
  }
560
556
  },
561
557
  },
@@ -600,13 +596,12 @@ export class WatchExpressionsSidebarPane extends UI.Widget.VBox implements UI.Ac
600
596
  return true;
601
597
  }
602
598
 
603
- appendApplicableItems(
604
- _event: Event, contextMenu: UI.ContextMenu.ContextMenu,
605
- target: ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement|UISourceCodeFrame): void {
606
- if (target instanceof ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement) {
607
- if (!target.property.property.synthetic) {
599
+ appendApplicableItems(_event: Event, contextMenu: UI.ContextMenu.ContextMenu,
600
+ target: ObjectUI.ObjectPropertiesSection.ObjectTreeNode|UISourceCodeFrame): void {
601
+ if (target instanceof ObjectUI.ObjectPropertiesSection.ObjectTreeNode) {
602
+ if (!target.property.synthetic) {
608
603
  contextMenu.debugSection().appendItem(i18nString(UIStrings.addPropertyPathToWatch),
609
- () => this.#focusAndAddExpressionToWatch(target.path()),
604
+ () => this.#focusAndAddExpressionToWatch(target.path),
610
605
  {jslogContext: 'add-property-path-to-watch'});
611
606
  }
612
607
  return;
@@ -2035,7 +2035,7 @@ UI.ContextMenu.registerProvider({
2035
2035
  },
2036
2036
  contextTypes() {
2037
2037
  return [
2038
- ObjectUI.ObjectPropertiesSection.ObjectPropertyTreeElement,
2038
+ ObjectUI.ObjectPropertiesSection.ObjectTreeNode,
2039
2039
  ...maybeRetrieveContextTypes(Sources => [Sources.UISourceCodeFrame.UISourceCodeFrame]),
2040
2040
  ];
2041
2041
  },
@@ -25,7 +25,7 @@ const UIStrings = {
25
25
  * @description Warning message indicating that an event is likely a performance bottleneck in the Performance panel.
26
26
  * @example {Forced reflow} PH1
27
27
  */
28
- sIsALikelyPerformanceBottleneck: '{PH1} is a likely performance bottleneck.',
28
+ sIsALikelyPerformanceBottleneck: '{PH1} is a likely performance bottleneck',
29
29
  /**
30
30
  * @description Warning message in the Performance panel for an idle callback function that took longer to execute than its predefined deadline.
31
31
  * @example {10ms} PH1
@@ -36,7 +36,7 @@ const UIStrings = {
36
36
  * @example {Task} PH1
37
37
  * @example {10ms} PH2
38
38
  */
39
- sTookS: '{PH1} took {PH2}.',
39
+ sTookS: '{PH1} took {PH2}',
40
40
  /**
41
41
  * @description Label in the Performance panel for a task that took a long time.
42
42
  */
@@ -49,7 +49,7 @@ const UIStrings = {
49
49
  * @description Warning message in the Performance panel indicating that an interaction caused poor responsiveness.
50
50
  * @example {Long interaction} PH1
51
51
  */
52
- sIsLikelyPoorPageResponsiveness: '{PH1} indicates poor page responsiveness.',
52
+ sIsLikelyPoorPageResponsiveness: '{PH1} indicates poor page responsiveness',
53
53
  /**
54
54
  * @description Label for the WebSocket sub-protocol in the event details view of the Performance panel.
55
55
  */
@@ -115,7 +115,7 @@ export const DEFAULT_VIEW: View = (input, _output, target) => {
115
115
  }
116
116
  // clang-format off
117
117
  Lit.render(html`
118
- <devtools-data-grid striped inline
118
+ <devtools-data-grid striped inline deletable
119
119
  @click=${(e: Event) => { e.stopPropagation(); }}
120
120
  @create=${input.onCreate}>
121
121
  <table>
@@ -57,7 +57,7 @@ const UIStrings = {
57
57
  * @description Accessible label for the button to expand an insight to view details in the Performance panel sidebar.
58
58
  * @example {LCP breakdown} PH1
59
59
  */
60
- viewDetails: 'View details for {PH1} insight.',
60
+ viewDetails: 'View details for {PH1} insight',
61
61
  } as const;
62
62
 
63
63
  const str_ = i18n.i18n.registerUIStrings('panels/timeline/components/insights/BaseInsightComponent.ts', UIStrings);
@@ -108,8 +108,7 @@ const DEFAULT_VIEW: View = (input, _output, target) => {
108
108
 
109
109
  let ariaLabel = `${i18nString(UIStrings.viewDetails, {PH1: model.title})}`;
110
110
  if (estimatedSavingsAriaLabel) {
111
- // space prefix is deliberate to add a gap after the view details text
112
- ariaLabel += ` ${estimatedSavingsAriaLabel}`;
111
+ ariaLabel += `. ${estimatedSavingsAriaLabel}`;
113
112
  }
114
113
 
115
114
  function renderInsightContent(): Lit.LitTemplate {
@@ -1621,9 +1621,6 @@ export class Overlays extends EventTarget {
1621
1621
  pin.setAttribute('role', 'button');
1622
1622
  pin.setAttribute('tabindex', '0');
1623
1623
  UI.ARIAUtils.setLabel(pin, i18nString(UIStrings.commentPin));
1624
- if (overlay.commentThreadId) {
1625
- pin.setAttribute('data-comment-id', overlay.commentThreadId);
1626
- }
1627
1624
  const cursor = document.createElement('div');
1628
1625
  cursor.classList.add('comment-cursor');
1629
1626
  pin.appendChild(cursor);
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: c6c44ec6a59862a1b0027bc453fcacb9dce75c9e
4
+ Revision: 02dcd5e6b2a012fb40e5273996867ae1a87574d0
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE
@@ -36,8 +36,6 @@ export interface PinPositionData {
36
36
  index: number;
37
37
  }
38
38
 
39
- export type PendingPinPositionData = Omit<PinPositionData, 'id'>;
40
-
41
39
  export interface HighlightRectData {
42
40
  id: string;
43
41
  top: number;
@@ -47,21 +45,10 @@ export interface HighlightRectData {
47
45
  visible: boolean;
48
46
  }
49
47
 
50
- export type PendingHighlightRectData = Omit<HighlightRectData, 'id'>;
51
-
52
- export interface PendingDraft {
53
- element: Element;
54
- anchor: CommentAnchorSignature;
55
- pin: PendingPinPositionData|null;
56
- highlight: PendingHighlightRectData|null;
57
- pinOffset: {offsetX: number, offsetY: number}|null;
58
- }
59
-
60
48
  export interface CreateCommentOptions {
61
49
  author?: 'DEVELOPER'|'AGENT';
62
50
  changes?: CommentManager.CommentManager.ChangeRecord[];
63
51
  coordinates?: {clientX: number, clientY: number};
64
- pendingDraft?: PendingDraft;
65
52
  }
66
53
 
67
54
  export interface HoverHighlightData {
@@ -99,7 +86,6 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
99
86
  #hoverData: HoverHighlightData|null = null;
100
87
  #pinPositions: PinPositionData[] = [];
101
88
  #highlightRects: HighlightRectData[] = [];
102
- #pendingDraft: PendingDraft|null = null;
103
89
 
104
90
  #clickListener?: (event: Event) => void;
105
91
  #hoverListener?: (event: Event) => void;
@@ -133,6 +119,7 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
133
119
  #mutationObserver?: MutationObserver;
134
120
  #rematchTimeoutId?: ReturnType<typeof setTimeout>;
135
121
  #cursorElement: HTMLElement|null = null;
122
+ #isCreatingComment = false;
136
123
 
137
124
  constructor(commentManager: CommentManager.CommentManager.CommentManager) {
138
125
  super();
@@ -140,7 +127,9 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
140
127
  this.#commentManager.addEventListener(
141
128
  CommentManager.CommentManager.Events.COMMENT_THREADS_CHANGED,
142
129
  () => {
143
- this.#updatePositions();
130
+ if (!this.#isCreatingComment) {
131
+ this.#updatePositions();
132
+ }
144
133
  },
145
134
  this,
146
135
  );
@@ -149,7 +138,7 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
149
138
  ({data: active}) => {
150
139
  if (!active) {
151
140
  this.#clearHover();
152
- this.clearPendingAnchor();
141
+ this.clearDraftThreads();
153
142
  }
154
143
  document.body.style.cursor = active ? COMMENT_MODE_CURSOR : '';
155
144
  },
@@ -237,83 +226,58 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
237
226
  return this.#highlightRects;
238
227
  }
239
228
 
240
- getPendingDraft(): PendingDraft|null {
241
- return this.#pendingDraft;
229
+ getAnchorElement(thread: CommentThread): Element|undefined {
230
+ return this.#liveNodeCache.get(thread);
242
231
  }
243
232
 
244
- clearPendingAnchor(): void {
245
- if (!this.#pendingDraft) {
246
- return;
247
- }
248
-
249
- if (!this.#observedThreads.has(this.#pendingDraft.element)) {
250
- this.#intersectionObserver?.unobserve(this.#pendingDraft.element);
233
+ clearDraftThreads(): void {
234
+ const draftThreads = this.#commentManager.getCommentThreads().filter(t => t.status === 'DRAFT');
235
+ for (const thread of draftThreads) {
236
+ this.removeCommentThread(thread.id);
251
237
  }
252
- this.#pendingDraft = null;
253
- this.#updatePositions();
254
238
  }
255
239
 
256
240
  handleElementClick(element: Element, options?: {clientX: number, clientY: number}): boolean {
257
241
  if (!this.isCommentMode() || closestAcrossShadow(element, '.comment-thread-widget')) {
258
242
  return false;
259
243
  }
260
- this.clearPendingAnchor();
244
+ this.clearDraftThreads();
261
245
 
262
246
  const resolved = this.#resolveAnchor(element, options);
263
247
  if (!resolved) {
264
248
  return false;
265
249
  }
266
- const {anchor, anchorElement: anchorEl} = resolved;
250
+ const {anchorElement: anchorEl} = resolved;
267
251
  const visibleRect = computeVisibleRect(anchorEl);
268
252
  if (!visibleRect) {
269
253
  return false;
270
254
  }
271
- const anchorRect = anchorEl.getBoundingClientRect();
272
255
 
273
- let pinOffset: {offsetX: number, offsetY: number}|null = null;
274
- if (options) {
275
- pinOffset = {
276
- offsetX: Math.min(Math.max(options.clientX, visibleRect.left), visibleRect.right) - anchorRect.left,
277
- offsetY: Math.min(Math.max(options.clientY, visibleRect.top), visibleRect.bottom) - anchorRect.top,
278
- };
279
- }
280
-
281
- this.#pendingDraft = {
282
- element: anchorEl,
283
- anchor,
284
- pin: null,
285
- highlight: null,
286
- pinOffset,
287
- };
288
- const observer = this.#getIntersectionObserver();
289
- if (!this.#observedThreads.has(anchorEl)) {
290
- observer.observe(anchorEl);
291
- }
292
- this.#updatePositions();
293
- return true;
256
+ const thread = this.createComment(element, undefined, {coordinates: options});
257
+ return thread !== null;
294
258
  }
295
259
 
296
260
  createComment(
297
261
  element: Element,
298
- text: string,
262
+ text?: string,
299
263
  options?: CreateCommentOptions,
300
264
  ): CommentThread|null {
301
265
  const author = options?.author ?? 'DEVELOPER';
302
266
  const changes = options?.changes;
303
- const pendingDraft = options?.pendingDraft;
304
- let resolved: {anchor: CommentAnchorSignature, anchorElement: Element}|null;
305
- if (pendingDraft) {
306
- resolved = {anchor: pendingDraft.anchor, anchorElement: pendingDraft.element};
307
- } else {
308
- resolved = this.#resolveAnchor(element, options?.coordinates);
309
- if (!resolved) {
310
- return null;
311
- }
267
+ const resolved = this.#resolveAnchor(element, options?.coordinates);
268
+ if (!resolved) {
269
+ return null;
312
270
  }
313
271
 
314
272
  const {anchor, anchorElement} = resolved;
315
273
 
316
- const thread = this.#commentManager.createCommentThread(anchor, text, author, changes);
274
+ let thread: CommentThread;
275
+ this.#isCreatingComment = true;
276
+ try {
277
+ thread = this.#commentManager.createCommentThread(anchor, text, author, changes);
278
+ } finally {
279
+ this.#isCreatingComment = false;
280
+ }
317
281
  // Non-DOM anchors (e.g. canvas-rendered timeline entries) manage their own overlays
318
282
  // and do not have individual backing DOM nodes to cache or observe.
319
283
  if (isDomTrackedAnchor(anchor)) {
@@ -324,11 +288,7 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
324
288
  this.#observedThreads.add(anchorElement);
325
289
  }
326
290
 
327
- if (pendingDraft) {
328
- this.clearPendingAnchor();
329
- } else {
330
- this.#updatePositions();
331
- }
291
+ this.#updatePositions();
332
292
 
333
293
  return thread;
334
294
  }
@@ -493,54 +453,12 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
493
453
 
494
454
  this.#pinPositions = newPins;
495
455
  this.#highlightRects = newHighlights;
496
- this.#updatePendingPositions(scrollX, scrollY);
497
456
  this.dispatchEventToListeners(Events.POSITIONS_UPDATED, {
498
457
  pins: newPins,
499
458
  highlights: newHighlights,
500
459
  });
501
460
  }
502
461
 
503
- #updatePendingPositions(scrollX: number, scrollY: number): void {
504
- if (!this.#pendingDraft) {
505
- return;
506
- }
507
-
508
- const visibleRect = computeVisibleRect(this.#pendingDraft.element);
509
- if (!visibleRect) {
510
- if (this.#pendingDraft.pin) {
511
- this.#pendingDraft.pin.visible = false;
512
- }
513
- if (this.#pendingDraft.highlight) {
514
- this.#pendingDraft.highlight.visible = false;
515
- }
516
- return;
517
- }
518
-
519
- const anchorRect = this.#pendingDraft.element.getBoundingClientRect();
520
- const pinOffset = this.#pendingDraft.pinOffset;
521
- const pinClientX = pinOffset ?
522
- Math.min(Math.max(anchorRect.left + pinOffset.offsetX, visibleRect.left), visibleRect.right) :
523
- visibleRect.right;
524
- const pinClientY = pinOffset ?
525
- Math.min(Math.max(anchorRect.top + pinOffset.offsetY, visibleRect.top), visibleRect.bottom) :
526
- visibleRect.top;
527
-
528
- this.#pendingDraft.pin = {
529
- top: scrollY + pinClientY - 12,
530
- left: scrollX + pinClientX - 12,
531
- visible: true,
532
- index: this.#commentManager.getCommentThreads().length + 1,
533
- };
534
-
535
- this.#pendingDraft.highlight = {
536
- top: scrollY + visibleRect.top,
537
- left: scrollX + visibleRect.left,
538
- width: visibleRect.width,
539
- height: visibleRect.height,
540
- visible: true,
541
- };
542
- }
543
-
544
462
  /**
545
463
  * Initializes event listeners and lifecycle observers across the target DOM container.
546
464
  *
@@ -579,7 +497,7 @@ export class CommentOverlayManager extends Common.ObjectWrapper.ObjectWrapper<Ev
579
497
  */
580
498
  stop(): void {
581
499
  document.body.style.cursor = '';
582
- this.clearPendingAnchor();
500
+ this.clearDraftThreads();
583
501
  this.#removeClickListener();
584
502
  this.#removeScrollListener();
585
503
  this.#removeResizeObserver();
@@ -4,14 +4,8 @@
4
4
 
5
5
  import * as CommentAnchorResolver from './CommentAnchorResolver.js';
6
6
  import * as CommentOverlayManager from './CommentOverlayManager.js';
7
- import * as CommentsOverlayWidget from './CommentsOverlayWidget.js';
8
- import * as CommentsStatusBarPill from './CommentsStatusBarPill.js';
9
- import * as CommentThreadWidget from './CommentThreadWidget.js';
10
7
 
11
8
  export {
12
9
  CommentAnchorResolver,
13
10
  CommentOverlayManager,
14
- CommentsOverlayWidget,
15
- CommentsStatusBarPill,
16
- CommentThreadWidget,
17
11
  };
@@ -48,6 +48,7 @@ interface ButtonState {
48
48
  variant: Variant;
49
49
  size?: Size;
50
50
  reducedFocusRing?: boolean;
51
+ buttonTitle?: string;
51
52
  disabled: boolean;
52
53
  toggled?: boolean;
53
54
  toggleOnClick?: boolean;
@@ -80,7 +81,14 @@ interface CommonButtonData {
80
81
  spinner?: boolean;
81
82
  type?: ButtonType;
82
83
  value?: string;
84
+ /**
85
+ * Sets title on the host and, unless buttonTitle is provided, the internal <button> element.
86
+ */
83
87
  title?: string;
88
+ /**
89
+ * Sets title on the internal <button> element, taking precedence over title.
90
+ */
91
+ buttonTitle?: string;
84
92
  jslogContext?: string;
85
93
  longClickable?: boolean;
86
94
  inverseColorTheme?: boolean;
@@ -166,6 +174,7 @@ export class Button extends HTMLElement {
166
174
  if (data.title) {
167
175
  this.title = data.title;
168
176
  }
177
+ this.#props.buttonTitle = data.buttonTitle;
169
178
 
170
179
  if (data.accessibleLabel) {
171
180
  this.accessibleLabel = data.accessibleLabel;
@@ -245,6 +254,15 @@ export class Button extends HTMLElement {
245
254
  this.#render();
246
255
  }
247
256
 
257
+ get buttonTitle(): string|undefined {
258
+ return this.#props.buttonTitle;
259
+ }
260
+
261
+ set buttonTitle(buttonTitle: string|undefined) {
262
+ this.#props.buttonTitle = buttonTitle;
263
+ this.#render();
264
+ }
265
+
248
266
  get disabled(): boolean {
249
267
  return this.#props.disabled;
250
268
  }
@@ -396,7 +414,7 @@ export class Button extends HTMLElement {
396
414
  Lit.render(
397
415
  html`
398
416
  <style>${buttonStyles}</style>
399
- <button title=${ifDefined(this.title || undefined)}
417
+ <button title=${ifDefined(this.buttonTitle || this.title || undefined)}
400
418
  ?disabled=${this.#props.disabled}
401
419
  class=${classMap(classes)}
402
420
  aria-pressed=${ifDefined(this.#props.toggled)}
@@ -989,6 +989,7 @@ export class ContextMenu extends SubMenu {
989
989
  * @property keepOpen -Reflects the `"keep-open"` attribute.
990
990
  * @property iconName - Reflects the `"icon-name"` attribute.
991
991
  * @property disabled - Reflects the `"disabled"` attribute.
992
+ * @property accessibleLabel - Sets the accessible name and tooltip on the internal button.
992
993
  * @attribute soft-menu - Whether to use the soft menu implementation.
993
994
  * @attribute keep-open - Whether the menu should stay open after an item is clicked.
994
995
  * @attribute icon-name - Name of the icon to display on the button.
@@ -1001,6 +1002,7 @@ export class MenuButton extends HTMLElement {
1001
1002
  readonly #shadow = this.attachShadow({mode: 'open'});
1002
1003
  #triggerTimeoutId?: number;
1003
1004
  #populateMenuCall?: (arg0: ContextMenu) => void;
1005
+ #accessibleLabel?: string;
1004
1006
 
1005
1007
  /**
1006
1008
  * Sets the callback function used to populate the context menu when the button is clicked.
@@ -1010,6 +1012,17 @@ export class MenuButton extends HTMLElement {
1010
1012
  this.#populateMenuCall = populateCall;
1011
1013
  }
1012
1014
 
1015
+ set accessibleLabel(accessibleLabel: string|undefined) {
1016
+ this.#accessibleLabel = accessibleLabel;
1017
+ if (this.iconName) {
1018
+ this.#render();
1019
+ }
1020
+ }
1021
+
1022
+ get accessibleLabel(): string|undefined {
1023
+ return this.#accessibleLabel;
1024
+ }
1025
+
1013
1026
  /**
1014
1027
  * Reflects the `soft-menu` attribute. If true, uses the `SoftContextMenu` implementation.
1015
1028
  * @default false
@@ -1120,13 +1133,15 @@ export class MenuButton extends HTMLElement {
1120
1133
  if (!this.iconName) {
1121
1134
  throw new Error('<devtools-menu-button> expects an icon.');
1122
1135
  }
1136
+ const accessibleLabel = this.accessibleLabel ?? this.title;
1123
1137
 
1124
1138
  // clang-format off
1125
1139
  render(html`
1126
1140
  <devtools-button .disabled=${this.disabled}
1127
1141
  .iconName=${this.iconName}
1128
1142
  .variant=${Buttons.Button.Variant.ICON}
1129
- .title=${this.title}
1143
+ .accessibleLabel=${accessibleLabel}
1144
+ .buttonTitle=${accessibleLabel}
1130
1145
  aria-haspopup='menu'
1131
1146
  @click=${this.#triggerContextMenu}>
1132
1147
  </devtools-button>`,
@@ -233,19 +233,18 @@ interface PlusButtonViewInput {
233
233
  */
234
234
  export const PLUS_BUTTON_VIEW =
235
235
  (input: PlusButtonViewInput, output: {button?: MenuButton}, target: HTMLElement): void => {
236
- render(
237
- html`
236
+ render(html`
238
237
  <devtools-menu-button
239
238
  ${Directives.ref(el => {
240
- output.button = el as MenuButton | undefined;
241
- })}
239
+ output.button = el as MenuButton | undefined;
240
+ })}
242
241
  slot="trailing-button"
243
242
  .iconName=${'plus'}
244
- .title=${input.title}
243
+ .accessibleLabel=${input.title}
245
244
  .jslogContext=${input.jslogContext}
246
245
  .populateMenuCall=${input.populateMenuCall}>
247
246
  </devtools-menu-button>`,
248
- target);
247
+ target);
249
248
  };
250
249
 
251
250
  /**
@@ -1631,6 +1631,10 @@ class TreeViewTreeElement extends TreeElement {
1631
1631
  }
1632
1632
 
1633
1633
  updateExpansionFromAttribute(): void {
1634
+ if (!this.isExpandable()) {
1635
+ this.#previousOpenAttributeValue = undefined;
1636
+ return;
1637
+ }
1634
1638
  const openAttr = this.configElement.getAttribute('open');
1635
1639
  if (openAttr === this.#previousOpenAttributeValue) {
1636
1640
  return;
@@ -1674,6 +1678,8 @@ class TreeViewTreeElement extends TreeElement {
1674
1678
  this.#clonedClasses.add(className);
1675
1679
  }
1676
1680
  this.hidden = hasBooleanAttribute(this.configElement, 'hidden');
1681
+ this.selectable =
1682
+ !this.configElement.hasAttribute('selectable') || hasBooleanAttribute(this.configElement, 'selectable');
1677
1683
  this.updateExpansionFromAttribute();
1678
1684
  }
1679
1685
 
@@ -1454,3 +1454,36 @@ Node.prototype.removeChildren = function(): void {
1454
1454
  }
1455
1455
  return originalRemoveChildren.call(this);
1456
1456
  };
1457
+
1458
+ export interface WrapperWidgetParams {
1459
+ widget: Widget;
1460
+ }
1461
+
1462
+ export class WrapperWidget extends Widget {
1463
+ #widget: Widget|null = null;
1464
+ constructor(element: HTMLElement, _deps: never[], params?: WrapperWidgetParams) {
1465
+ super(element);
1466
+ this.element.style.setProperty('display', 'contents');
1467
+ if (params?.widget) {
1468
+ this.widget = params.widget;
1469
+ }
1470
+ }
1471
+
1472
+ set widget(widget: Widget|null) {
1473
+ if (this.#widget === widget) {
1474
+ return;
1475
+ }
1476
+ if (this.#widget) {
1477
+ this.#widget.detach();
1478
+ }
1479
+ this.#widget = widget;
1480
+ if (this.#widget) {
1481
+ this.#widget.show(this.element, undefined, /* suppressOrphanWidgetError */ true);
1482
+ }
1483
+ }
1484
+ override focus(): void {
1485
+ if (this.#widget) {
1486
+ this.#widget.focus();
1487
+ }
1488
+ }
1489
+ }
@@ -54,6 +54,7 @@ export interface ViewInput {
54
54
  data: CookieData[];
55
55
  selectedKey?: string;
56
56
  editable?: boolean;
57
+ deletable?: boolean;
57
58
  renderInline?: boolean;
58
59
  portBindingEnabled?: boolean;
59
60
  schemeBindingEnabled?: boolean;
@@ -233,6 +234,7 @@ export class CookiesTable extends UI.Widget.VBox {
233
234
  id="cookies-table"
234
235
  striped
235
236
  ?inline=${input.renderInline}
237
+ ?deletable=${input.deletable}
236
238
  @create=${(e: CustomEvent<CookieData>) => input.onCreate(e.detail)}
237
239
  @refresh=${input.onRefresh}
238
240
  @deselect=${() => input.onSelect(undefined)}
@@ -448,6 +450,7 @@ export class CookiesTable extends UI.Widget.VBox {
448
450
  data: this.data,
449
451
  selectedKey: this.selectedKey,
450
452
  editable: this.#editable,
453
+ deletable: Boolean(this.#deleteCallback),
451
454
  renderInline: this.renderInline,
452
455
  schemeBindingEnabled: this.schemeBindingEnabled,
453
456
  portBindingEnabled: this.portBindingEnabled,