chrome-devtools-frontend 1.0.1570343 → 1.0.1571573

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 (72) hide show
  1. package/agents/prompts/README.md +18 -0
  2. package/agents/prompts/devtools-imports.md +47 -0
  3. package/agents/prompts/verification.md +27 -0
  4. package/docs/contributing/infrastructure.md +22 -0
  5. package/front_end/core/host/AidaClient.ts +1 -1
  6. package/front_end/core/host/UserMetrics.ts +1 -1
  7. package/front_end/core/root/Runtime.ts +54 -34
  8. package/front_end/core/sdk/CSSProperty.ts +1 -1
  9. package/front_end/core/sdk/CookieModel.ts +1 -1
  10. package/front_end/core/sdk/DOMModel.ts +1 -1
  11. package/front_end/core/sdk/DebuggerModel.ts +2 -21
  12. package/front_end/core/sdk/OverlayModel.ts +3 -2
  13. package/front_end/core/sdk/SourceMap.ts +0 -9
  14. package/front_end/core/sdk/SourceMapScopesInfo.ts +0 -24
  15. package/front_end/entrypoints/main/MainImpl.ts +43 -18
  16. package/front_end/generated/SupportedCSSProperties.js +2 -6
  17. package/front_end/models/ai_assistance/BuiltInAi.ts +5 -4
  18. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +2 -2
  19. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -0
  20. package/front_end/models/trace/ModelImpl.ts +0 -4
  21. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +1 -1
  22. package/front_end/panels/ai_assistance/PatchWidget.ts +10 -15
  23. package/front_end/panels/ai_assistance/SelectWorkspaceDialog.ts +5 -4
  24. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -2
  25. package/front_end/panels/application/FrameDetailsView.ts +2 -1
  26. package/front_end/panels/application/components/ReportsGrid.ts +2 -1
  27. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +3 -5
  28. package/front_end/panels/common/AiCodeCompletionTeaser.ts +5 -5
  29. package/front_end/panels/console/ConsoleInsightTeaser.ts +10 -11
  30. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  31. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  32. package/front_end/panels/elements/ComputedStyleModel.ts +11 -13
  33. package/front_end/panels/elements/ComputedStyleWidget.ts +3 -3
  34. package/front_end/panels/elements/ElementsPanel.ts +5 -2
  35. package/front_end/panels/elements/ElementsSidebarPane.ts +1 -1
  36. package/front_end/panels/elements/PlatformFontsWidget.ts +1 -1
  37. package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
  38. package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
  39. package/front_end/panels/emulation/DeviceModeWrapper.ts +101 -62
  40. package/front_end/panels/explain/components/ConsoleInsight.ts +27 -23
  41. package/front_end/panels/explain/components/consoleInsight.css +1 -1
  42. package/front_end/panels/network/RequestConditionsDrawer.ts +0 -1
  43. package/front_end/panels/network/RequestTimingView.ts +4 -3
  44. package/front_end/panels/network/components/RequestHeadersView.css +2 -2
  45. package/front_end/panels/network/components/RequestHeadersView.ts +7 -6
  46. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  47. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  48. package/front_end/panels/recorder/RecorderController.ts +6 -7
  49. package/front_end/panels/recorder/recorderController.css +1 -1
  50. package/front_end/panels/security/CookieControlsView.ts +2 -2
  51. package/front_end/panels/security/CookieReportView.ts +7 -7
  52. package/front_end/panels/settings/AISettingsTab.ts +5 -5
  53. package/front_end/panels/settings/components/SyncSection.ts +4 -3
  54. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -1
  55. package/front_end/panels/sources/NavigatorView.ts +1 -1
  56. package/front_end/panels/sources/SourcesPanel.ts +3 -1
  57. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +1 -1
  58. package/front_end/panels/timeline/ThreadAppender.ts +1 -1
  59. package/front_end/panels/timeline/TimelineController.ts +4 -3
  60. package/front_end/panels/timeline/TimelinePanel.ts +4 -3
  61. package/front_end/panels/whats_new/ReleaseNoteView.ts +4 -3
  62. package/front_end/third_party/chromium/README.chromium +1 -1
  63. package/front_end/ui/components/markdown_view/CodeBlock.ts +3 -6
  64. package/front_end/ui/components/markdown_view/MarkdownLink.ts +3 -4
  65. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +3 -4
  66. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +9 -6
  67. package/front_end/ui/components/panel_feedback/panelFeedback.css +2 -2
  68. package/front_end/ui/kit/link/Link.ts +1 -14
  69. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -1
  70. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +5 -4
  71. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -1
  72. package/package.json +1 -1
@@ -123,73 +123,47 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
123
123
  return;
124
124
  }
125
125
 
126
+ // Resolve to a remote object to ensure the node is alive in the context.
126
127
  const object = await node.resolveToObject();
