chrome-devtools-frontend 1.0.1603822 → 1.0.1605219

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 (89) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/Tests.js +23 -7
  3. package/front_end/core/host/AidaClient.ts +153 -525
  4. package/front_end/core/host/AidaClientTypes.ts +470 -0
  5. package/front_end/core/host/AidaGcaTranslation.ts +231 -122
  6. package/front_end/core/host/GcaClient.ts +112 -0
  7. package/front_end/core/host/GcaTypes.ts +107 -155
  8. package/front_end/core/host/UserMetrics.ts +0 -1
  9. package/front_end/core/host/host.ts +2 -0
  10. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
  11. package/front_end/core/root/ExperimentNames.ts +0 -1
  12. package/front_end/core/root/Runtime.ts +5 -0
  13. package/front_end/core/sdk/AutofillModel.ts +3 -2
  14. package/front_end/core/sdk/CSSModel.ts +3 -4
  15. package/front_end/core/sdk/CSSProperty.ts +1 -1
  16. package/front_end/core/sdk/ConsoleModel.ts +15 -13
  17. package/front_end/core/sdk/CookieModel.ts +5 -4
  18. package/front_end/core/sdk/DOMDebuggerModel.ts +20 -14
  19. package/front_end/core/sdk/DOMModel.ts +24 -22
  20. package/front_end/core/sdk/DebuggerModel.ts +21 -36
  21. package/front_end/core/sdk/EmulationModel.ts +21 -23
  22. package/front_end/core/sdk/EventBreakpointsModel.ts +16 -6
  23. package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
  24. package/front_end/core/sdk/IsolateManager.ts +12 -7
  25. package/front_end/core/sdk/NetworkManager.ts +35 -28
  26. package/front_end/core/sdk/OverlayModel.ts +10 -10
  27. package/front_end/core/sdk/PreloadingModel.ts +3 -4
  28. package/front_end/core/sdk/ServiceWorkerManager.ts +2 -3
  29. package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
  30. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
  31. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
  32. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
  33. package/front_end/entrypoints/main/MainImpl.ts +0 -4
  34. package/front_end/generated/InspectorBackendCommands.ts +4 -0
  35. package/front_end/generated/SupportedCSSProperties.js +68 -2
  36. package/front_end/generated/protocol-mapping.d.ts +7 -0
  37. package/front_end/generated/protocol-proxy-api.d.ts +14 -0
  38. package/front_end/generated/protocol.ts +22 -0
  39. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +31 -17
  40. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  41. package/front_end/models/bindings/TempFile.ts +1 -4
  42. package/front_end/models/emulation/DeviceModeModel.ts +21 -26
  43. package/front_end/models/extensions/ExtensionAPI.ts +1 -1
  44. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
  46. package/front_end/models/trace/insights/LCPDiscovery.ts +14 -6
  47. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +85 -31
  48. package/front_end/panels/ai_assistance/components/ChatMessage.ts +50 -40
  49. package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
  50. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +35 -7
  51. package/front_end/panels/ai_assistance/components/chatMessage.css +5 -1
  52. package/front_end/panels/application/ApplicationPanelSidebar.ts +6 -0
  53. package/front_end/panels/application/IndexedDBViews.ts +0 -9
  54. package/front_end/panels/application/WebMCPTreeElement.ts +35 -0
  55. package/front_end/panels/application/WebMCPView.ts +118 -0
  56. package/front_end/panels/application/application.ts +4 -0
  57. package/front_end/panels/application/webMCPView.css +65 -0
  58. package/front_end/panels/common/aiCodeCompletionSummaryToolbar.css +1 -1
  59. package/front_end/panels/console/consoleView.css +4 -0
  60. package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
  61. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +23 -2
  62. package/front_end/panels/elements/StylesSidebarPane.ts +85 -20
  63. package/front_end/panels/elements/elementsPanel.css +14 -0
  64. package/front_end/panels/elements/elementsTreeOutline.css +18 -0
  65. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  66. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
  67. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
  68. package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
  69. package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
  70. package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
  71. package/front_end/panels/recorder/components/recordingView.css +0 -6
  72. package/front_end/panels/sensors/SensorsView.ts +28 -61
  73. package/front_end/panels/timeline/EventsTimelineTreeView.ts +2 -2
  74. package/front_end/panels/timeline/ThirdPartyTreeView.ts +35 -36
  75. package/front_end/panels/timeline/TimelineDetailsView.ts +47 -41
  76. package/front_end/panels/timeline/TimelinePanel.ts +1 -3
  77. package/front_end/panels/timeline/TimelineTreeView.ts +13 -13
  78. package/front_end/panels/timeline/components/LiveMetricsView.ts +852 -824
  79. package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
  80. package/front_end/panels/timeline/thirdPartyTreeView.css +2 -2
  81. package/front_end/third_party/chromium/README.chromium +1 -1
  82. package/front_end/ui/components/buttons/button.css +2 -2
  83. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +0 -11
  84. package/front_end/ui/legacy/InspectorDrawerView.ts +206 -0
  85. package/front_end/ui/legacy/InspectorView.ts +41 -91
  86. package/front_end/ui/legacy/ViewManager.ts +14 -5
  87. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +5 -0
  88. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -1
  89. package/package.json +1 -1
