chrome-devtools-frontend 1.0.1518653 → 1.0.1519267

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 (91) hide show
  1. package/config/owner/COMMON_OWNERS +2 -2
  2. package/eslint.config.mjs +1 -0
  3. package/front_end/core/sdk/EnhancedTracesParser.ts +5 -5
  4. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +211 -0
  5. package/front_end/core/sdk/TargetManager.ts +4 -0
  6. package/front_end/generated/SupportedCSSProperties.js +19 -4
  7. package/front_end/models/ai_assistance/agents/AiAgent.ts +57 -10
  8. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +4 -53
  9. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -31
  10. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +6 -0
  11. package/front_end/models/ai_assistance/performance/AIContext.ts +1 -1
  12. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +5 -0
  13. package/front_end/models/badges/AiExplorerBadge.ts +19 -3
  14. package/front_end/models/badges/Badge.ts +2 -0
  15. package/front_end/models/badges/CodeWhispererBadge.ts +1 -0
  16. package/front_end/models/badges/DOMDetectiveBadge.ts +1 -0
  17. package/front_end/models/badges/SpeedsterBadge.ts +1 -0
  18. package/front_end/models/badges/StarterBadge.ts +1 -0
  19. package/front_end/models/badges/badges.ts +1 -0
  20. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  21. package/front_end/models/trace/EventsSerializer.ts +4 -3
  22. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +101 -73
  23. package/front_end/models/trace/helpers/Timing.ts +1 -1
  24. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +4 -1
  25. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +16 -14
  26. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +2 -2
  27. package/front_end/panels/common/BadgeNotification.ts +3 -3
  28. package/front_end/panels/common/GdpSignUpDialog.ts +3 -4
  29. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
  30. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  31. package/front_end/panels/search/SearchResultsPane.ts +157 -138
  32. package/front_end/panels/search/SearchView.ts +12 -9
  33. package/front_end/panels/search/searchResultsPane.css +9 -0
  34. package/front_end/panels/security/CookieControlsView.ts +2 -1
  35. package/front_end/panels/settings/AISettingsTab.ts +6 -3
  36. package/front_end/panels/settings/components/SyncSection.ts +23 -9
  37. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +1 -1
  38. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +3 -0
  39. package/front_end/panels/sources/SourcesPanel.ts +1 -1
  40. package/front_end/panels/sources/sourcesView.css +6 -1
  41. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +1 -1
  42. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +1 -1
  43. package/front_end/panels/timeline/components/RelatedInsightChips.ts +1 -1
  44. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  45. package/front_end/third_party/chromium/README.chromium +1 -1
  46. package/front_end/third_party/puppeteer/README.chromium +2 -2
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
  55. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.d.ts.map +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js +16 -25
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js.map +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  63. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +19 -28
  64. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  65. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  69. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
  70. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  72. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  73. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.d.ts.map +1 -1
  75. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js +16 -25
  76. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js.map +1 -1
  77. package/front_end/third_party/puppeteer/package/package.json +10 -3
  78. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  79. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  80. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +1 -0
  81. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  82. package/front_end/third_party/puppeteer/package/src/util/Function.ts +22 -30
  83. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  84. package/front_end/ui/components/markdown_view/MarkdownImage.ts +4 -5
  85. package/front_end/ui/components/switch/SwitchImpl.ts +12 -1
  86. package/front_end/ui/components/text_editor/config.ts +16 -2
  87. package/front_end/ui/legacy/Treeoutline.ts +3 -1
  88. package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -11
  89. package/front_end/ui/lit/i18n-template.ts +5 -2
  90. package/front_end/ui/visual_logging/KnownContextValues.ts +9 -5
  91. package/package.json +1 -1