127
128
  if (!object) {
128
129
  return;
129
130
  }
130
- const result = await object.callFunction(function(this: Element) {
131
- function getFrameOffset(frame: Element|null): {x: number, y: number} {
132
- if (!frame) {
133
- return {x: 0, y: 0};
134
- }
135
-
136
- // The offset of the frame's content relative to the frame element
137
- // contains the border width and the padding.
138
- // The border width.
139
- const borderTop = frame.clientTop;
140
- const borderLeft = frame.clientLeft;
141
-
142
- // The padding can be retrieved via computed styles.
143
- const styles = window.getComputedStyle(frame);
144
- const paddingTop = parseFloat(styles.paddingTop);
145
- const paddingLeft = parseFloat(styles.paddingLeft);
146
-
147
- // The position of the frame in it's parent.
148
- const rect = frame.getBoundingClientRect();
149
-
150
- // The offset of the parent frame's content relative to the
151
- // document. If there is no parent frame, the offset is 0.
152
- // In case of OOPiF, there is no access to the parent frame's
153
- // offset.
154
- const parentFrameOffset = getFrameOffset(frame.ownerDocument.defaultView?.frameElement ?? null);
155
-
156
- // The scroll position of the frame.
157
- const scrollX = frame.ownerDocument.defaultView?.scrollX ?? 0;
158
- const scrollY = frame.ownerDocument.defaultView?.scrollY ?? 0;
159
-
160
- return {
161
- x: parentFrameOffset.x + rect.left + borderLeft + paddingLeft + scrollX,
162
- y: parentFrameOffset.y + rect.top + borderTop + paddingTop + scrollY,
163
- };
164
- }
165
-
166
- // The bounding client rect of the node relative to the viewport.
167
- const rect = this.getBoundingClientRect();
168
- const frameOffset = getFrameOffset(this.ownerDocument.defaultView?.frameElement ?? null);
169
-
170
- // The scroll position of the frame.
171
- const scrollX = this.ownerDocument.defaultView?.scrollX ?? 0;
172
- const scrollY = this.ownerDocument.defaultView?.scrollY ?? 0;
173
-
174
- // The offset of the node's content relative to the top-level
175
- // document is the sum of the element offset relative to the
176
- // document's viewport, the document's scroll position, and the
177
- // parent's offset relative to the top-level document.
178
- return JSON.stringify({
179
- x: rect.left + frameOffset.x + scrollX,
180
- y: rect.top + frameOffset.y + scrollY,
181
- width: rect.width,
182
- height: rect.height,
183
- scale: 1,
184
- });
185
- });
186
- if (!result.object) {
187
- throw new Error('Clipping error: could not get object data.');
131
+
132
+ // Get the Box Model via CDP.
133
+ // This returns the quads relative to the target's viewport.
134
+ // We use the 'border' quad to include the border and padding in the screenshot,
135
+ // matching the 'width' and 'height' properties which are also Border Box dimensions.
136
+ const nodeBoxModel = await node.boxModel();
137
+ if (!nodeBoxModel) {
138
+ throw new Error(`Unable to get box model of the node: ${new Error().stack}`);
139
+ }
140
+ const nodeBorderQuad = nodeBoxModel.border;
141
+
142
+ // Get Layout Metrics to account for the Visual Viewport scroll and zoom.
143
+ const metrics = await node.domModel().target().pageAgent().invoke_getLayoutMetrics();
144
+ if (metrics.getError()) {
145
+ throw new Error(`Unable to get metrics: ${new Error().stack}`);
188
146
  }
189
- const clip = (JSON.parse((result.object.value as string)));
190
- const response = await node.domModel().target().pageAgent().invoke_getLayoutMetrics();
191
- const error = response.getError();
192
- const zoom = !error && response.visualViewport.zoom || 1;
147
+
148
+ const scrollX = metrics.cssVisualViewport.pageX;
149
+ const scrollY = metrics.cssVisualViewport.pageY;
150
+
151
+ // Calculate the global offset for OOPiFs (Out-of-Process iframes).
152
+ // This accounts for the position of the target's frame within the main page.
153
+ const {x: oopifOffsetX, y: oopifOffsetY} = await getOopifOffset(node.domModel().target());
154
+
155
+ // Assemble the final Clip.
156
+ // The absolute coordinates are: Global (OOPiF) + Viewport Scroll + Local Node Position (Border Box).
157
+ const clip = {
158
+ x: oopifOffsetX + scrollX + nodeBorderQuad[0],
159
+ y: oopifOffsetY + scrollY + nodeBorderQuad[1],
160
+ width: nodeBoxModel.width,
161
+ height: nodeBoxModel.height,
162
+ scale: 1,
163
+ };
164
+
165
+ // Apply Zoom factor.
166
+ const zoom = metrics.cssVisualViewport.zoom ?? 1;
193
167
  clip.x *= zoom;
194
168
  clip.y *= zoom;
195
169
  clip.width *= zoom;
@@ -210,3 +184,68 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
210
184
  return false;
211
185
  }
