chrome-devtools-frontend 1.0.1549484 → 1.0.1550444

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 (196) hide show
  1. package/docs/styleguide/ux/components.md +53 -12
  2. package/docs/styleguide/ux/images/cards.png +0 -0
  3. package/docs/ui_engineering.md +2 -2
  4. package/front_end/core/sdk/NetworkManager.ts +12 -10
  5. package/front_end/core/sdk/PageResourceLoader.ts +8 -1
  6. package/front_end/core/sdk/SourceMapManager.ts +12 -6
  7. package/front_end/entrypoints/main/MainImpl.ts +0 -9
  8. package/front_end/foundation/Universe.ts +7 -0
  9. package/front_end/generated/InspectorBackendCommands.ts +5 -2
  10. package/front_end/generated/protocol-mapping.d.ts +8 -0
  11. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  12. package/front_end/generated/protocol.ts +76 -0
  13. package/front_end/models/ai_assistance/BuiltInAi.ts +79 -5
  14. package/front_end/models/issues_manager/AttributionReportingIssue.ts +6 -8
  15. package/front_end/models/issues_manager/BounceTrackingIssue.ts +4 -14
  16. package/front_end/models/issues_manager/ClientHintIssue.ts +5 -12
  17. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +5 -12
  18. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +7 -14
  19. package/front_end/models/issues_manager/CookieIssue.ts +27 -30
  20. package/front_end/models/issues_manager/CorsIssue.ts +8 -17
  21. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -8
  22. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -14
  23. package/front_end/models/issues_manager/ElementAccessibilityIssue.ts +7 -14
  24. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +4 -11
  25. package/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.ts +4 -11
  26. package/front_end/models/issues_manager/GenericIssue.ts +11 -16
  27. package/front_end/models/issues_manager/HeavyAdIssue.ts +4 -11
  28. package/front_end/models/issues_manager/Issue.ts +12 -4
  29. package/front_end/models/issues_manager/IssueAggregator.ts +8 -2
  30. package/front_end/models/issues_manager/LowTextContrastIssue.ts +3 -10
  31. package/front_end/models/issues_manager/MixedContentIssue.ts +7 -13
  32. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +4 -11
  33. package/front_end/models/issues_manager/PropertyRuleIssue.ts +6 -12
  34. package/front_end/models/issues_manager/QuirksModeIssue.ts +3 -10
  35. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +7 -13
  36. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +4 -11
  37. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +6 -13
  38. package/front_end/models/issues_manager/StylesheetLoadingIssue.ts +8 -13
  39. package/front_end/models/issues_manager/UnencodedDigestIssue.ts +2 -9
  40. package/front_end/models/javascript_metadata/NativeFunctions.js +0 -13
  41. package/front_end/panels/application/AppManifestView.ts +4 -4
  42. package/front_end/panels/application/ApplicationPanelSidebar.ts +21 -21
  43. package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -2
  44. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +2 -2
  45. package/front_end/panels/application/InterestGroupTreeElement.ts +2 -2
  46. package/front_end/panels/application/OpenedWindowDetailsView.ts +2 -2
  47. package/front_end/panels/application/OriginTrialTreeView.ts +1 -1
  48. package/front_end/panels/application/PreloadingTreeElement.ts +3 -3
  49. package/front_end/panels/application/ReportingApiTreeElement.ts +2 -2
  50. package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +3 -3
  51. package/front_end/panels/application/SharedStorageListTreeElement.ts +2 -2
  52. package/front_end/panels/application/StorageBucketsTreeElement.ts +3 -3
  53. package/front_end/panels/application/StorageView.ts +2 -2
  54. package/front_end/panels/application/TrustTokensTreeElement.ts +2 -2
  55. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
  56. package/front_end/panels/application/components/ProtocolHandlersView.ts +1 -1
  57. package/front_end/panels/application/components/SharedStorageMetadataView.ts +1 -1
  58. package/front_end/panels/application/components/TrustTokensView.ts +1 -1
  59. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +1 -1
  60. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +1 -1
  61. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  62. package/front_end/panels/changes/ChangesSidebar.ts +2 -0
  63. package/front_end/panels/changes/CombinedDiffView.ts +2 -0
  64. package/front_end/panels/common/AnnotationManager.ts +71 -0
  65. package/front_end/panels/common/PersistenceUtils.ts +6 -7
  66. package/front_end/panels/common/common.ts +1 -0
  67. package/front_end/panels/console/ConsolePrompt.ts +4 -4
  68. package/front_end/panels/console/ConsoleView.ts +2 -2
  69. package/front_end/panels/console/ConsoleViewMessage.ts +10 -11
  70. package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -0
  71. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
  72. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +3 -3
  73. package/front_end/panels/elements/ElementsPanel.ts +49 -0
  74. package/front_end/panels/elements/ElementsTreeElement.ts +156 -108
  75. package/front_end/panels/elements/ElementsTreeOutline.ts +9 -2
  76. package/front_end/panels/elements/ShortcutTreeElement.ts +2 -2
  77. package/front_end/panels/elements/StyleEditorWidget.ts +2 -2
  78. package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -6
  79. package/front_end/panels/elements/StylesSidebarPane.ts +4 -5
  80. package/front_end/panels/elements/TopLayerContainer.ts +2 -2
  81. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  82. package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +1 -1
  83. package/front_end/panels/elements/components/QueryContainer.ts +1 -1
  84. package/front_end/panels/elements/components/StylePropertyEditor.ts +1 -1
  85. package/front_end/panels/emulation/DeviceModeWrapper.ts +48 -3
  86. package/front_end/panels/explain/components/ConsoleInsight.ts +6 -4
  87. package/front_end/panels/issues/AffectedResourcesView.ts +2 -2
  88. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +2 -2
  89. package/front_end/panels/issues/IssueKindView.ts +2 -2
  90. package/front_end/panels/issues/IssueView.ts +4 -4
  91. package/front_end/panels/js_timeline/js_timeline-meta.ts +4 -2
  92. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +1 -1
  93. package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +1 -1
  94. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +1 -1
  95. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplay.ts +1 -1
  96. package/front_end/panels/media/PlayerListView.ts +1 -1
  97. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +2 -2
  98. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +2 -3
  99. package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
  100. package/front_end/panels/network/NetworkFrameGrouper.ts +2 -2
  101. package/front_end/panels/network/NetworkItemView.ts +4 -4
  102. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  103. package/front_end/panels/network/RequestCookiesView.ts +2 -2
  104. package/front_end/panels/network/SignedExchangeInfoView.ts +2 -2
  105. package/front_end/panels/network/components/RequestTrustTokensView.ts +5 -6
  106. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +3 -3
  107. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -2
  108. package/front_end/panels/profiler/ProfilesPanel.ts +2 -2
  109. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  110. package/front_end/panels/recorder/components/CreateRecordingView.ts +1 -1
  111. package/front_end/panels/recorder/components/ExtensionView.ts +1 -1
  112. package/front_end/panels/recorder/components/RecordingListView.ts +1 -1
  113. package/front_end/panels/recorder/components/RecordingView.ts +1 -1
  114. package/front_end/panels/recorder/components/StepView.ts +1 -1
  115. package/front_end/panels/screencast/ScreencastView.ts +8 -8
  116. package/front_end/panels/search/SearchView.ts +1 -1
  117. package/front_end/panels/security/CookieControlsTreeElement.ts +2 -2
  118. package/front_end/panels/security/CookieReportTreeElement.ts +2 -2
  119. package/front_end/panels/security/SecurityPanel.ts +5 -5
  120. package/front_end/panels/security/SecurityPanelSidebar.ts +3 -4
  121. package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -4
  122. package/front_end/panels/settings/SettingsScreen.ts +2 -3
  123. package/front_end/panels/snippets/SnippetsQuickOpen.ts +16 -8
  124. package/front_end/panels/sources/BreakpointEditDialog.ts +3 -3
  125. package/front_end/panels/sources/BreakpointsView.ts +1 -1
  126. package/front_end/panels/sources/CSSPlugin.ts +3 -3
  127. package/front_end/panels/sources/CallStackSidebarPane.ts +4 -4
  128. package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
  129. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +39 -30
  130. package/front_end/panels/sources/GoToLineQuickOpen.ts +11 -7
  131. package/front_end/panels/sources/NavigatorView.ts +2 -2
  132. package/front_end/panels/sources/OpenFileQuickOpen.ts +11 -15
  133. package/front_end/panels/sources/OutlineQuickOpen.ts +23 -26
  134. package/front_end/panels/sources/SourcesView.ts +2 -2
  135. package/front_end/panels/sources/TabbedEditorContainer.ts +4 -5
  136. package/front_end/panels/sources/ThreadsSidebarPane.ts +2 -2
  137. package/front_end/panels/sources/UISourceCodeFrame.ts +5 -5
  138. package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -2
  139. package/front_end/panels/timeline/TimelinePanel.ts +14 -9
  140. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +1 -1
  141. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  142. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +1 -1
  143. package/front_end/panels/timeline/components/NetworkThrottlingSelector.ts +1 -1
  144. package/front_end/panels/timeline/components/OriginMap.ts +1 -1
  145. package/front_end/panels/timeline/components/insights/Checklist.ts +1 -1
  146. package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -1
  147. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -1
  148. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +1 -1
  149. package/front_end/panels/timeline/overlays/components/EntriesLinkOverlay.ts +1 -1
  150. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +1 -1
  151. package/front_end/panels/timeline/timeline-meta.ts +3 -2
  152. package/front_end/panels/utils/utils.ts +1 -0
  153. package/front_end/third_party/chromium/README.chromium +1 -1
  154. package/front_end/ui/components/adorners/Adorner.ts +20 -0
  155. package/front_end/ui/components/annotations/AnnotationRepository.ts +1 -1
  156. package/front_end/ui/components/buttons/Button.ts +1 -1
  157. package/front_end/ui/components/buttons/FloatingButton.ts +1 -1
  158. package/front_end/ui/components/highlighting/HighlightElement.ts +15 -2
  159. package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
  160. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  161. package/front_end/ui/components/icon_button/icon_button.ts +0 -2
  162. package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
  163. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -1
  164. package/front_end/ui/components/markdown_view/MarkdownImage.ts +3 -3
  165. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  166. package/front_end/ui/components/settings/SettingDeprecationWarning.ts +1 -1
  167. package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
  168. package/front_end/ui/components/text_editor/config.ts +2 -2
  169. package/front_end/ui/kit/cards/Card.docs.ts +43 -0
  170. package/front_end/ui/{components/icon_button → kit/icons}/Icon.docs.ts +3 -4
  171. package/front_end/ui/{components/icon_button → kit/icons}/Icon.ts +4 -4
  172. package/front_end/ui/kit/kit.ts +1 -0
  173. package/front_end/ui/legacy/Infobar.ts +3 -3
  174. package/front_end/ui/legacy/InspectorView.ts +3 -3
  175. package/front_end/ui/legacy/SearchableView.ts +2 -2
  176. package/front_end/ui/legacy/SoftContextMenu.ts +5 -5
  177. package/front_end/ui/legacy/SoftDropDown.ts +2 -2
  178. package/front_end/ui/legacy/TabbedPane.ts +9 -9
  179. package/front_end/ui/legacy/Toolbar.ts +3 -3
  180. package/front_end/ui/legacy/Treeoutline.ts +2 -2
  181. package/front_end/ui/legacy/UIUtils.ts +4 -4
  182. package/front_end/ui/legacy/ViewManager.ts +4 -4
  183. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +8 -8
  184. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +4 -4
  185. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +4 -4
  186. package/front_end/ui/legacy/components/inline_editor/FontEditor.ts +2 -2
  187. package/front_end/ui/legacy/components/inline_editor/Swatches.ts +5 -5
  188. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +3 -3
  189. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +3 -3
  190. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +22 -29
  191. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +8 -15
  192. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +11 -14
  193. package/front_end/ui/legacy/components/utils/Linkifier.ts +3 -3
  194. package/mcp/mcp.ts +1 -0
  195. package/package.json +1 -1
  196. /package/front_end/ui/{components/icon_button → kit/icons}/icon.css +0 -0
