chrome-devtools-frontend 1.0.1598808 → 1.0.1601661

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 (161) hide show
  1. package/.agents/README.md +13 -0
  2. package/{agents/prompts/creating-a-model.md → .agents/skills/creating-a-model/SKILL.md} +7 -1
  3. package/{agents/prompts/devtools-imports.md → .agents/skills/devtools-imports/SKILL.md} +10 -5
  4. package/{agents/prompts/merging-devtools-module.md → .agents/skills/merging-devtools-module/SKILL.md} +5 -0
  5. package/{agents/prompts/ui-widgets.md → .agents/skills/ui-widgets/SKILL.md} +5 -0
  6. package/{agents/prompts/verification.md → .agents/skills/verification/SKILL.md} +5 -0
  7. package/front_end/core/common/Settings.ts +24 -1
  8. package/front_end/core/dom_extension/DOMExtension.ts +1 -0
  9. package/front_end/core/host/AidaClient.ts +5 -2
  10. package/front_end/core/host/AidaGcaTranslation.ts +377 -0
  11. package/front_end/core/host/GcaTypes.ts +520 -0
  12. package/front_end/core/host/UserMetrics.ts +0 -3
  13. package/front_end/core/host/host.ts +4 -0
  14. package/front_end/core/root/ExperimentNames.ts +0 -3
  15. package/front_end/core/sdk/CPUThrottlingManager.ts +12 -9
  16. package/front_end/core/sdk/ResourceTreeModel.ts +1 -1
  17. package/front_end/core/sdk/SourceMap.ts +4 -2
  18. package/front_end/entrypoints/main/MainImpl.ts +1 -12
  19. package/front_end/generated/Deprecation.ts +16 -0
  20. package/front_end/generated/InspectorBackendCommands.ts +4 -6
  21. package/front_end/generated/protocol.ts +46 -77
  22. package/front_end/models/ai_assistance/AiConversation.ts +49 -22
  23. package/front_end/models/ai_assistance/AiHistoryStorage.snapshot.txt +1 -1
  24. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
  25. package/front_end/models/ai_assistance/ConversationHandler.ts +16 -11
  26. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +76 -36
  27. package/front_end/models/ai_assistance/agents/AiAgent.ts +26 -2
  28. package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1
  29. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +11 -0
  30. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +39 -0
  31. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +53 -12
  32. package/front_end/models/ai_assistance/agents/FileAgent.ts +0 -15
  33. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +0 -5
  34. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +57 -0
  35. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +87 -15
  36. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +0 -10
  37. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -6
  38. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -5
  39. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  40. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +84 -0
  41. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +172 -0
  42. package/front_end/models/breakpoints/BreakpointManager.ts +20 -12
  43. package/front_end/models/emulation/DeviceModeModel.ts +5 -1
  44. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +60 -0
  46. package/front_end/models/lighthouse/LighthouseReporterTypes.ts +104 -10
  47. package/front_end/models/lighthouse/RunTypes.ts +42 -0
  48. package/front_end/models/lighthouse/lighthouse.ts +2 -0
  49. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +59 -35
  50. package/front_end/models/stack_trace/StackTrace.ts +5 -0
  51. package/front_end/models/stack_trace/StackTraceImpl.ts +7 -1
  52. package/front_end/models/stack_trace/StackTraceModel.ts +2 -1
  53. package/front_end/models/stack_trace/stack_trace.ts +4 -0
  54. package/front_end/models/trace/ModelImpl.ts +4 -0
  55. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -8
  56. package/front_end/models/trace/types/Configuration.ts +0 -5
  57. package/front_end/panels/accessibility/AccessibilityNodeView.ts +7 -3
  58. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +163 -74
  59. package/front_end/panels/ai_assistance/ExportConversation.ts +25 -0
  60. package/front_end/panels/ai_assistance/ai_assistance.ts +2 -0
  61. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
  62. package/front_end/panels/ai_assistance/components/ChatMessage.ts +120 -32
  63. package/front_end/panels/ai_assistance/components/ChatView.ts +44 -0
  64. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +240 -0
  65. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +4 -12
  66. package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +5 -27
  67. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +115 -17
  68. package/front_end/panels/ai_assistance/components/chatMessage.css +65 -1
  69. package/front_end/panels/ai_assistance/components/chatView.css +8 -0
  70. package/front_end/panels/ai_assistance/components/exportForAgentsDialog.css +82 -0
  71. package/front_end/panels/ai_assistance/components/walkthroughView.css +9 -1
  72. package/front_end/panels/animation/AnimationTimeline.ts +5 -5
  73. package/front_end/panels/application/AppManifestView.ts +13 -7
  74. package/front_end/panels/application/FrameDetailsView.ts +4 -4
  75. package/front_end/panels/application/preloading/PreloadingView.ts +2 -4
  76. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +6 -3
  77. package/front_end/panels/application/preloading/components/PreloadingString.ts +15 -2
  78. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +31 -2
  79. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +3 -2
  80. package/front_end/panels/common/DOMLinkifier.ts +10 -8
  81. package/front_end/panels/console/ConsoleView.ts +24 -2
  82. package/front_end/panels/console/ConsoleViewMessage.ts +22 -23
  83. package/front_end/panels/console/console.ts +0 -2
  84. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
  85. package/front_end/panels/elements/ElementsTreeElement.ts +2 -3
  86. package/front_end/panels/elements/PropertiesWidget.ts +5 -3
  87. package/front_end/panels/elements/StandaloneStylesContainer.ts +21 -9
  88. package/front_end/panels/elements/StylePropertiesSection.ts +98 -50
  89. package/front_end/panels/elements/StylePropertyTreeElement.ts +38 -4
  90. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +43 -35
  91. package/front_end/panels/elements/StylesSidebarPane.ts +154 -24
  92. package/front_end/panels/elements/components/ComputedStyleTrace.ts +3 -2
  93. package/front_end/panels/event_listeners/EventListenersView.ts +16 -4
  94. package/front_end/panels/explain/components/ConsoleInsight.ts +6 -9
  95. package/front_end/panels/explain/explain-meta.ts +5 -0
  96. package/front_end/panels/issues/AffectedResourcesView.ts +5 -9
  97. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +1 -1
  98. package/front_end/panels/lighthouse/LighthouseController.ts +154 -164
  99. package/front_end/panels/lighthouse/LighthousePanel.ts +5 -9
  100. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -0
  101. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +9 -6
  102. package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
  103. package/front_end/panels/lighthouse/LighthouseStatusView.ts +32 -8
  104. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +7 -3
  105. package/front_end/panels/network/NetworkDataGridNode.ts +34 -0
  106. package/front_end/panels/network/NetworkLogViewColumns.ts +10 -0
  107. package/front_end/panels/network/RequestPayloadView.ts +4 -1
  108. package/front_end/panels/network/RequestTimingView.ts +8 -2
  109. package/front_end/panels/performance_monitor/performanceMonitor.css +6 -4
  110. package/front_end/panels/recorder/RecorderController.ts +52 -14
  111. package/front_end/panels/recorder/components/RecordingView.ts +2 -1
  112. package/front_end/panels/recorder/models/RecordingStorage.ts +15 -20
  113. package/front_end/panels/sensors/SensorsView.ts +333 -157
  114. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +18 -4
  115. package/front_end/panels/sources/DebuggerPausedMessage.ts +6 -6
  116. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -3
  117. package/front_end/panels/sources/NavigatorView.ts +11 -7
  118. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  119. package/front_end/panels/sources/SourcesPanel.ts +12 -34
  120. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +5 -1
  121. package/front_end/panels/sources/sources-meta.ts +6 -0
  122. package/front_end/panels/timeline/StatusDialog.ts +159 -83
  123. package/front_end/panels/timeline/ThirdPartyTreeView.ts +6 -2
  124. package/front_end/panels/timeline/TimelineController.ts +0 -4
  125. package/front_end/panels/timeline/TimelineDetailsView.ts +35 -3
  126. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +6 -1
  127. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +9 -4
  128. package/front_end/panels/timeline/TimelinePanel.ts +36 -11
  129. package/front_end/panels/timeline/TimelineTreeView.ts +14 -3
  130. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -57
  131. package/front_end/panels/timeline/components/InteractionBreakdown.ts +2 -1
  132. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  133. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +3 -7
  134. package/front_end/panels/timeline/components/Sidebar.ts +11 -19
  135. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +2 -1
  136. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +60 -27
  137. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +66 -0
  138. package/front_end/panels/timeline/components/TimelineSummary.ts +7 -19
  139. package/front_end/panels/timeline/components/components.ts +2 -0
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +55 -28
  141. package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -3
  142. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +7 -0
  143. package/front_end/panels/timeline/components/insights/insights.ts +0 -2
  144. package/front_end/panels/timeline/components/timelineRangeSummaryView.css +20 -0
  145. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +7 -7
  146. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  147. package/front_end/panels/timeline/timelineDetailsView.css +0 -9
  148. package/front_end/third_party/chromium/README.chromium +1 -1
  149. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +11 -2
  150. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +11 -2
  151. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +65 -4
  152. package/front_end/ui/kit/link/link.css +2 -2
  153. package/front_end/ui/legacy/Widget.ts +5 -3
  154. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +7 -2
  155. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +57 -35
  156. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -0
  157. package/front_end/ui/visual_logging/KnownContextValues.ts +6 -1
  158. package/package.json +1 -1
  159. package/agents/prompts/README.md +0 -18
  160. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -93
  161. /package/front_end/{panels/console → models/stack_trace}/ErrorStackParser.ts +0 -0