212
186
  }
187
+
188
+ /**
189
+ * Calculate the offset of the "Local Root" frame relative to the "Global Root" (the main frame).
190
+ * This involves traversing the CDP Targets for OOPiFs.
191
+ */
192
+ async function getOopifOffset(target: SDK.Target.Target|null): Promise<{x: number, y: number}> {
193
+ if (!target) {
194
+ return {x: 0, y: 0};
195
+ }
196
+
197
+ // Get the parent target. If there's no parent (we are at root) or it's not a frame, we are done.
198
+ const parentTarget = target.parentTarget();
199
+ if (!parentTarget || parentTarget.type() !== SDK.Target.Type.FRAME) {
200
+ return {x: 0, y: 0};
201
+ }
202
+
203
+ // Identify the current frame's ID to find its owner in the parent.
204
+ const frameId = target.model(SDK.ResourceTreeModel.ResourceTreeModel)?.mainFrame?.id;
205
+ if (!frameId) {
206
+ return {x: 0, y: 0};
207
+ }
208
+
209
+ // Get the DOMModel of the parent to query the frame owner element.
210
+ const parentDOMModel = parentTarget.model(SDK.DOMModel.DOMModel);
211
+ if (!parentDOMModel) {
212
+ return {x: 0, y: 0};
213
+ }
214
+
215
+ // Retrieve the frame owner node (e.g. the <iframe> element) in the parent's document.
216
+ const frameOwnerDeferred = await parentDOMModel.getOwnerNodeForFrame(frameId);
217
+ const frameOwner = await frameOwnerDeferred?.resolvePromise();
218
+ if (!frameOwner) {
219
+ return {x: 0, y: 0};
220
+ }
221
+
222
+ // Get the content box of the iframe element.
223
+ // This is relative to the parent target's viewport.
224
+ const boxModel = await frameOwner.boxModel();
225
+ if (!boxModel) {
226
+ return {x: 0, y: 0};
227
+ }
228
+
229
+ // content is a Quad [x1, y1, x2, y2, x3, y3, x4, y4]
230
+ const contentQuad = boxModel.content;
231
+ const iframeContentX = contentQuad[0];
232
+ const iframeContentY = contentQuad[1];
233
+
234
+ // Get the scroll position of the parent target to convert viewport-relative coordinates
235
+ // to document-relative coordinates.
236
+ const parentMetrics = await parentTarget.pageAgent().invoke_getLayoutMetrics();
237
+ if (parentMetrics.getError()) {
238
+ return {x: 0, y: 0};
239
+ }
240
+
241
+ const scrollX = parentMetrics.cssVisualViewport.pageX;
242
+ const scrollY = parentMetrics.cssVisualViewport.pageY;
243
+
244
+ // Recursively add the offset of the parent target itself (if it is also an OOPiF).
245
+ const parentOffset = await getOopifOffset(parentTarget);
246
+
247
+ return {
248
+ x: iframeContentX + scrollX + parentOffset.x,
249
+ y: iframeContentY + scrollY + parentOffset.y,
250
+ };
251
+ }
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import '../../../ui/components/spinners/spinners.js';
6
+ import '../../../ui/kit/kit.js';
6
7
 
7
8
  import * as Common from '../../../core/common/common.js';
8
9
  import * as Host from '../../../core/host/host.js';
@@ -299,9 +300,9 @@ function renderSearchButton(onSearch: ViewInput['callbacks']['onSearch']): Lit.T
299
300
 
300
301
  function renderLearnMoreAboutInsights(): Lit.TemplateResult {
301
302
  // clang-format off
302
- return html`<x-link href=${LEARN_MORE_URL} class="link" jslog=${VisualLogging.link('learn-more').track({click: true})}>
303
+ return html`<devtools-link href=${LEARN_MORE_URL} class="link" .jslogContext=${'learn-more'}>
303
304
  ${i18nString(UIStrings.learnMore)}
304
- </x-link>`;
305
+ </devtools-link>`;
305
306
  // clang-format on
306
307
  }
307
308
 
