chrome-devtools-frontend 1.0.1681091 → 1.0.1682249

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 (208) hide show
  1. package/eslint.config.mjs +8 -3
  2. package/front_end/core/sdk/ConsoleModel.ts +1 -1
  3. package/front_end/core/sdk/DOMModel.ts +8 -0
  4. package/front_end/core/sdk/NetworkManager.ts +9 -4
  5. package/front_end/core/sdk/OverlayModel.ts +3 -2
  6. package/front_end/core/sdk/PreloadingModel.ts +44 -22
  7. package/front_end/core/sdk/RemoteObject.ts +4 -1
  8. package/front_end/core/sdk/RuntimeModel.ts +5 -5
  9. package/front_end/core/sdk/SDKSettings.ts +19 -0
  10. package/front_end/core/sdk/sdk.ts +2 -0
  11. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -1
  12. package/front_end/entrypoints/inspector_main/InspectorMain.ts +3 -1
  13. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -5
  14. package/front_end/entrypoints/main/MainImpl.ts +9 -10
  15. package/front_end/entrypoints/main/main-meta.ts +82 -0
  16. package/front_end/entrypoints/shell/shell.ts +0 -5
  17. package/front_end/entrypoints/trace_app/trace_app.ts +0 -5
  18. package/front_end/generated/InspectorBackendCommands.ts +2 -0
  19. package/front_end/generated/protocol-mapping.d.ts +16 -0
  20. package/front_end/generated/protocol-proxy-api.d.ts +12 -0
  21. package/front_end/generated/protocol.ts +12 -0
  22. package/front_end/models/ai_assistance/ExtensionScope.ts +11 -12
  23. package/front_end/models/ai_assistance/agents/AiAgent.ts +1 -1
  24. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +2 -1
  25. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +1 -1
  26. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -1
  27. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +2 -1
  28. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +8 -8
  29. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
  30. package/front_end/models/ai_code_completion/debug.ts +6 -3
  31. package/front_end/models/ai_code_generation/debug.ts +6 -3
  32. package/front_end/models/badges/UserBadges.ts +9 -2
  33. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +1 -0
  34. package/front_end/models/emulation/DeviceModeModel.ts +16 -27
  35. package/front_end/models/emulation/EmulatedDevices.ts +30 -125
  36. package/front_end/models/extensions/ExtensionAPI.ts +34 -23
  37. package/front_end/models/formatter/ScriptFormatter.ts +1 -0
  38. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  39. package/front_end/models/live-metrics/web-vitals-injected/spec/spec.ts +4 -4
  40. package/front_end/models/logs/NetworkLog.ts +11 -4
  41. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +4 -2
  42. package/front_end/models/persistence/NetworkPersistenceManager.ts +7 -1
  43. package/front_end/models/stack_trace/StackTraceImpl.ts +1 -0
  44. package/front_end/models/trace/Name.ts +5 -5
  45. package/front_end/models/trace/Styles.ts +115 -115
  46. package/front_end/models/trace/extras/TraceTree.ts +2 -1
  47. package/front_end/models/trace/helpers/Network.ts +4 -1
  48. package/front_end/models/trace/insights/CLSCulprits.ts +4 -2
  49. package/front_end/models/trace/insights/CharacterSet.ts +3 -3
  50. package/front_end/models/trace/insights/DOMSize.ts +1 -1
  51. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +6 -2
  52. package/front_end/models/trace/insights/FontDisplay.ts +9 -3
  53. package/front_end/models/trace/insights/ForcedReflow.ts +4 -4
  54. package/front_end/models/trace/insights/INPBreakdown.ts +3 -4
  55. package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
  56. package/front_end/models/trace/insights/LCPBreakdown.ts +1 -1
  57. package/front_end/models/trace/insights/LCPDiscovery.ts +5 -5
  58. package/front_end/models/trace/insights/LegacyJavaScript.ts +7 -3
  59. package/front_end/models/trace/insights/ModernHTTP.ts +3 -3
  60. package/front_end/models/trace/insights/NetworkDependencyTree.ts +13 -9
  61. package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
  62. package/front_end/models/trace/insights/SlowCSSSelector.ts +29 -25
  63. package/front_end/models/trace/insights/ThirdParties.ts +13 -5
  64. package/front_end/models/trace/insights/Viewport.ts +4 -2
  65. package/front_end/models/workspace/IgnoreListManager.ts +53 -17
  66. package/front_end/panels/accessibility/ARIAAttributesView.ts +11 -2
  67. package/front_end/panels/ai_assistance/components/ChatMessage.ts +67 -53
  68. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
  69. package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +2 -2
  70. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +5 -5
  71. package/front_end/panels/animation/AnimationTimeline.ts +2 -0
  72. package/front_end/panels/application/ServiceWorkersView.ts +1 -1
  73. package/front_end/panels/application/StorageView.ts +2 -0
  74. package/front_end/panels/application/preloading/PreloadingView.ts +9 -3
  75. package/front_end/panels/application/preloading/components/components.ts +2 -0
  76. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +10 -11
  77. package/front_end/panels/changes/CombinedDiffView.ts +1 -1
  78. package/front_end/panels/common/BadgeNotification.ts +1 -1
  79. package/front_end/panels/common/ExtensionPanel.ts +12 -7
  80. package/front_end/panels/common/ExtensionServer.ts +85 -26
  81. package/front_end/panels/common/GdpSignUpDialog.ts +1 -1
  82. package/front_end/panels/console/ConsoleView.ts +2 -1
  83. package/front_end/panels/console/ConsoleViewMessage.ts +3 -2
  84. package/front_end/panels/console/console-meta.ts +9 -0
  85. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +9 -4
  86. package/front_end/panels/elements/CSSRuleValidator.ts +12 -12
  87. package/front_end/panels/elements/CSSSpecificityBreakdown.ts +1 -1
  88. package/front_end/panels/elements/ClassesPaneWidget.ts +6 -6
  89. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +1 -1
  90. package/front_end/panels/elements/ComputedStyleWidget.ts +4 -5
  91. package/front_end/panels/elements/DOMTreeContextMenu.ts +3 -6
  92. package/front_end/panels/elements/ElementIssueUtils.ts +20 -20
  93. package/front_end/panels/elements/ElementStatePaneWidget.ts +9 -6
  94. package/front_end/panels/elements/ElementsPanel.ts +10 -10
  95. package/front_end/panels/elements/ElementsTreeElement.ts +35 -29
  96. package/front_end/panels/elements/ElementsTreeOutline.ts +5 -20
  97. package/front_end/panels/elements/EventListenersWidget.ts +18 -19
  98. package/front_end/panels/elements/LayersWidget.ts +4 -4
  99. package/front_end/panels/elements/LayoutPane.ts +11 -11
  100. package/front_end/panels/elements/MarkerDecorator.ts +3 -3
  101. package/front_end/panels/elements/PlatformFontsWidget.ts +8 -8
  102. package/front_end/panels/elements/PropertiesWidget.ts +4 -4
  103. package/front_end/panels/elements/PropertyRenderer.ts +2 -2
  104. package/front_end/panels/elements/ShortcutTreeElement.ts +1 -1
  105. package/front_end/panels/elements/StylePropertiesSection.ts +14 -14
  106. package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -21
  107. package/front_end/panels/elements/StylesSidebarPane.ts +12 -13
  108. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +1 -1
  109. package/front_end/panels/elements/components/CSSHintDetailsView.ts +1 -1
  110. package/front_end/panels/elements/components/CSSVariableValueView.ts +3 -3
  111. package/front_end/panels/elements/components/ElementsBreadcrumbsUtils.ts +2 -2
  112. package/front_end/panels/elements/components/ElementsTreeExpandButton.ts +1 -1
  113. package/front_end/panels/elements/elements-meta.ts +13 -13
  114. package/front_end/panels/issues/AffectedCookiesView.ts +2 -0
  115. package/front_end/panels/issues/AffectedElementsView.ts +5 -0
  116. package/front_end/panels/issues/IssueView.ts +12 -8
  117. package/front_end/panels/layer_viewer/LayerDetailsView.ts +11 -7
  118. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +2 -0
  119. package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +1 -1
  120. package/front_end/panels/media/PlayerPropertiesView.ts +309 -416
  121. package/front_end/panels/media/playerPropertiesView.css +1 -1
  122. package/front_end/panels/network/NetworkLogView.ts +5 -2
  123. package/front_end/panels/network/NetworkOverview.ts +11 -5
  124. package/front_end/panels/network/NetworkPanel.ts +4 -2
  125. package/front_end/panels/network/NetworkWaterfallColumn.ts +16 -3
  126. package/front_end/panels/network/RequestHeadersView.ts +4 -4
  127. package/front_end/panels/network/components/ResponseHeaderSection.ts +7 -4
  128. package/front_end/panels/network/network-meta.ts +63 -0
  129. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
  130. package/front_end/panels/recorder/RecordingView.ts +89 -73
  131. package/front_end/panels/recorder/ReplaySection.ts +59 -40
  132. package/front_end/panels/recorder/injected/injected.ts +4 -0
  133. package/front_end/panels/security/SecurityPanel.ts +5 -6
  134. package/front_end/panels/security/SecurityPanelSidebar.ts +244 -204
  135. package/front_end/panels/security/security.ts +0 -4
  136. package/front_end/panels/settings/EditFileSystemView.ts +8 -7
  137. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +20 -14
  138. package/front_end/panels/settings/components/SyncSection.ts +1 -1
  139. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +0 -3
  140. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +10 -11
  141. package/front_end/panels/sources/NavigatorView.ts +6 -2
  142. package/front_end/panels/sources/SourcesNavigator.ts +8 -4
  143. package/front_end/panels/sources/SourcesPanel.ts +4 -2
  144. package/front_end/panels/sources/SourcesSearchScope.ts +3 -1
  145. package/front_end/panels/sources/UISourceCodeFrame.ts +2 -2
  146. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +3 -3
  147. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +5 -5
  148. package/front_end/panels/timeline/components/CWVMetrics.ts +1 -2
  149. package/front_end/panels/timeline/components/IgnoreListSetting.ts +5 -5
  150. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +2 -3
  151. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  152. package/front_end/panels/timeline/components/Sidebar.ts +3 -3
  153. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -2
  154. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -1
  155. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +1 -2
  156. package/front_end/panels/timeline/components/insights/Cache.ts +1 -2
  157. package/front_end/panels/timeline/components/insights/CharacterSet.ts +1 -2
  158. package/front_end/panels/timeline/components/insights/DOMSize.ts +1 -2
  159. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +2 -2
  160. package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +2 -2
  161. package/front_end/panels/timeline/components/insights/FontDisplay.ts +1 -2
  162. package/front_end/panels/timeline/components/insights/ForcedReflow.ts +1 -2
  163. package/front_end/panels/timeline/components/insights/INPBreakdown.ts +1 -2
  164. package/front_end/panels/timeline/components/insights/ImageDelivery.ts +1 -2
  165. package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +13 -13
  166. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +1 -2
  167. package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +4 -4
  168. package/front_end/panels/timeline/components/insights/ModernHTTP.ts +1 -2
  169. package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +10 -8
  170. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +2 -2
  171. package/front_end/panels/timeline/components/insights/SidebarInsight.ts +3 -1
  172. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
  173. package/front_end/panels/timeline/components/insights/ThirdParties.ts +1 -2
  174. package/front_end/panels/timeline/components/insights/Viewport.ts +1 -2
  175. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -2
  176. package/front_end/panels/timeline/timeline.ts +0 -2
  177. package/front_end/panels/web_audio/WebAudioView.ts +14 -6
  178. package/front_end/panels/webauthn/WebauthnPane.ts +9 -9
  179. package/front_end/third_party/chromium/README.chromium +1 -1
  180. package/front_end/third_party/web-vitals/rebuild.sh +1 -1
  181. package/front_end/ui/components/diff_view/DiffView.ts +2 -1
  182. package/front_end/ui/components/report_view/ReportView.docs.ts +2 -2
  183. package/front_end/ui/components/text_editor/javascript.ts +12 -13
  184. package/front_end/ui/legacy/GlassPane.ts +38 -14
  185. package/front_end/ui/legacy/Treeoutline.ts +14 -3
  186. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +11 -11
  187. package/front_end/ui/legacy/components/color_picker/FormatPickerContextMenu.ts +1 -1
  188. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +19 -20
  189. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +1 -1
  190. package/front_end/ui/legacy/components/object_ui/JavaScriptREPL.ts +1 -1
  191. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -3
  192. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +185 -355
  193. package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +3 -8
  194. package/front_end/ui/legacy/components/utils/ImagePreview.ts +15 -16
  195. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +4 -4
  196. package/front_end/ui/legacy/components/utils/Linkifier.ts +8 -10
  197. package/front_end/ui/settings/InspectorMainSettings.ts +12 -0
  198. package/front_end/ui/settings/settings.ts +2 -0
  199. package/front_end/ui/visual_logging/KnownContextValues.ts +32 -0
  200. package/mcp/mcp.ts +0 -9
  201. package/package.json +1 -1
  202. package/front_end/core/sdk/sdk-meta.ts +0 -40
  203. package/front_end/models/badges/badges-meta.ts +0 -27
  204. package/front_end/models/logs/logs-meta.ts +0 -84
  205. package/front_end/models/persistence/persistence-meta.ts +0 -69
  206. package/front_end/models/workspace/workspace-meta.ts +0 -40
  207. package/front_end/panels/security/OriginTreeElement.ts +0 -60
  208. package/front_end/panels/security/SecurityPanelSidebarTreeElement.ts +0 -30