@@ -6602,6 +6602,30 @@ export const NativeFunctions = [
6602
6602
  name: "replaceWithHTMLUnsafe",
6603
6603
  signatures: [["html","?options"]]
6604
6604
  },
6605
+ {
6606
+ name: "streamBeforeHTMLUnsafe",
6607
+ signatures: [["?options"]]
6608
+ },
6609
+ {
6610
+ name: "streamBeforeHTML",
6611
+ signatures: [["?options"]]
6612
+ },
6613
+ {
6614
+ name: "streamAfterHTMLUnsafe",
6615
+ signatures: [["?options"]]
6616
+ },
6617
+ {
6618
+ name: "streamAfterHTML",
6619
+ signatures: [["?options"]]
6620
+ },
6621
+ {
6622
+ name: "streamReplaceWithHTMLUnsafe",
6623
+ signatures: [["?options"]]
6624
+ },
6625
+ {
6626
+ name: "streamReplaceWithHTML",
6627
+ signatures: [["?options"]]
6628
+ },
6605
6629
  {
6606
6630
  name: "Comment",
6607
6631
  signatures: [["?data"]]
@@ -6650,6 +6674,10 @@ export const NativeFunctions = [
6650
6674
  name: "streamHTMLUnsafe",
6651
6675
  signatures: [["?options"]]
6652
6676
  },
6677
+ {
6678
+ name: "streamPrependHTMLUnsafe",
6679
+ signatures: [["?options"]]
6680
+ },
6653
6681
  {
6654
6682
  name: "streamAppendHTML",
6655
6683
  signatures: [["?options"]]
@@ -6658,6 +6686,10 @@ export const NativeFunctions = [
6658
6686
  name: "streamHTML",
6659
6687
  signatures: [["?options"]]
6660
6688
  },
6689
+ {
6690
+ name: "streamPrependHTML",
6691
+ signatures: [["?options"]]
6692
+ },
6661
6693
  {
6662
6694
  name: "appendHTML",
6663
6695
  signatures: [["html","?options"]]
@@ -7779,6 +7811,22 @@ export const NativeFunctions = [
7779
7811
  name: "signalCurrentUserDetails",
7780
7812
  signatures: [["options"]]
7781
7813
  },
7814
+ {
7815
+ name: "encapsulateKey",
7816
+ signatures: [["encapsulationAlgorithm","encapsulationKey","sharedKeyAlgorithm","extractable","keyUsages"]]
7817
+ },
7818
+ {
7819
+ name: "encapsulateBits",
7820
+ signatures: [["encapsulationAlgorithm","encapsulationKey"]]
7821
+ },
7822
+ {
7823
+ name: "decapsulateKey",
7824
+ signatures: [["decapsulationAlgorithm","decapsulationKey","ciphertext","sharedKeyAlgorithm","extractable","keyUsages"]]
7825
+ },
7826
+ {
7827
+ name: "decapsulateBits",
7828
+ signatures: [["decapsulationAlgorithm","decapsulationKey","ciphertext"]]
7829
+ },
7782
7830
  {
7783
7831
  name: "registerPaint",
7784
7832
  signatures: [["name","paintCtor"]]
@@ -8067,6 +8115,10 @@ export const NativeFunctions = [
8067
8115
  name: "OverconstrainedError",
8068
8116
  signatures: [["constraint","?message"]]
8069
8117
  },
8118
+ {
8119
+ name: "setConstraints",
8120
+ signatures: [["constraints"]]
8121
+ },
8070
8122
  {
8071
8123
  name: "createContext",
8072
8124
  signatures: [["?options"]]
@@ -8785,6 +8837,14 @@ export const NativeFunctions = [
8785
8837
  name: "SpeechSynthesisUtterance",
8786
8838
  signatures: [["?text"]]
8787
8839
  },
8840
+ {
8841
+ name: "addWords",
8842
+ signatures: [["words"]]
8843
+ },
8844
+ {
8845
+ name: "removeWords",
8846
+ signatures: [["words"]]
8847
+ },
8788
8848
  {
8789
8849
  name: "requestStorageAccessFor",
8790
8850
  signatures: [["requestedOrigin"]]
@@ -5,11 +5,14 @@
5
5
  import type * as Platform from '../../core/platform/platform.js';
6
6
  import type * as Trace from '../../models/trace/trace.js';
7
7
 
8
+ import type {CategoryId} from './RunTypes.js';
9
+
8
10
  export class LighthouseReportGenerator {
9
11
  generateReportHtml(_lhr: ReportJSON): string {
10
12
  return '';
11
13
  }
12
14
  }
15
+
13
16
  export interface AuditResultJSON {
14
17
  rawValue?: number|boolean;
15
18
  id: string;
@@ -21,8 +24,16 @@ export interface AuditResultJSON {
21
24
  scoreDisplayMode: string;
22
25
  error: boolean;
23
26
  score: number|null;
27
+ numericValue?: number;
28
+ numericUnit?: string;
29
+ warnings?: string[];
24
30
  details?: DetailsJSON;
31
+ scoringOptions?: {
32
+ p10: number,
33
+ median: number,
34
+ };
25
35
  }
36
+
26
37
  export interface AuditJSON {
27
38
  id: string;
28
39
  score: number|null;
@@ -30,6 +41,7 @@ export interface AuditJSON {
30
41
  group?: string;
31
42
  result: AuditResultJSON;
32
43
  }
44
+
33
45
  export interface CategoryJSON {
34
46
  title: string;
35
47
  id: string;
@@ -38,37 +50,103 @@ export interface CategoryJSON {
38
50
  manualDescription: string;
39
51
  auditRefs: AuditJSON[];
40
52
  }
53
+
41
54
  export interface GroupJSON {
42
55
  title: string;
43
56
  description?: string;
44
57
  }
58
+
45
59
  export interface ReportJSON {
46
60
  lighthouseVersion: string;
47
61
  userAgent: string;
48
62
  fetchTime: string;
49
63
  timing: {total: number};
50
64
  requestedUrl?: string;
65
+ mainDocumentUrl?: string;
51
66
  finalDisplayedUrl: string;
52
67
  finalUrl?: string;
53
68
  runWarnings?: string[];
69
+ environment?: {
70
+ networkUserAgent: string,
71
+ hostUserAgent: string,
72
+ benchmarkIndex: number,
73
+ credits?: Record<string, string>,
74
+ };
54
75
  // eslint-disable-next-line @typescript-eslint/naming-convention
55
76
  artifacts: {Trace: {traceEvents: unknown[]}};
56
77
  audits: Record<string, AuditResultJSON>;
57
- categories: Record<string, CategoryJSON>;
78
+ categories: Record<CategoryId, CategoryJSON>;
58
79
  categoryGroups: Record<string, GroupJSON>;
59
80
  }
60
- export interface DetailsJSON {
61
- type: string;
62
- value?: string|number;
81
+
82
+ export type DetailsJSON =
83
+ |TableDetailsJSON|OpportunityDetailsJSON|FilmstripDetailsJSON|ScreenshotDetailsJSON|DebugDataDetailsJSON;
84
+
85
+ export interface TableDetailsJSON {
86
+ type: 'table';
87
+ headings: TableHeadingJSON[];
88
+ items: Array<Record<string, TableItemValue>>;
63
89
  summary?: OpportunitySummary;
64
- granularity?: number;
65
- displayUnit?: string;
66
90
  }
91
+
92
+ export interface TableHeadingJSON {
93
+ key: string;
94
+ valueType: 'url'|'text'|'numeric'|'timespanMs'|'bytes'|'node'|'source-location'|'code';
95
+ label: string;
96
+ itemType?: string;
97
+ subItemsHeading?: {
98
+ key: string,
99
+ valueType: string,
100
+ };
101
+ }
102
+
103
+ /**
104
+ * Represents the possible values found in an 'item' object
105
+ * based on the 'valueType' specified in headings.
106
+ */
107
+ export type TableItemValue =|string|number|NodeDetailsJSON|SourceLocationDetailsJSON|Platform.DevToolsPath.UrlString;
108
+
109
+ export interface OpportunityDetailsJSON {
110
+ type: 'opportunity';
111
+ headings: TableHeadingJSON[];
112
+ items: Array<{
113
+ url: string,
114
+ wastedBytes?: number,
115
+ wastedMs?: number,
116
+ totalBytes?: number, [key: string]: unknown,
117
+ }>;
118
+ overallSavingsMs: number;
119
+ overallSavingsBytes?: number;
120
+ }
121
+
122
+ export interface FilmstripDetailsJSON {
123
+ type: 'filmstrip';
124
+ scale: number;
125
+ items: Array<{
126
+ timing: number,
127
+ timestamp: number,
128
+ data: string,
129
+ }>;
130
+ }
131
+
132
+ export interface ScreenshotDetailsJSON {
133
+ type: 'screenshot';
134
+ timing: number;
135
+ timestamp: number;
136
+ data: string;
137
+ }
138
+
139
+ export interface DebugDataDetailsJSON {
140
+ type: 'debugdata';
141
+ items: unknown[];
142
+ }
143
+
67
144
  export interface RunnerResultArtifacts {
68
145
  // eslint-disable-next-line @typescript-eslint/naming-convention
69
146
  Trace: {traceEvents: Trace.Types.Events.Event[]};
70
147
  settings: {throttlingMethod: string};
71
148
  }
149
+
72
150
  export interface RunnerResult {
73
151
  lhr: ReportJSON;
74
152
  artifacts: RunnerResultArtifacts;
@@ -77,17 +155,33 @@ export interface RunnerResult {
77
155
  fatal: boolean;
78
156
  message?: string;
79
157
  }
158
+
80
159
  export interface NodeDetailsJSON {
81
- type: string;
160
+ type: 'node';
161
+ lhId?: string;
82
162
  path?: string;
83
163
  selector?: string;
164
+ nodeLabel?: string;
84
165
  snippet?: string;
166
+ boundingRect?: {
167
+ top: number,
168
+ bottom: number,
169
+ left: number,
170
+ right: number,
171
+ width: number,
172
+ height: number,
173
+ };
174
+ explanation?: string;
85
175
  }
176
+
86
177
  export interface SourceLocationDetailsJSON {
87
- sourceUrl?: Platform.DevToolsPath.UrlString;
88
- sourceLine?: string;
89
- sourceColumn?: string;
178
+ type: 'source-location';
179
+ url?: Platform.DevToolsPath.UrlString;
180
+ urlProvider?: 'network'|'stack';
181
+ line?: number;
182
+ column?: number;
90
183
  }
184
+
91
185
  export interface OpportunitySummary {
92
186
  wastedMs?: number;
93
187
  wastedBytes?: number;
@@ -0,0 +1,42 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+ import type * as Common from '../../core/common/common.js';
5
+ import type * as Host from '../../core/host/host.js';
6
+ import type * as Platform from '../../core/platform/platform.js';
7
+
8
+ export type CategoryId = 'performance'|'accessibility'|'best-practices'|'seo';
9
+
10
+ export interface Preset {
11
+ setting: Common.Settings.Setting<boolean>;
12
+ configID: CategoryId;
13
+ title: () => Common.UIString.LocalizedString;
14
+ description: () => Common.UIString.LocalizedString;
15
+ supportedModes: string[];
16
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed;
17
+ }
18
+ export interface RuntimeSetting {
19
+ setting: Common.Settings.Setting<string|boolean>;
20
+ description: () => Common.UIString.LocalizedString;
21
+ setFlags: (flags: Flags, value: string|boolean) => void;
22
+ options?: Array<{
23
+ label: () => Common.UIString.LocalizedString,
24
+ value: string,
25
+ tooltip?: () => Common.UIString.LocalizedString,
26
+ }>;
27
+ title?: () => Common.UIString.LocalizedString;
28
+ learnMore?: Platform.DevToolsPath.UrlString;
29
+ }
30
+
31
+ export interface Flags {
32
+ additionalTraceCategories?: string;
33
+ disableStorageReset?: boolean;
34
+ throttlingMethod?: string;
35
+ formFactor?: string|boolean;
36
+ mode?: string|boolean;
37
+ }
38
+
39
+ export interface RunOverrides {
40
+ categoryIds?: CategoryId[];
41
+ isAIControlled?: boolean;
42
+ }
@@ -3,7 +3,9 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as ReporterTypes from './LighthouseReporterTypes.js';
6
+ import * as RunTypes from './RunTypes.js';
6
7
 
7
8
  export {
8
9
  ReporterTypes,
10
+ RunTypes,
9
11
  };
@@ -17,33 +17,64 @@ declare const window: Window&{
17
17
  [Spec.EVENT_BINDING_NAME]: (payload: string) => void,
18
18
  };
19
19
 
20
- type ListenerArgs = Parameters<typeof globalThis['addEventListener']>;
21
-
22
- const windowListeners: ListenerArgs[] = [];
23
- const documentListeners: ListenerArgs[] = [];
24
- const observers: PerformanceObserver[] = [];
20
+ const eventListenerCleanupController = new AbortController();
21
+
22
+ const patchAddListener = (proto: typeof Window.prototype|typeof Document.prototype): void => {
23
+ const original = proto.addEventListener;
24
+
25
+ proto.addEventListener = function(
26
+ type: string, listener: EventListenerOrEventListenerObject, options?: boolean|AddEventListenerOptions): void {
27
+ // Standardize options into an object
28
+ const navOptions = typeof options === 'boolean' ? {capture: options} : {...options};
29
+
30
+ // If we already have a signal, we should respect it,
31
+ // but also link it to our global cleanup signal.
32
+ if (navOptions.signal) {
33
+ navOptions.signal = AbortSignal.any([navOptions.signal, eventListenerCleanupController.signal]);
34
+ } else {
35
+ navOptions.signal = eventListenerCleanupController.signal;
36
+ }
25
37
 
26
- const originalWindowAddListener = Window.prototype.addEventListener;
27
- Window.prototype.addEventListener = function(...args: ListenerArgs) {
28
- windowListeners.push(args);
29
- return originalWindowAddListener.call(this, ...args);
38
+ return original.call(this, type, listener, navOptions);
39
+ };
30
40
  };
31
41
 
32
- const originalDocumentAddListener = Document.prototype.addEventListener;
33
- Document.prototype.addEventListener = function(...args: ListenerArgs) {
34
- documentListeners.push(args);
35
- return originalDocumentAddListener.call(this, ...args);
36
- };
42
+ // Patch the core targets
43
+ patchAddListener(Window.prototype);
44
+ patchAddListener(Document.prototype);
37
45
 
38
- class InternalPerformanceObserver extends PerformanceObserver {
39
- constructor(...args: ConstructorParameters<typeof PerformanceObserver>) {
40
- super(...args);
41
- observers.push(this);
46
+ // Use a class wrapper that auto-registers and auto-unregisters
47
+ const activeObservers = new Set<PerformanceObserver>();
48
+ class TrackedPerformanceObserver extends globalThis.PerformanceObserver {
49
+ constructor(callback: PerformanceObserverCallback) {
50
+ super(callback);
51
+ activeObservers.add(this);
52
+ }
53
+
54
+ // Override disconnect to remove it from our tracking set
55
+ override disconnect(): void {
56
+ super.disconnect();
57
+ activeObservers.delete(this);
42
58
  }
43
59
  }
44
- globalThis.PerformanceObserver = InternalPerformanceObserver;
45
60
 
46
- let killed = false;
61
+ const nodeList: Array<WeakRef<Node>> = [];
62
+ const nodeToIdMap = new WeakMap<Node, number>();
63
+
64
+ function establishNodeIndex(node: Node): number {
65
+ let index = nodeToIdMap.get(node);
66
+ if (index !== undefined) {
67
+ return index;
68
+ }
69
+
70
+ index = nodeList.length;
71
+ nodeList.push(new WeakRef(node));
72
+ nodeToIdMap.set(node, index);
73
+ return index;
74
+ }
75
+
76
+ // Replace the global constructor
77
+ globalThis.PerformanceObserver = TrackedPerformanceObserver;
47
78
 
48
79
  /**
49
80
  * This is a hack solution to remove any listeners that were added by web-vitals.js
@@ -51,22 +82,23 @@ let killed = false;
51
82
  * context should be considered dead and a new one will need to be created for live metrics
52
83
  * to be served again.
53
84
  */
85
+ let killed = false;
54
86
  window[Spec.INTERNAL_KILL_SWITCH] = () => {
55
87
  if (killed) {
56
88
  return;
57
89
  }
58
90
 
59
- for (const observer of observers) {
91
+ for (const observer of activeObservers) {
92
+ // This calls the overridden disconnect above,
93
+ // cleaning up BOTH the browser resource and our Set.
60
94
  observer.disconnect();
61
95
  }
96
+ activeObservers.clear();
62
97
 
63
- for (const args of windowListeners) {
64
- window.removeEventListener(...args);
65
- }
98
+ eventListenerCleanupController.abort();
66
99
 
67
- for (const args of documentListeners) {
68
- document.removeEventListener(...args);
69
- }
100
+ // Explicitly clear the Node List to help GC
101
+ nodeList.length = 0;
70
102
 
71
103
  killed = true;
72
104
  };
@@ -76,14 +108,6 @@ function sendEventToDevTools(event: Spec.WebVitalsEvent): void {
76
108
  window[Spec.EVENT_BINDING_NAME](payload);
77
109
  }
78
110
 
79
- const nodeList: Array<WeakRef<Node>> = [];
80
-
81
- function establishNodeIndex(node: Node): number {
82
- const index = nodeList.length;
83
- nodeList.push(new WeakRef(node));
84
- return index;
85
- }
86
-
87
111
  /**
88
112
  * The data sent over the event binding needs to be JSON serializable, so we
89
113
  * can't send DOM nodes directly. Instead we create an ID for each node (see
@@ -34,6 +34,11 @@ export interface Frame {
34
34
  readonly column: number;
35
35
 
36
36
  readonly missingDebugInfo?: MissingDebugInfo;
37
+ /**
38
+ * The untranslated function name. For inlined frames this will be the name
39
+ * of the containing function.
40
+ */
41
+ readonly rawName?: string;
37
42
  }
38
43
 
39
44
  export interface DebuggableFrame extends Frame {
@@ -84,16 +84,18 @@ export class FrameImpl implements StackTrace.StackTrace.Frame {
84
84
  readonly column: number;
85
85
 
86
86
  readonly missingDebugInfo?: StackTrace.StackTrace.MissingDebugInfo;
87
+ readonly rawName?: string;
87
88
 
88
89
  constructor(
89
90
  url: string|undefined, uiSourceCode: Workspace.UISourceCode.UISourceCode|undefined, name: string|undefined,
90
- line: number, column: number, missingDebugInfo?: StackTrace.StackTrace.MissingDebugInfo) {
91
+ line: number, column: number, missingDebugInfo?: StackTrace.StackTrace.MissingDebugInfo, rawName?: string) {
91
92
  this.url = url;
92
93
  this.uiSourceCode = uiSourceCode;
93
94
  this.name = name;
94
95
  this.line = line;
95
96
  this.column = column;
96
97
  this.missingDebugInfo = missingDebugInfo;
98
+ this.rawName = rawName;
97
99
  }
98
100
  }
99
101
 
@@ -166,6 +168,10 @@ export class DebuggableFrameImpl implements StackTrace.StackTrace.DebuggableFram
166
168
  return this.#frame.missingDebugInfo;
167
169
  }
168
170
 
171
+ get rawName(): string|undefined {
172
+ return this.#frame.rawName;
173
+ }
174
+
169
175
  get sdkFrame(): SDK.DebuggerModel.CallFrame {
170
176
  return this.#sdkFrame;
171
177
  }
@@ -166,7 +166,8 @@ export class StackTraceModel extends SDK.SDKModel.SDKModel<unknown> {
166
166
  for (const node of fragment.node.getCallStack()) {
167
167
  node.frames = uiFrames[i++].map(
168
168
  frame => new FrameImpl(
169
- frame.url, frame.uiSourceCode, frame.name, frame.line, frame.column, frame.missingDebugInfo));
169
+ frame.url, frame.uiSourceCode, frame.name, frame.line, frame.column, frame.missingDebugInfo,
170
+ node.rawFrame.functionName));
170
171
  }
171
172
  }
172
173
 
@@ -2,8 +2,12 @@
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 ErrorStackParser from './ErrorStackParser.js';
5
6
  import * as StackTrace from './StackTrace.js';
6
7
 
7
8
  export {
9
+ // TODO(crbug.com/485142682): Move to stack_trace_impl.js once all usage
10
+ // goes through createStackTraceFromErrorObject.
11
+ ErrorStackParser,
8
12
  StackTrace,
9
13
  };
@@ -173,6 +173,10 @@ export class Model extends EventTarget {
173
173
  this.#recordingsAvailable.splice(recordingIndex, 1);
174
174
  }
175
175
 
176
+ indexForTrace(trace: ParsedTrace): number {
177
+ return this.#traces.indexOf(trace);
178
+ }
179
+
176
180
  getRecordingsAvailable(): string[] {
177
181
  return this.#recordingsAvailable;
178
182
  }
@@ -477,20 +477,13 @@ export class SamplesIntegrator {
477
477
  if (showAllEvents) {
478
478
  return;
479
479
  }
480
- let previousNativeFrameName: string|null = null;
481
480
  let j = 0;
482
481
  for (let i = 0; i < stack.length; ++i) {
483
482
  const frame = stack[i].callFrame;
484
483
  const nativeRuntimeFrame = SamplesIntegrator.isNativeRuntimeFrame(frame);
485
- if (nativeRuntimeFrame &&
486
- !SamplesIntegrator.showNativeName(frame.functionName, engineConfig.includeRuntimeCallStats)) {
484
+ if (nativeRuntimeFrame) {
487
485
  continue;
488
486
  }
489
- const nativeFrameName = nativeRuntimeFrame ? SamplesIntegrator.nativeGroup(frame.functionName) : null;
490
- if (previousNativeFrameName && previousNativeFrameName === nativeFrameName) {
491
- continue;
492
- }
493
- previousNativeFrameName = nativeFrameName;
494
487
  stack[j++] = stack[i];
495
488
  }
496
489
  stack.length = j;
@@ -11,10 +11,6 @@ import type * as File from './File.js';
11
11
  import type {Milli} from './Timing.js';
12
12
 
13
13
  export interface Configuration {
14
- /**
15
- * Include V8 RCS functions in the JS stacks
16
- */
17
- includeRuntimeCallStats: boolean;
18
14
  /**
19
15
  * Show all events: disable the default filtering which hides and excludes some events.
20
16
  */
@@ -49,7 +45,6 @@ export interface Configuration {
49
45
  }
50
46
 
51
47
  export const defaults = (): Configuration => ({
52
- includeRuntimeCallStats: false,
53
48
  showAllEvents: false,
54
49
  debugMode: false,
55
50
  maxInvalidationEventsPerEvent: 20,
@@ -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-imperative-dom-api */
5
+ /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
6
 
6
7
  import * as Common from '../../core/common/common.js';
7
8
  import * as i18n from '../../core/i18n/i18n.js';
@@ -9,6 +10,7 @@ import * as SDK from '../../core/sdk/sdk.js';
9
10
  import * as Protocol from '../../generated/protocol.js';
10
11
  import * as uiI18n from '../../ui/i18n/i18n.js';
11
12
  import * as UI from '../../ui/legacy/legacy.js';
13
+ import {render} from '../../ui/lit/lit.js';
12
14
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
13
15
  import * as PanelsCommon from '../common/common.js';
14
16
 
@@ -591,9 +593,11 @@ export class AXRelatedNodeElement {
591
593
  if (!node) {
592
594
  return;
593
595
  }
594
- valueElement.appendChild(PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(node, {
595
- preventKeyboardFocus: true,
596
- }));
596
+ render(
597
+ PanelsCommon.DOMLinkifier.Linkifier.instance().linkify(node, {
598
+ preventKeyboardFocus: true,
599
+ }),
600
+ valueElement);
597
601
  });
598
602
  } else if (this.idref) {
599
603
  element.classList.add('invalid');