@@ -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 Common from '../../core/common/common.js';
5
6
  import * as Host from '../../core/host/host.js';
6
7
  import * as Root from '../../core/root/root.js';
7
8
 
@@ -23,11 +24,13 @@ export const enum LanguageModelAvailability {
23
24
  DISABLED = 'disabled',
24
25
  }
25
26
 
26
- export class BuiltInAi {
27
+ export class BuiltInAi extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
27
28
  #availability: LanguageModelAvailability|null = null;
28
29
  #hasGpu: boolean;
29
30
  #consoleInsightsSession?: LanguageModel;
30
31
  initDoneForTesting: Promise<void>;
32
+ #downloadProgress: number|null = null;
33
+ #currentlyCreatingSession = false;
31
34
 
32
35
  static instance(): BuiltInAi {
33
36
  if (builtInAiInstance === undefined) {
@@ -37,9 +40,10 @@ export class BuiltInAi {
37
40
  }
38
41
 
39
42
  constructor() {
43
+ super();
40
44
  this.#hasGpu = this.#isGpuAvailable();
41
45
  this.initDoneForTesting =
42
- this.getLanguageModelAvailability().then(() => this.initialize()).then(() => this.#sendAvailabilityMetrics());
46
+ this.getLanguageModelAvailability().then(() => this.#sendAvailabilityMetrics()).then(() => this.initialize());
43
47
  }
44
48
 
45
49
  async getLanguageModelAvailability(): Promise<LanguageModelAvailability> {
@@ -49,14 +53,59 @@ export class BuiltInAi {
49
53
  }
50
54
  try {
51
55
  // @ts-expect-error
52
- this.#availability = await window.LanguageModel.availability(
53
- {expectedOutputs: [{type: 'text', languages: ['en']}]}) as LanguageModelAvailability;
56
+ this.#availability = await window.LanguageModel.availability({
57
+ expectedInputs: [{
58
+ type: 'text',
59
+ languages: ['en'],
60
+ }],
61
+ expectedOutputs: [{
62
+ type: 'text',
63
+ languages: ['en'],
64
+ }],
65
+ }) as LanguageModelAvailability;
54
66
  } catch {
55
67
  this.#availability = LanguageModelAvailability.UNAVAILABLE;
56
68
  }
57
69
  return this.#availability;
58
70
  }
59
71
 
72
+ isDownloading(): boolean {
73
+ return this.#availability === LanguageModelAvailability.DOWNLOADING;
74
+ }
75
+
76
+ isEventuallyAvailable(): boolean {
77
+ if (!this.#hasGpu && !Boolean(Root.Runtime.hostConfig.devToolsAiPromptApi?.allowWithoutGpu)) {
78
+ return false;
79
+ }
80
+ return this.#availability === LanguageModelAvailability.AVAILABLE ||
81
+ this.#availability === LanguageModelAvailability.DOWNLOADING ||
82
+ this.#availability === LanguageModelAvailability.DOWNLOADABLE;
83
+ }
84
+
85
+ #setDownloadProgress(newValue: number): void {
86
+ this.#downloadProgress = newValue;
87
+ this.dispatchEventToListeners(Events.DOWNLOAD_PROGRESS_CHANGED, this.#downloadProgress);
88
+ }
89
+
90
+ getDownloadProgress(): number|null {
91
+ return this.#downloadProgress;
92
+ }
93
+
94
+ startDownloadingModel(): void {
95
+ if (!Root.Runtime.hostConfig.devToolsAiPromptApi?.allowWithoutGpu && !this.#hasGpu) {
96
+ return;
97
+ }
98
+ if (this.#availability !== LanguageModelAvailability.DOWNLOADABLE) {
99
+ return;
100
+ }
101
+
102
+ void this.#createSession();
103
+ // Without the timeout, the returned availability would still be `downloadable`
104
+ setTimeout(() => {
105
+ void this.getLanguageModelAvailability();
106
+ }, 1000);
107
+ }
108
+
60
109
  #isGpuAvailable(): boolean {
61
110
  const canvas = document.createElement('canvas');
62
111
  try {
@@ -86,16 +135,29 @@ export class BuiltInAi {
86
135
  if (!Root.Runtime.hostConfig.devToolsAiPromptApi?.allowWithoutGpu && !this.#hasGpu) {
87
136
  return;
88
137
  }
89
- if (this.#availability !== LanguageModelAvailability.AVAILABLE) {
138
+ if (this.#availability !== LanguageModelAvailability.AVAILABLE &&
139
+ this.#availability !== LanguageModelAvailability.DOWNLOADING) {
90
140
  return;
91
141
  }
92
142
  await this.#createSession();
93
143
  }
94
144
 
95
145
  async #createSession(): Promise<void> {
146
+ if (this.#currentlyCreatingSession) {
147
+ return;
148
+ }
149
+ this.#currentlyCreatingSession = true;
150
+
151
+ const monitor = (m: EventTarget): void => {
152
+ m.addEventListener('downloadprogress', ((e: {loaded: number}) => {
153
+ this.#setDownloadProgress(e.loaded);
154
+ }) as unknown as EventListener);
155
+ };
156
+
96
157
  try {
97
158
  // @ts-expect-error
98
159
  this.#consoleInsightsSession = await window.LanguageModel.create({
160
+ monitor,
99
161
  initialPrompts: [{
100
162
  role: 'system',
101
163
  content: `
@@ -125,11 +187,13 @@ Your instructions are as follows:
125
187
  }],
126
188
  });
127
189
  if (this.#availability !== LanguageModelAvailability.AVAILABLE) {
190
+ this.dispatchEventToListeners(Events.DOWNLOADED_AND_SESSION_CREATED);
128
191
  void this.getLanguageModelAvailability();
129
192
  }
130
193
  } catch (e) {
131
194
  console.error('Error when creating LanguageModel session', e.message);
132
195
  }
196
+ this.#currentlyCreatingSession = false;
133
197
  }
134
198
 
135
199
  static removeInstance(): void {
@@ -198,3 +262,13 @@ Your instructions are as follows:
198
262
  }
199
263
  }
200
264
  }
265
+
266
+ export const enum Events {
267
+ DOWNLOAD_PROGRESS_CHANGED = 'downloadProgressChanged',
268
+ DOWNLOADED_AND_SESSION_CREATED = 'downloadedAndSessionCreated',
269
+ }
270
+
271
+ export interface EventTypes {
272
+ [Events.DOWNLOAD_PROGRESS_CHANGED]: number;
273
+ [Events.DOWNLOADED_AND_SESSION_CREATED]: void;
274
+ }
@@ -89,13 +89,10 @@ const structuredHeaderLink = {
89
89
  linkTitle: 'Structured Headers RFC',
90
90
  };
91
91
 
92
- export class AttributionReportingIssue extends Issue<IssueCode> {
93
- issueDetails: Readonly<Protocol.Audits.AttributionReportingIssueDetails>;
94
-
92
+ export class AttributionReportingIssue extends Issue<Protocol.Audits.AttributionReportingIssueDetails, IssueCode> {
95
93
  constructor(
96
94
  issueDetails: Protocol.Audits.AttributionReportingIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
97
- super(getIssueCode(issueDetails), issuesModel);
98
- this.issueDetails = issueDetails;
95
+ super(getIssueCode(issueDetails), issueDetails, issuesModel);
99
96
  }
100
97
 
101
98
  getCategory(): IssueCategory {
@@ -106,8 +103,9 @@ export class AttributionReportingIssue extends Issue<IssueCode> {
106
103
  const url = new URL('https://wicg.github.io/attribution-reporting-api/validate-headers');
107
104
  url.searchParams.set('header', name);
108
105
 
109
- if (this.issueDetails.invalidParameter) {
110
- url.searchParams.set('json', this.issueDetails.invalidParameter);
106
+ const details = this.details();
107
+ if (details.invalidParameter) {
108
+ url.searchParams.set('json', details.invalidParameter);
111
109
  }
112
110
 
113
111
  return {
@@ -229,7 +227,7 @@ export class AttributionReportingIssue extends Issue<IssueCode> {
229
227
  }
230
228
 
231
229
  primaryKey(): string {
232
- return JSON.stringify(this.issueDetails);
230
+ return JSON.stringify(this.details());
233
231
  }
234
232
 
235
233
  getKind(): IssueKind {
@@ -18,12 +18,9 @@ const UIStrings = {
18
18
  const str_ = i18n.i18n.registerUIStrings('models/issues_manager/BounceTrackingIssue.ts', UIStrings);
19
19
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
20
 
21
- export class BounceTrackingIssue extends Issue {
22
- readonly #issueDetails: Protocol.Audits.BounceTrackingIssueDetails;
23
-
21
+ export class BounceTrackingIssue extends Issue<Protocol.Audits.BounceTrackingIssueDetails> {
24
22
  constructor(issueDetails: Protocol.Audits.BounceTrackingIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
25
- super(Protocol.Audits.InspectorIssueCode.BounceTrackingIssue, issuesModel);
26
- this.#issueDetails = issueDetails;
23
+ super(Protocol.Audits.InspectorIssueCode.BounceTrackingIssue, issueDetails, issuesModel);
27
24
  }
28
25
 
29
26
  getCategory(): IssueCategory {
@@ -42,23 +39,16 @@ export class BounceTrackingIssue extends Issue {
42
39
  };
43
40
  }
44
41
 
45
- details(): Protocol.Audits.BounceTrackingIssueDetails {
46
- return this.#issueDetails;
47
- }
48
-
49
42
  getKind(): IssueKind {
50
43
  return IssueKind.BREAKING_CHANGE;
51
44
  }
52
45
 
53
46
  primaryKey(): string {
54
- return JSON.stringify(this.#issueDetails);
47
+ return JSON.stringify(this.details());
55
48
  }
56
49
 
57
50
  override trackingSites(): Iterable<string> {
58
- if (this.#issueDetails.trackingSites) {
59
- return this.#issueDetails.trackingSites;
60
- }
61
- return [];
51
+ return this.details().trackingSites;
62
52
  }
63
53
 
64
54
  static fromInspectorIssue(
@@ -22,29 +22,22 @@ const UIStrings = {
22
22
  const str_ = i18n.i18n.registerUIStrings('models/issues_manager/ClientHintIssue.ts', UIStrings);
23
23
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
24
24
 
25
- export class ClientHintIssue extends Issue {
26
- private issueDetails: Protocol.Audits.ClientHintIssueDetails;
27
-
25
+ export class ClientHintIssue extends Issue<Protocol.Audits.ClientHintIssueDetails> {
28
26
  constructor(issueDetails: Protocol.Audits.ClientHintIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
29
27
  super(
30
28
  {
31
29
  code: Protocol.Audits.InspectorIssueCode.ClientHintIssue,
32
30
  umaCode: [Protocol.Audits.InspectorIssueCode.ClientHintIssue, issueDetails.clientHintIssueReason].join('::'),
33
31
  },
34
- issuesModel);
35
- this.issueDetails = issueDetails;
32
+ issueDetails, issuesModel);
36
33
  }
37
34
 
38
35
  getCategory(): IssueCategory {
39
36
  return IssueCategory.OTHER;
40
37
  }
41
38
 
42
- details(): Protocol.Audits.ClientHintIssueDetails {
43
- return this.issueDetails;
44
- }
45
-
46
39
  getDescription(): MarkdownIssueDescription|null {
47
- const description = issueDescriptions.get(this.issueDetails.clientHintIssueReason);
40
+ const description = issueDescriptions.get(this.details().clientHintIssueReason);
48
41
  if (!description) {
49
42
  return null;
50
43
  }
@@ -52,11 +45,11 @@ export class ClientHintIssue extends Issue {
52
45
  }
53
46
 
54
47
  override sources(): Iterable<Protocol.Audits.SourceCodeLocation> {
55
- return [this.issueDetails.sourceCodeLocation];
48
+ return [this.details().sourceCodeLocation];
56
49
  }
57
50
 
58
51
  primaryKey(): string {
59
- return JSON.stringify(this.issueDetails);
52
+ return JSON.stringify(this.details());
60
53
  }
61
54
 
62
55
  getKind(): IssueKind {
@@ -38,9 +38,7 @@ const UIStrings = {
38
38
  const str_ = i18n.i18n.registerUIStrings('models/issues_manager/ContentSecurityPolicyIssue.ts', UIStrings);
39
39
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
40
40
 
41
- export class ContentSecurityPolicyIssue extends Issue {
42
- #issueDetails: Protocol.Audits.ContentSecurityPolicyIssueDetails;
43
-
41
+ export class ContentSecurityPolicyIssue extends Issue<Protocol.Audits.ContentSecurityPolicyIssueDetails> {
44
42
  constructor(
45
43
  issueDetails: Protocol.Audits.ContentSecurityPolicyIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null,
46
44
  issueId?: Protocol.Audits.IssueId) {
@@ -48,8 +46,7 @@ export class ContentSecurityPolicyIssue extends Issue {
48
46
  Protocol.Audits.InspectorIssueCode.ContentSecurityPolicyIssue,
49
47
  issueDetails.contentSecurityPolicyViolationType,
50
48
  ].join('::');
51
- super(issueCode, issuesModel, issueId);
52
- this.#issueDetails = issueDetails;
49
+ super(issueCode, issueDetails, issuesModel, issueId);
53
50
  }
54
51
 
55
52
  getCategory(): IssueCategory {
@@ -57,7 +54,7 @@ export class ContentSecurityPolicyIssue extends Issue {
57
54
  }
58
55
 
59
56
  primaryKey(): string {
60
- return JSON.stringify(this.#issueDetails, [
57
+ return JSON.stringify(this.details(), [
61
58
  'blockedURL',
62
59
  'contentSecurityPolicyViolationType',
63
60
  'violatedDirective',
@@ -71,19 +68,15 @@ export class ContentSecurityPolicyIssue extends Issue {
71
68
  }
72
69
 
73
70
  getDescription(): MarkdownIssueDescription|null {
74
- const description = issueDescriptions.get(this.#issueDetails.contentSecurityPolicyViolationType);
71
+ const description = issueDescriptions.get(this.details().contentSecurityPolicyViolationType);
75
72
  if (!description) {
76
73
  return null;
77
74
  }
78
75
  return resolveLazyDescription(description);
79
76
  }
80
77
 
81
- details(): Protocol.Audits.ContentSecurityPolicyIssueDetails {
82
- return this.#issueDetails;
83
- }
84
-
85
78
  getKind(): IssueKind {
86
- if (this.#issueDetails.isReportOnly) {
79
+ if (this.details().isReportOnly) {
87
80
  return IssueKind.IMPROVEMENT;
88
81
  }
89
82
  return IssueKind.PAGE_ERROR;
@@ -19,16 +19,13 @@ const str_ = i18n.i18n.registerUIStrings('models/issues_manager/CookieDeprecatio
19
19
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
20
 
21
21
  /** TODO(b/305738703): Move this issue into a warning on CookieIssue. **/
22
- export class CookieDeprecationMetadataIssue extends Issue {
23
- readonly #issueDetails: Protocol.Audits.CookieDeprecationMetadataIssueDetails;
24
-
22
+ export class CookieDeprecationMetadataIssue extends Issue<Protocol.Audits.CookieDeprecationMetadataIssueDetails> {
25
23
  constructor(
26
24
  issueDetails: Protocol.Audits.CookieDeprecationMetadataIssueDetails,
27
25
  issuesModel: SDK.IssuesModel.IssuesModel|null) {
28
26
  // Set a distinct code for ReadCookie and SetCookie issues, so they are grouped separately.
29
27
  const issueCode = Protocol.Audits.InspectorIssueCode.CookieDeprecationMetadataIssue + '_' + issueDetails.operation;
30
- super(issueCode, issuesModel);
31
- this.#issueDetails = issueDetails;
28
+ super(issueCode, issueDetails, issuesModel);
32
29
  }
33
30
 
34
31
  getCategory(): IssueCategory {
@@ -36,12 +33,12 @@ export class CookieDeprecationMetadataIssue extends Issue {
36
33
  }
37
34
 
38
35
  getDescription(): MarkdownIssueDescription {
39
- const fileName = this.#issueDetails.operation === 'SetCookie' ? 'cookieWarnMetadataGrantSet.md' :
40
- 'cookieWarnMetadataGrantRead.md';
36
+ const fileName =
37
+ this.details().operation === 'SetCookie' ? 'cookieWarnMetadataGrantSet.md' : 'cookieWarnMetadataGrantRead.md';
41
38
 
42
39
  let optOutText = '';
43
- if (this.#issueDetails.isOptOutTopLevel) {
44
- optOutText = '\n\n (Top level site opt-out: ' + this.#issueDetails.optOutPercentage +
40
+ if (this.details().isOptOutTopLevel) {
41
+ optOutText = '\n\n (Top level site opt-out: ' + this.details().optOutPercentage +
45
42
  '% - [learn more](gracePeriodStagedControlExplainer))';
46
43
  }
47
44
 
@@ -59,16 +56,12 @@ export class CookieDeprecationMetadataIssue extends Issue {
59
56
  };
60
57
  }
61
58
 
62
- details(): Protocol.Audits.CookieDeprecationMetadataIssueDetails {
63
- return this.#issueDetails;
64
- }
65
-
66
59
  getKind(): IssueKind {
67
60
  return IssueKind.BREAKING_CHANGE;
68
61
  }
69
62
 
70
63
  primaryKey(): string {
71
- return JSON.stringify(this.#issueDetails);
64
+ return JSON.stringify(this.details());
72
65
  }
73
66
 
74
67
  static fromInspectorIssue(
@@ -68,27 +68,20 @@ export interface CookieReportInfo {
68
68
  insight?: Protocol.Audits.CookieIssueInsight;
69
69
  }
70
70
 
71
- export class CookieIssue extends Issue {
72
- #issueDetails: Protocol.Audits.CookieIssueDetails;
73
-
74
- constructor(
75
- code: string, issueDetails: Protocol.Audits.CookieIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null,
76
- issueId: Protocol.Audits.IssueId|undefined) {
77
- super(code, issuesModel, issueId);
78
- this.#issueDetails = issueDetails;
79
- }
80
-
71
+ export class CookieIssue extends Issue<Protocol.Audits.CookieIssueDetails> {
81
72
  cookieId(): string {
82
- if (this.#issueDetails.cookie) {
83
- const {domain, path, name} = this.#issueDetails.cookie;
73
+ const details = this.details();
74
+ if (details.cookie) {
75
+ const {domain, path, name} = details.cookie;
84
76
  const cookieId = `${domain};${path};${name}`;
85
77
  return cookieId;
86
78
  }
87
- return this.#issueDetails.rawCookieLine ?? 'no-cookie-info';
79
+ return this.details().rawCookieLine ?? 'no-cookie-info';
88
80
  }
89
81
 
90
82
  primaryKey(): string {
91
- const requestId = this.#issueDetails.request ? this.#issueDetails.request.requestId : 'no-request';
83
+ const details = this.details();
84
+ const requestId = details.request ? details.request.requestId : 'no-request';
92
85
  return `${this.code()}-(${this.cookieId()})-(${requestId})`;
93
86
  }
94
87
 
@@ -210,22 +203,25 @@ export class CookieIssue extends Issue {
210
203
  }
211
204
 
212
205
  override cookies(): Iterable<Protocol.Audits.AffectedCookie> {
213
- if (this.#issueDetails.cookie) {
214
- return [this.#issueDetails.cookie];
206
+ const details = this.details();
207
+ if (details.cookie) {
208
+ return [details.cookie];
215
209
  }
216
210
  return [];
217
211
  }
218
212
 
219
213
  override rawCookieLines(): Iterable<string> {
220
- if (this.#issueDetails.rawCookieLine) {
221
- return [this.#issueDetails.rawCookieLine];
214
+ const details = this.details();
215
+ if (details.rawCookieLine) {
216
+ return [details.rawCookieLine];
222
217
  }
223
218
  return [];
224
219
  }
225
220
 
226
221
  override requests(): Iterable<Protocol.Audits.AffectedRequest> {
227
- if (this.#issueDetails.request) {
228
- return [this.#issueDetails.request];
222
+ const details = this.details();
223
+ if (details.request) {
224
+ return [details.request];
229
225
  }
230
226
  return [];
231
227
  }
@@ -244,27 +240,28 @@ export class CookieIssue extends Issue {
244
240
 
245
241
  override isCausedByThirdParty(): boolean {
246
242
  const outermostFrame = SDK.FrameManager.FrameManager.instance().getOutermostFrame();
247
- return isCausedByThirdParty(outermostFrame, this.#issueDetails.cookieUrl, this.#issueDetails.siteForCookies);
243
+ return isCausedByThirdParty(outermostFrame, this.details().cookieUrl, this.details().siteForCookies);
248
244
  }
249
245
 
250
246
  getKind(): IssueKind {
251
- if (this.#issueDetails.cookieExclusionReasons?.length > 0) {
247
+ if (this.details().cookieExclusionReasons?.length > 0) {
252
248
  return IssueKind.PAGE_ERROR;
253
249
  }
254
250
  return IssueKind.BREAKING_CHANGE;
255
251
  }
256
252
 
257
253
  makeCookieReportEntry(): CookieReportInfo|undefined {
258
- const status = CookieIssue.getCookieStatus(this.#issueDetails);
259
- if (this.#issueDetails.cookie && this.#issueDetails.cookieUrl && status !== undefined) {
260
- const entity = ThirdPartyWeb.ThirdPartyWeb.getEntity(this.#issueDetails.cookieUrl);
254
+ const status = CookieIssue.getCookieStatus(this.details());
255
+ const details = this.details();
256
+ if (details.cookie && details.cookieUrl && status !== undefined) {
257
+ const entity = ThirdPartyWeb.ThirdPartyWeb.getEntity(details.cookieUrl);
261
258
  return {
262
- name: this.#issueDetails.cookie.name,
263
- domain: this.#issueDetails.cookie.domain,
259
+ name: details.cookie.name,
260
+ domain: details.cookie.domain,
264
261
  type: entity?.category,
265
262
  platform: entity?.name,
266
263
  status,
267
- insight: this.#issueDetails.insight,
264
+ insight: this.details().insight,
268
265
  };
269
266
  }
270
267
 
@@ -332,8 +329,8 @@ export class CookieIssue extends Issue {
332
329
  return new SDK.ConsoleModel.ConsoleMessage(
333
330
  issuesModel.target().model(SDK.RuntimeModel.RuntimeModel), Common.Console.FrontendMessageSource.ISSUE_PANEL,
334
331
  Protocol.Log.LogEntryLevel.Warning, UIStrings.consoleTpcdErrorMessage, {
335
- url: this.#issueDetails.request?.url as Platform.DevToolsPath.UrlString | undefined,
336
- affectedResources: {requestId: this.#issueDetails.request?.requestId, issueId: this.issueId},
332
+ url: this.details().request?.url as Platform.DevToolsPath.UrlString | undefined,
333
+ affectedResources: {requestId: this.details().request?.requestId, issueId: this.issueId},
337
334
  isCookieReportIssue: true
338
335
  });
339
336
  }
@@ -115,26 +115,19 @@ function getIssueCode(details: Protocol.Audits.CorsIssueDetails): IssueCode {
115
115
  }
116
116
  }
117
117
 
118
- export class CorsIssue extends Issue<IssueCode> {
119
- #issueDetails: Protocol.Audits.CorsIssueDetails;
120
-
118
+ export class CorsIssue extends Issue<Protocol.Audits.CorsIssueDetails, IssueCode> {
121
119
  constructor(
122
120
  issueDetails: Protocol.Audits.CorsIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null,
123
121
  issueId: Protocol.Audits.IssueId|undefined) {
124
- super(getIssueCode(issueDetails), issuesModel, issueId);
125
- this.#issueDetails = issueDetails;
122
+ super(getIssueCode(issueDetails), issueDetails, issuesModel, issueId);
126
123
  }
127
124
 
128
125
  getCategory(): IssueCategory {
129
126
  return IssueCategory.CORS;
130
127
  }
131
128
 
132
- details(): Protocol.Audits.CorsIssueDetails {
133
- return this.#issueDetails;
134
- }
135
-
136
129
  getDescription(): MarkdownIssueDescription|null {
137
- switch (getIssueCode(this.#issueDetails)) {
130
+ switch (getIssueCode(this.details())) {
138
131
  case IssueCode.INSECURE_PRIVATE_NETWORK:
139
132
  return {
140
133
  file: 'corsInsecurePrivateNetwork.md',
@@ -269,16 +262,14 @@ export class CorsIssue extends Issue<IssueCode> {
269
262
  }
270
263
 
271
264
  primaryKey(): string {
272
- return JSON.stringify(this.#issueDetails);
265
+ return JSON.stringify(this.details());
273
266
  }
274
267
 
275
268
  getKind(): IssueKind {
276
- if (this.#issueDetails.isWarning &&
277
- (this.#issueDetails.corsErrorStatus.corsError === Protocol.Network.CorsError.InsecurePrivateNetwork ||
278
- this.#issueDetails.corsErrorStatus.corsError ===
279
- Protocol.Network.CorsError.PreflightMissingAllowPrivateNetwork ||
280
- this.#issueDetails.corsErrorStatus.corsError ===
281
- Protocol.Network.CorsError.PreflightInvalidAllowPrivateNetwork)) {
269
+ if (this.details().isWarning &&
270
+ (this.details().corsErrorStatus.corsError === Protocol.Network.CorsError.InsecurePrivateNetwork ||
271
+ this.details().corsErrorStatus.corsError === Protocol.Network.CorsError.PreflightMissingAllowPrivateNetwork ||
272
+ this.details().corsErrorStatus.corsError === Protocol.Network.CorsError.PreflightInvalidAllowPrivateNetwork)) {
282
273
  return IssueKind.BREAKING_CHANGE;
283
274
  }
284
275
  return IssueKind.PAGE_ERROR;
@@ -42,25 +42,22 @@ export function isCrossOriginEmbedderPolicyIssue(reason: Protocol.Audits.Blocked
42
42
  return false;
43
43
  }
44
44
 
45
- export class CrossOriginEmbedderPolicyIssue extends Issue {
46
- #issueDetails: Protocol.Audits.BlockedByResponseIssueDetails;
47
-
45
+ export class CrossOriginEmbedderPolicyIssue extends Issue<Protocol.Audits.BlockedByResponseIssueDetails> {
48
46
  constructor(
49
47
  issueDetails: Protocol.Audits.BlockedByResponseIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
50
- super(`CrossOriginEmbedderPolicyIssue::${issueDetails.reason}`, issuesModel);
51
- this.#issueDetails = issueDetails;
48
+ super(`CrossOriginEmbedderPolicyIssue::${issueDetails.reason}`, issueDetails, issuesModel);
52
49
  }
53
50
 
54
51
  primaryKey(): string {
55
- return `${this.code()}-(${this.#issueDetails.request.requestId})`;
52
+ return `${this.code()}-(${this.details().request.requestId})`;
56
53
  }
57
54
 
58
55
  override getBlockedByResponseDetails(): Iterable<Protocol.Audits.BlockedByResponseIssueDetails> {
59
- return [this.#issueDetails];
56
+ return [this.details()];
60
57
  }
61
58
 
62
59
  override requests(): Iterable<Protocol.Audits.AffectedRequest> {
63
- return [this.#issueDetails.request];
60
+ return [this.details().request];
64
61
  }
65
62
 
66
63
  getCategory(): IssueCategory {
@@ -33,35 +33,28 @@ const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined
33
33
  const strDeprecation = i18n.i18n.registerUIStrings('generated/Deprecation.ts', Deprecation.UIStrings);
34
34
  const i18nLazyDeprecationString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, strDeprecation);
35
35
 
36
- export class DeprecationIssue extends Issue {
37
- #issueDetails: Protocol.Audits.DeprecationIssueDetails;
38
-
36
+ export class DeprecationIssue extends Issue<Protocol.Audits.DeprecationIssueDetails> {
39
37
  constructor(issueDetails: Protocol.Audits.DeprecationIssueDetails, issuesModel: SDK.IssuesModel.IssuesModel|null) {
40
38
  const issueCode = [
41
39
  Protocol.Audits.InspectorIssueCode.DeprecationIssue,
42
40
  issueDetails.type,
43
41
  ].join('::');
44
- super({code: issueCode, umaCode: 'DeprecationIssue'}, issuesModel);
45
- this.#issueDetails = issueDetails;
42
+ super({code: issueCode, umaCode: 'DeprecationIssue'}, issueDetails, issuesModel);
46
43
  }
47
44
 
48
45
  getCategory(): IssueCategory {
49
46
  return IssueCategory.OTHER;
50
47
  }
51
48
 
52
- details(): Protocol.Audits.DeprecationIssueDetails {
53
- return this.#issueDetails;
54
- }
55
-
56
49
  getDescription(): MarkdownIssueDescription {
57
50
  let messageFunction = (): string => '';
58
- const maybeEnglishMessage = (Deprecation.UIStrings as Record<string, string>)[this.#issueDetails.type];
51
+ const maybeEnglishMessage = (Deprecation.UIStrings as Record<string, string>)[this.details().type];
59
52
  if (maybeEnglishMessage) {
60
53
  messageFunction = i18nLazyDeprecationString(maybeEnglishMessage);
61
54
  }
62
55
 
63
56
  const links = [];
64
- const deprecationMeta = Deprecation.DEPRECATIONS_METADATA[this.#issueDetails.type];
57
+ const deprecationMeta = Deprecation.DEPRECATIONS_METADATA[this.details().type];
65
58
  const feature = deprecationMeta?.chromeStatusFeature ?? 0;
66
59
  if (feature !== 0) {
67
60
  links.push({
@@ -87,14 +80,14 @@ export class DeprecationIssue extends Issue {
87
80
  }
88
81
 
89
82
  override sources(): Iterable<Protocol.Audits.SourceCodeLocation> {
90
- if (this.#issueDetails.sourceCodeLocation) {
91
- return [this.#issueDetails.sourceCodeLocation];
83
+ if (this.details().sourceCodeLocation) {
84
+ return [this.details().sourceCodeLocation];
92
85
  }
93
86
  return [];
94
87
  }
95
88
 
96
89
  primaryKey(): string {
97
- return JSON.stringify(this.#issueDetails);
90
+ return JSON.stringify(this.details());
98
91
  }
99
92
 
100
93
  getKind(): IssueKind {