chrome-devtools-frontend 1.0.1001476 → 1.0.1002543

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 (73) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -6
  2. package/front_end/core/common/ParsedURL.ts +3 -3
  3. package/front_end/core/host/InspectorFrontendHost.ts +30 -1
  4. package/front_end/core/i18n/locales/en-US.json +6 -30
  5. package/front_end/core/i18n/locales/en-XL.json +6 -30
  6. package/front_end/core/protocol_client/InspectorBackend.ts +4 -0
  7. package/front_end/core/root/Runtime.ts +7 -3
  8. package/front_end/core/sdk/ServiceWorkerManager.ts +6 -5
  9. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +14 -0
  10. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +491 -0
  11. package/front_end/entrypoints/formatter_worker/Substitute.ts +4 -440
  12. package/front_end/entrypoints/formatter_worker/formatter_worker.ts +2 -0
  13. package/front_end/generated/InspectorBackendCommands.js +38 -10
  14. package/front_end/generated/protocol-mapping.d.ts +5 -1
  15. package/front_end/generated/protocol-proxy-api.d.ts +4 -1
  16. package/front_end/generated/protocol.ts +50 -10
  17. package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
  18. package/front_end/models/issues_manager/AttributionReportingIssue.ts +5 -36
  19. package/front_end/models/issues_manager/DeprecationIssue.ts +0 -69
  20. package/front_end/models/issues_manager/Issue.ts +8 -4
  21. package/front_end/models/timeline_model/TimelineModel.ts +0 -48
  22. package/front_end/panels/application/AppManifestView.ts +3 -3
  23. package/front_end/panels/application/ApplicationPanelCacheSection.ts +3 -1
  24. package/front_end/panels/application/ApplicationPanelSidebar.ts +11 -6
  25. package/front_end/panels/application/ApplicationPanelTreeElement.ts +2 -2
  26. package/front_end/panels/application/BackgroundServiceView.ts +5 -4
  27. package/front_end/panels/application/ResourcesPanel.ts +1 -1
  28. package/front_end/panels/console/ConsoleViewMessage.ts +6 -3
  29. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +3 -2
  30. package/front_end/panels/elements/StylePropertyTreeElement.ts +19 -13
  31. package/front_end/panels/elements/StylesSidebarPane.ts +53 -0
  32. package/front_end/panels/issues/AffectedResourcesView.ts +4 -3
  33. package/front_end/panels/issues/AffectedSourcesView.ts +2 -1
  34. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +0 -43
  35. package/front_end/panels/issues/IssueView.ts +1 -1
  36. package/front_end/panels/lighthouse/LighthouseController.ts +5 -3
  37. package/front_end/panels/lighthouse/LighthouseReporterTypes.ts +2 -1
  38. package/front_end/panels/lighthouse/lighthousePanel.css +4 -0
  39. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +2 -2
  40. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -1
  41. package/front_end/panels/profiler/ProfileDataGrid.ts +1 -1
  42. package/front_end/panels/security/SecurityPanel.ts +6 -5
  43. package/front_end/panels/settings/SettingsScreen.ts +2 -3
  44. package/front_end/panels/timeline/PerformanceModel.ts +2 -6
  45. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -14
  46. package/front_end/panels/timeline/TimelineUIUtils.ts +14 -12
  47. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1036 -1088
  48. package/front_end/third_party/lighthouse/locales/en-US.json +241 -4
  49. package/front_end/third_party/lighthouse/locales/en-XL.json +241 -4
  50. package/front_end/third_party/lighthouse/report/bundle.d.ts +2 -0
  51. package/front_end/third_party/lighthouse/report/bundle.js +18 -12
  52. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  53. package/front_end/ui/components/docs/linkifier/simple-url.ts +2 -1
  54. package/front_end/ui/components/docs/panel_feedback/basic.ts +3 -2
  55. package/front_end/ui/components/docs/panel_feedback/button.ts +2 -1
  56. package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -3
  57. package/front_end/ui/components/linkifier/LinkifierUtils.ts +2 -3
  58. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +4 -6
  59. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +5 -4
  60. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +3 -3
  61. package/front_end/ui/legacy/EmptyWidget.ts +2 -1
  62. package/front_end/ui/legacy/UIUtils.ts +4 -4
  63. package/front_end/ui/legacy/XLink.ts +12 -13
  64. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +2 -4
  65. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
  66. package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +0 -2
  67. package/front_end/ui/legacy/components/utils/ImagePreview.ts +3 -7
  68. package/front_end/ui/legacy/components/utils/Linkifier.ts +23 -23
  69. package/front_end/ui/legacy/toolbar.css +1 -1
  70. package/package.json +1 -1
  71. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceEventId.md +0 -3
  72. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceExpiry.md +0 -4
  73. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourcePriority.md +0 -4