@@ -10,6 +10,7 @@ export class StarterBadge extends Badge {
10
10
  override readonly name =
11
11
  'profiles/me/awards/developers.google.com%2Fprofile%2Fbadges%2Factivity%2Fchrome-devtools%2Fchrome-devtools-user';
12
12
  override readonly title = 'Chrome DevTools User';
13
+ override readonly jslogContext = 'chrome-devtools-user';
13
14
  override readonly imageUri = STARTER_BADGE_IMAGE_URI;
14
15
 
15
16
  // TODO(ergunsh): Add remaining non-trivial event definitions
@@ -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
 
5
+ export * from './AiExplorerBadge.js';
5
6
  export * from './SpeedsterBadge.js';
6
7
  export * from './StarterBadge.js';
7
8
  export * from './Badge.js';
@@ -7978,7 +7978,7 @@ export const NativeFunctions = [
7978
7978
  },
7979
7979
  {
7980
7980
  name: "constant",
7981
- signatures: [["tensor"],["desc","buffer"]]
7981
+ signatures: [["tensor"],["desc","buffer"],["type","value"]]
7982
7982
  },
7983
7983
  {
7984
7984
  name: "argMin",
@@ -39,7 +39,7 @@ export class EventsSerializer {
39
39
  if (EventsSerializer.isLegacyTimelineFrameKey(eventValues)) {
40
40
  const event = parsedTrace.data.Frames.frames.at(eventValues.rawIndex);
41
41
  if (!event) {
42
- throw new Error(`Could not find frame with index ${eventValues.rawIndex}`);
42
+ throw new Error(`Unknown trace event. Could not find frame with index ${eventValues.rawIndex}`);
43
43
  }
44
44
  return event;
45
45
  }
@@ -48,7 +48,8 @@ export class EventsSerializer {
48
48
  const syntheticEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getSyntheticTraces();
49
49
  const syntheticEvent = syntheticEvents.at(eventValues.rawIndex);
50
50
  if (!syntheticEvent) {
51
- throw new Error(`Attempted to get a synthetic event from an unknown raw event index: ${eventValues.rawIndex}`);
51
+ throw new Error(`Unknown trace event. Attempted to get a synthetic event from an unknown raw event index: ${
52
+ eventValues.rawIndex}`);
52
53
  }
53
54
  return syntheticEvent;
54
55
  }
@@ -57,7 +58,7 @@ export class EventsSerializer {
57
58
  const rawEvents = Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents();
58
59
  return rawEvents[eventValues.rawIndex];
59
60
  }
60
- throw new Error(`Unknown trace event serializable key values: ${(eventValues as unknown[]).join('-')}`);
61
+ throw new Error(`Unknown trace event. Serializable key values: ${(eventValues as unknown[]).join('-')}`);
61
62
  }
62
63
 
63
64
  static isProfileCallKey(key: Types.File.SerializableKeyValues): key is Types.File.ProfileCallKeyValues {
@@ -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
 
5
+ import * as Platform from '../../../core/platform/platform.js';
5
6
  import * as Helpers from '../helpers/helpers.js';
6
7
  import * as Types from '../types/types.js';
7
8
 
@@ -56,15 +57,15 @@ let longestInteractionEvent: Types.Events.SyntheticInteractionPair|null = null;
56
57
 
57
58
  let interactionEvents: Types.Events.SyntheticInteractionPair[] = [];
58
59
  let interactionEventsWithNoNesting: Types.Events.SyntheticInteractionPair[] = [];
59
- let eventTimingEndEventsById = new Map<string, Types.Events.EventTimingEnd>();
60
60
  let eventTimingStartEventsForInteractions: Types.Events.EventTimingBegin[] = [];
61
+ let eventTimingEndEventsForInteractions: Types.Events.EventTimingEnd[] = [];
61
62
 
62
63
  export function reset(): void {
63
64
  beginCommitCompositorFrameEvents = [];
64
65
  parseMetaViewportEvents = [];
65
66
  interactionEvents = [];
66
67
  eventTimingStartEventsForInteractions = [];
67
- eventTimingEndEventsById = new Map();
68
+ eventTimingEndEventsForInteractions = [];
68
69
  interactionEventsWithNoNesting = [];
69
70
  longestInteractionEvent = null;
70
71
  }
@@ -86,7 +87,7 @@ export function handleEvent(event: Types.Events.Event): void {
86
87
 
87
88
  if (Types.Events.isEventTimingEnd(event)) {
88
89
  // Store the end event; for each start event that is an interaction, we need the matching end event to calculate the duration correctly.
89
- eventTimingEndEventsById.set(event.id, event);
90
+ eventTimingEndEventsForInteractions.push(event);
90
91
  }
91
92
 
92
93
  // From this point on we want to find events that represent interactions.
@@ -167,9 +168,18 @@ export function categoryOfInteraction(interaction: Types.Events.SyntheticInterac
167
168
  * =======B=[keyup]=====
168
169
  * ====C=[pointerdown]=
169
170
  * =D=[pointerup]=
171
+ *
172
+ * Additionally, this method will also maximise the processing duration of the
173
+ * events that we keep as non-nested. We want to make sure we give an accurate
174
+ * representation of main thread activity, so if we keep an event + hide its
175
+ * nested children, we set the top level event's processing start &
176
+ * processing end to be the earliest processing start & the latest processing
177
+ * end of its children. This ensures we report a more accurate main thread
178
+ * activity time which is important as we want developers to focus on fixing
179
+ * this.
170
180
  **/
171
- export function removeNestedInteractions(interactions: readonly Types.Events.SyntheticInteractionPair[]):
172
- readonly Types.Events.SyntheticInteractionPair[] {
181
+ export function removeNestedInteractionsAndSetProcessingTime(
182
+ interactions: readonly Types.Events.SyntheticInteractionPair[]): readonly Types.Events.SyntheticInteractionPair[] {
173
183
  /**
174
184
  * Because we nest events only that are in the same category, we store the
175
185
  * longest event for a given end time by category.
@@ -257,77 +267,95 @@ function writeSyntheticTimespans(event: Types.Events.SyntheticInteractionPair):
257
267
  export async function finalize(): Promise<void> {
258
268
  const {navigationsByFrameId} = metaHandlerData();
259
269
 
260
- // For each interaction start event, find the async end event by the ID, and then create the Synthetic Interaction event.
261
- for (const interactionStartEvent of eventTimingStartEventsForInteractions) {
262
- const endEvent = eventTimingEndEventsById.get(interactionStartEvent.id);
263
- if (!endEvent) {
264
- // If we cannot find an end event, bail and drop this event.
265
- continue;
266
- }
267
- const {type, interactionId, timeStamp, processingStart, processingEnd} = interactionStartEvent.args.data;
268
- if (!type || !interactionId || !timeStamp || !processingStart || !processingEnd) {
269
- // A valid interaction event that we care about has to have a type (e.g. pointerdown, keyup).
270
- // We also need to ensure it has an interactionId and various timings. There are edge cases where these aren't included in the trace event.
271
- continue;
272
- }
273
-
274
- // In the future we will add microsecond timestamps to the trace events…
275
- // (See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/window_performance.cc;l=900-901;drc=b503c262e425eae59ced4a80d59d176ed07152c7 )
276
- // …but until then we can use the millisecond precision values that are in
277
- // the trace event. To adjust them to be relative to the event.ts and the
278
- // trace timestamps, for both processingStart and processingEnd we subtract
279
- // the event timestamp (NOT event.ts, but the timeStamp millisecond value
280
- // emitted in args.data), and then add that value to the event.ts. This
281
- // will give us a processingStart and processingEnd time in microseconds
282
- // that is relative to event.ts, and can be used when drawing boxes.
283
- // There is some inaccuracy here as we are converting milliseconds to microseconds, but it is good enough until the backend emits more accurate numbers.
284
- const processingStartRelativeToTraceTime = Types.Timing.Micro(
285
- Helpers.Timing.milliToMicro(processingStart) - Helpers.Timing.milliToMicro(timeStamp) +
286
- interactionStartEvent.ts,
287
- );
288
-
289
- const processingEndRelativeToTraceTime = Types.Timing.Micro(
290
- (Helpers.Timing.milliToMicro(processingEnd) - Helpers.Timing.milliToMicro(timeStamp)) +
291
- interactionStartEvent.ts);
292
-
293
- // Ultimate frameId fallback only needed for TSC, see comments in the type.
294
- const frameId = interactionStartEvent.args.frame ?? interactionStartEvent.args.data.frame ?? '';
295
- const navigation = Helpers.Trace.getNavigationForTraceEvent(interactionStartEvent, frameId, navigationsByFrameId);
296
- const navigationId = navigation?.args.data?.navigationId;
297
- const interactionEvent =
298
- Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticInteractionPair>({
299
- // Use the start event to define the common fields.
300
- rawSourceEvent: interactionStartEvent,
301
- cat: interactionStartEvent.cat,
302
- name: interactionStartEvent.name,
303
- pid: interactionStartEvent.pid,
304
- tid: interactionStartEvent.tid,
305
- ph: interactionStartEvent.ph,
306
- processingStart: processingStartRelativeToTraceTime,
307
- processingEnd: processingEndRelativeToTraceTime,
308
- // These will be set in writeSyntheticTimespans()
309
- inputDelay: Types.Timing.Micro(-1),
310
- mainThreadHandling: Types.Timing.Micro(-1),
311
- presentationDelay: Types.Timing.Micro(-1),
312
- args: {
313
- data: {
314
- beginEvent: interactionStartEvent,
315
- endEvent,
316
- frame: frameId,
317
- navigationId,
270
+ const beginAndEndEvents = Platform.ArrayUtilities.mergeOrdered(
271
+ eventTimingStartEventsForInteractions, eventTimingEndEventsForInteractions,
272
+ Helpers.Trace.eventTimeComparator) as Types.Events.EventTimingBeginOrEnd[];
273
+
274
+ // Pair up the begin & end events and create synthetic user timing events.
275
+ const beginEventById = new Map<string, Types.Events.EventTimingBegin[]>();
276
+ for (const event of beginAndEndEvents) {
277
+ if (Types.Events.isEventTimingStart(event)) {
278
+ const forId = beginEventById.get(event.id) ?? [];
279
+ forId.push(event);
280
+ beginEventById.set(event.id, forId);
281
+ } else if (Types.Events.isEventTimingEnd(event)) {
282
+ const beginEvents = beginEventById.get(event.id) ?? [];
283
+ const beginEvent = beginEvents.pop();
284
+ if (!beginEvent) {
285
+ continue;
286
+ }
287
+ const {type, interactionId, timeStamp, processingStart, processingEnd} = beginEvent.args.data;
288
+ if (!type || !interactionId || !timeStamp || !processingStart || !processingEnd) {
289
+ // A valid interaction event that we care about has to have a type (e.g. pointerdown, keyup).
290
+ // We also need to ensure it has an interactionId and various timings. There are edge cases where these aren't included in the trace event.
291
+ continue;
292
+ }
293
+ // In the future we will add microsecond timestamps to the trace events…
294
+ // (See https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/timing/window_performance.cc;l=900-901;drc=b503c262e425eae59ced4a80d59d176ed07152c7 )
295
+ // …but until then we can use the millisecond precision values that are in
296
+ // the trace event. To adjust them to be relative to the event.ts and the
297
+ // trace timestamps, for both processingStart and processingEnd we subtract
298
+ // the event timestamp (NOT event.ts, but the timeStamp millisecond value
299
+ // emitted in args.data), and then add that value to the event.ts. This
300
+ // will give us a processingStart and processingEnd time in microseconds
301
+ // that is relative to event.ts, and can be used when drawing boxes.
302
+ // There is some inaccuracy here as we are converting milliseconds to
303
+ // microseconds, but it is good enough until the backend emits more
304
+ // accurate numbers.
305
+ const processingStartRelativeToTraceTime = Types.Timing.Micro(
306
+ Helpers.Timing.milliToMicro(processingStart) - Helpers.Timing.milliToMicro(timeStamp) + beginEvent.ts,
307
+ );
308
+
309
+ const processingEndRelativeToTraceTime = Types.Timing.Micro(
310
+ (Helpers.Timing.milliToMicro(processingEnd) - Helpers.Timing.milliToMicro(timeStamp)) + beginEvent.ts);
311
+
312
+ // Ultimate frameId fallback only needed for TSC, see comments in the type.
313
+ const frameId = beginEvent.args.frame ?? beginEvent.args.data.frame ?? '';
314
+ const navigation = Helpers.Trace.getNavigationForTraceEvent(beginEvent, frameId, navigationsByFrameId);
315
+ const navigationId = navigation?.args.data?.navigationId;
316
+ const interactionEvent =
317
+ Helpers.SyntheticEvents.SyntheticEventsManager.registerSyntheticEvent<Types.Events.SyntheticInteractionPair>({
318
+ // Use the start event to define the common fields.
319
+ rawSourceEvent: beginEvent,
320
+ cat: beginEvent.cat,
321
+ name: beginEvent.name,
322
+ pid: beginEvent.pid,
323
+ tid: beginEvent.tid,
324
+ ph: beginEvent.ph,
325
+ processingStart: processingStartRelativeToTraceTime,
326
+ processingEnd: processingEndRelativeToTraceTime,
327
+ // These will be set in writeSyntheticTimespans()
328
+ inputDelay: Types.Timing.Micro(-1),
329
+ mainThreadHandling: Types.Timing.Micro(-1),
330
+ presentationDelay: Types.Timing.Micro(-1),
331
+ args: {
332
+ data: {
333
+ beginEvent,
334
+ endEvent: event,
335
+ frame: frameId,
336
+ navigationId,
337
+ },
318
338
  },
319
- },
320
- ts: interactionStartEvent.ts,
321
- dur: Types.Timing.Micro(endEvent.ts - interactionStartEvent.ts),
322
- type: interactionStartEvent.args.data.type,
323
- interactionId: interactionStartEvent.args.data.interactionId,
324
- });
325
- writeSyntheticTimespans(interactionEvent);
326
-
327
- interactionEvents.push(interactionEvent);
339
+ ts: beginEvent.ts,
340
+ dur: Types.Timing.Micro(event.ts - beginEvent.ts),
341
+ type: beginEvent.args.data.type,
342
+ interactionId: beginEvent.args.data.interactionId,
343
+ });
344
+ writeSyntheticTimespans(interactionEvent);
345
+ interactionEvents.push(interactionEvent);
346
+ }
328
347
  }
329
348
 
330
- interactionEventsWithNoNesting.push(...removeNestedInteractions(interactionEvents));
349
+ // Once we gather up all the interactions, we want to remove nested
350
+ // interactions. Interactions can be nested because one user action (e.g. a
351
+ // click) will cause a pointerdown, pointerup and click. But we don't want to
352
+ // fill the interactions track with lots of noise. To fix this, we go through
353
+ // all the events and remove any nested ones so on the timeline we focus the
354
+ // user on the most important events, which we define as the longest one. But
355
+ // this algorithm assumes the events are in ASC order, so we first sort the
356
+ // set of interactions.
357
+ Helpers.Trace.sortTraceEventsInPlace(interactionEvents);
358
+ interactionEventsWithNoNesting.push(...removeNestedInteractionsAndSetProcessingTime(interactionEvents));
331
359
 
332
360
  // Pick the longest interactions from the set that were not nested, as we
333
361
  // know those are the set of the largest interactions.
@@ -221,7 +221,7 @@ export function boundsIncludeTimeRange(data: BoundsIncludeTimeRange): boolean {
221
221
  /** Checks to see if the event is within or overlaps the bounds */
222
222
  export function eventIsInBounds(event: Types.Events.Event, bounds: Types.Timing.TraceWindowMicro): boolean {
223
223
  const startTime = event.ts;
224
- return startTime <= bounds.max && bounds.min <= (startTime + (event.dur ?? 0));
224
+ return startTime <= bounds.max && bounds.min < (startTime + (event.dur ?? 0));
225
225
  }
226
226
 
227
227
  export function timestampIsInBounds(bounds: Types.Timing.TraceWindowMicro, timestamp: Types.Timing.Micro): boolean {
@@ -12,6 +12,7 @@ import * as Root from '../../core/root/root.js';
12
12
  import * as SDK from '../../core/sdk/sdk.js';
13
13
  import * as Protocol from '../../generated/protocol.js';
14
14
  import * as AiAssistanceModel from '../../models/ai_assistance/ai_assistance.js';
15
+ import * as Badges from '../../models/badges/badges.js';
15
16
  import * as TextUtils from '../../models/text_utils/text_utils.js';
16
17
  import * as Workspace from '../../models/workspace/workspace.js';
17
18
  import * as Buttons from '../../ui/components/buttons/buttons.js';
@@ -1409,7 +1410,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
1409
1410
  // invariants do not hold anymore.
1410
1411
  throw new Error('cross-origin context data should not be included');
1411
1412
  }
1412
-
1413
+ if (this.#conversation?.isEmpty) {
1414
+ Badges.UserBadges.instance().recordAction(Badges.BadgeAction.STARTED_AI_CONVERSATION);
1415
+ }
1413
1416
  const image = isAiAssistanceMultimodalInputEnabled() ? imageInput : undefined;
1414
1417
  const imageId = image ? crypto.randomUUID() : undefined;
1415
1418
  const multimodalInput = image && imageId && multimodalInputType ? {
@@ -20,21 +20,23 @@ export class PerformanceAgentMarkdownRenderer extends MarkdownRendererWithCodeBl
20
20
  override templateForToken(token: Marked.Marked.MarkedToken): Lit.TemplateResult|null {
21
21
  if (token.type === 'link' && token.href.startsWith('#')) {
22
22
  const event = this.lookupEvent(token.href.slice(1) as Trace.Types.File.SerializableKey);
23
- if (event) {
24
- let label = token.text;
25
- let title = '';
26
- if (Trace.Types.Events.isSyntheticNetworkRequest(event)) {
27
- title = event.args.data.url;
28
- } else {
29
- label += ` (${event.name})`;
30
- }
31
-
32
- // eslint-disable-next-line rulesdir/no-a-tags-in-lit
33
- return html`<a href="#" draggable=false .title=${title} @click=${(e: Event) => {
34
- e.stopPropagation();
35
- void Common.Revealer.reveal(new SDK.TraceObject.RevealableEvent(event));
36
- }}>${label}</a>`;
23
+ if (!event) {
24
+ return html`${token.text}`;
37
25
  }
26
+
27
+ let label = token.text;
28
+ let title = '';
29
+ if (Trace.Types.Events.isSyntheticNetworkRequest(event)) {
30
+ title = event.args.data.url;
31
+ } else {
32
+ label += ` (${event.name})`;
33
+ }
34
+
35
+ // eslint-disable-next-line rulesdir/no-a-tags-in-lit
36
+ return html`<a href="#" draggable=false .title=${title} @click=${(e: Event) => {
37
+ e.stopPropagation();
38
+ void Common.Revealer.reveal(new SDK.TraceObject.RevealableEvent(event));
39
+ }}>${label}</a>`;
38
40
  }
39
41
 
40
42
  return super.templateForToken(token);
@@ -146,9 +146,9 @@ export class BounceTrackingMitigationsView extends LegacyWrapper.LegacyWrapper.W
146
146
  // clang-format on
147
147
  }
148
148
 
149
- #renderDeletedSitesOrNoSitesMessage(): Lit.TemplateResult {
149
+ #renderDeletedSitesOrNoSitesMessage(): Lit.LitTemplate {
150
150
  if (!this.#seenButtonClick) {
151
- return html``;
151
+ return Lit.nothing;
152
152
  }
153
153
 
154
154
  if (this.#trackingSites.length === 0) {
@@ -211,7 +211,7 @@ export class BadgeNotification extends UI.Widget.Widget {
211
211
  this.#show({
212
212
  message: i18nFormatString(
213
213
  UIStrings.starterBadgeAwardMessageSettingDisabled, {PH1: badge.title, PH2: googleDeveloperProgramLink}),
214
- jslogContext: badge.name,
214
+ jslogContext: badge.jslogContext,
215
215
  actions: [
216
216
  {
217
217
  label: i18nString(UIStrings.remindMeLater),
@@ -240,7 +240,7 @@ export class BadgeNotification extends UI.Widget.Widget {
240
240
  this.#show({
241
241
  message: i18nFormatString(
242
242
  UIStrings.starterBadgeAwardMessageNoGdpProfile, {PH1: badge.title, PH2: googleDeveloperProgramLink}),
243
- jslogContext: badge.name,
243
+ jslogContext: badge.jslogContext,
244
244
  actions: [
245
245
  {
246
246
  label: i18nString(UIStrings.remindMeLater),
@@ -270,7 +270,7 @@ export class BadgeNotification extends UI.Widget.Widget {
270
270
  #presentActivityBasedBadge(badge: Badges.Badge): void {
271
271
  this.#show({
272
272
  message: i18nString(UIStrings.activityBasedBadgeAwardMessage, {PH1: badge.title}),
273
- jslogContext: badge.name,
273
+ jslogContext: badge.jslogContext,
274
274
  actions: [
275
275
  {
276
276
  label: i18nString(UIStrings.manageSettings),
@@ -14,7 +14,6 @@ import * as Snackbars from '../../ui/components/snackbars/snackbars.js';
14
14
  import type * as Switch from '../../ui/components/switch/switch.js';
15
15
  import * as UI from '../../ui/legacy/legacy.js';
16
16
  import {html, render} from '../../ui/lit/lit.js';
17
- import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
18
17
 
19
18
  import styles from './gdpSignUpDialog.css.js';
20
19
 
@@ -114,7 +113,7 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
114
113
  render(
115
114
  html`
116
115
  <style>${styles}</style>
117
- <div class="gdp-sign-up-dialog-header" role="img" tabindex="0" aria-label="Google Developer Program"></div>
116
+ <div class="gdp-sign-up-dialog-header" role="img" aria-label="Google Developer Program"></div>
118
117
  <div class="main-content">
119
118
  <div class="section">
120
119
  <div class="icon-container">
@@ -136,9 +135,9 @@ export const DEFAULT_VIEW: View = (input, _output, target): void => {
136
135
  <div class="switch-container">
137
136
  <devtools-switch
138
137
  .checked=${input.keepMeUpdated}
138
+ .jslogContext=${'keep-me-updated'}
139
+ .label=${i18nString(UIStrings.keepUpdated)}
139
140
  @switchchange=${(e: Switch.Switch.SwitchChangeEvent) => input.onKeepMeUpdatedChange(e.checked)}
140
- jslog=${VisualLogging.toggle('keep-me-updated').track({ click: true })}
141
- aria-label=${i18nString(UIStrings.keepUpdated)}
142
141
  >
143
142
  </devtools-switch>
144
143
  </div>
@@ -15,7 +15,7 @@ import * as Geometry from '../../models/geometry/geometry.js';
15
15
  import * as TextUtils from '../../models/text_utils/text_utils.js';
16
16
  import * as Components from '../../ui/legacy/components/utils/utils.js';
17
17
  import * as UI from '../../ui/legacy/legacy.js';
18
- import {Directives, html, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
18
+ import {Directives, html, type LitTemplate, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
19
19
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
20
20
 
21
21
  import cssOverviewCompletedViewStyles from './cssOverviewCompletedView.css.js';
@@ -519,10 +519,10 @@ function renderContrastIssue(key: string, issues: ContrastIssue[]): TemplateResu
519
519
  // clang-format on
520
520
  }
521
521
 
522
- function renderColor(section: string, color: string): TemplateResult {
522
+ function renderColor(section: string, color: string): LitTemplate {
523
523
  const borderColor = Common.Color.parse(color)?.asLegacyColor();
524
524
  if (!borderColor) {
525
- return html``;
525
+ return nothing;
526
526
  }
527
527
  // clang-format off
528
528
  return html`<li>
@@ -1006,9 +1006,9 @@ export class ElementDetailsView extends UI.Widget.Widget {
1006
1006
  }
1007
1007
  }
1008
1008
 
1009
- function renderNode(data: PopulateNodesEventNodeTypes, link?: HTMLElement, showNode?: () => void): TemplateResult {
1009
+ function renderNode(data: PopulateNodesEventNodeTypes, link?: HTMLElement, showNode?: () => void): LitTemplate {
1010
1010
  if (!link) {
1011
- return html``;
1011
+ return nothing;
1012
1012
  }
1013
1013
  return html`
1014
1014
  <td>
@@ -220,9 +220,9 @@ function renderSettings({
220
220
  replayState,
221
221
  onReplaySettingsKeydown,
222
222
  onToggleReplaySettings
223
- }: ViewInput): Lit.TemplateResult {
223
+ }: ViewInput): Lit.LitTemplate {
224
224
  if (!settings) {
225
- return html``;
225
+ return Lit.nothing;
226
226
  }
227
227
  const environmentFragments = [];
228
228
  if (settings.viewportSettings) {