@@ -2744,6 +2744,18 @@ export namespace Browser {
2744
2744
  url: string;
2745
2745
  }
2746
2746
 
2747
+ export interface GetGlobalPrivacyControlResponse extends ProtocolResponseWithError {
2748
+ gpc: boolean;
2749
+ }
2750
+
2751
+ export interface SetGlobalPrivacyControlRequest {
2752
+ gpc: boolean;
2753
+ }
2754
+
2755
+ export interface SetGlobalPrivacyControlResponse extends ProtocolResponseWithError {
2756
+ gpc: boolean;
2757
+ }
2758
+
2747
2759
  /**
2748
2760
  * Fired when page is about to start a download.
2749
2761
  */
@@ -100,18 +100,17 @@ export class ExtensionScope {
100
100
  ): Promise<{
101
101
  object: SDK.RemoteObject.RemoteObject,
102
102
  }> {
103
- const response = await context.evaluate(
104
- {
105
- expression,
106
- replMode: true,
107
- includeCommandLineAPI: false,
108
- returnByValue,
109
- silent: false,
110
- generatePreview: false,
111
- allowUnsafeEvalBlockedByCSP: true,
112
- throwOnSideEffect: false,
113
- },
114
- /* userGesture */ false, /* awaitPromise */ true);
103
+ const response = await context.evaluateWithSelectedFrameFallback({
104
+ expression,
105
+ replMode: true,
106
+ includeCommandLineAPI: false,
107
+ returnByValue,
108
+ silent: false,
109
+ generatePreview: false,
110
+ allowUnsafeEvalBlockedByCSP: true,
111
+ throwOnSideEffect: false,
112
+ },
113
+ /* userGesture */ false, /* awaitPromise */ true);
115
114
 
116
115
  if (!response) {
117
116
  throw new Error('Response is not found');
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Host from '../../../core/host/host.js';
6
- import type {UrlString} from '../../../core/platform/DevToolsPath.js';
7
6
  import type * as Platform from '../../../core/platform/platform.js';
8
7
  import * as Root from '../../../core/root/root.js';
9
8
  import * as SDK from '../../../core/sdk/sdk.js';
@@ -16,6 +15,7 @@ import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiO
16
15
  import {debugLog, isStructuredLogEnabled} from '../debug.js';
17
16
  import type {ContextHandlerResult, DataHandlerResult} from '../tools/Tool.js';
18
17
 
18
+ type UrlString = Platform.DevToolsPath.UrlString;
19
19
  const MAX_SUGGESTION_LENGTH = 200;
20
20
 
21
21
  export const enum ResponseType {
@@ -6,7 +6,6 @@ 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
8
  import * as Root from '../../../core/root/root.js';
9
- import type {NetworkRequest} from '../../../core/sdk/NetworkRequest.js';
10
9
  import type * as SDK from '../../../core/sdk/sdk.js';
11
10
  import type * as LHModel from '../../lighthouse/lighthouse.js';
12
11
  import * as Logs from '../../logs/logs.js';
@@ -32,6 +31,8 @@ import {
32
31
  type RequestOptions,
33
32
  } from './AiAgent.js';
34
33
 
34
+ type NetworkRequest = SDK.NetworkRequest.NetworkRequest;
35
+
35
36
  const lockedString = i18n.i18n.lockedString;
36
37
  /**
37
38
  * WARNING: preamble defined in code is only used when userTier is
@@ -38,7 +38,7 @@ Content:
38
38
  "details": [
39
39
  {
40
40
  "title": "Trace details",
41
- "text": "Trace summary:\nURL: https://chromedevtools.github.io/performance-stories/lcp-large-image/index.html\nTrace bounds: {min: 658799706428µs, max: 658804825864µs}\nCPU throttling: 1x\nNetwork throttling: No throttling\n\n# Available insight sets\n\nThe following is a list of insight sets. An insight set covers a specific part of the trace, split by navigations. The insights within each insight set are specific to that part of the trace. Be sure to consider the insight set id and bounds when calling functions. If no specific insight set or navigation is mentioned, assume the user is referring to the first one.\n\n## insight set id: NAVIGATION_0\n\nURL: https://chromedevtools.github.io/performance-stories/lcp-large-image/index.html\nBounds: {min: 658799738257µs, max: 658804825864µs}\nMetrics (lab / observed):\n - LCP: 110 ms, event: (eventKey: r-2399, ts: 658799847880), nodeId: 10\n - LCP breakdown:\n - TTFB: 7 ms, bounds: {min: 658799738257µs, max: 658799745193µs}\n - Load delay: 34 ms, bounds: {min: 658799745193µs, max: 658799778937µs}\n - Load duration: 12 ms, bounds: {min: 658799778937µs, max: 658799791032µs}\n - Render delay: 57 ms, bounds: {min: 658799791032µs, max: 658799847880µs}\n - CLS: 0.00\nMetrics (field / real users): n/a – no data for this page in CrUX\nAvailable insights:\n - insight name: LCPBreakdown\n description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.\n relevant trace bounds: {min: 658799738257µs, max: 658799847880µs}\n example question: Help me optimize my LCP score\n example question: Which LCP subpart was most problematic?\n example question: What can I do to reduce the LCP time for this page load?\n - insight name: LCPDiscovery\n description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading\n relevant trace bounds: {min: 658799745193µs, max: 658799793683µs}\n example question: Suggest fixes to reduce my LCP\n example question: What can I do to reduce my LCP discovery time?\n example question: Why is LCP discovery time important?\n - insight name: RenderBlocking\n description: Requests are blocking the page’s initial render, which may delay LCP. [Deferring or inlining](https://developer.chrome.com/docs/performance/insights/render-blocking) can move these network requests out of the critical path.\n relevant trace bounds: {min: 658799775876µs, max: 658799791419µs}\n example question: Show me the most impactful render-blocking requests that I should focus on\n example question: How can I reduce the number of render-blocking requests?\n - insight name: Cache\n description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).\n relevant trace bounds: {min: 658799777502µs, max: 658799791419µs}\n example question: What caching strategies can I apply to improve my page performance?\n# Critical network requests\n\nnone\n\n# Main thread bottom-up summary\n\nThis is the bottom-up summary for the entire trace. Only the top 10 activities (sorted by self time) are shown. An activity is all the aggregated time spent on the same type of work. For example, it can be all the time spent in a specific JavaScript function, or all the time spent in a specific browser rendering stage (like layout, v8 compile, parsing html). \"Self time\" represents the aggregated time spent directly in an activity, across all occurrences. \"Total time\" represents the aggregated time spent in an activity or any of its children.\n\n- self: 57 ms, total: 79 ms, source: Task\n- self: 5 ms, total: 5 ms, source: Layout\n- self: 4 ms, total: 4 ms, source: Major GC\n- self: 3 ms, total: 3 ms, source: Parse HTML\n- self: 2 ms, total: 2 ms, source: Recalculate style\n- self: 2 ms, total: 2 ms, source: Commit\n- self: 1 ms, total: 1 ms, source: C++ GC\n- self: 1 ms, total: 1 ms, source: Paint\n\n# 3rd party summary\n\n- name: GitHub, main thread time: 3 ms, network transfer size: 0 B\n\n# Longest tasks\n\n- total time: 23 ms, event: (eventKey: r-617, ts: 658799757023)\n- total time: 12 ms, event: (eventKey: r-1571, ts: 658799793885)\n- total time: 11 ms, event: (eventKey: r-1891, ts: 658799811130)\n\nUser selected the LCPBreakdown insight.\n\n\n# User query\n\ntest"
41
+ "text": "Trace summary:\nURL: https://chromedevtools.github.io/performance-stories/lcp-large-image/index.html\nTrace bounds: {min: 658799706428µs, max: 658804825864µs}\nCPU throttling: 1x\nNetwork throttling: No throttling\n\n# Available insight sets\n\nThe following is a list of insight sets. An insight set covers a specific part of the trace, split by navigations. The insights within each insight set are specific to that part of the trace. Be sure to consider the insight set id and bounds when calling functions. If no specific insight set or navigation is mentioned, assume the user is referring to the first one.\n\n## insight set id: NAVIGATION_0\n\nURL: https://chromedevtools.github.io/performance-stories/lcp-large-image/index.html\nBounds: {min: 658799738257µs, max: 658804825864µs}\nMetrics (lab / observed):\n - LCP: 110 ms, event: (eventKey: r-2399, ts: 658799847880), nodeId: 10\n - LCP breakdown:\n - TTFB: 7 ms, bounds: {min: 658799738257µs, max: 658799745193µs}\n - Load delay: 34 ms, bounds: {min: 658799745193µs, max: 658799778937µs}\n - Load duration: 12 ms, bounds: {min: 658799778937µs, max: 658799791032µs}\n - Render delay: 57 ms, bounds: {min: 658799791032µs, max: 658799847880µs}\n - CLS: 0.00\nMetrics (field / real users): n/a – no data for this page in CrUX\nAvailable insights:\n - insight name: LCPBreakdown\n description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.\n relevant trace bounds: {min: 658799738257µs, max: 658799847880µs}\n example question: Help me optimize my LCP score\n example question: Which LCP subpart was most problematic?\n example question: What can I do to reduce the LCP time for this page load?\n - insight name: LCPDiscovery\n description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading.\n relevant trace bounds: {min: 658799745193µs, max: 658799793683µs}\n example question: Suggest fixes to reduce my LCP\n example question: What can I do to reduce my LCP discovery time?\n example question: Why is LCP discovery time important?\n - insight name: RenderBlocking\n description: Requests are blocking the page’s initial render, which may delay LCP. [Deferring or inlining](https://developer.chrome.com/docs/performance/insights/render-blocking) can move these network requests out of the critical path.\n relevant trace bounds: {min: 658799775876µs, max: 658799791419µs}\n example question: Show me the most impactful render-blocking requests that I should focus on\n example question: How can I reduce the number of render-blocking requests?\n - insight name: Cache\n description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).\n relevant trace bounds: {min: 658799777502µs, max: 658799791419µs}\n example question: What caching strategies can I apply to improve my page performance?\n# Critical network requests\n\nnone\n\n# Main thread bottom-up summary\n\nThis is the bottom-up summary for the entire trace. Only the top 10 activities (sorted by self time) are shown. An activity is all the aggregated time spent on the same type of work. For example, it can be all the time spent in a specific JavaScript function, or all the time spent in a specific browser rendering stage (like layout, v8 compile, parsing html). \"Self time\" represents the aggregated time spent directly in an activity, across all occurrences. \"Total time\" represents the aggregated time spent in an activity or any of its children.\n\n- self: 57 ms, total: 79 ms, source: Task\n- self: 5 ms, total: 5 ms, source: Layout\n- self: 4 ms, total: 4 ms, source: Major GC\n- self: 3 ms, total: 3 ms, source: Parse HTML\n- self: 2 ms, total: 2 ms, source: Recalculate style\n- self: 2 ms, total: 2 ms, source: Commit\n- self: 1 ms, total: 1 ms, source: C++ GC\n- self: 1 ms, total: 1 ms, source: Paint\n\n# 3rd party summary\n\n- name: GitHub, main thread time: 3 ms, network transfer size: 0 B\n\n# Longest tasks\n\n- total time: 23 ms, event: (eventKey: r-617, ts: 658799757023)\n- total time: 12 ms, event: (eventKey: r-1571, ts: 658799793885)\n- total time: 11 ms, event: (eventKey: r-1891, ts: 658799811130)\n\nUser selected the LCPBreakdown insight.\n\n\n# User query\n\ntest"
42
42
  }
43
43
  ],
44
44
  "widgets": [
@@ -5,7 +5,6 @@
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 {UrlString} from '../../../core/platform/DevToolsPath.js';
9
8
  import type * as Platform from '../../../core/platform/platform.js';
10
9
  import * as Root from '../../../core/root/root.js';
11
10
  import * as SDK from '../../../core/sdk/sdk.js';
@@ -36,6 +35,8 @@ import {
36
35
  type ToolResult,
37
36
  } from './AiAgent.js';
38
37
 
38
+ type UrlString = Platform.DevToolsPath.UrlString;
39
+
39
40
  const UIStringsNotTranslated = {
40
41
  /**
41
42
  * @description Shown when the agent is investigating network activity
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../../core/common/common.js';
6
- import type {UrlString} from '../../../core/platform/DevToolsPath.js';
7
6
  import type * as Platform from '../../../core/platform/platform.js';
8
7
  import * as SDK from '../../../core/sdk/sdk.js';
9
8
  import * as Tracing from '../../../services/tracing/tracing.js';
@@ -24,6 +23,8 @@ import {PerformanceTraceFormatter} from '../data_formatters/PerformanceTraceForm
24
23
  import type {AICallTree} from '../performance/AICallTree.js';
25
24
  import {AgentFocus} from '../performance/AIContext.js';
26
25
 
26
+ type UrlString = Platform.DevToolsPath.UrlString;
27
+
27
28
  /**
28
29
  * Labels used to identify specific periods or categories in the trace for getting main thread summary.
29
30
  * Supports hardcoded phases, dynamic navigation IDs (`NAVIGATION_X`), and insight models.
@@ -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
- - LCP resources should not use loading=lazy: PASSED
229
+ - LCP resources shouldn’t use loading=lazy: PASSED
230
230
  - Request is discoverable in initial document: PASSED
231
231
 
232
232
  ## Estimated savings: none
@@ -1052,7 +1052,7 @@ The network dependency tree checks revealed no problems, but optimization sugges
1052
1052
 
1053
1053
  No rendering tasks impacted by network dependencies.
1054
1054
 
1055
- no origins were preconnected.
1055
+ No origins were preconnected.
1056
1056
 
1057
1057
  ## Estimated savings: none
1058
1058
 
@@ -1085,7 +1085,7 @@ The following is the critical request chain:
1085
1085
  - http://localhost:8787/lcp-iframes/app.js (eventKey: s-7225, ts: 566782574106) (5,015 ms) (longest chain)
1086
1086
  - http://localhost:8787/lcp-iframes/app.css (eventKey: s-7213, ts: 566782573909) (5,010 ms)
1087
1087
 
1088
- no origins were preconnected.
1088
+ No origins were preconnected.
1089
1089
 
1090
1090
  ## Estimated savings: none
1091
1091
 
@@ -1097,13 +1097,13 @@ no origins were preconnected.
1097
1097
 
1098
1098
  Title: PerformanceInsightFormatter SlowCssSelector serializes correctly when there are no results
1099
1099
  Content:
1100
- ## Insight Title: CSS Selector costs
1100
+ ## Insight Title: CSS selector costs
1101
1101
 
1102
1102
  ## Insight Summary:
1103
1103
  This insight identifies CSS selectors that are slowing down your page's rendering performance.
1104
1104
 
1105
1105
  ## Detailed analysis:
1106
- No CSS selector data was found. CSS selector stats need to be enabled in the performance panel settings.
1106
+ No CSS selector data was found. CSS selector stats need to be enabled in the Performance panel settings.
1107
1107
 
1108
1108
  ## Estimated savings: none
1109
1109
 
@@ -1114,7 +1114,7 @@ No CSS selector data was found. CSS selector stats need to be enabled in the per
1114
1114
 
1115
1115
  Title: PerformanceInsightFormatter SlowCssSelector serializes the correct details when CSS selectors are found
1116
1116
  Content:
1117
- ## Insight Title: CSS Selector costs
1117
+ ## Insight Title: CSS selector costs
1118
1118
 
1119
1119
  ## Insight Summary:
1120
1120
  This insight identifies CSS selectors that are slowing down your page's rendering performance.
@@ -1130,7 +1130,7 @@ Elapsed time: 0 ms
1130
1130
  Match attempts: 2444
1131
1131
  Match count: 465
1132
1132
 
1133
- If Recalculate Style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/performance/insights/slow-css-selector) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.
1133
+ If recalculate style costs remain high, selector optimization can reduce them. [Optimize the selectors](https://developer.chrome.com/docs/performance/insights/slow-css-selector) with both high elapsed time and high slow-path %. Simpler selectors, fewer selectors, a smaller DOM, and a shallower DOM will all reduce matching costs.
1134
1134
 
1135
1135
  ## Estimated savings: none
1136
1136
 
@@ -1258,7 +1258,7 @@ The webpage is not optimized for mobile viewing.
1258
1258
 
1259
1259
  The viewport meta tag is missing.
1260
1260
 
1261
- Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.
1261
+ Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport isn’t optimized for mobile.
1262
1262
 
1263
1263
  ## Estimated savings: none
1264
1264
 
@@ -530,7 +530,7 @@ Available insights:
530
530
  relevant trace bounds: {min: 157423489126µs, max: 157426527569µs}
531
531
  example question: How do I optimize my network dependency tree?
532
532
  - insight name: ImageDelivery
533
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
533
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
534
534
  relevant trace bounds: {min: 157423794709µs, max: 157424082831µs}
535
535
  estimated metric savings: FCP 0 ms, LCP 0 ms
536
536
  estimated wasted bytes: 97.8 kB
@@ -552,7 +552,7 @@ Available insights:
552
552
  estimated wasted bytes: 847.4 kB
553
553
  example question: What caching strategies can I apply to improve my page performance?
554
554
  - insight name: LegacyJavaScript
555
- description: Polyfills and transforms enable older browsers to use new JavaScript features. However, many aren’t necessary for modern browsers. Consider modifying your JavaScript build process to not transpile [Baseline](https://web.dev/articles/baseline-and-polyfills) features, unless you know you must support older browsers. [Learn why most sites can deploy ES6+ code without transpiling](https://developer.chrome.com/docs/performance/insights/legacy-javascript)
555
+ description: Polyfills and transforms enable older browsers to use new JavaScript features. However, many aren’t necessary for modern browsers. Consider modifying your JavaScript build process to not transpile [Baseline](https://web.dev/articles/baseline-and-polyfills) features, unless you know you must support older browsers. [Learn why most sites can deploy ES6+ code without transpiling](https://developer.chrome.com/docs/performance/insights/legacy-javascript).
556
556
  relevant trace bounds: {min: 157423489126µs, max: 157426132225µs}
557
557
  estimated metric savings: FCP 0 ms, LCP 0 ms
558
558
  estimated wasted bytes: 126.9 kB
@@ -660,7 +660,7 @@ Available insights:
660
660
  estimated wasted bytes: 971.5 kB
661
661
  example question: What caching strategies can I apply to improve my page performance?
662
662
  - insight name: ImageDelivery
663
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
663
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
664
664
  relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
665
665
  estimated metric savings: FCP 0 ms, LCP 100 ms
666
666
  estimated wasted bytes: 2 MB
@@ -673,7 +673,7 @@ Available insights:
673
673
  example question: Which LCP subpart was most problematic?
674
674
  example question: What can I do to reduce the LCP time for this page load?
675
675
  - insight name: LCPDiscovery
676
- description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading
676
+ description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading.
677
677
  relevant trace bounds: {min: 59728656735µs, max: 59729209036µs}
678
678
  example question: Suggest fixes to reduce my LCP
679
679
  example question: What can I do to reduce my LCP discovery time?
@@ -691,7 +691,7 @@ Available insights:
691
691
  example question: How do I decrease the initial loading time of my page?
692
692
  example question: Did anything slow down the request for this document?
693
693
  - insight name: Viewport
694
- description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.
694
+ description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport isn’t optimized for mobile.
695
695
  relevant trace bounds: {min: 59728649746µs, max: 59734400108µs}
696
696
  estimated metric savings: INP 0 ms
697
697
  example question: How do I make sure my page is optimized for mobile viewing?
@@ -744,7 +744,7 @@ Available insights:
744
744
  estimated wasted bytes: 971.5 kB
745
745
  example question: What caching strategies can I apply to improve my page performance?
746
746
  - insight name: ImageDelivery
747
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery)
747
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
748
748
  relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
749
749
  estimated metric savings: FCP 0 ms, LCP 100 ms
750
750
  estimated wasted bytes: 2 MB
@@ -757,7 +757,7 @@ Available insights:
757
757
  example question: Which LCP subpart was most problematic?
758
758
  example question: What can I do to reduce the LCP time for this page load?
759
759
  - insight name: LCPDiscovery
760
- description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading
760
+ description: [Optimize LCP](https://developer.chrome.com/docs/performance/insights/lcp-discovery) by making the LCP image discoverable from the HTML immediately, and avoiding lazy-loading.
761
761
  relevant trace bounds: {min: 59728656735µs, max: 59729209036µs}
762
762
  example question: Suggest fixes to reduce my LCP
763
763
  example question: What can I do to reduce my LCP discovery time?
@@ -775,7 +775,7 @@ Available insights:
775
775
  example question: How do I decrease the initial loading time of my page?
776
776
  example question: Did anything slow down the request for this document?
777
777
  - insight name: Viewport
778
- description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport is not optimized for mobile.
778
+ description: Tap interactions may be [delayed by up to 300 ms](https://developer.chrome.com/docs/performance/insights/viewport) if the viewport isn’t optimized for mobile.
779
779
  relevant trace bounds: {min: 59728649746µs, max: 59734400108µs}
780
780
  estimated metric savings: INP 0 ms
781
781
  example question: How do I make sure my page is optimized for mobile viewing?
@@ -6,8 +6,10 @@
6
6
  * @file Local debugging utilities.
7
7
  */
8
8
 
9
+ import * as Platform from '../../core/platform/platform.js';
10
+
9
11
  export function isDebugMode(): boolean {
10
- return Boolean(localStorage.getItem('debugAiCodeCompletionEnabled'));
12
+ return Boolean(Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.getItem('debugAiCodeCompletionEnabled'));
11
13
  }
12
14
 
13
15
  export function debugLog(...log: unknown[]): void {
@@ -20,10 +22,11 @@ export function debugLog(...log: unknown[]): void {
20
22
  }
21
23
 
22
24
  function setDebugAiCodeCompletionEnabled(enabled: boolean): void {
25
+ const localStorage = Platform.HostRuntime.HOST_RUNTIME.getLocalStorage();
23
26
  if (enabled) {
24
- localStorage.setItem('debugAiCodeCompletionEnabled', 'true');
27
+ localStorage?.setItem('debugAiCodeCompletionEnabled', 'true');
25
28
  } else {
26
- localStorage.removeItem('debugAiCodeCompletionEnabled');
29
+ localStorage?.removeItem('debugAiCodeCompletionEnabled');
27
30
  }
28
31
  }
29
32
  // @ts-expect-error
@@ -6,8 +6,10 @@
6
6
  * @file Local debugging utilities.
7
7
  */
8
8
 
9
+ import * as Platform from '../../core/platform/platform.js';
10
+
9
11
  export function isDebugMode(): boolean {
10
- return Boolean(localStorage.getItem('debugAiCodeGenerationEnabled'));
12
+ return Boolean(Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.getItem('debugAiCodeGenerationEnabled'));
11
13
  }
12
14
 
13
15
  export function debugLog(...log: unknown[]): void {
@@ -20,10 +22,11 @@ export function debugLog(...log: unknown[]): void {
20
22
  }
21
23
 
22
24
  function setDebugAiCodeGenerationEnabled(enabled: boolean): void {
25
+ const localStorage = Platform.HostRuntime.HOST_RUNTIME.getLocalStorage();
23
26
  if (enabled) {
24
- localStorage.setItem('debugAiCodeGenerationEnabled', 'true');
27
+ localStorage?.setItem('debugAiCodeGenerationEnabled', 'true');
25
28
  } else {
26
- localStorage.removeItem('debugAiCodeGenerationEnabled');
29
+ localStorage?.removeItem('debugAiCodeGenerationEnabled');
27
30
  }
28
31
  }
29
32
  // @ts-expect-error
@@ -13,6 +13,13 @@ import {DOMDetectiveBadge} from './DOMDetectiveBadge.js';
13
13
  import {SpeedsterBadge} from './SpeedsterBadge.js';
14
14
  import {StarterBadge} from './StarterBadge.js';
15
15
 
16
+ export const receiveGdpBadgesSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
17
+ name: 'receive-gdp-badges',
18
+ type: Common.Settings.SettingType.BOOLEAN,
19
+ defaultValue: false,
20
+ storageType: Common.Settings.SettingStorageType.SYNCED,
21
+ };
22
+
16
23
  type BadgeClass = new (badgeContext: BadgeContext) => Badge;
17
24
 
18
25
  export const enum BadgeTriggerReason {
@@ -36,7 +43,7 @@ const DELAY_BEFORE_TRIGGER = 1500;
36
43
  export class UserBadges extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
37
44
  readonly #badgeActionEventTarget = new Common.ObjectWrapper.ObjectWrapper<BadgeActionEvents>();
38
45
 
39
- #receiveBadgesSetting: Common.Settings.Setting<Boolean>;
46
+ #receiveBadgesSetting: Common.Settings.Setting<boolean>;
40
47
  #allBadges: Badge[];
41
48
 
42
49
  #starterBadgeSnoozeCount: Common.Settings.Setting<number>;
@@ -66,7 +73,7 @@ export class UserBadges extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
66
73
  this.#gdpClient = gdpClient;
67
74
  this.#inspectorFrontendHost = inspectorFrontendHost;
68
75
 
69
- this.#receiveBadgesSetting = this.#settings.moduleSetting('receive-gdp-badges');
76
+ this.#receiveBadgesSetting = this.#settings.resolve(receiveGdpBadgesSettingDescriptor);
70
77
  if (!Host.GdpClient.isBadgesEnabled()) {
71
78
  this.#receiveBadgesSetting.set(false);
72
79
  }
@@ -11,6 +11,7 @@ import * as SDK from '../../core/sdk/sdk.js';
11
11
  import * as TextUtils from '../../core/text_utils/text_utils.js';
12
12
  import * as Protocol from '../../generated/protocol.js';
13
13
  import * as StackTrace from '../stack_trace/stack_trace.js';
14
+ // eslint-disable-next-line @devtools/es-modules-import
14
15
  import type * as StackTraceImpl from '../stack_trace/stack_trace_impl.js';
15
16
  import * as Workspace from '../workspace/workspace.js';
16
17
 
@@ -317,7 +317,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
317
317
  #updateFitScale(): void {
318
318
  if (this.#type === Type.Device && this.#device && this.#mode) {
319
319
  const orientation = this.#device.orientationByName(this.#mode.orientation);
320
- this.#scaleSetting.set(this.calculateFitScale(orientation.width, orientation.height, this.currentInsets()));
320
+ this.#scaleSetting.set(this.calculateFitScale(orientation.width, orientation.height));
321
321
  }
322
322
  }
323
323
 
@@ -595,13 +595,6 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
595
595
  return Math.floor(this.#preferredSize.height / (this.#scaleSetting.get() || 1));
596
596
  }
597
597
 
598
- private currentInsets(): Insets {
599
- if (this.#type !== Type.Device || !this.#mode) {
600
- return new Insets(0, 0, 0, 0);
601
- }
602
- return this.#mode.insets;
603
- }
604
-
605
598
  private currentSafeAreaInsets(): Insets|null {
606
599
  if (!Root.Runtime.hostConfig.devToolsMobileSafeAreaEmulation?.enabled) {
607
600
  return null;
@@ -650,22 +643,21 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
650
643
  }
651
644
  if (this.#type === Type.Device && this.#device && this.#mode) {
652
645
  const orientation = this.#device.orientationByName(this.#mode.orientation);
653
- const insets = this.currentInsets();
654
- this.#fitScale = this.calculateFitScale(orientation.width, orientation.height, insets);
646
+ this.#fitScale = this.calculateFitScale(orientation.width, orientation.height);
655
647
  if (mobile) {
656
648
  this.#appliedUserAgentType = this.#device.touch() ? UA.MOBILE : UA.MOBILE_NO_TOUCH;
657
649
  } else {
658
650
  this.#appliedUserAgentType = this.#device.touch() ? UA.DESKTOP_TOUCH : UA.DESKTOP;
659
651
  }
660
- this.applyDeviceMetrics(new Geometry.Size(orientation.width, orientation.height), insets,
661
- this.#scaleSetting.get(), this.#device.deviceScaleFactor, mobile,
662
- this.getScreenOrientationType(), resetPageScaleFactor);
652
+ this.applyDeviceMetrics(new Geometry.Size(orientation.width, orientation.height), this.#scaleSetting.get(),
653
+ this.#device.deviceScaleFactor, mobile, this.getScreenOrientationType(),
654
+ resetPageScaleFactor);
663
655
  this.applyUserAgent(this.#device.userAgent, this.#device.userAgentMetadata);
664
656
  this.applyTouch(this.#device.touch(), mobile);
665
657
  } else if (this.#type === Type.None) {
666
658
  this.#fitScale = this.calculateFitScale(this.#availableSize.width, this.#availableSize.height);
667
659
  this.#appliedUserAgentType = UA.DESKTOP;
668
- this.applyDeviceMetrics(this.#availableSize, new Insets(0, 0, 0, 0), 1, 0, mobile, null, resetPageScaleFactor);
660
+ this.applyDeviceMetrics(this.#availableSize, 1, 0, mobile, null, resetPageScaleFactor);
669
661
  this.applyUserAgent('', null);
670
662
  this.applyTouch(false, false);
671
663
  } else if (this.#type === Type.Responsive) {
@@ -680,8 +672,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
680
672
  const defaultDeviceScaleFactor = mobile ? defaultMobileScaleFactor : 0;
681
673
  this.#fitScale = this.calculateFitScale(this.#widthSetting.get(), this.#heightSetting.get());
682
674
  this.#appliedUserAgentType = this.#uaSetting.get();
683
- this.applyDeviceMetrics(new Geometry.Size(screenWidth, screenHeight), new Insets(0, 0, 0, 0),
684
- this.#scaleSetting.get(),
675
+ this.applyDeviceMetrics(new Geometry.Size(screenWidth, screenHeight), this.#scaleSetting.get(),
685
676
  this.#deviceScaleFactorSetting.get() || defaultDeviceScaleFactor, mobile,
686
677
  screenHeight >= screenWidth ? Protocol.Emulation.ScreenOrientationType.PortraitPrimary :
687
678
  Protocol.Emulation.ScreenOrientationType.LandscapePrimary,
@@ -701,9 +692,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
701
692
  this.dispatchEventToListeners(Events.UPDATED);
702
693
  }
703
694
 
704
- private calculateFitScale(screenWidth: number, screenHeight: number, insets?: Insets): number {
705
- const insetsWidth = insets ? insets.left + insets.right : 0;
706
- const insetsHeight = insets ? insets.top + insets.bottom : 0;
695
+ private calculateFitScale(screenWidth: number, screenHeight: number): number {
707
696
  let scale = Math.min(screenWidth ? this.#preferredSize.width / screenWidth : 1,
708
697
  screenHeight ? this.#preferredSize.height / screenHeight : 1);
709
698
  scale = Math.min(Math.floor(scale * 100), 100);
@@ -712,10 +701,10 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
712
701
  while (sharpScale > scale * 0.7) {
713
702
  let sharp = true;
714
703
  if (screenWidth) {
715
- sharp = sharp && Number.isInteger((screenWidth - insetsWidth) * sharpScale / 100);
704
+ sharp = sharp && Number.isInteger(screenWidth * sharpScale / 100);
716
705
  }
717
706
  if (screenHeight) {
718
- sharp = sharp && Number.isInteger((screenHeight - insetsHeight) * sharpScale / 100);
707
+ sharp = sharp && Number.isInteger(screenHeight * sharpScale / 100);
719
708
  }
720
709
  if (sharp) {
721
710
  return sharpScale / 100;
@@ -738,17 +727,17 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
738
727
  this.#multitargetNetworkManager.setUserAgentOverride(userAgent, userAgent ? userAgentMetadata : null);
739
728
  }
740
729
 
741
- private applyDeviceMetrics(screenSize: Geometry.Size, insets: Insets, scale: number, deviceScaleFactor: number,
742
- mobile: boolean, screenOrientation: Protocol.Emulation.ScreenOrientationType|null,
730
+ private applyDeviceMetrics(screenSize: Geometry.Size, scale: number, deviceScaleFactor: number, mobile: boolean,
731
+ screenOrientation: Protocol.Emulation.ScreenOrientationType|null,
743
732
  resetPageScaleFactor: boolean): void {
744
733
  screenSize.width = Math.max(1, Math.floor(screenSize.width));
745
734
  screenSize.height = Math.max(1, Math.floor(screenSize.height));
746
735
 
747
- let pageWidth: 0|number = screenSize.width - insets.left - insets.right;
748
- let pageHeight: 0|number = screenSize.height - insets.top - insets.bottom;
736
+ let pageWidth: 0|number = screenSize.width;
737
+ let pageHeight: 0|number = screenSize.height;
749
738
 
750
- const positionX = insets.left;
751
- const positionY = insets.top;
739
+ const positionX = 0;
740
+ const positionY = 0;
752
741
  const screenOrientationAngle =
753
742
  screenOrientation === Protocol.Emulation.ScreenOrientationType.LandscapePrimary ? 90 : 0;
754
743