@@ -848,45 +848,46 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
848
848
  return;
849
849
  }
850
850
 
851
+ const contextMenu = this.createCopyContextMenu(event);
852
+ void contextMenu.show();
853
+ }
854
+
855
+ createCopyContextMenu(event: Event): UI.ContextMenu.ContextMenu {
851
856
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
852
- contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyDeclaration), () => {
857
+ contextMenu.headerSection().appendItem(i18nString(UIStrings.copyDeclaration), () => {
853
858
  const propertyText = `${this.property.name}: ${this.property.value};`;
854
859
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(propertyText);
855
860
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.DeclarationViaContextMenu);
856
861
  });
857
862
 
858
- contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyProperty), () => {
863
+ contextMenu.headerSection().appendItem(i18nString(UIStrings.copyProperty), () => {
859
864
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.property.name);
860
865
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.PropertyViaContextMenu);
861
866
  });
862
867
 
863
- contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyValue), () => {
868
+ contextMenu.headerSection().appendItem(i18nString(UIStrings.copyValue), () => {
864
869
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.property.value);
865
870
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.ValueViaContextMenu);
866
871
  });
867
872
 
868
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.copyRule), () => {
873
+ contextMenu.headerSection().appendItem(i18nString(UIStrings.copyRule), () => {
869
874
  const section = (this.section() as StylePropertiesSection);
870
875
  const ruleText = StylesSidebarPane.formatLeadingProperties(section).ruleText;
871
876
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(ruleText);
872
877
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.RuleViaContextMenu);
873
878
  });
874
879
 
875
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.copyAllDeclarations), () => {
880
+ contextMenu.headerSection().appendItem(
881
+ i18nString(UIStrings.copyCssDeclarationAsJs), this.copyCssDeclarationAsJs.bind(this));
882
+
883
+ contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyAllDeclarations), () => {
876
884
  const section = (this.section() as StylePropertiesSection);
877
885
  const allDeclarationText = StylesSidebarPane.formatLeadingProperties(section).allDeclarationText;
878
886
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(allDeclarationText);
879
887
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.AllDeclarationsViaContextMenu);
880
888
  });
881
889
 
882
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.viewComputedValue), () => {
883
- void this.viewComputedValue();
884
- });
885
-
886
890
  contextMenu.clipboardSection().appendItem(
887
- i18nString(UIStrings.copyCssDeclarationAsJs), this.copyCssDeclarationAsJs.bind(this));
888
-
889
- contextMenu.defaultSection().appendItem(
890
891
  i18nString(UIStrings.copyAllCssDeclarationsAsJs), this.copyAllCssDeclarationAsJs.bind(this));
891
892
 
892
893
  // TODO(changhaohan): conditionally add this item only when there are changes to copy
@@ -896,7 +897,11 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
896
897
  Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.AllChangesViaStylesPane);
897
898
  });
898
899
 
899
- void contextMenu.show();
900
+ contextMenu.footerSection().appendItem(i18nString(UIStrings.viewComputedValue), () => {
901
+ void this.viewComputedValue();
902
+ });
903
+
904
+ return contextMenu;
900
905
  }
901
906
 