@@ -1747,10 +1747,16 @@ export const generatedProperties = [
1747
1747
  },
1748
1748
  {
1749
1749
  "inherited": false,
1750
+ "keywords": [
1751
+ "overlap-join"
1752
+ ],
1750
1753
  "name": "column-rule-edge-inset-end"
1751
1754
  },
1752
1755
  {
1753
1756
  "inherited": false,
1757
+ "keywords": [
1758
+ "overlap-join"
1759
+ ],
1754
1760
  "name": "column-rule-edge-inset-start"
1755
1761
  },
1756
1762
  {
@@ -1785,10 +1791,16 @@ export const generatedProperties = [
1785
1791
  },
1786
1792
  {
1787
1793
  "inherited": false,
1794
+ "keywords": [
1795
+ "overlap-join"
1796
+ ],
1788
1797
  "name": "column-rule-interior-inset-end"
1789
1798
  },
1790
1799
  {
1791
1800
  "inherited": false,
1801
+ "keywords": [
1802
+ "overlap-join"
1803
+ ],
1792
1804
  "name": "column-rule-interior-inset-start"
1793
1805
  },
1794
1806
  {
@@ -2805,7 +2817,8 @@ export const generatedProperties = [
2805
2817
  "keywords": [
2806
2818
  "normal",
2807
2819
  "running",
2808
- "paused"
2820
+ "paused",
2821
+ "stopped"
2809
2822
  ],
2810
2823
  "name": "image-animation"
2811
2824
  },
@@ -3814,10 +3827,16 @@ export const generatedProperties = [
3814
3827
  },
3815
3828
  {
3816
3829
  "inherited": false,
3830
+ "keywords": [
3831
+ "overlap-join"
3832
+ ],
3817
3833
  "name": "row-rule-edge-inset-end"
3818
3834
  },
3819
3835
  {
3820
3836
  "inherited": false,
3837
+ "keywords": [
3838
+ "overlap-join"
3839
+ ],
3821
3840
  "name": "row-rule-edge-inset-start"
3822
3841
  },
3823
3842
  {
@@ -3852,10 +3871,16 @@ export const generatedProperties = [
3852
3871
  },
3853
3872
  {
3854
3873
  "inherited": false,
3874
+ "keywords": [
3875
+ "overlap-join"
3876
+ ],
3855
3877
  "name": "row-rule-interior-inset-end"
3856
3878
  },
3857
3879
  {
3858
3880
  "inherited": false,
3881
+ "keywords": [
3882
+ "overlap-join"
3883
+ ],
3859
3884
  "name": "row-rule-interior-inset-start"
3860
3885
  },
3861
3886
  {
@@ -5598,6 +5623,26 @@ export const generatedPropertyValues = {
5598
5623
  "currentcolor"
5599
5624
  ]
5600
5625
  },
5626
+ "column-rule-edge-inset-end": {
5627
+ "values": [
5628
+ "overlap-join"
5629
+ ]
5630
+ },
5631
+ "column-rule-edge-inset-start": {
5632
+ "values": [
5633
+ "overlap-join"
5634
+ ]
5635
+ },
5636
+ "column-rule-interior-inset-end": {
5637
+ "values": [
5638
+ "overlap-join"
5639
+ ]
5640
+ },
5641
+ "column-rule-interior-inset-start": {
5642
+ "values": [
5643
+ "overlap-join"
5644
+ ]
5645
+ },
5601
5646
  "column-rule-style": {
5602
5647
  "values": [
5603
5648
  "none",
@@ -6220,7 +6265,8 @@ export const generatedPropertyValues = {
6220
6265
  "values": [
6221
6266
  "normal",
6222
6267
  "running",
6223
- "paused"
6268
+ "paused",
6269
+ "stopped"
6224
6270
  ]
6225
6271
  },
6226
6272
  "image-rendering": {
@@ -6737,6 +6783,26 @@ export const generatedPropertyValues = {
6737
6783
  "currentcolor"
6738
6784
  ]
6739
6785
  },
6786
+ "row-rule-edge-inset-end": {
6787
+ "values": [
6788
+ "overlap-join"
6789
+ ]
6790
+ },
6791
+ "row-rule-edge-inset-start": {
6792
+ "values": [
6793
+ "overlap-join"
6794
+ ]
6795
+ },
6796
+ "row-rule-interior-inset-end": {
6797
+ "values": [
6798
+ "overlap-join"
6799
+ ]
6800
+ },
6801
+ "row-rule-interior-inset-start": {
6802
+ "values": [
6803
+ "overlap-join"
6804
+ ]
6805
+ },
6740
6806
  "row-rule-style": {
6741
6807
  "values": [
6742
6808
  "none",
@@ -1892,6 +1892,13 @@ export namespace ProtocolMapping {
1892
1892
  paramsType: [Protocol.Cast.StopCastingRequest];
1893
1893
  returnType: void;
1894
1894
  };
1895
+ /**
1896
+ * Returns all entries in the CrashReportContext across all frames in the page.
1897
+ */
1898
+ 'CrashReportContext.getEntries': {
1899
+ paramsType: [];
1900
+ returnType: Protocol.CrashReportContext.GetEntriesResponse;
1901
+ };
1895
1902
  /**
1896
1903
  * Collects class names for the node with given id and all of it's child nodes.
1897
1904
  */
@@ -38,6 +38,8 @@ declare namespace ProtocolProxyApi {
38
38
 
39
39
  Cast: CastApi;
40
40
 
41
+ CrashReportContext: CrashReportContextApi;
42
+
41
43
  DOM: DOMApi;
42
44
 
43
45
  DOMDebugger: DOMDebuggerApi;
@@ -149,6 +151,8 @@ declare namespace ProtocolProxyApi {
149
151
 
150
152
  Cast: CastDispatcher;
151
153
 
154
+ CrashReportContext: CrashReportContextDispatcher;
155
+
152
156
  DOM: DOMDispatcher;
153
157
 
154
158
  DOMDebugger: DOMDebuggerDispatcher;
@@ -1046,6 +1050,16 @@ declare namespace ProtocolProxyApi {
1046
1050
 
1047
1051
  }
1048
1052
 
1053
+ export interface CrashReportContextApi {
1054
+ /**
1055
+ * Returns all entries in the CrashReportContext across all frames in the page.
1056
+ */
1057
+ invoke_getEntries(): Promise<Protocol.CrashReportContext.GetEntriesResponse>;
1058
+
1059
+ }
1060
+ export interface CrashReportContextDispatcher {
1061
+ }
1062
+
1049
1063
  export interface DOMApi {
1050
1064
  /**
1051
1065
  * Collects class names for the node with given id and all of it's child nodes.
@@ -4525,6 +4525,28 @@ export namespace Cast {
4525
4525
  }
4526
4526
  }
4527
4527
 
4528
+ /**
4529
+ * This domain exposes the current state of the CrashReportContext API.
4530
+ */
4531
+ export namespace CrashReportContext {
4532
+
4533
+ /**
4534
+ * Key-value pair in CrashReportContext.
4535
+ */
4536
+ export interface CrashReportContextEntry {
4537
+ key: string;
4538
+ value: string;
4539
+ /**
4540
+ * The ID of the frame where the key-value pair was set.
4541
+ */
4542
+ frameId: Page.FrameId;
4543
+ }
4544
+
4545
+ export interface GetEntriesResponse extends ProtocolResponseWithError {
4546
+ entries: CrashReportContextEntry[];
4547
+ }
4548
+ }
4549
+
4528
4550
  /**
4529
4551
  * This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object
4530
4552
  * that has an `id`. This `id` can be used to get additional information on the Node, resolve it into
@@ -82,7 +82,7 @@ Your primary goal is to provide actionable advice to web developers about their
82
82
 
83
83
  You will be provided a summary of a trace: some performance metrics; the most critical network requests; a bottom-up call graph summary; and a brief overview of available insights. Each insight has information about potential performance issues with the page.
84
84
 
85
- Don't mention anything about an insight or the actual LCP element without first getting more data about it by calling \`getInsightDetails\`.
85
+ Always call getInsightDetails to gather more data on an insight or the actual LCP element BEFORE mentioning any specific details about them.
86
86
 
87
87
  You have functions available to learn more about the trace. Use these to confirm hypotheses, or to further explore the trace when diagnosing performance issues.
88
88
 
@@ -105,23 +105,41 @@ Note: if the user asks a specific question about the trace (such as "What is my
105
105
 
106
106
  ### Step 1: Determine a performance problem to investigate
107
107
 
108
+ - If the trace summary indicates that the main performance metrics (LCP, INP, CLS) are all within good thresholds, acknowledge this to the user. In this case, let the user know that they can try recording a trace with mobile emulation and throttling options and show them how.
108
109
  - With help from the user, determine what performance problem to focus on.
109
- - If the user is not specific about what problem to investigate, help them by doing a investigation yourself. Present to the user options with 1-sentence summaries. Mention what performance metrics each option impacts. Call as many functions and confirm the data thoroughly: never present an option without being certain it is a real performance issue. Don't suggest solutions yet.
110
- - Rank the options from most impactful to least impactful, and present them to the user in that order.
111
- - Don't present more than 2 options.
110
+ - If the user is not specific about what problem to investigate, help them by doing a investigation yourself focus on performance improvements for better LCP, INP and CLS. Present to the user options with 1-sentence summaries. Mention what performance metrics each option impacts. Call as many functions and confirm the data thoroughly: never present an option without being certain it is a real performance issue.
111
+ - Focus on identifying the problem in Step 1 and save solution suggestions for Step 2.
112
112
  - Once a performance problem has been identified for investigation, move on to step 2.
113
113
 
114
+ #### Response Structure
115
+
116
+ - Rank the options from most impactful to least impactful, and present them to the user in that order.
117
+ - Limit the number of performance problem options presented to the user to a maximum of 2.
118
+
114
119
  ### Step 2: Suggest solutions
115
120
 
116
121
  - Suggest solutions to remedy the identified performance problem. Be as specific as possible, using data from the trace via the provided functions to back up everything you say. You should prefer specific solutions, but absent any specific solution you may suggest general solutions (such as from an insight's documentation links).
117
122
  - If you are unsure, be honest and present information that can be helpful for further investigation.
118
123
  - A good first step to discover solutions is to consider the insights, but you should also validate all potential advice by analyzing the trace until you are confident about the root cause of a performance issue.
119
124
 
125
+ #### Response Structure
126
+
127
+ - If available, point out the root cause(s) of the problem.
128
+ - Example: "**Root Cause**: The page is slow because of [reason]."
129
+ - Example: "**Root Causes**:"
130
+ - [Reason 1]
131
+ - [Reason 2]
132
+ - if applicable, list actionable solution suggestion(s) in order of impact:
133
+ - Example: "**Suggestion**: [Suggestion 1]
134
+ - Example: "**Suggestions**:"
135
+ - [Suggestion 1]
136
+ - [Suggestion 2]
137
+
120
138
  ## Guidelines
121
139
 
122
140
  - Use the provided functions to get detailed performance data. Prioritize functions that provide context relevant to the performance issue being investigated.
123
141
  - Before finalizing your advice, look over it and validate using any relevant functions. If something seems off, refine the advice before giving it to the user.
124
- - Do not rely on assumptions or incomplete information. Use the provided functions to get more data when needed.
142
+ - Base your analysis and advice solely on the data retrieved through the provided functions. Always use the provided functions to gather sufficient data when needed.
125
143
  - Use the track summary functions to get high-level detail about portions of the trace. For the \`bounds\` parameter, default to using the bounds of the trace. Never specifically ask the user for a bounds. You can use more narrow bounds (such as the bounds relevant to a specific insight) when appropriate. Narrow the bounds given functions when possible.
126
144
  - Use \`getEventByKey\` to get data on a specific trace event. This is great for root-cause analysis or validating any assumptions.
127
145
  - Provide clear, actionable recommendations. Avoid technical jargon unless necessary, and explain any technical terms used.
@@ -147,15 +165,6 @@ Adhere to the following critical requirements:
147
165
  - If asked about sensitive topics (religion, race, politics, sexuality, gender, etc.), respond with: "My expertise is limited to website performance analysis. I cannot provide information on that topic.".
148
166
  - Do not provide answers on non-web-development topics, such as legal, financial, medical, or personal advice.
149
167
  - Use the precision of Strunk & White, the brevity of Hemingway, and the simple clarity of Vonnegut. Don't add repeated information, and keep the whole answer short.
150
-
151
- ## Response Structure
152
-
153
- - If available, point out the root cause of the problem. It may be a bullet point list.
154
- - Example: "**Root Cause**: The page is slow because of [reason]."
155
- - if applicable, list actionable solution suggestion(s) in order of impact:
156
- - Example: "**Suggestions**:
157
- - [Suggestion 1]
158
- - [Suggestion 2]
159
168
  `;
160
169
  };
161
170
 
@@ -166,7 +175,7 @@ When referring to a trace event that has a corresponding \`eventKey\`, annotate
166
175
  - When referring to a URL for which you know the eventKey of: [https://www.example.com](#s-1827)
167
176
  - Never show the eventKey (like "eventKey: s-1852"); instead, use a markdown link as described above.
168
177
 
169
- When asking the user to make a choice between multiple options, output a list of choices at the end of your text response. The format is \`SUGGESTIONS: ["suggestion1", "suggestion2", "suggestion3"]\`. This MUST start on a newline, and be a single line.
178
+ When asking the user to make a choice between options, output a list of choices at the end of your text response. The format is \`SUGGESTIONS: ["suggestion1", "suggestion2", "suggestion3"]\`. This MUST start on a newline, and be a single line.
170
179
  `;
171
180
 
172
181
  const buildExtraPreambleWhenFreshTrace = (): string => {
@@ -231,8 +240,13 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
231
240
  }
232
241
 
233
242
  override getOrigin(): string {
234
- const {min, max} = this.#focus.parsedTrace.data.Meta.traceBounds;
235
- return `trace-${min}-${max}`;
243
+ try {
244
+ const url = new URL(this.#focus.parsedTrace.data.Meta.mainFrameURL);
245
+ return url.origin;
246
+ } catch {
247
+ const {min, max} = this.#focus.parsedTrace.data.Meta.traceBounds;
248
+ return `trace-${min}-${max}`;
249
+ }
236
250
  }
237
251
 
238
252
  override getItem(): AgentFocus {
@@ -226,7 +226,7 @@ Response headers
226
226
 
227
227
  The result of the checks for this insight are:
228
228
  - fetchpriority=high should be applied: FAILED
229
- - lazy load not applied: PASSED
229
+ - LCP resources should not use loading=lazy: PASSED
230
230
  - Request is discoverable in initial document: PASSED
231
231
 
232
232
  ## Estimated savings: none
@@ -7,10 +7,7 @@ import * as Common from '../../core/common/common.js';
7
7
  import {ChunkedFileReader, type ChunkedReader} from './FileUtils.js';
8
8
 
9
9
  export class TempFile {
10
- #lastBlob: Blob|null;
11
- constructor() {
12
- this.#lastBlob = null;
13
- }
10
+ #lastBlob: Blob|null = null;
14
11
 
15
12
  write(pieces: Array<string|Blob>): void {
16
13
  if (this.#lastBlob) {
@@ -795,35 +795,30 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
795
795
  overlayModel.setShowViewportSizeOnResize(false);
796
796
  }
797
797
 
798
- const screenshot = await screenCaptureModel.captureScreenshot(
799
- Protocol.Page.CaptureScreenshotRequestFormat.Png, 100, screenshotMode, clip);
800
-
801
- const deviceMetrics: Protocol.Page.SetDeviceMetricsOverrideRequest = {
802
- width: 0,
803
- height: 0,
804
- deviceScaleFactor: 0,
805
- mobile: false,
806
- };
807
- if (fullSize && this.#emulationModel) {
808
- if (this.#device && this.#mode) {
809
- const orientation = this.#device.orientationByName(this.#mode.orientation);
810
- deviceMetrics.width = orientation.width;
811
- deviceMetrics.height = orientation.height;
812
- const dispFeature = this.getDisplayFeature();
813
- if (dispFeature) {
814
- // @ts-expect-error: displayFeature isn't in protocol.ts but is an
815
- // experimental flag:
816
- // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride
817
- deviceMetrics.displayFeature = dispFeature;
818
- }
819
- } else {
820
- deviceMetrics.width = 0;
821
- deviceMetrics.height = 0;
798
+ if (this.#emulationModel && this.#device && this.#mode) {
799
+ const orientation = this.#device.orientationByName(this.#mode.orientation);
800
+ const deviceMetrics: Protocol.Emulation.SetDeviceMetricsOverrideRequest = {
801
+ width: orientation.width,
802
+ height: orientation.height,
803
+ deviceScaleFactor: this.#device.deviceScaleFactor,
804
+ mobile: this.isMobile(),
805
+ };
806
+ const dispFeature = this.getDisplayFeature();
807
+ if (dispFeature) {
808
+ deviceMetrics.displayFeature = dispFeature;
822
809
  }
823
810
  await this.#emulationModel.emulateDevice(deviceMetrics);
824
811
  }
825
- this.calculateAndEmulate(false);
826
- return screenshot;
812
+
813
+ try {
814
+ const screenshot = await screenCaptureModel.captureScreenshot(
815
+ Protocol.Page.CaptureScreenshotRequestFormat.Png, 100, screenshotMode, clip);
816
+ return screenshot;
817
+ } finally {
818
+ await this.#emulationModel?.emulateDevice(null);
819
+ overlayModel?.setShowViewportSizeOnResize(this.#type === Type.None);
820
+ this.calculateAndEmulate(false);
821
+ }
827
822
  }
828
823
 
829
824
  private applyTouch(touchEnabled: boolean, mobile: boolean): void {
@@ -616,7 +616,7 @@ self.injectedExtensionAPI = function(
616
616
  entries[i].__proto__ = new (Constructor(Request))(entries[i]._requestId as number);
617
617
  delete entries[i]._requestId;
618
618
  }
619
- callback?.(result as Object);
619
+ callback?.(result);
620
620
  }
621
621
  extensionServer.sendRequest({command: PrivateAPI.Commands.GetHAR}, callback && callbackWrapper);
622
622
  },
@@ -71,13 +71,19 @@ export class Node {
71
71
  retainedSize: number;
72
72
  selfSize: number;
73
73
  type: string;
74
- canBeQueried: boolean;
75
- detachedDOMTreeNode: boolean;
76
- isAddedNotRemoved: boolean|null;
77
- ignored: boolean;
74
+ canBeQueried = false;
75
+ detachedDOMTreeNode = false;
76
+ isAddedNotRemoved: boolean|null = null;
77
+ ignored = false;
78
78
  constructor(
79
- id: number, name: string, distance: number, nodeIndex: number, retainedSize: number, selfSize: number,
80
- type: string) {
79
+ id: number,
80
+ name: string,
81
+ distance: number,
82
+ nodeIndex: number,
83
+ retainedSize: number,
84
+ selfSize: number,
85
+ type: string,
86
+ ) {
81
87
  this.id = id;
82
88
  this.name = name;
83
89
  this.distance = distance;
@@ -85,11 +91,6 @@ export class Node {
85
91
  this.retainedSize = retainedSize;
86
92
  this.selfSize = selfSize;
87
93
  this.type = type;
88
-
89
- this.canBeQueried = false;
90
- this.detachedDOMTreeNode = false;
91
- this.isAddedNotRemoved = null;
92
- this.ignored = false;
93
94
  }
94
95
  }
95
96
 
@@ -98,13 +99,12 @@ export class Edge {
98
99
  node: Node;
99
100
  type: string;
100
101
  edgeIndex: number;
101
- isAddedNotRemoved: boolean|null;
102
+ isAddedNotRemoved: boolean|null = null;
102
103
  constructor(name: string, node: Node, type: string, edgeIndex: number) {
103
104
  this.name = name;
104
105
  this.node = node;
105
106
  this.type = type;
106
107
  this.edgeIndex = edgeIndex;
107
- this.isAddedNotRemoved = null;
108
108
  }
109
109
  }
110
110
 
@@ -132,37 +132,19 @@ export class AggregateForDiff {
132
132
 
133
133
  export class Diff {
134
134
  name: string;
135
- addedCount: number;
136
- removedCount: number;
137
- addedSize: number;
138
- removedSize: number;
139
- deletedIndexes: number[];
140
- addedIndexes: number[];
135
+ addedCount = 0;
136
+ removedCount = 0;
137
+ addedSize = 0;
138
+ removedSize = 0;
139
+ deletedIndexes: number[] = [];
140
+ addedIndexes: number[] = [];
141
141
  countDelta!: number;
142
142
  sizeDelta!: number;
143
143
  constructor(name: string) {
144
144
  this.name = name;
145
- this.addedCount = 0;
146
- this.removedCount = 0;
147
- this.addedSize = 0;
148
- this.removedSize = 0;
149
- this.deletedIndexes = [];
150
- this.addedIndexes = [];
151
145
  }
152
146
  }
153
147
 
154
- export class DiffForClass {
155
- name!: string;
156
- addedCount!: number;
157
- removedCount!: number;
158
- addedSize!: number;
159
- removedSize!: number;
160
- deletedIndexes!: number[];
161
- addedIndexes!: number[];
162
- countDelta!: number;
163
- sizeDelta!: number;
164
- }
165
-
166
148
  export class ComparatorConfig {
167
149
  fieldName1: string;
168
150
  ascending1: boolean;
@@ -176,16 +158,16 @@ export class ComparatorConfig {
176
158
  }
177
159
  }
178
160
 
179
- export class WorkerCommand {
180
- callId!: number;
181
- disposition!: string;
182
- objectId!: number;
183
- newObjectId!: number;
184
- methodName!: string;
161
+ export interface WorkerCommand {
162
+ callId: number;
163
+ disposition: string;
164
+ objectId: number;
165
+ newObjectId: number;
166
+ methodName: string;
185
167
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
186
168
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
187
- methodArguments!: any[];
188
- source!: string;
169
+ methodArguments: any[];
170
+ source: string;
189
171
  }
190
172
 
191
173
  export class ItemsRange {
@@ -244,8 +226,13 @@ export class SearchConfig {
244
226
  shouldJump: boolean;
245
227
  jumpBackward: boolean;
246
228
  constructor(
247
- query: string, caseSensitive: boolean, wholeWord: boolean, isRegex: boolean, shouldJump: boolean,
248
- jumpBackward: boolean) {
229
+ query: string,
230
+ caseSensitive: boolean,
231
+ wholeWord: boolean,
232
+ isRegex: boolean,
233
+ shouldJump: boolean,
234
+ jumpBackward: boolean,
235
+ ) {
249
236
  this.query = query;
250
237
  this.caseSensitive = caseSensitive;
251
238
  this.wholeWord = wholeWord;
@@ -6606,16 +6606,12 @@ export const NativeFunctions = [
6606
6606
  name: "replaceWithHTMLUnsafe",
6607
6607
  signatures: [["html","?options"]]
6608
6608
  },
6609
- {
6610
- name: "streamBeforeHTMLUnsafe",
6611
- signatures: [["?options"]]
6612
- },
6613
6609
  {
6614
6610
  name: "streamBeforeHTML",
6615
6611
  signatures: [["?options"]]
6616
6612
  },
6617
6613
  {
6618
- name: "streamAfterHTMLUnsafe",
6614
+ name: "streamBeforeHTMLUnsafe",
6619
6615
  signatures: [["?options"]]
6620
6616
  },
6621
6617
  {
@@ -6623,13 +6619,17 @@ export const NativeFunctions = [
6623
6619
  signatures: [["?options"]]
6624
6620
  },
6625
6621
  {
6626
- name: "streamReplaceWithHTMLUnsafe",
6622
+ name: "streamAfterHTMLUnsafe",
6627
6623
  signatures: [["?options"]]
6628
6624
  },
6629
6625
  {
6630
6626
  name: "streamReplaceWithHTML",
6631
6627
  signatures: [["?options"]]
6632
6628
  },
6629
+ {
6630
+ name: "streamReplaceWithHTMLUnsafe",
6631
+ signatures: [["?options"]]
6632
+ },
6633
6633
  {
6634
6634
  name: "Comment",
6635
6635
  signatures: [["?data"]]
@@ -41,14 +41,18 @@ export const UIStrings = {
41
41
  * @description Text to tell the user that a fetchpriority property value of "high" should be applied to the LCP request.
42
42
  */
43
43
  fetchPriorityShouldBeApplied: 'fetchpriority=high should be applied',
44
+ /**
45
+ * @description Text to tell the user that a fetchpriority property value of "high" should be applied to the preload request that loads the LCP image.
46
+ */
47
+ fetchPriorityShouldBeAppliedToImagePreload: 'fetchpriority=high should be applied to the image preload request',
44
48
  /**
45
49
  * @description Text to tell the user that the LCP request is discoverable in the initial document.
46
50
  */
47
51
  requestDiscoverable: 'Request is discoverable in initial document',
48
52
  /**
49
- * @description Text to tell the user that the LCP request does not have the lazy load property applied.
53
+ * @description Text to tell the user that LCP resources should avoid using loading=lazy.
50
54
  */
51
- lazyLoadNotApplied: 'lazy load not applied',
55
+ lazyLoadNotApplied: 'LCP resources should not use loading=lazy',
52
56
  /**
53
57
  * @description Text status indicating that the the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
54
58
  */
@@ -133,12 +137,17 @@ export function generateInsight(
133
137
  lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
134
138
  const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
135
139
 
136
- const imageLoadingAttr = lcpEvent.args.data?.loadingAttr;
137
140
  const imageFetchPriorityHint = lcpRequest?.args.data.fetchPriorityHint;
138
141
  // This is the earliest discovery time an LCP request could have - it's TTFB (as an absolute timestamp).
139
142
  const earliestDiscoveryTime = calculateDocFirstByteTs(docRequest);
140
143
 
141
144
  const priorityHintFound = imageFetchPriorityHint === 'high';
145
+ const missingPriorityHintLabel = lcpRequest.args.data.isLinkPreload ?
146
+ i18nString(UIStrings.fetchPriorityShouldBeAppliedToImagePreload) :
147
+ i18nString(UIStrings.fetchPriorityShouldBeApplied);
148
+ // A lazy-loaded LCP image can still be eagerly loaded when its request is
149
+ // initiated by a preload.
150
+ const lcpNotLazyLoaded = lcpEvent.args.data?.loadingAttr !== 'lazy' || lcpRequest.args.data.isLinkPreload;
142
151
 
143
152
  return finalize({
144
153
  lcpEvent,
@@ -146,12 +155,11 @@ export function generateInsight(
146
155
  earliestDiscoveryTimeTs: earliestDiscoveryTime ? Types.Timing.Micro(earliestDiscoveryTime) : undefined,
147
156
  checklist: {
148
157
  priorityHinted: {
149
- label: priorityHintFound ? i18nString(UIStrings.fetchPriorityApplied) :
150
- i18nString(UIStrings.fetchPriorityShouldBeApplied),
158
+ label: priorityHintFound ? i18nString(UIStrings.fetchPriorityApplied) : missingPriorityHintLabel,
151
159
  value: priorityHintFound
152
160
  },
153
161
  requestDiscoverable: {label: i18nString(UIStrings.requestDiscoverable), value: imgPreloadedOrFoundInHTML},
154
- eagerlyLoaded: {label: i18nString(UIStrings.lazyLoadNotApplied), value: imageLoadingAttr !== 'lazy'},
162
+ eagerlyLoaded: {label: i18nString(UIStrings.lazyLoadNotApplied), value: lcpNotLazyLoaded},
155
163
  },
156
164
  });
157
165
  }