@@ -317,15 +318,15 @@ function maybeRenderSources(
317
318
  <ol class="sources-list">
318
319
  ${directCitationUrls.map((url, index) => html`
319
320
  <li>
320
- <x-link
321
+ <devtools-link
321
322
  href=${url}
322
323
  class=${Directives.classMap({link: true, highlighted: index === highlightedCitationIndex})}
323
- jslog=${VisualLogging.link('references.console-insights').track({click: true})}
324
+ .jslogContext=${'references.console-insights'}
324
325
  ${Directives.ref(e => { output.citationLinks[index] = e as HTMLElement; })}
325
326
  @animationend=${onCitationAnimationEnd}
326
327
  >
327
328
  ${url}
328
- </x-link>
329
+ </devtools-link>
329
330
  </li>
330
331
  `)}
331
332
  </ol>
@@ -343,13 +344,13 @@ function maybeRenderRelatedContent(relatedUrls: string[], directCitationUrls: st
343
344
  <ul class="references-list">
344
345
  ${relatedUrls.map(relatedUrl => html`
345
346
  <li>
346
- <x-link
347
+ <devtools-link
347
348
  href=${relatedUrl}
348
349
  class="link"
349
- jslog=${VisualLogging.link('references.console-insights').track({click: true})}
350
+ .jslogContext=${'references.console-insights'}
350
351
  >
351
352
  ${relatedUrl}
352
- </x-link>
353
+ </devtools-link>
353
354
  </li>
354
355
  `)}
355
356
  </ul>
@@ -379,10 +380,10 @@ function renderInsightSourcesList(
379
380
  <div class="insight-sources">
380
381
  <ul>
381
382
  ${Directives.repeat(sources, item => item.value, item => {
382
- return html`<li><x-link class="link" title="${localizeType(item.type)} ${i18nString(UIStrings.opensInNewTab)}" href="data:text/plain;charset=utf-8,${encodeURIComponent(item.value)}" jslog=${VisualLogging.link('source-' + item.type).track({click: true})}>
383
+ return html`<li><devtools-link class="link" title="${localizeType(item.type)} ${i18nString(UIStrings.opensInNewTab)}" href="data:text/plain;charset=utf-8,${encodeURIComponent(item.value)}" .jslogContext=${'source-' + item.type}>
383
384
  <devtools-icon name="open-externally"></devtools-icon>
384
385
  ${localizeType(item.type)}
385
- </x-link></li>`;
386
+ </devtools-link></li>`;
386
387
  })}
387
388
  ${isPageReloadRecommended ? html`<li class="source-disclaimer">
388
389
  <devtools-icon name="warning"></devtools-icon>
@@ -450,28 +451,28 @@ function renderConsentReminder(noLogging: boolean): Lit.TemplateResult {
450
451
  <devtools-icon name="policy" class="medium">
451
452
  </devtools-icon>
452
453
  </div>
453
- <div>Use of this feature is subject to the <x-link
454
+ <div>Use of this feature is subject to the <devtools-link
454
455
  href=${TERMS_OF_SERVICE_URL}
455
456
  class="link"
456
- jslog=${VisualLogging.link('terms-of-service.console-insights').track({click: true})}>
457
+ .jslogContext=${'terms-of-service.console-insights'}>
457
458
  Google Terms of Service
458
- </x-link> and <x-link
459
+ </devtools-link> and <devtools-link
459
460
  href=${PRIVACY_POLICY_URL}
460
461
  class="link"
461
- jslog=${VisualLogging.link('privacy-policy.console-insights').track({click: true})}>
462
+ .jslogContext=${'privacy-policy.console-insights'}>
462
463
  Google Privacy Policy
463
- </x-link>
464
+ </devtools-link>
464
465
  </div>
465
466
  <div>
466
467
  <devtools-icon name="warning" class="medium">
467
468
  </devtools-icon>
468
469
  </div>
469
470
  <div>
470
- <x-link
471
+ <devtools-link
471
472
  href=${CODE_SNIPPET_WARNING_URL}
472
473
  class="link"
473
- jslog=${VisualLogging.link('code-snippets-explainer.console-insights').track({click: true})}
474
- >Use generated code snippets with caution</x-link>
474
+ .jslogContext=${'code-snippets-explainer.console-insights'}
475
+ >Use generated code snippets with caution</devtools-link>
475
476
  </div>
476
477
  </div>`;
477
478
  // clang-format on
@@ -513,10 +514,10 @@ function renderDisclaimer(noLogging: boolean, onDisclaimerSettingsLink: () => vo
513
514
  } <button class="link" role="link" @click=${onDisclaimerSettingsLink}
514
515
  jslog=${VisualLogging.action('open-ai-settings').track({click: true})}>
515
516
  Open settings
516
- </button> or <x-link href=${LEARN_MORE_URL}
517
- class="link" jslog=${VisualLogging.link('learn-more').track({click: true})}>
517
+ </button> or <devtools-link href=${LEARN_MORE_URL}
518
+ class="link" .jslogContext=${'learn-more'}>
518
519
  learn more
519
- </x-link>
520
+ </devtools-link>
520
521
  </span>`;
521
522
  // clang-format on
522
523
  }
@@ -549,7 +550,8 @@ function renderSignInFooter(onGoToSignIn: () => void): Lit.LitTemplate {
549
550
  // clang-format on
550
551
  }
551
552
 
552
- function renderConsentReminderFooter(onReminderSettingsLink: () => void, onConsentReminderConfirmed: () => void): Lit.LitTemplate {
553
+ function renderConsentReminderFooter(
554
+ onReminderSettingsLink: () => void, onConsentReminderConfirmed: () => void): Lit.LitTemplate {
553
555
  // clang-format off
554
556
  return html`
555
557
  <div class="filler"></div>
@@ -575,7 +577,9 @@ function renderConsentReminderFooter(onReminderSettingsLink: () => void, onConse
575
577
  // clang-format on
576
578
  }
577
579
 
578
- function renderInsightFooter(noLogging: ViewInput['noLogging'], selectedRating: ViewInput['selectedRating'], callbacks: ViewInput['callbacks']): Lit.LitTemplate {
580
+ function renderInsightFooter(
581
+ noLogging: ViewInput['noLogging'], selectedRating: ViewInput['selectedRating'],
582
+ callbacks: ViewInput['callbacks']): Lit.LitTemplate {
579
583
  // clang-format off
580
584
  return html`
581
585
  <div class="disclaimer">
@@ -360,7 +360,7 @@
360
360
  display: table-cell;
361
361
  }
362
362
 
363
- .sources-list x-link.highlighted {
363
+ .sources-list devtools-link.highlighted {
364
364
  animation: highlight-fadeout 2s;
365
365
  }
366
366
 
@@ -181,7 +181,6 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
181
181
  render(
182
182
  // clang-format off
183
183
  html`
184
- <style>${RequestConditionsDrawer}</style>
185
184
  <devtools-toolbar jslog=${VisualLogging.toolbar()}>
186
185
  <devtools-checkbox
187
186
  ?checked=${input.enabled}
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  /* eslint-disable @devtools/no-imperative-dom-api */
6
+ import '../../ui/kit/kit.js';
6
7
 
7
8
  import * as Common from '../../core/common/common.js';
8
9
  import * as Host from '../../core/host/host.js';
@@ -500,12 +501,12 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
500
501
  </tr>` : nothing}
501
502
  <tr class=network-timing-footer>
502
503
  <td colspan=1>
503
- <x-link
504
+ <devtools-link
504
505
  href="https://developer.chrome.com/docs/devtools/network/reference/#timing-explanation"
505
506
  class=devtools-link
506
- jslog=${VisualLogging.link().track({click: true, keydown:'Enter|Space'}).context('explanation')}>
507
+ .jslogContext=${'explanation'}>
507
508
  ${i18nString(UIStrings.explanation)}
508
- </x-link>
509
+ </devtools-link>
509
510
  <td></td>
510
511
  <td class=${input.wasThrottled ? 'throttled' : ''} title=${ifDefined(throttledRequestTitle)}>
511
512
  ${input.wasThrottled ? html` <devtools-icon name=watch @click=${revealThrottled}></devtools-icon>` : nothing}
@@ -147,11 +147,11 @@ div.raw-headers-row {
147
147
  color: var(--sys-color-on-surface);
148
148
  }
149
149
 
150
- x-link {
150
+ devtools-link {
151
151
  position: relative;
152
152
  }
153
153
 
154
- x-link .inline-icon {
154
+ devtools-link .inline-icon {
155
155
  padding-right: 3px;
156
156
  }
157
157
 
@@ -2,6 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
+ import '../../../ui/kit/kit.js';
5
6
 
6
7
  import * as Common from '../../../core/common/common.js';
7
8
  import * as Host from '../../../core/host/host.js';
@@ -306,22 +307,22 @@ export class RequestHeadersView extends LegacyWrapper.LegacyWrapper.WrappableCom
306
307
  // Disabled until https://crbug.com/1079231 is fixed.
307
308
  // clang-format off
308
309
  return html`
309
- <x-link
310
+ <devtools-link
310
311
  href="https://goo.gle/devtools-override"
311
312
  class="link devtools-link"
312
- jslog=${VisualLogging.link('devtools-override').track({click: true})}
313
+ .jslogContext=${'devtools-override'}
313
314
  >
314
315
  <devtools-icon name="help" class="inline-icon medium">
315
316
  </devtools-icon>
316
- </x-link>
317
- <x-link
317
+ </devtools-link>
318
+ <devtools-link
318
319
  @click=${revealHeadersFile}
319
320
  class="link devtools-link"
320
321
  title=${UIStrings.revealHeaderOverrides}
321
- jslog=${VisualLogging.link('reveal-header-overrides').track({click: true})}
322
+ .jslogContext=${'reveal-header-overrides'}
322
323
  >
323
324
  ${fileIcon}${Persistence.NetworkPersistenceManager.HEADERS_FILENAME}
324
- </x-link>
325
+ </devtools-link>
325
326
  `;
326
327
  // clang-format on
327
328
  }
@@ -144,7 +144,7 @@ export class HeapProfileView extends ProfileView implements UI.SearchableView.Se
144
144
 
145
145
  this.timelineOverview = new HeapTimelineOverview();
146
146
 
147
- if (Root.Runtime.experiments.isEnabled('sampling-heap-profiler-timeline')) {
147
+ if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.SAMPLING_HEAP_PROFILER_TIMELINE)) {
148
148
  this.timelineOverview.addEventListener(Events.IDS_RANGE_CHANGED, this.onIdsRangeChanged.bind(this));
149
149
  this.timelineOverview.show(this.element, this.element.firstChild);
150
150
  this.timelineOverview.start();
@@ -368,7 +368,7 @@ export class SamplingHeapProfileType extends SamplingHeapProfileTypeBase {
368
368
  }
369
369
 
370
370
  override hasTemporaryView(): boolean {
371
- return Root.Runtime.experiments.isEnabled('sampling-heap-profiler-timeline');
371
+ return Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.SAMPLING_HEAP_PROFILER_TIMELINE);
372
372
  }
373
373
 
374
374
  override startSampling(): void {
@@ -378,7 +378,7 @@ export class SamplingHeapProfileType extends SamplingHeapProfileTypeBase {
378
378
  }
379
379
 
380
380
  void heapProfilerModel.startSampling();
381
- if (Root.Runtime.experiments.isEnabled('sampling-heap-profiler-timeline')) {
381
+ if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.SAMPLING_HEAP_PROFILER_TIMELINE)) {
382
382
  this.updateTimer = window.setTimeout(() => {
383
383
  void this.updateStats();
384
384
  }, this.updateIntervalMs);
@@ -1337,8 +1337,8 @@ export class HeapSnapshotProfileType extends
1337
1337
  }
1338
1338
 
1339
1339
  override customContent(): Element|null {
1340
- const showOptionToExposeInternalsInHeapSnapshot =
1341
- Root.Runtime.experiments.isEnabled('show-option-tp-expose-internals-in-heap-snapshot');
1340
+ const showOptionToExposeInternalsInHeapSnapshot = Root.Runtime.experiments.isEnabled(
1341
+ Root.Runtime.ExperimentName.SHOW_OPTION_TO_EXPOSE_INTERNALS_IN_HEAP_SNAPSHOT);
1342
1342
  const exposeInternalsInHeapSnapshotCheckbox =
1343
1343
  SettingsUI.SettingsUI.createSettingCheckbox(i18nString(UIStrings.exposeInternals), this.exposeInternals);
1344
1344
  this.customContentInternal = exposeInternalsInHeapSnapshotCheckbox;
@@ -1,6 +1,7 @@
1
1
  // Copyright 2023 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
+ import '../../ui/kit/kit.js';
4
5
 
5
6
  import * as Common from '../../core/common/common.js';
6
7
  import * as Host from '../../core/host/host.js';
@@ -1193,13 +1194,11 @@ export class RecorderController extends LitElement {
1193
1194
  <div class="empty-state-header">${i18nString(UIStrings.header)}</div>
1194
1195
  <div class="empty-state-description">
1195
1196
  <span>${i18nString(UIStrings.recordingDescription)}</span>
1196
- <x-link
1197
+ <devtools-link
1197
1198
  class="x-link devtools-link"
1198
1199
  href=${RECORDER_EXPLANATION_URL}
1199
- jslog=${VisualLogging.link()
1200
- .track({ click: true, keydown: 'Enter|Space' })
1201
- .context('learn-more')}
1202
- >${i18nString(UIStrings.learnMore)}</x-link>
1200
+ .jslogContext=${'learn-more'}
1201
+ >${i18nString(UIStrings.learnMore)}</devtools-link>
1203
1202
  </div>
1204
1203
  <devtools-button .variant=${Buttons.Button.Variant.TONAL} jslogContext=${Actions.RecorderActions.CREATE_RECORDING} @click=${this.#onCreateNewRecording}>${i18nString(UIStrings.createRecording)}</devtools-button>
1205
1204
  </div>
@@ -1474,9 +1473,9 @@ export class RecorderController extends LitElement {
1474
1473
  }
1475
1474
  ></devtools-button>
1476
1475
  <div class="feedback">
1477
- <x-link class="x-link" title=${i18nString(UIStrings.sendFeedback)} href=${
1476
+ <devtools-link class="x-link" title=${i18nString(UIStrings.sendFeedback)} href=${
1478
1477
  FEEDBACK_URL
1479
- } jslog=${VisualLogging.link('feedback').track({click: true})}>${i18nString(UIStrings.sendFeedback)}</x-link>
1478
+ } .jslogContext=${'feedback'}>${i18nString(UIStrings.sendFeedback)}</devtools-link>
1480
1479
  </div>
1481
1480
  <div class="separator"></div>
1482
1481
  <devtools-shortcut-dialog
@@ -167,7 +167,7 @@ devtools-recording-list-view {
167
167
  font: var(--sys-typescale-body4-regular);
168
168
  color: var(--sys-color-on-surface-subtle);
169
169
 
170
- > x-link {
170
+ > devtools-link {
171
171
  white-space: nowrap;
172
172
  margin-left: var(--sys-size-3);
173
173
  cursor: pointer;
@@ -304,8 +304,8 @@ const DEFAULT_VIEW: View = (input: ViewInput, _output: object, target: HTMLEleme
304
304
  class="medium"
305
305
  style="color: var(--icon-warning); margin-right: var(--sys-size-2);">
306
306
  </devtools-icon>
307
- ${i18nFormatString(UIStrings.upperDeprecationWarning, {
308
- PH1: UI.Fragment.html`<x-link class="devtools-link" href="https://privacysandbox.com/news/privacy-sandbox-update/" jslog=${VisualLogging.link('privacy-sandbox-update').track({click: true})}>${i18nString(UIStrings.blogPostLink)}</x-link>`,
307
+ ${i18nFormatStringTemplate(UIStrings.upperDeprecationWarning, {
308
+ PH1: html`<devtools-link class="devtools-link" href="https://privacysandbox.com/news/privacy-sandbox-update/" .jslogContext=${'privacy-sandbox-update'}>${i18nString(UIStrings.blogPostLink)}</devtools-link>`,
309
309
  })}
310
310
  </div>
311
311
  <div class="body">
@@ -4,6 +4,7 @@
4
4
  /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
5
 
6
6
  import '../../ui/legacy/components/data_grid/data_grid.js';
7
+ import '../../ui/kit/kit.js';
7
8
 
8
9
  import * as Common from '../../core/common/common.js';
9
10
  import * as i18n from '../../core/i18n/i18n.js';
@@ -15,7 +16,6 @@ import type * as TextUtils from '../../models/text_utils/text_utils.js';
15
16
  import * as uiI18n from '../../ui/i18n/i18n.js';
16
17
  import * as UI from '../../ui/legacy/legacy.js';
17
18
  import * as Lit from '../../ui/lit/lit.js';
18
- import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
19
19
  import * as NetworkForward from '../network/forward/forward.js';
20
20
 
21
21
  import cookieReportViewStyles from './cookieReportView.css.js';
@@ -187,6 +187,7 @@ const UIStrings = {
187
187
  const str_ = i18n.i18n.registerUIStrings('panels/security/CookieReportView.ts', UIStrings);
188
188
  export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
189
189
  export const i18nFormatString = uiI18n.getFormatLocalizedString.bind(undefined, str_);
190
+ export const i18nFormatStringTemplate = uiI18n.getFormatLocalizedStringTemplate.bind(undefined, str_);
190
191
 
191
192
  export interface ViewInput {
192
193
  cookieRows: IssuesManager.CookieIssue.CookieReportInfo[];
@@ -221,11 +222,10 @@ const DEFAULT_VIEW: View = (input, output, target) => {
221
222
  class="medium"
222
223
  style="color: var(--icon-warning); margin-right: var(--sys-size-2);">
223
224
  </devtools-icon>
224
- ${i18nFormatString(UIStrings.upperDeprecationWarning, {
225
- PH1: UI.Fragment
226
- .html`<x-link class="devtools-link" href="https://privacysandbox.com/news/privacy-sandbox-update/" jslog=${
227
- VisualLogging.link('privacy-sandbox-update').track({click: true})}>${
228
- i18nString(UIStrings.blogPostLink)}</x-link>`,
225
+ ${i18nFormatStringTemplate(UIStrings.upperDeprecationWarning, {
226
+ PH1:
227
+ html`<devtools-link class="devtools-link" href="https://privacysandbox.com/news/privacy-sandbox-update/" .jslogContext=${
228
+ 'privacy-sandbox-update'}>${i18nString(UIStrings.blogPostLink)}</devtools-link>`,
229
229
  })}
230
230
  </div>
231
231
  <div class="body">
@@ -239,7 +239,7 @@ const DEFAULT_VIEW: View = (input, output, target) => {
239
239
  <div class="report overflow-auto">
240
240
  <div class="header">
241
241
  <h1>${i18nString(UIStrings.title)}</h1>
242
- <div class="body">${i18nString(UIStrings.body)} <x-link class="devtools-link" href="https://developers.google.com/privacy-sandbox/cookies/prepare/audit-cookies" jslog=${VisualLogging.link('learn-more').track({click: true})}>${i18nString(UIStrings.learnMoreLink)}</x-link></div>
242
+ <div class="body">${i18nString(UIStrings.body)} <devtools-link class="devtools-link" href="https://developers.google.com/privacy-sandbox/cookies/prepare/audit-cookies" .jslogContext=${'learn-more'}>${i18nString(UIStrings.learnMoreLink)}</devtools-link></div>
243
243
  </div>
244
244
  ${input.cookieRows.length > 0 ?
245
245
  html`
@@ -2,6 +2,8 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import '../../ui/kit/kit.js';
6
+
5
7
  import * as Common from '../../core/common/common.js';
6
8
  import * as Host from '../../core/host/host.js';
7
9
  import * as i18n from '../../core/i18n/i18n.js';
@@ -348,14 +350,12 @@ export const AI_SETTINGS_TAB_DEFAULT_VIEW: View = (input, _output, target): void
348
350
  <h3 class="expansion-grid-whole-row">${i18nString(UIStrings.thingsToConsider)}</h3>
349
351
  ${settingData.toConsiderSettingItems.map(item => renderSettingItem(item))}
350
352
  <div class="expansion-grid-whole-row">
351
- <x-link
353
+ <devtools-link
352
354
  href=${settingData.learnMoreLink.url}
353
355
  class="link"
354
356
  tabindex=${tabindex}
355
- jslog=${VisualLogging.link(settingData.learnMoreLink.linkJSLogContext).track({
356
- click: true,
357
- })}
358
- >${i18nString(UIStrings.learnMore)}</x-link>
357
+ .jslogContext=${settingData.learnMoreLink.linkJSLogContext}
358
+ >${i18nString(UIStrings.learnMore)}</devtools-link>
359
359
  </div>
360
360
  </div>
361
361
  </div>
@@ -4,6 +4,7 @@
4
4
 
5
5
  import '../../../ui/components/settings/settings.js';
6
6
  import '../../../ui/components/tooltips/tooltips.js';
7
+ import '../../../ui/kit/kit.js';
7
8
 
8
9
  import * as Common from '../../../core/common/common.js';
9
10
  import * as Host from '../../../core/host/host.js';
@@ -179,12 +180,12 @@ const DEFAULT_VIEW = (input: ViewInput, output: ViewOutput, target: HTMLElement)
179
180
  <div class="plan-details">
180
181
  ${getGdpSubscriptionText(input.gdpProfile)}
181
182
  &nbsp;·&nbsp;
182
- <x-link
183
- .jslog=${VisualLogging.link().track({click: true, keydown: 'Enter|Space'}).context('view-profile')}
183
+ <devtools-link
184
+ .jslogContext=${'view-profile'}
184
185
  class="link"
185
186
  href=${Host.GdpClient.GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK}>
186
187
  ${i18nString(UIStrings.viewProfile)}
187
- </x-link></div>
188
+ </devtools-link></div>
188
189
  ${hasReceiveBadgesCheckbox ? html`
189
190
  <div class="setting-container" ${ref(el => {
190
191
  output.highlightReceiveBadgesSetting = () => {
@@ -45,6 +45,7 @@ import {Directives, html, render} from '../../ui/lit/lit.js';
45
45
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
46
46
 
47
47
  import callStackSidebarPaneStyles from './callStackSidebarPane.css.js';
48
+ import {QuickSourceView, SourcesPanel} from './SourcesPanel.js';
48
49
 
49
50
  const UIStrings = {
50
51
  /**
@@ -285,7 +286,9 @@ export class CallStackSidebarPane extends UI.View.SimpleView implements UI.Conte
285
286
  if (this.maxAsyncStackChainDepth === defaultMaxAsyncStackChainDepth) {
286
287
  this.list.selectNextItem(true /* canWrap */, false /* center */);
287
288
  const selectedItem = this.list.selectedItem();
288
- if (selectedItem) {
289
+ if (selectedItem &&
290
+ (UI.Context.Context.instance().flavor(QuickSourceView) ||
291
+ UI.Context.Context.instance().flavor(SourcesPanel))) {
289
292
  this.activateItem(selectedItem);
290
293
  }
291
294
  }
@@ -179,7 +179,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
179
179
  private authoredNode?: NavigatorGroupTreeNode;
180
180
  private deployedNode?: NavigatorGroupTreeNode;
181
181
  private navigatorGroupByFolderSetting: Common.Settings.Setting<boolean>;
182
- private navigatorGroupByAuthoredExperiment?: string;
182
+ private navigatorGroupByAuthoredExperiment?: Root.Runtime.ExperimentName;
183
183
  #workspace!: Workspace.Workspace.WorkspaceImpl;
184
184
  private groupByFrame?: boolean;
185
185
  private groupByAuthored?: boolean;