902
907
  private async viewComputedValue(): Promise<void> {
@@ -1513,6 +1518,7 @@ export class StylePropertyTreeElement extends UI.TreeOutline.TreeElement {
1513
1518
  }
1514
1519
  if (updatedProperty) {
1515
1520
  this.listItemElement.classList.toggle('changed', this.isPropertyChanged(updatedProperty));
1521
+ this.parentPane().updateChangeStatus();
1516
1522
  }
1517
1523
 
1518
1524
  this.matchedStylesInternal.resetActiveProperties();
@@ -147,6 +147,14 @@ const UIStrings = {
147
147
  */
148
148
  automaticDarkMode: 'Automatic dark mode',
149
149
  /**
150
+ *@description Tooltip text that appears when hovering over the css changes button in the Styles Sidebar Pane of the Elements panel
151
+ */
152
+ copyAllCSSChanges: 'Copy all the CSS changes',
153
+ /**
154
+ *@description Tooltip text that appears after clicking on the copy CSS changes button
155
+ */
156
+ copiedToClipboard: 'Copied to clipboard',
157
+ /**
150
158
  *@description Text displayed on layer separators in the styles sidebar pane.
151
159
  */
152
160
  layer: 'Layer',
@@ -207,6 +215,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
207
215
  private readonly imagePreviewPopover: ImagePreviewPopover;
208
216
  activeCSSAngle: InlineEditor.CSSAngle.CSSAngle|null;
209
217
  #urlToChangeTracker: Map<Platform.DevToolsPath.UrlString, ChangeTracker> = new Map();
218
+ #copyChangesButton?: UI.Toolbar.ToolbarButton;
210
219
 
211
220
  static instance(): StylesSidebarPane {
212
221
  if (!stylesSidebarPaneInstance) {
@@ -579,6 +588,11 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
579
588
  if (!this.initialUpdateCompleted) {
580
589
  this.initialUpdateCompleted = true;
581
590
  this.appendToolbarItem(this.createRenderingShortcuts());
591
+ if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES)) {
592
+ this.#copyChangesButton = this.createCopyAllChangesButton();
593
+ this.appendToolbarItem(this.#copyChangesButton);
594
+ this.#copyChangesButton.element.classList.add('hidden');
595
+ }
582
596
  this.dispatchEventToListeners(Events.InitialUpdateCompleted);
583
597
  }
584
598
 
@@ -1109,6 +1123,22 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
1109
1123
  return changedLines.has(formattedLineNumber + 1);
1110
1124
  }
1111
1125
 
1126
+ updateChangeStatus(): void {
1127
+ if (!this.#copyChangesButton) {
1128
+ return;
1129
+ }
1130
+
1131
+ let hasChangedStyles = false;
1132
+ for (const changeTracker of this.#urlToChangeTracker.values()) {
1133
+ if (changeTracker.changedLines.size > 0) {
1134
+ hasChangedStyles = true;
1135
+ break;
1136
+ }
1137
+ }
1138
+
1139
+ this.#copyChangesButton.element.classList.toggle('hidden', !hasChangedStyles);
1140
+ }
1141
+
1112
1142
  private async refreshChangedLines(uiSourceCode: Workspace.UISourceCode.UISourceCode): Promise<void> {
1113
1143
  const changeTracker = this.#urlToChangeTracker.get(uiSourceCode.url());
1114
1144
  if (!changeTracker) {
@@ -1290,6 +1320,29 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
1290
1320
 
1291
1321
  return button;
1292
1322
  }
1323
+
1324
+ private createCopyAllChangesButton(): UI.Toolbar.ToolbarButton {
1325
+ const copyAllChangesButton =
1326
+ new UI.Toolbar.ToolbarButton(i18nString(UIStrings.copyAllCSSChanges), 'largeicon-copy');
1327
+ // TODO(1296947): implement a dedicated component to share between all copy buttons
1328
+ copyAllChangesButton.element.setAttribute('data-content', i18nString(UIStrings.copiedToClipboard));
1329
+ let timeout: number|undefined;
1330
+ copyAllChangesButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, async () => {
1331
+ const allChanges = await this.getFormattedChanges();
1332
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(allChanges);
1333
+ Host.userMetrics.styleTextCopied(Host.UserMetrics.StyleTextCopied.AllChangesViaStylesPane);
1334
+ if (timeout) {
1335
+ clearTimeout(timeout);
1336
+ timeout = undefined;
1337
+ }
1338
+ copyAllChangesButton.element.classList.add('copied-to-clipboard');
1339
+ timeout = window.setTimeout(() => {
1340
+ copyAllChangesButton.element.classList.remove('copied-to-clipboard');
1341
+ timeout = undefined;
1342
+ }, 2000);
1343
+ });
1344
+ return copyAllChangesButton;
1345
+ }
1293
1346
  }
1294
1347
 
1295
1348
  export const enum Events {
@@ -5,6 +5,7 @@
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
+ import type * as Platform from '../../core/platform/platform.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
9
10
  import type * as IssuesManager from '../../models/issues_manager/issues_manager.js';
10
11
  import * as Logs from '../../models/logs/logs.js';
@@ -44,7 +45,7 @@ export const enum AffectedItem {
44
45
  Source = 'Source',
45
46
  }
46
47
 
47
- export const extractShortPath = (path: string): string => {
48
+ export const extractShortPath = (path: Platform.DevToolsPath.UrlString): string => {
48
49
  // 1st regex matches everything after last '/'
49
50
  // if path ends with '/', 2nd regex returns everything between the last two '/'
50
51
  return (/[^/]+$/.exec(path) || /[^/]+\/$/.exec(path) || [''])[0];
@@ -255,8 +256,8 @@ export abstract class AffectedResourcesView extends UI.TreeOutline.TreeElement {
255
256
  // TODO(crbug.com/1108503): Add some mechanism to be able to add telemetry to this element.
256
257
  const linkifier = new Components.Linkifier.Linkifier(maxLengthForDisplayedURLs);
257
258
  const sourceAnchor = linkifier.linkifyScriptLocation(
258
- target || null, sourceLocation.scriptId || null, sourceLocation.url, sourceLocation.lineNumber,
259
- {columnNumber: sourceLocation.columnNumber, inlineFrameIndex: 0});
259
+ target || null, sourceLocation.scriptId || null, sourceLocation.url as Platform.DevToolsPath.UrlString,
260
+ sourceLocation.lineNumber, {columnNumber: sourceLocation.columnNumber, inlineFrameIndex: 0});
260
261
  sourceCodeLocation.appendChild(sourceAnchor);
261
262
  }
262
263
  element.appendChild(sourceCodeLocation);
@@ -42,7 +42,8 @@ export class AffectedSourcesView extends AffectedResourcesView {
42
42
  // Also, this element has a context menu, so we should be able to
43
43
  // track when the user use the context menu too.
44
44
  // TODO(crbug.com/1108503): Add some mechanism to be able to add telemetry to this element.
45
- const anchorElement = Components.Linkifier.Linkifier.linkifyURL(url, linkifierURLOptions);
45
+ const anchorElement =
46
+ Components.Linkifier.Linkifier.linkifyURL(url as Platform.DevToolsPath.UrlString, linkifierURLOptions);
46
47
  cellElement.appendChild(anchorElement);
47
48
  const rowElement = document.createElement('tr');
48
49
  rowElement.classList.add('affected-resource-source');
@@ -27,21 +27,6 @@ const UIStrings = {
27
27
  * @description Noun, label for the column showing the associated network request in the issue details table.
28
28
  */
29
29
  request: 'Request',
30
- /**
31
- * @description Label for the column showing the invalid value used as the 'attributionsourceeventid' attribute
32
- * on an anchor HTML element ("a link").
33
- */
34
- invalidSourceEventId: 'Invalid `attributionsourceeventid`',
35
- /**
36
- * @description Label for the column showing the invalid value used as the 'attributionexpiry' attribute
37
- * on an anchor HTML element ("a link").
38
- */
39
- invalidSourceExpiry: 'Invalid `attributionexpiry`',
40
- /**
41
- * @description Label for the column showing the invalid value used as the 'attributionpriority' attribute
42
- * on an anchor HTML element ("a link").
43
- */
44
- invalidSourcePriority: 'Invalid `attributionsourcepriority`',
45
30
  /**
46
31
  * @description Label for the column showing the invalid URL used in an HTML anchor element ("a link").
47
32
  * A origin is (roughly said) the front part of a URL.
@@ -89,21 +74,6 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
89
74
  this.appendColumnTitle(header, i18nString(UIStrings.element));
90
75
  this.appendColumnTitle(header, i18nString(UIStrings.untrustworthyOrigin));
91
76
  break;
92
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourceEventId:
93
- this.appendColumnTitle(header, i18nString(UIStrings.frame));
94
- this.appendColumnTitle(header, i18nString(UIStrings.element));
95
- this.appendColumnTitle(header, i18nString(UIStrings.invalidSourceEventId));
96
- break;
97
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourceExpiry:
98
- this.appendColumnTitle(header, i18nString(UIStrings.frame));
99
- this.appendColumnTitle(header, i18nString(UIStrings.element));
100
- this.appendColumnTitle(header, i18nString(UIStrings.invalidSourceExpiry));
101
- break;
102
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourcePriority:
103
- this.appendColumnTitle(header, i18nString(UIStrings.frame));
104
- this.appendColumnTitle(header, i18nString(UIStrings.element));
105
- this.appendColumnTitle(header, i18nString(UIStrings.invalidSourcePriority));
106
- break;
107
77
  case IssuesManager.AttributionReportingIssue.IssueCode.PermissionPolicyDisabled:
108
78
  this.appendColumnTitle(header, i18nString(UIStrings.frame));
109
79
  this.appendColumnTitle(header, i18nString(UIStrings.element));
@@ -129,11 +99,6 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
129
99
  const details = issue.issueDetails;
130
100
 
131
101
  switch (issueCode) {
132
- case IssuesManager.AttributionReportingIssue.IssueCode.AttributionUntrustworthyFrameOrigin:
133
- this.#appendFrameOrEmptyCell(element, issue);
134
- this.#appendRequestOrEmptyCell(element, details.request);
135
- this.appendIssueDetailCell(element, details.invalidParameter || '');
136
- break;
137
102
  case IssuesManager.AttributionReportingIssue.IssueCode.AttributionSourceUntrustworthyOrigin:
138
103
  await this.#appendElementOrEmptyCell(element, issue);
139
104
  this.appendIssueDetailCell(element, details.invalidParameter || '');
@@ -142,14 +107,6 @@ export class AttributionReportingIssueDetailsView extends AffectedResourcesView
142
107
  this.#appendRequestOrEmptyCell(element, details.request);
143
108
  this.appendIssueDetailCell(element, details.invalidParameter || '');
144
109
  break;
145
- case IssuesManager.AttributionReportingIssue.IssueCode.AttributionSourceUntrustworthyFrameOrigin:
146
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourceEventId:
147
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourceExpiry:
148
- case IssuesManager.AttributionReportingIssue.IssueCode.InvalidAttributionSourcePriority:
149
- this.#appendFrameOrEmptyCell(element, issue);
150
- await this.#appendElementOrEmptyCell(element, issue);
151
- this.appendIssueDetailCell(element, details.invalidParameter || '');
152
- break;
153
110
  case IssuesManager.AttributionReportingIssue.IssueCode.PermissionPolicyDisabled:
154
111
  this.#appendFrameOrEmptyCell(element, issue);
155
112
  await this.#appendElementOrEmptyCell(element, issue);
@@ -181,7 +181,7 @@ class AffectedMixedContentView extends AffectedResourcesView {
181
181
  },
182
182
  }));
183
183
  } else {
184
- const filename = extractShortPath(mixedContent.insecureURL);
184
+ const filename = extractShortPath(mixedContent.insecureURL as Platform.DevToolsPath.UrlString);
185
185
  const cell = this.appendIssueDetailCell(element, filename, 'affected-resource-mixed-content-info');
186
186
  cell.title = mixedContent.insecureURL;
187
187
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as i18n from '../../core/i18n/i18n.js';
7
+ import type * as Platform from '../../core/platform/platform.js';
7
8
  import * as SDK from '../../core/sdk/sdk.js';
8
9
  import * as Protocol from '../../generated/protocol.js';
9
10
 
@@ -508,7 +509,7 @@ export const RuntimeSettings: RuntimeSetting[] = [
508
509
  value: 'snapshot',
509
510
  },
510
511
  ],
511
- learnMore: 'https://web.dev/lighthouse-user-flows/',
512
+ learnMore: 'https://web.dev/lighthouse-user-flows/' as Platform.DevToolsPath.UrlString,
512
513
  },
513
514
  {
514
515
  // This setting is disabled, but we keep it around to show in the UI.
@@ -517,7 +518,8 @@ export const RuntimeSettings: RuntimeSetting[] = [
517
518
  title: i18nLazyString(UIStrings.simulatedThrottling),
518
519
  // We will disable this when we have a Lantern trace viewer within DevTools.
519
520
  learnMore:
520
- 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling',
521
+ 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
522
+ Platform.DevToolsPath.UrlString,
521
523
  description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
522
524
  setFlags: (flags: Flags, value: string|boolean): void => {
523
525
  flags.throttlingMethod = value ? 'simulate' : 'devtools';
@@ -600,5 +602,5 @@ export interface RuntimeSetting {
600
602
  tooltip?: () => Common.UIString.LocalizedString,
601
603
  }[];
602
604
  title?: () => Common.UIString.LocalizedString;
603
- learnMore?: string;
605
+ learnMore?: Platform.DevToolsPath.UrlString;
604
606
  }
@@ -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 type * as Platform from '../../core/platform/platform.js';
5
6
  import type * as SDK from '../../core/sdk/sdk.js';
6
7
 
7
8
  export class LighthouseReportGenerator {
@@ -80,7 +81,7 @@ export interface NodeDetailsJSON {
80
81
  snippet?: string;
81
82
  }
82
83
  export interface SourceLocationDetailsJSON {
83
- sourceUrl?: string;
84
+ sourceUrl?: Platform.DevToolsPath.UrlString;
84
85
  sourceLine?: string;
85
86
  sourceColumn?: string;
86
87
  }
@@ -50,3 +50,7 @@ button.view-trace {
50
50
  .lighthouse-toolbar-container > :first-child {
51
51
  flex: 1 1 auto;
52
52
  }
53
+
54
+ .lh-devtools .lh-element-screenshot__overlay {
55
+ position: absolute;
56
+ }
@@ -1299,8 +1299,8 @@ export class AllocationGridNode extends HeapSnapshotGridNode {
1299
1299
  const linkifier = (this.dataGridInternal as AllocationDataGrid).linkifier;
1300
1300
  const urlElement = linkifier.linkifyScriptLocation(
1301
1301
  heapProfilerModel ? heapProfilerModel.target() : null,
1302
- String(allocationNode.scriptId) as Protocol.Runtime.ScriptId, allocationNode.scriptName,
1303
- allocationNode.line - 1, {
1302
+ String(allocationNode.scriptId) as Protocol.Runtime.ScriptId,
1303
+ allocationNode.scriptName as Platform.DevToolsPath.UrlString, allocationNode.line - 1, {
1304
1304
  columnNumber: allocationNode.column - 1,
1305
1305
  inlineFrameIndex: 0,
1306
1306
  className: 'profile-node-file',
@@ -1904,7 +1904,8 @@ export class HeapAllocationStackView extends UI.Widget.Widget {
1904
1904
  const target = this.heapProfilerModel ? this.heapProfilerModel.target() : null;
1905
1905
  const options = {columnNumber: frame.column - 1, inlineFrameIndex: 0};
1906
1906
  const urlElement = this.linkifier.linkifyScriptLocation(
1907
- target, String(frame.scriptId) as Protocol.Runtime.ScriptId, frame.scriptName, frame.line - 1, options);
1907
+ target, String(frame.scriptId) as Protocol.Runtime.ScriptId,
1908
+ frame.scriptName as Platform.DevToolsPath.UrlString, frame.line - 1, options);
1908
1909
  frameDiv.appendChild(urlElement);
1909
1910
  stackFrameToURLElement.set(frameDiv, urlElement);
1910
1911
  frameDiv.addEventListener('contextmenu', this.onContextMenu.bind(this, urlElement));
@@ -65,7 +65,7 @@ export class ProfileDataGridNode extends DataGrid.DataGrid.DataGridNode<unknown>
65
65
  total: number;
66
66
  functionName: string;
67
67
  readonly deoptReason: string;
68
- url: string;
68
+ url: Platform.DevToolsPath.UrlString;
69
69
  linkElement: Element|null;
70
70
  populated: boolean;
71
71
  savedSelf?: number;
@@ -5,6 +5,7 @@
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
+ import type * as Platform from '../../core/platform/platform.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
9
10
  import * as Protocol from '../../generated/protocol.js';
10
11
  import * as NetworkForward from '../../panels/network/forward/forward.js';
@@ -513,7 +514,7 @@ export class SecurityPanel extends UI.Panel.PanelWithSidebar implements
513
514
  return certificateButton;
514
515
  }
515
516
 
516
- static createHighlightedUrl(url: string, securityState: string): Element {
517
+ static createHighlightedUrl(url: Platform.DevToolsPath.UrlString, securityState: string): Element {
517
518
  const schemeSeparator = '://';
518
519
  const index = url.indexOf(schemeSeparator);
519
520
 
@@ -548,7 +549,7 @@ export class SecurityPanel extends UI.Panel.PanelWithSidebar implements
548
549
  // The sidebar element will trigger displaying the main view. Rather than making a redundant call to display the main view, we rely on this.
549
550
  this.sidebarMainViewElement.select(true);
550
551
  }
551
- showOrigin(origin: string): void {
552
+ showOrigin(origin: Platform.DevToolsPath.UrlString): void {
552
553
  const originState = this.origins.get(origin);
553
554
  if (!originState) {
554
555
  return;
@@ -820,7 +821,7 @@ export class SecurityPanelSidebarTree extends UI.TreeOutline.TreeOutlineInShadow
820
821
  }
821
822
  }
822
823
 
823
- addOrigin(origin: string, securityState: Protocol.Security.SecurityState): void {
824
+ addOrigin(origin: Platform.DevToolsPath.UrlString, securityState: Protocol.Security.SecurityState): void {
824
825
  const originElement = new SecurityPanelSidebarTreeElement(
825
826
  SecurityPanel.createHighlightedUrl(origin, securityState), this.showOriginInPanel.bind(this, origin),
826
827
  'security-sidebar-tree-item', 'security-property');
@@ -1394,7 +1395,7 @@ export class SecurityMainView extends UI.Widget.VBox {
1394
1395
  export class SecurityOriginView extends UI.Widget.VBox {
1395
1396
  private readonly panel: SecurityPanel;
1396
1397
  private readonly originLockIcon: HTMLElement;
1397
- constructor(panel: SecurityPanel, origin: string, originState: OriginState) {
1398
+ constructor(panel: SecurityPanel, origin: Platform.DevToolsPath.UrlString, originState: OriginState) {
1398
1399
  super();
1399
1400
  this.panel = panel;
1400
1401
  this.setMinimumSize(200, 100);
@@ -1657,4 +1658,4 @@ export interface OriginState {
1657
1658
  originView?: SecurityOriginView|null;
1658
1659
  }
1659
1660
 
1660
- export type Origin = string;
1661
+ export type Origin = Platform.DevToolsPath.UrlString;
@@ -511,9 +511,8 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
511
511
  return true;
512
512
  // TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
513
513
  case 'settings.documentation':
514
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
515
- UI.UIUtils.addReferrerToURL('https://developer.chrome.com/docs/devtools/') as
516
- Platform.DevToolsPath.UrlString);
514
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(UI.UIUtils.addReferrerToURL(
515
+ 'https://developer.chrome.com/docs/devtools/' as Platform.DevToolsPath.UrlString));
517
516
  return true;
518
517
  case 'settings.shortcuts':
519
518
  void SettingsScreen.showSettingsScreen({name: 'keybinds', focusTabHeader: true});
@@ -75,18 +75,14 @@ export class PerformanceModel extends Common.ObjectWrapper.ObjectWrapper<EventTy
75
75
  this.tracingModelInternal = model;
76
76
  this.timelineModelInternal.setEvents(model);
77
77
 
78
- let inputEvents: SDK.TracingModel.AsyncEvent[]|null = null;
79
78
  let animationEvents: SDK.TracingModel.AsyncEvent[]|null = null;
80
79
  for (const track of this.timelineModelInternal.tracks()) {
81
- if (track.type === TimelineModel.TimelineModel.TrackType.Input) {
82
- inputEvents = track.asyncEvents;
83
- }
84
80
  if (track.type === TimelineModel.TimelineModel.TrackType.Animation) {
85
81
  animationEvents = track.asyncEvents;
86
82
  }
87
83
  }
88
- if (inputEvents || animationEvents) {
89
- this.irModel.populate(inputEvents || [], animationEvents || []);
84
+ if (animationEvents) {
85
+ this.irModel.populate([], animationEvents || []);
90
86
  }
91
87
 
92
88
  const mainTracks = this.timelineModelInternal.tracks().filter(
@@ -54,10 +54,6 @@ const UIStrings = {
54
54
  */
55
55
  onIgnoreList: 'On ignore list',
56
56
  /**
57
- *@description Text in Timeline Flame Chart Data Provider of the Performance panel
58
- */
59
- input: 'Input',
60
- /**
61
57
  *@description Text that refers to the animation of the web page
62
58
  */
63
59
  animation: 'Animation',
@@ -428,10 +424,8 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
428
424
 
429
425
  const eventEntryType = EntryType.Event;
430
426
 
431
- const weight = (track: TimelineModel.TimelineModel.Track): 0|1|2|3|4|5|6|7|8|9|10|- 1 => {
427
+ const weight = (track: TimelineModel.TimelineModel.Track): 1|2|3|4|5|6|7|8|9|10|- 1 => {
432
428
  switch (track.type) {
433
- case TimelineModel.TimelineModel.TrackType.Input:
434
- return 0;
435
429
  case TimelineModel.TimelineModel.TrackType.Animation:
436
430
  return 1;
437
431
  case TimelineModel.TimelineModel.TrackType.Timings:
@@ -464,13 +458,6 @@ export class TimelineFlameChartDataProvider extends Common.ObjectWrapper.ObjectW
464
458
  let rasterCount = 0;
465
459
  for (const track of tracks) {
466
460
  switch (track.type) {
467
- case TimelineModel.TimelineModel.TrackType.Input: {
468
- this.appendAsyncEventsGroup(
469
- track, i18nString(UIStrings.input), track.asyncEvents, this.interactionsHeaderLevel2, eventEntryType,
470
- false /* selectable */);
471
- break;
472
- }
473
-
474
461
  case TimelineModel.TimelineModel.TrackType.Animation: {
475
462
  this.appendAsyncEventsGroup(
476
463
  track, i18nString(UIStrings.animation), track.asyncEvents, this.interactionsHeaderLevel2, eventEntryType,
@@ -1918,7 +1918,8 @@ export class TimelineUIUtils {
1918
1918
  null {
1919
1919
  const options =
1920
1920
  {columnNumber, showColumnNumber: true, inlineFrameIndex: 0, className: 'timeline-details', tabStop: true};
1921
- return linkifier.linkifyScriptLocation(target, scriptId, url, lineNumber, options);
1921
+ return linkifier.linkifyScriptLocation(
1922
+ target, scriptId, url as Platform.DevToolsPath.UrlString, lineNumber, options);
1922
1923
  }
1923
1924
 
1924
1925
  function linkifyTopCallFrame(): Element|null {
@@ -1931,7 +1932,7 @@ export class TimelineUIUtils {
1931
1932
  }
1932
1933
 
1933
1934
  static buildDetailsNodeForPerformanceEvent(event: SDK.TracingModel.Event): Element {
1934
- let link: string = 'https://web.dev/user-centric-performance-metrics/';
1935
+ let link = 'https://web.dev/user-centric-performance-metrics/';
1935
1936
  let name = 'page performance metrics';
1936
1937
  const recordType = TimelineModel.TimelineModel.RecordType;
1937
1938
  switch (event.name) {
@@ -2029,7 +2030,7 @@ export class TimelineUIUtils {
2029
2030
  const eventData = event.args['data'];
2030
2031
  const timelineData = TimelineModel.TimelineModel.TimelineData.forEvent(event);
2031
2032
  const initiator = timelineData.initiator();
2032
- let url: (string|null)|null = null;
2033
+ let url: Platform.DevToolsPath.UrlString|null = null;
2033
2034
 
2034
2035
  if (timelineData.warning) {
2035
2036
  contentHelper.appendWarningRow(event);
@@ -2137,7 +2138,7 @@ export class TimelineUIUtils {
2137
2138
  }
2138
2139
 
2139
2140
  case recordTypes.CompileScript: {
2140
- url = eventData && eventData['url'];
2141
+ url = eventData && eventData['url'] as Platform.DevToolsPath.UrlString;
2141
2142
  if (url) {
2142
2143
  contentHelper.appendLocationRow(
2143
2144
  i18nString(UIStrings.script), url, eventData['lineNumber'], eventData['columnNumber']);
@@ -2154,7 +2155,7 @@ export class TimelineUIUtils {
2154
2155
  }
2155
2156
 
2156
2157
  case recordTypes.CacheModule: {
2157
- url = eventData && eventData['url'];
2158
+ url = eventData && eventData['url'] as Platform.DevToolsPath.UrlString;
2158
2159
  contentHelper.appendTextRow(
2159
2160
  i18nString(UIStrings.compilationCacheSize),
2160
2161
  Platform.NumberUtilities.bytesToString(eventData['producedCacheSize']));
@@ -2162,7 +2163,7 @@ export class TimelineUIUtils {
2162
2163
  }
2163
2164
 
2164
2165
  case recordTypes.CacheScript: {
2165
- url = eventData && eventData['url'];
2166
+ url = eventData && eventData['url'] as Platform.DevToolsPath.UrlString;
2166
2167
  if (url) {
2167
2168
  contentHelper.appendLocationRow(
2168
2169
  i18nString(UIStrings.script), url, eventData['lineNumber'], eventData['columnNumber']);
@@ -2174,7 +2175,7 @@ export class TimelineUIUtils {
2174
2175
  }
2175
2176
 
2176
2177
  case recordTypes.EvaluateScript: {
2177
- url = eventData && eventData['url'];
2178
+ url = eventData && eventData['url'] as Platform.DevToolsPath.UrlString;
2178
2179
  if (url) {
2179
2180
  contentHelper.appendLocationRow(
2180
2181
  i18nString(UIStrings.script), url, eventData['lineNumber'], eventData['columnNumber']);
@@ -2188,7 +2189,7 @@ export class TimelineUIUtils {
2188
2189
  case recordTypes.WasmModuleCacheHit:
2189
2190
  case recordTypes.WasmModuleCacheInvalid: {
2190
2191
  if (eventData) {
2191
- url = event.args['url'];
2192
+ url = event.args['url'] as Platform.DevToolsPath.UrlString;
2192
2193
  if (url) {
2193
2194
  contentHelper.appendTextRow(i18nString(UIStrings.url), url);
2194
2195
  }
@@ -2242,7 +2243,7 @@ export class TimelineUIUtils {
2242
2243
  }
2243
2244
 
2244
2245
  case recordTypes.ParseAuthorStyleSheet: {
2245
- url = eventData['styleSheetUrl'];
2246
+ url = eventData['styleSheetUrl'] as Platform.DevToolsPath.UrlString;
2246
2247
  if (url) {
2247
2248
  const options = {
2248
2249
  tabStop: true,
@@ -2911,7 +2912,7 @@ export class TimelineUIUtils {
2911
2912
  }
2912
2913
  const imageURLPromise = snapshotWithRect.snapshot.replay();
2913
2914
  snapshotWithRect.snapshot.release();
2914
- const imageURL = await imageURLPromise;
2915
+ const imageURL = await imageURLPromise as Platform.DevToolsPath.UrlString;
2915
2916
  if (!imageURL) {
2916
2917
  return null;
2917
2918
  }
@@ -3662,14 +3663,15 @@ export class TimelineDetailsContentHelper {
3662
3663
  showColumnNumber: true,
3663
3664
  inlineFrameIndex: 0,
3664
3665
  };
3665
- const link = this.linkifierInternal.maybeLinkifyScriptLocation(this.target, null, url, startLine, options);
3666
+ const link = this.linkifierInternal.maybeLinkifyScriptLocation(
3667
+ this.target, null, url as Platform.DevToolsPath.UrlString, startLine, options);
3666
3668
  if (!link) {
3667
3669
  return;
3668
3670
  }
3669
3671
  this.appendElementRow(title, link);
3670
3672
  }
3671
3673
 
3672
- appendLocationRange(title: string, url: string, startLine: number, endLine?: number): void {
3674
+ appendLocationRange(title: string, url: Platform.DevToolsPath.UrlString, startLine: number, endLine?: number): void {
3673
3675
  if (!this.linkifierInternal || !this.target) {
3674
3676
  return;
3675
3677
  }