chrome-devtools-frontend 1.0.1657110 → 1.0.1660788

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 (317) hide show
  1. package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +125 -0
  2. package/.agents/skills/migrate-chromium-test/SKILL.md +15 -70
  3. package/.agents/skills/repro-flaky-tests/SKILL.md +53 -0
  4. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +37 -18
  5. package/.agents/skills/version-control/SKILL.md +8 -1
  6. package/AUTHORS +1 -0
  7. package/SECURITY.md +3 -0
  8. package/docs/get_the_code.md +6 -0
  9. package/front_end/Images/src/ads.svg +1 -0
  10. package/front_end/Tests.js +6 -6
  11. package/front_end/core/common/Gzip.ts +12 -5
  12. package/front_end/core/common/ResourceType.ts +19 -19
  13. package/front_end/core/common/Revealer.ts +15 -15
  14. package/front_end/core/common/SettingRegistration.ts +19 -19
  15. package/front_end/core/host/AidaClient.ts +35 -9
  16. package/front_end/core/host/GdpClient.ts +10 -7
  17. package/front_end/core/platform/StringUtilities.ts +35 -0
  18. package/front_end/core/sdk/AccessibilityModel.snapshot.txt +17 -0
  19. package/front_end/core/sdk/AccessibilityModel.ts +132 -2
  20. package/front_end/core/sdk/CPUThrottlingManager.ts +8 -5
  21. package/front_end/core/sdk/CSSMetadata.ts +110 -16
  22. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -5
  23. package/front_end/core/sdk/ConsoleModel.ts +5 -5
  24. package/front_end/core/sdk/DOMDebuggerModel.ts +5 -1
  25. package/front_end/core/sdk/DOMModel.ts +32 -18
  26. package/front_end/core/sdk/NetworkManager.ts +58 -14
  27. package/front_end/core/sdk/NetworkRequest.ts +37 -1
  28. package/front_end/core/sdk/OverlayModel.ts +45 -6
  29. package/front_end/core/sdk/ResourceTreeModel.ts +6 -7
  30. package/front_end/core/sdk/ScreenCaptureModel.ts +2 -2
  31. package/front_end/core/sdk/ServerTiming.ts +17 -13
  32. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +4 -2
  33. package/front_end/core/sdk/ServiceWorkerManager.ts +19 -5
  34. package/front_end/core/sdk/TargetManager.ts +10 -1
  35. package/front_end/core/sdk/TraceObject.ts +4 -2
  36. package/front_end/core/sdk/sdk-meta.ts +170 -0
  37. package/front_end/design_system_tokens.css +0 -5
  38. package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -1
  39. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +13 -4
  40. package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +5 -2
  41. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +23 -4
  42. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +33 -10
  43. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +8 -3
  44. package/front_end/entrypoints/inspector_main/InspectorMain.ts +4 -4
  45. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +2 -2
  46. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +36 -37
  47. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +15 -33
  48. package/front_end/entrypoints/js_app/js_app.ts +6 -5
  49. package/front_end/entrypoints/main/GlobalAiButton.ts +4 -4
  50. package/front_end/entrypoints/main/MainImpl.ts +25 -55
  51. package/front_end/entrypoints/main/main-meta.ts +50 -50
  52. package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +5 -5
  53. package/front_end/entrypoints/node_app/app/NodeMain.ts +3 -3
  54. package/front_end/entrypoints/node_app/node_app.ts +10 -9
  55. package/front_end/entrypoints/worker_app/WorkerMain.ts +1 -1
  56. package/front_end/foundation/Universe.ts +76 -6
  57. package/front_end/generated/InspectorBackendCommands.ts +3 -3
  58. package/front_end/generated/SupportedCSSProperties.js +19 -12
  59. package/front_end/generated/protocol.ts +7 -1
  60. package/front_end/models/ai_assistance/AiConversation.ts +19 -17
  61. package/front_end/models/ai_assistance/AiHistoryStorage.ts +37 -14
  62. package/front_end/models/ai_assistance/AiUtils.ts +38 -42
  63. package/front_end/models/ai_assistance/agents/AiAgent.ts +5 -1
  64. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -2
  65. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -1
  66. package/front_end/models/ai_assistance/agents/StorageAgent.ts +7 -5
  67. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +270 -286
  68. package/front_end/models/ai_assistance/data_formatters/UnitFormatters.ts +20 -0
  69. package/front_end/models/ai_assistance/performance/AICallTree.ts +3 -1
  70. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +3 -2
  71. package/front_end/models/autofill_manager/AutofillManager.ts +3 -1
  72. package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -5
  73. package/front_end/models/bindings/CompilerScriptMapping.ts +2 -1
  74. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +15 -16
  75. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +6 -4
  76. package/front_end/models/bindings/FileUtils.ts +11 -12
  77. package/front_end/models/bindings/NetworkProject.ts +4 -0
  78. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +2 -1
  79. package/front_end/models/bindings/ResourceUtils.ts +1 -1
  80. package/front_end/models/bindings/SASSSourceMapping.ts +8 -5
  81. package/front_end/models/emulation/DeviceModeModel.ts +14 -14
  82. package/front_end/models/emulation/EmulatedDevices.ts +392 -11
  83. package/front_end/models/extensions/ExtensionAPI.ts +6 -6
  84. package/front_end/models/extensions/LanguageExtensionEndpoint.ts +13 -12
  85. package/front_end/models/issues_manager/BounceTrackingIssue.ts +1 -1
  86. package/front_end/models/issues_manager/ClientHintIssue.ts +1 -1
  87. package/front_end/models/issues_manager/ConnectionAllowlistIssue.ts +1 -1
  88. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +7 -7
  89. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +2 -2
  90. package/front_end/models/issues_manager/CookieIssue.ts +6 -7
  91. package/front_end/models/issues_manager/CorsIssue.ts +3 -3
  92. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +2 -2
  93. package/front_end/models/issues_manager/DeprecationIssue.ts +3 -3
  94. package/front_end/models/issues_manager/EmailVerificationRequestIssue.ts +1 -1
  95. package/front_end/models/issues_manager/FederatedAuthRequestIssue.ts +1 -1
  96. package/front_end/models/issues_manager/FederatedAuthUserInfoRequestIssue.ts +1 -1
  97. package/front_end/models/issues_manager/GenericIssue.ts +7 -7
  98. package/front_end/models/issues_manager/HeavyAdIssue.ts +3 -3
  99. package/front_end/models/issues_manager/Issue.ts +8 -8
  100. package/front_end/models/issues_manager/MixedContentIssue.ts +1 -1
  101. package/front_end/models/issues_manager/PartitioningBlobURLIssue.ts +3 -3
  102. package/front_end/models/issues_manager/QuirksModeIssue.ts +1 -1
  103. package/front_end/models/issues_manager/SRIMessageSignatureIssue.ts +2 -2
  104. package/front_end/models/issues_manager/SelectivePermissionsInterventionIssue.ts +2 -2
  105. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +2 -2
  106. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +1 -1
  107. package/front_end/models/issues_manager/UnencodedDigestIssue.ts +3 -3
  108. package/front_end/models/javascript_metadata/NativeFunctions.js +5 -1
  109. package/front_end/models/stack_trace/StackTraceModel.ts +3 -3
  110. package/front_end/models/text_utils/ContentData.ts +27 -0
  111. package/front_end/models/trace/helpers/SamplesIntegrator.ts +21 -5
  112. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +29 -14
  113. package/front_end/models/web_mcp/WebMCPModel.ts +24 -6
  114. package/front_end/models/workspace/IgnoreListManager.ts +6 -6
  115. package/front_end/models/workspace/UISourceCode.ts +3 -3
  116. package/front_end/models/workspace_diff/WorkspaceDiff.ts +23 -12
  117. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -22
  118. package/front_end/panels/ai_assistance/ExportConversation.ts +3 -4
  119. package/front_end/panels/ai_assistance/ai_assistance-meta.ts +3 -3
  120. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
  121. package/front_end/panels/ai_assistance/components/ChatMessage.ts +7 -0
  122. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +2 -2
  123. package/front_end/panels/animation/AnimationTimeline.ts +17 -19
  124. package/front_end/panels/animation/AnimationUI.ts +5 -5
  125. package/front_end/panels/animation/animation-meta.ts +2 -2
  126. package/front_end/panels/application/ApplicationPanelSidebar.ts +13 -4
  127. package/front_end/panels/application/BackgroundServiceView.ts +2 -1
  128. package/front_end/panels/application/DeviceBoundSessionsView.ts +2 -6
  129. package/front_end/panels/application/IndexedDBViews.ts +245 -262
  130. package/front_end/panels/application/OpenedWindowDetailsView.ts +1 -1
  131. package/front_end/panels/application/ResourcesPanel.ts +9 -2
  132. package/front_end/panels/application/ServiceWorkersView.ts +252 -211
  133. package/front_end/panels/application/StorageView.ts +97 -33
  134. package/front_end/panels/application/WebMCPView.ts +15 -1
  135. package/front_end/panels/application/components/AdsView.ts +1 -1
  136. package/front_end/panels/application/indexedDBViews.css +38 -9
  137. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +2 -1
  138. package/front_end/panels/application/resourcesSidebar.css +5 -0
  139. package/front_end/panels/application/storageView.css +26 -9
  140. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +5 -1
  141. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +8 -6
  142. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  143. package/front_end/panels/common/ExtensionServer.ts +119 -14
  144. package/front_end/panels/console/ConsoleContextSelector.ts +4 -4
  145. package/front_end/panels/console/ConsolePinPane.ts +12 -12
  146. package/front_end/panels/console/ConsolePrompt.ts +6 -6
  147. package/front_end/panels/console/ConsoleSidebar.ts +7 -7
  148. package/front_end/panels/console/ConsoleView.ts +45 -44
  149. package/front_end/panels/console/ConsoleViewMessage.ts +40 -40
  150. package/front_end/panels/console/SymbolizedErrorWidget.ts +2 -1
  151. package/front_end/panels/console/console-meta.ts +34 -34
  152. package/front_end/panels/console_counters/WarningErrorCounter.ts +2 -2
  153. package/front_end/panels/coverage/CoverageListView.ts +28 -28
  154. package/front_end/panels/coverage/CoverageModel.ts +2 -1
  155. package/front_end/panels/coverage/CoverageView.ts +23 -23
  156. package/front_end/panels/coverage/coverage-meta.ts +5 -5
  157. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +36 -36
  158. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +1 -1
  159. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +2 -2
  160. package/front_end/panels/css_overview/CSSOverviewStartView.ts +6 -6
  161. package/front_end/panels/css_overview/CSSOverviewUnusedDeclarations.ts +6 -6
  162. package/front_end/panels/css_overview/css_overview-meta.ts +2 -2
  163. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +20 -21
  164. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +6 -8
  165. package/front_end/panels/developer_resources/developer_resources-meta.ts +2 -2
  166. package/front_end/panels/elements/AccessibilityTreeUtils.ts +8 -102
  167. package/front_end/panels/elements/AccessibilityTreeView.ts +163 -70
  168. package/front_end/panels/elements/ElementsPanel.ts +17 -11
  169. package/front_end/panels/elements/ElementsTreeElement.ts +49 -2
  170. package/front_end/panels/elements/ElementsTreeOutline.ts +4 -4
  171. package/front_end/panels/elements/LayoutPane.ts +1 -1
  172. package/front_end/panels/elements/MetricsSidebarPane.ts +100 -34
  173. package/front_end/panels/elements/StylePropertiesSection.ts +2 -2
  174. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -2
  175. package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
  176. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +7 -18
  177. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +2 -2
  178. package/front_end/panels/elements/components/QueryContainer.ts +1 -1
  179. package/front_end/panels/issues/AffectedDirectivesView.ts +1 -1
  180. package/front_end/panels/issues/AffectedResourcesView.ts +2 -1
  181. package/front_end/panels/layer_viewer/LayerViewHost.ts +1 -1
  182. package/front_end/panels/media/EventDisplayTable.ts +2 -2
  183. package/front_end/panels/media/EventTimelineView.ts +4 -4
  184. package/front_end/panels/media/MainView.ts +4 -4
  185. package/front_end/panels/media/PlayerDetailView.ts +5 -5
  186. package/front_end/panels/media/PlayerListView.ts +1 -1
  187. package/front_end/panels/media/PlayerMessagesView.ts +12 -12
  188. package/front_end/panels/media/PlayerPropertiesView.ts +17 -17
  189. package/front_end/panels/network/NetworkDataGridNode.ts +124 -36
  190. package/front_end/panels/network/NetworkLogView.ts +11 -2
  191. package/front_end/panels/network/NetworkLogViewColumns.ts +18 -0
  192. package/front_end/panels/network/NetworkPanel.ts +2 -1
  193. package/front_end/panels/network/NetworkWaterfallColumn.ts +1 -3
  194. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  195. package/front_end/panels/network/RequestPayloadView.ts +53 -7
  196. package/front_end/panels/network/RequestPreviewView.ts +7 -1
  197. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  198. package/front_end/panels/network/forward/UIFilter.ts +1 -0
  199. package/front_end/panels/network/networkPanel.css +1 -0
  200. package/front_end/panels/network/networkTimingTable.css +1 -1
  201. package/front_end/panels/network/requestPayloadView.css +10 -0
  202. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +12 -12
  203. package/front_end/panels/performance_monitor/performance_monitor-meta.ts +7 -7
  204. package/front_end/panels/profiler/HeapDetachedElementsView.ts +2 -2
  205. package/front_end/panels/profiler/HeapProfileView.ts +563 -51
  206. package/front_end/panels/profiler/HeapSnapshotView.ts +15 -9
  207. package/front_end/panels/profiler/ProfilesPanel.ts +13 -7
  208. package/front_end/panels/profiler/WritableProfileHeader.ts +152 -0
  209. package/front_end/panels/profiler/profiler.ts +2 -2
  210. package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -10
  211. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +28 -32
  212. package/front_end/panels/protocol_monitor/protocol_monitor-meta.ts +1 -1
  213. package/front_end/panels/recorder/RecorderController.ts +15 -15
  214. package/front_end/panels/recorder/RecorderEvents.ts +8 -0
  215. package/front_end/panels/recorder/components/CreateRecordingView.ts +11 -11
  216. package/front_end/panels/recorder/components/ExtensionView.ts +74 -83
  217. package/front_end/panels/recorder/components/RecordingListView.ts +3 -3
  218. package/front_end/panels/recorder/components/RecordingView.ts +13 -10
  219. package/front_end/panels/recorder/components/ReplaySection.ts +9 -9
  220. package/front_end/panels/recorder/components/StepEditor.ts +352 -321
  221. package/front_end/panels/recorder/components/StepView.ts +36 -37
  222. package/front_end/panels/recorder/components/recordingView.css +1 -1
  223. package/front_end/panels/recorder/models/RecorderSettings.ts +2 -2
  224. package/front_end/panels/recorder/recorder-meta.ts +7 -7
  225. package/front_end/panels/screencast/ScreencastApp.ts +1 -1
  226. package/front_end/panels/screencast/ScreencastView.ts +12 -12
  227. package/front_end/panels/search/SearchResultsPane.ts +4 -4
  228. package/front_end/panels/search/SearchView.ts +20 -20
  229. package/front_end/panels/security/SecurityModel.ts +7 -7
  230. package/front_end/panels/security/SecurityPanel.ts +99 -107
  231. package/front_end/panels/security/SecurityPanelSidebar.ts +7 -7
  232. package/front_end/panels/security/security-meta.ts +2 -2
  233. package/front_end/panels/sensors/LocationsSettingsTab.ts +19 -19
  234. package/front_end/panels/sensors/SensorsView.ts +27 -27
  235. package/front_end/panels/sensors/sensors-meta.ts +13 -167
  236. package/front_end/panels/settings/AISettingsTab.ts +98 -56
  237. package/front_end/panels/settings/EditFileSystemView.ts +2 -2
  238. package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +20 -20
  239. package/front_end/panels/settings/KeybindsSettingsTab.ts +20 -21
  240. package/front_end/panels/settings/SettingsScreen.ts +11 -11
  241. package/front_end/panels/settings/WorkspaceSettingsTab.ts +5 -5
  242. package/front_end/panels/settings/components/SyncSection.ts +12 -12
  243. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +13 -13
  244. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +31 -31
  245. package/front_end/panels/settings/emulation/emulation-meta.ts +1 -1
  246. package/front_end/panels/settings/settings-meta.ts +14 -14
  247. package/front_end/panels/sources/NavigatorView.ts +7 -6
  248. package/front_end/panels/sources/ScopeChainSidebarPane.ts +83 -37
  249. package/front_end/panels/sources/SourcesNavigator.ts +20 -18
  250. package/front_end/panels/sources/SourcesView.ts +10 -1
  251. package/front_end/panels/sources/scopeChainSidebarPane.css +12 -4
  252. package/front_end/panels/sources/sources-meta.ts +4 -4
  253. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +5 -2
  254. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +2 -1
  255. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +2 -1
  256. package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
  257. package/front_end/panels/timeline/TimelinePanel.ts +2 -1
  258. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
  259. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +4 -2
  260. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +4 -2
  261. package/front_end/panels/timeline/components/insights/ImageRef.ts +2 -1
  262. package/front_end/panels/utils/utils.ts +7 -3
  263. package/front_end/panels/web_audio/WebAudioView.ts +17 -18
  264. package/front_end/panels/web_audio/web_audio-meta.ts +3 -3
  265. package/front_end/panels/webauthn/WebauthnPane.ts +10 -10
  266. package/front_end/panels/whats_new/ReleaseNoteView.ts +1 -1
  267. package/front_end/panels/whats_new/whats_new-meta.ts +11 -11
  268. package/front_end/third_party/chromium/README.chromium +1 -1
  269. package/front_end/third_party/lit/lib/async-directive.d.ts +2 -1
  270. package/front_end/third_party/lit/lib/async-directive.js +1 -1
  271. package/front_end/third_party/lit/lib/async-directive.js.map +1 -1
  272. package/front_end/third_party/lit/lib/decorators.d.ts +2 -1
  273. package/front_end/third_party/lit/lib/decorators.js.map +1 -1
  274. package/front_end/third_party/lit/lib/directive.d.ts +2 -1
  275. package/front_end/third_party/lit/lib/directive.js.map +1 -1
  276. package/front_end/third_party/lit/lib/directives.d.ts +2 -1
  277. package/front_end/third_party/lit/lib/directives.js +8 -8
  278. package/front_end/third_party/lit/lib/directives.js.map +1 -1
  279. package/front_end/third_party/lit/lib/lit.d.ts +2 -1
  280. package/front_end/third_party/lit/lib/lit.js +1 -1
  281. package/front_end/third_party/lit/lib/lit.js.map +1 -1
  282. package/front_end/third_party/lit/lib/static-html.d.ts +2 -1
  283. package/front_end/third_party/lit/lib/static-html.js +1 -1
  284. package/front_end/third_party/lit/lib/static-html.js.map +1 -1
  285. package/front_end/third_party/lit/package.json +2 -2
  286. package/front_end/third_party/lit/rebuild.sh +1 -1
  287. package/front_end/third_party/lit/src/async-directive.ts +5 -0
  288. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  289. package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -1
  290. package/front_end/ui/components/dialogs/shortcutDialog.css +15 -12
  291. package/front_end/ui/components/diff_view/DiffView.ts +2 -2
  292. package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
  293. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +5 -5
  294. package/front_end/ui/components/lists/List.ts +2 -2
  295. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
  296. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +5 -5
  297. package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
  298. package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
  299. package/front_end/ui/components/survey_link/SurveyLink.ts +3 -3
  300. package/front_end/ui/components/text_editor/config.ts +2 -2
  301. package/front_end/ui/components/tree_outline/TreeOutline.ts +34 -1
  302. package/front_end/ui/legacy/ReportView.ts +5 -0
  303. package/front_end/ui/legacy/Treeoutline.ts +18 -0
  304. package/front_end/ui/legacy/View.ts +1 -1
  305. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -0
  306. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +8 -3
  307. package/front_end/ui/legacy/components/data_grid/data_grid.ts +1 -0
  308. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
  309. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +100 -36
  310. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +7 -1
  311. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +5 -0
  312. package/front_end/ui/legacy/components/utils/ImagePreview.ts +4 -2
  313. package/front_end/ui/legacy/inspectorCommon.css +5 -0
  314. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -0
  315. package/mcp/mcp.ts +2 -0
  316. package/package.json +4 -4
  317. package/front_end/panels/profiler/ProfileView.ts +0 -610
@@ -15,7 +15,7 @@ import {OverlayPersistentHighlighter} from './OverlayPersistentHighlighter.js';
15
15
  import type {RemoteObject} from './RemoteObject.js';
16
16
  import {SDKModel} from './SDKModel.js';
17
17
  import {Capability, type Target} from './Target.js';
18
- import {TargetManager} from './TargetManager.js';
18
+ import type {TargetManager} from './TargetManager.js';
19
19
 
20
20
  const UIStrings = {
21
21
  /**
@@ -49,6 +49,19 @@ export interface Hinge {
49
49
  contentColor: HighlightColor;
50
50
  outlineColor: HighlightColor;
51
51
  }
52
+ export interface BaseDisplayCutout {
53
+ width: number;
54
+ height: number;
55
+ x: number;
56
+ y: number;
57
+ shape: Protocol.Overlay.DisplayCutoutShape;
58
+ contentColor?: HighlightColor;
59
+ }
60
+ export type DisplayCutout =
61
+ BaseDisplayCutout&({shape: Protocol.Overlay.DisplayCutoutShape.Rectangle}|
62
+ {shape: Protocol.Overlay.DisplayCutoutShape.Pill, borderRadius: number}|
63
+ {shape: Protocol.Overlay.DisplayCutoutShape.Notch, upperRadius: number, lowerRadius: number}|
64
+ {shape: Protocol.Overlay.DisplayCutoutShape.Circle, cx: number, cy: number, radius: number});
52
65
 
53
66
  export const enum EmulatedOSType {
54
67
  WINDOWS = 'Windows',
@@ -178,27 +191,27 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
178
191
  }
179
192
  }
180
193
 
181
- static hideDOMNodeHighlight(targetManager: TargetManager = TargetManager.instance()): void {
194
+ static hideDOMNodeHighlight(targetManager: TargetManager): void {
182
195
  for (const overlayModel of targetManager.models(OverlayModel)) {
183
196
  overlayModel.delayedHideHighlight(0);
184
197
  }
185
198
  }
186
199
 
187
- static async muteHighlight(targetManager: TargetManager = TargetManager.instance()): Promise<void[]> {
200
+ static async muteHighlight(targetManager: TargetManager): Promise<void[]> {
188
201
  return await Promise.all(targetManager.models(OverlayModel).map(model => model.suspendModel()));
189
202
  }
190
203
 
191
- static async unmuteHighlight(targetManager: TargetManager = TargetManager.instance()): Promise<void[]> {
204
+ static async unmuteHighlight(targetManager: TargetManager): Promise<void[]> {
192
205
  return await Promise.all(targetManager.models(OverlayModel).map(model => model.resumeModel()));
193
206
  }
194
207
 
195
- static highlightRect(rect: HighlightRect, targetManager: TargetManager = TargetManager.instance()): void {
208
+ static highlightRect(rect: HighlightRect, targetManager: TargetManager): void {
196
209
  for (const overlayModel of targetManager.models(OverlayModel)) {
197
210
  void overlayModel.highlightRect(rect);
198
211
  }
199
212
  }
200
213
 
201
- static clearHighlight(targetManager: TargetManager = TargetManager.instance()): void {
214
+ static clearHighlight(targetManager: TargetManager): void {
202
215
  for (const overlayModel of targetManager.models(OverlayModel)) {
203
216
  void overlayModel.clearHighlight();
204
217
  }
@@ -497,6 +510,32 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
497
510
  }
498
511
  }
499
512
 
513
+ showDisplayCutout(cutout: DisplayCutout|null): void {
514
+ if (cutout) {
515
+ const {x, y, width, height, shape, contentColor} = cutout;
516
+ const displayCutoutConfig: Protocol.Overlay.DisplayCutoutConfig = {
517
+ rect: {x, y, width, height},
518
+ shape,
519
+ contentColor,
520
+ };
521
+ if (shape === Protocol.Overlay.DisplayCutoutShape.Pill) {
522
+ displayCutoutConfig.borderRadius = cutout.borderRadius;
523
+ } else if (shape === Protocol.Overlay.DisplayCutoutShape.Notch) {
524
+ displayCutoutConfig.upperRadius = cutout.upperRadius;
525
+ displayCutoutConfig.lowerRadius = cutout.lowerRadius;
526
+ } else if (shape === Protocol.Overlay.DisplayCutoutShape.Circle) {
527
+ displayCutoutConfig.cx = cutout.cx;
528
+ displayCutoutConfig.cy = cutout.cy;
529
+ displayCutoutConfig.radius = cutout.radius;
530
+ }
531
+ void this.overlayAgent.invoke_setShowDisplayCutout({
532
+ displayCutoutConfig,
533
+ });
534
+ } else {
535
+ void this.overlayAgent.invoke_setShowDisplayCutout({});
536
+ }
537
+ }
538
+
500
539
  setWindowControlsPlatform(selectedPlatform: EmulatedOSType): void {
501
540
  this.#windowControls.selectedPlatform = selectedPlatform;
502
541
  }
@@ -18,7 +18,7 @@ import {SDKModel} from './SDKModel.js';
18
18
  import {SecurityOriginManager} from './SecurityOriginManager.js';
19
19
  import {StorageKeyManager} from './StorageKeyManager.js';
20
20
  import {Capability, type Target, Type} from './Target.js';
21
- import {TargetManager} from './TargetManager.js';
21
+ import type {TargetManager} from './TargetManager.js';
22
22
 
23
23
  export class ResourceTreeModel extends SDKModel<EventTypes> {
24
24
  readonly agent: ProtocolProxyApi.PageApi;
@@ -74,16 +74,16 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
74
74
  return request.frameId ? resourceTreeModel.frameForId(request.frameId) : null;
75
75
  }
76
76
 
77
- static frames(): ResourceTreeFrame[] {
77
+ static frames(targetManager: TargetManager): ResourceTreeFrame[] {
78
78
  const result = [];
79
- for (const resourceTreeModel of TargetManager.instance().models(ResourceTreeModel)) {
79
+ for (const resourceTreeModel of targetManager.models(ResourceTreeModel)) {
80
80
  result.push(...resourceTreeModel.frames());
81
81
  }
82
82
  return result;
83
83
  }
84
84
 
85
- static resourceForURL(url: Platform.DevToolsPath.UrlString): Resource|null {
86
- for (const resourceTreeModel of TargetManager.instance().models(ResourceTreeModel)) {
85
+ static resourceForURL(targetManager: TargetManager, url: Platform.DevToolsPath.UrlString): Resource|null {
86
+ for (const resourceTreeModel of targetManager.models(ResourceTreeModel)) {
87
87
  const mainFrame = resourceTreeModel.mainFrame;
88
88
  // Workers call into this with no #frames available.
89
89
  const result = mainFrame ? mainFrame.resourceForURL(url) : null;
@@ -94,8 +94,7 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
94
94
  return null;
95
95
  }
96
96
 
97
- static reloadAllPages(bypassCache?: boolean, scriptToEvaluateOnLoad?: string,
98
- targetManager: TargetManager = TargetManager.instance()): void {
97
+ static reloadAllPages(targetManager: TargetManager, bypassCache?: boolean, scriptToEvaluateOnLoad?: string): void {
99
98
  for (const resourceTreeModel of targetManager.models(ResourceTreeModel)) {
100
99
  if (resourceTreeModel.target().parentTarget()?.type() !== Type.FRAME) {
101
100
  resourceTreeModel.reloadPage(bypassCache, scriptToEvaluateOnLoad);
@@ -145,9 +145,9 @@ export class ScreenCaptureModel extends SDKModel<void> implements ProtocolProxyA
145
145
  throw new Error('Unexpected or unspecified screnshotMode');
146
146
  }
147
147
 
148
- await OverlayModel.muteHighlight();
148
+ await OverlayModel.muteHighlight(this.target().targetManager());
149
149
  const result = await this.#agent.invoke_captureScreenshot(properties);
150
- await OverlayModel.unmuteHighlight();
150
+ await OverlayModel.unmuteHighlight(this.target().targetManager());
151
151
  return result.data;
152
152
  }
153
153
 
@@ -69,14 +69,14 @@ export class ServerTiming {
69
69
  this.description = description;
70
70
  }
71
71
 
72
- static parseHeaders(headers: NameValue[]): ServerTiming[]|null {
72
+ static parseHeaders(headers: NameValue[], devToolsConsole: Common.Console.Console): ServerTiming[]|null {
73
73
  const rawServerTimingHeaders = headers.filter(item => item.name.toLowerCase() === 'server-timing');
74
74
  if (!rawServerTimingHeaders.length) {
75
75
  return null;
76
76
  }
77
77
 
78
78
  const serverTimings = rawServerTimingHeaders.reduce<ServerTiming[]>((timings, header) => {
79
- const timing = this.createFromHeaderValue(header.value);
79
+ const timing = this.createFromHeaderValue(header.value, devToolsConsole);
80
80
  timings.push(...timing.map(function(entry) {
81
81
  return new ServerTiming(entry.name, entry.dur ?? null, entry.desc ?? '');
82
82
  }));
@@ -85,7 +85,9 @@ export class ServerTiming {
85
85
  return serverTimings;
86
86
  }
87
87
 
88
- static createFromHeaderValue(valueString: string): ServerTimingMetric[] {
88
+ static createFromHeaderValue(valueString: string,
89
+ devToolsConsole: Common.Console.Console = new Common.Console.Console()):
90
+ ServerTimingMetric[] {
89
91
  function trimLeadingWhiteSpace(): void {
90
92
  valueString = valueString.replace(/^\s*/, '');
91
93
  }
@@ -158,7 +160,7 @@ export class ServerTiming {
158
160
  const entry: ServerTimingMetric = {name};
159
161
 
160
162
  if (valueString.charAt(0) === '=') {
161
- this.showWarning(i18nString(UIStrings.deprecatedSyntaxFoundPleaseUse, {PH1: name}));
163
+ this.#showWarning(i18nString(UIStrings.deprecatedSyntaxFoundPleaseUse, {PH1: name}), devToolsConsole);
162
164
  }
163
165
 
164
166
  while (consumeDelimiter(';')) {
@@ -168,7 +170,7 @@ export class ServerTiming {
168
170
  }
169
171
 
170
172
  paramName = paramName.toLowerCase();
171
- const parseParameter = this.getParserForParameter(paramName);
173
+ const parseParameter = this.#getParserForParameter(paramName, devToolsConsole);
172
174
  let paramValue: (string|null)|null = null;
173
175
  if (consumeDelimiter('=')) {
174
176
  // always parse the value, even if we don't recognize the parameter #name
@@ -179,19 +181,19 @@ export class ServerTiming {
179
181
  if (parseParameter) {
180
182
  // paramName is valid
181
183
  if (entry.hasOwnProperty(paramName)) {
182
- this.showWarning(i18nString(UIStrings.duplicateParameterSIgnored, {PH1: paramName}));
184
+ this.#showWarning(i18nString(UIStrings.duplicateParameterSIgnored, {PH1: paramName}), devToolsConsole);
183
185
  continue;
184
186
  }
185
187
 
186
188
  if (paramValue === null) {
187
- this.showWarning(i18nString(UIStrings.noValueFoundForParameterS, {PH1: paramName}));
189
+ this.#showWarning(i18nString(UIStrings.noValueFoundForParameterS, {PH1: paramName}), devToolsConsole);
188
190
  }
189
191
 
190
192
  parseParameter.call(this, entry, paramValue);
191
193
  } else {
192
194
  // paramName is not valid
193
195
  // TODO(paulirish): consider showing other included params, like `start`: https://github.com/w3c/server-timing/issues/43
194
- this.showWarning(i18nString(UIStrings.unrecognizedParameterS, {PH1: paramName}));
196
+ this.#showWarning(i18nString(UIStrings.unrecognizedParameterS, {PH1: paramName}), devToolsConsole);
195
197
  }
196
198
  }
197
199
 
@@ -219,12 +221,13 @@ export class ServerTiming {
219
221
  }
220
222
 
221
223
  if (valueString.length) {
222
- this.showWarning(i18nString(UIStrings.extraneousTrailingCharacters));
224
+ this.#showWarning(i18nString(UIStrings.extraneousTrailingCharacters), devToolsConsole);
223
225
  }
224
226
  return result;
225
227
  }
226
228
 
227
- static getParserForParameter(paramName: string): ((arg0: ServerTimingMetric, arg1: string|null) => void)|null {
229
+ static #getParserForParameter(paramName: string, devToolsConsole: Common.Console.Console):
230
+ ((arg0: ServerTimingMetric, arg1: string|null) => void)|null {
228
231
  switch (paramName) {
229
232
  case 'dur': {
230
233
  function durParser(entry: ServerTimingMetric, paramValue: string|null): void {
@@ -232,7 +235,8 @@ export class ServerTiming {
232
235
  if (paramValue !== null) {
233
236
  const duration = parseFloat(paramValue);
234
237
  if (isNaN(duration)) {
235
- ServerTiming.showWarning(i18nString(UIStrings.unableToParseSValueS, {PH1: paramName, PH2: paramValue}));
238
+ ServerTiming.#showWarning(i18nString(UIStrings.unableToParseSValueS, {PH1: paramName, PH2: paramValue}),
239
+ devToolsConsole);
236
240
  return;
237
241
  }
238
242
  entry.dur = duration;
@@ -254,7 +258,7 @@ export class ServerTiming {
254
258
  }
255
259
  }
256
260
 
257
- static showWarning(msg: string): void {
258
- Common.Console.Console.instance().warn(`ServerTiming: ${msg}`);
261
+ static #showWarning(msg: string, devToolsConsole: Common.Console.Console): void {
262
+ devToolsConsole.warn(`ServerTiming: ${msg}`);
259
263
  }
260
264
  }
@@ -28,6 +28,7 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
28
28
  readonly cacheAgent: ProtocolProxyApi.CacheStorageApi;
29
29
  readonly #storageAgent: ProtocolProxyApi.StorageApi;
30
30
  readonly #storageBucketModel: StorageBucketsModel;
31
+ readonly #console: Common.Console.Console;
31
32
 
32
33
  readonly #caches = new Map<string, Cache>();
33
34
  readonly #storageKeysTracked = new Set<string>();
@@ -48,6 +49,7 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
48
49
  this.cacheAgent = target.cacheStorageAgent();
49
50
  this.#storageAgent = target.storageAgent();
50
51
  this.#storageBucketModel = (target.model(StorageBucketsModel) as StorageBucketsModel);
52
+ this.#console = target.targetManager().getConsole();
51
53
  }
52
54
 
53
55
  enable(): void {
@@ -101,8 +103,8 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
101
103
  async deleteCacheEntry(cache: Cache, request: string): Promise<void> {
102
104
  const response = await this.cacheAgent.invoke_deleteEntry({cacheId: cache.cacheId, request});
103
105
  if (response.getError()) {
104
- Common.Console.Console.instance().error(i18nString(
105
- UIStrings.serviceworkercacheagentError, {PH1: cache.toString(), PH2: String(response.getError())}));
106
+ this.#console.error(i18nString(UIStrings.serviceworkercacheagentError,
107
+ {PH1: cache.toString(), PH2: String(response.getError())}));
106
108
  return;
107
109
  }
108
110
  }
@@ -8,6 +8,7 @@ import * as Common from '../common/common.js';
8
8
  import * as i18n from '../i18n/i18n.js';
9
9
  import type * as Platform from '../platform/platform.js';
10
10
 
11
+ import {MultitargetNetworkManager} from './NetworkManager.js';
11
12
  import {Events as RuntimeModelEvents, type ExecutionContext, RuntimeModel} from './RuntimeModel.js';
12
13
  import {SDKModel} from './SDKModel.js';
13
14
  import {Capability, type Target, Type} from './Target.js';
@@ -70,23 +71,36 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
70
71
  readonly #registrations = new Map<string, ServiceWorkerRegistration>();
71
72
  #enabled = false;
72
73
  readonly #forceUpdateSetting: Common.Settings.Setting<boolean>;
74
+ readonly #networkManager: MultitargetNetworkManager;
73
75
 
74
76
  constructor(target: Target) {
75
77
  super(target);
78
+ this.#networkManager = target.targetManager().getNetworkManager();
76
79
  target.registerServiceWorkerDispatcher(new ServiceWorkerDispatcher(this));
77
80
  this.#agent = target.serviceWorkerAgent();
78
81
  void this.enable();
79
- this.#forceUpdateSetting = this.target()
80
- .targetManager()
81
- .context.get(Common.Settings.Settings)
82
- .createSetting('service-worker-update-on-reload', false);
82
+ this.#forceUpdateSetting = target.targetManager().settings.createSetting('service-worker-update-on-reload', false);
83
83
  if (this.#forceUpdateSetting.get()) {
84
84
  this.forceUpdateSettingChanged();
85
85
  }
86
86
  this.#forceUpdateSetting.addChangeListener(this.forceUpdateSettingChanged, this);
87
+ this.#networkManager.addEventListener(
88
+ MultitargetNetworkManager.Events.CONDITIONS_CHANGED,
89
+ this.forceUpdateSettingChanged,
90
+ this,
91
+ );
87
92
  new ServiceWorkerContextNamer(target, this);
88
93
  }
89
94
 
95
+ override dispose(): void {
96
+ this.#networkManager.removeEventListener(
97
+ MultitargetNetworkManager.Events.CONDITIONS_CHANGED,
98
+ this.forceUpdateSettingChanged,
99
+ this,
100
+ );
101
+ super.dispose();
102
+ }
103
+
90
104
  async enable(): Promise<void> {
91
105
  if (this.#enabled) {
92
106
  return;
@@ -237,7 +251,7 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
237
251
  }
238
252
 
239
253
  private forceUpdateSettingChanged(): void {
240
- const forceUpdateOnPageLoad = this.#forceUpdateSetting.get();
254
+ const forceUpdateOnPageLoad = this.#forceUpdateSetting.get() && !this.#networkManager.isOffline();
241
255
  void this.#agent.invoke_setForceUpdateOnPageLoad({forceUpdateOnPageLoad});
242
256
  }
243
257
  }
@@ -12,6 +12,7 @@ import * as Root from '../root/root.js';
12
12
 
13
13
  import {FrameManager} from './FrameManager.js';
14
14
  import {MultitargetNetworkManager} from './NetworkManager.js';
15
+ import {PageResourceLoader} from './PageResourceLoader.js';
15
16
  import {type RegistrationInfo, SDKModel, type SDKModelConstructor} from './SDKModel.js';
16
17
  import {Target, Type as TargetType} from './Target.js';
17
18
 
@@ -58,6 +59,14 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
58
59
  return this.context.get(MultitargetNetworkManager);
59
60
  }
60
61
 
62
+ // TODO(crbug.com/493763857): Remove fallback once all unit tests use TestUniverse.
63
+ getPageResourceLoader(): PageResourceLoader {
64
+ if ('has' in this.context && typeof this.context.has === 'function' && !this.context.has(PageResourceLoader)) {
65
+ return PageResourceLoader.instance();
66
+ }
67
+ return this.context.get(PageResourceLoader);
68
+ }
69
+
61
70
  /* eslint-disable @typescript-eslint/no-explicit-any */
62
71
  #modelListeners: Platform.MapUtilities.Multimap<string|symbol|number, {
63
72
  modelClass: SDKModelConstructor,
@@ -135,7 +144,7 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
135
144
  async #waitForPromiseWithTimeout(promise: Promise<void>, timeoutMessage: string): Promise<void> {
136
145
  const {promise: timeoutPromise, resolve: timeoutResolve} = Promise.withResolvers<void>();
137
146
  const timeoutId = globalThis.setTimeout(() => {
138
- Common.Console.Console.instance().warn(timeoutMessage);
147
+ this.getConsole().warn(timeoutMessage);
139
148
  timeoutResolve();
140
149
  }, 2000);
141
150
  await Promise.race([promise, timeoutPromise]);
@@ -10,6 +10,7 @@ import type {NetworkRequest} from './NetworkRequest.js';
10
10
  import type {RehydratingResource} from './RehydratingObject.js';
11
11
  import {ResourceTreeModel} from './ResourceTreeModel.js';
12
12
  import type {SourceMapV3} from './SourceMap.js';
13
+ import type {TargetManager} from './TargetManager.js';
13
14
 
14
15
  interface TraceObjectWithNoMetadata {
15
16
  readonly traceEvents: TraceObject['traceEvents'];
@@ -57,13 +58,14 @@ export class RevealableNetworkRequest {
57
58
  }
58
59
 
59
60
  // Only Trace.Types.Events.SyntheticNetworkRequest are passed in, but we can't depend on that type from SDK
60
- static create(event: unknown): RevealableNetworkRequest|null {
61
+ static create(targetManager: TargetManager, event: unknown): RevealableNetworkRequest|null {
61
62
  const syntheticNetworkRequest = event;
62
63
  // @ts-expect-error We don't have type checking here to confirm these events have .args.data.url.
63
64
  const url = syntheticNetworkRequest.args.data.url as Platform.DevToolsPath.UrlString;
64
65
  const urlWithoutHash = Common.ParsedURL.ParsedURL.urlWithoutHash(url) as Platform.DevToolsPath.UrlString;
65
66
 
66
- const resource = ResourceTreeModel.resourceForURL(url) ?? ResourceTreeModel.resourceForURL(urlWithoutHash);
67
+ const resource = ResourceTreeModel.resourceForURL(targetManager, url) ??
68
+ ResourceTreeModel.resourceForURL(targetManager, urlWithoutHash);
67
69
  const sdkNetworkRequest = resource?.request;
68
70
  return sdkNetworkRequest ? new RevealableNetworkRequest(sdkNetworkRequest) : null;
69
71
  }
@@ -166,6 +166,71 @@ const UIStrings = {
166
166
  * @description A drop-down menu option to do not emulate css media type
167
167
  */
168
168
  noEmulation: 'No emulation',
169
+ /**
170
+ * @description Text for the CPU Pressure type to simulate on a device.
171
+ */
172
+ cpuPressure: 'CPU Pressure',
173
+ /**
174
+ * @description Title of an option in Sensors tab cpu pressure emulation drop-down. Turns off emulation of cpu pressure state.
175
+ */
176
+ noPressureEmulation: 'No override',
177
+ /**
178
+ * @description An option that appears in a drop-down that represents the nominal state.
179
+ */
180
+ nominal: 'Nominal',
181
+ /**
182
+ * @description An option that appears in a drop-down that represents the fair state.
183
+ */
184
+ fair: 'Fair',
185
+ /**
186
+ * @description An option that appears in a drop-down that represents the serious state.
187
+ */
188
+ serious: 'Serious',
189
+ /**
190
+ * @description An option that appears in a drop-down that represents the critical state.
191
+ */
192
+ critical: 'Critical',
193
+ /**
194
+ * @description Text for the touch type to simulate on a device. Refers to touch input as opposed to
195
+ * mouse input.
196
+ */
197
+ touch: 'Touch',
198
+ /**
199
+ * @description Text in Sensors View of the Device Toolbar. Means that touch input will be forced
200
+ *on, even if the device type e.g. desktop computer does not normally have touch input.
201
+ */
202
+ forceEnabled: 'Force enabled',
203
+ /**
204
+ * @description Text in Sensors View of the Device Toolbar. Refers to device-based touch input,
205
+ *which means the input type will be 'touch' only if the device normally has touch input e.g. a
206
+ *phone or tablet.
207
+ */
208
+ devicebased: 'Device-based',
209
+ /**
210
+ * @description Title of a section option in Sensors tab for idle emulation. This is a command, to
211
+ *emulate the state of the 'Idle Detector'.
212
+ */
213
+ emulateIdleDetectorState: 'Emulate Idle Detector state',
214
+ /**
215
+ * @description Title of an option in Sensors tab idle emulation drop-down. Turns off emulation of idle state.
216
+ */
217
+ noIdleEmulation: 'No idle emulation',
218
+ /**
219
+ * @description Title of an option in Sensors tab idle emulation drop-down.
220
+ */
221
+ userActiveScreenUnlocked: 'User active, screen unlocked',
222
+ /**
223
+ * @description Title of an option in Sensors tab idle emulation drop-down.
224
+ */
225
+ userActiveScreenLocked: 'User active, screen locked',
226
+ /**
227
+ * @description Title of an option in Sensors tab idle emulation drop-down.
228
+ */
229
+ userIdleScreenUnlocked: 'User idle, screen unlocked',
230
+ /**
231
+ * @description Title of an option in Sensors tab idle emulation drop-down.
232
+ */
233
+ userIdleScreenLocked: 'User idle, screen locked',
169
234
  /**
170
235
  * @description Title of a setting under the Rendering category that can be invoked through the Command Menu
171
236
  */
@@ -419,6 +484,13 @@ const UIStrings = {
419
484
  * @description Title of a setting under the Elements category in Settings.
420
485
  */
421
486
  apca: 'Advanced Perceptual Contrast Algorithm (APCA) replacing previous contrast ratio and AA/AAA guidelines',
487
+ /**
488
+ * @description Title of a setting under the Appearance category in Settings. When the webpage is
489
+ * paused by devtools, an overlay is shown on top of the page to indicate that it is paused. The
490
+ * overlay is a pause/unpause button and some text, which appears on top of the paused page. This
491
+ * setting turns off this overlay.
492
+ */
493
+ disablePaused: 'Disable paused state overlay',
422
494
  } as const;
423
495
  const str_ = i18n.i18n.registerUIStrings('core/sdk/sdk-meta.ts', UIStrings);
424
496
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
@@ -785,6 +857,95 @@ Common.Settings.registerSettingExtension({
785
857
  title: i18nLazyString(UIStrings.emulateCssMediaType),
786
858
  });
787
859
 
860
+ Common.Settings.registerSettingExtension({
861
+ title: i18nLazyString(UIStrings.cpuPressure),
862
+ reloadRequired: true,
863
+ settingName: 'emulation.cpu-pressure',
864
+ settingType: Common.Settings.SettingType.ENUM,
865
+ defaultValue: 'none',
866
+ options: [
867
+ {
868
+ value: 'none',
869
+ title: i18nLazyString(UIStrings.noPressureEmulation),
870
+ text: i18nLazyString(UIStrings.noPressureEmulation),
871
+ },
872
+ {
873
+ value: 'nominal',
874
+ title: i18nLazyString(UIStrings.nominal),
875
+ text: i18nLazyString(UIStrings.nominal),
876
+ },
877
+ {
878
+ value: 'fair',
879
+ title: i18nLazyString(UIStrings.fair),
880
+ text: i18nLazyString(UIStrings.fair),
881
+ },
882
+ {
883
+ value: 'serious',
884
+ title: i18nLazyString(UIStrings.serious),
885
+ text: i18nLazyString(UIStrings.serious),
886
+ },
887
+ {
888
+ value: 'critical',
889
+ title: i18nLazyString(UIStrings.critical),
890
+ text: i18nLazyString(UIStrings.critical),
891
+ },
892
+ ],
893
+ });
894
+
895
+ Common.Settings.registerSettingExtension({
896
+ title: i18nLazyString(UIStrings.touch),
897
+ reloadRequired: true,
898
+ settingName: 'emulation.touch',
899
+ settingType: Common.Settings.SettingType.ENUM,
900
+ defaultValue: 'none',
901
+ options: [
902
+ {
903
+ value: 'none',
904
+ title: i18nLazyString(UIStrings.devicebased),
905
+ text: i18nLazyString(UIStrings.devicebased),
906
+ },
907
+ {
908
+ value: 'force',
909
+ title: i18nLazyString(UIStrings.forceEnabled),
910
+ text: i18nLazyString(UIStrings.forceEnabled),
911
+ },
912
+ ],
913
+ });
914
+
915
+ Common.Settings.registerSettingExtension({
916
+ title: i18nLazyString(UIStrings.emulateIdleDetectorState),
917
+ settingName: 'emulation.idle-detection',
918
+ settingType: Common.Settings.SettingType.ENUM,
919
+ defaultValue: 'none',
920
+ options: [
921
+ {
922
+ value: 'none',
923
+ title: i18nLazyString(UIStrings.noIdleEmulation),
924
+ text: i18nLazyString(UIStrings.noIdleEmulation),
925
+ },
926
+ {
927
+ value: '{\"isUserActive\":true,\"isScreenUnlocked\":true}',
928
+ title: i18nLazyString(UIStrings.userActiveScreenUnlocked),
929
+ text: i18nLazyString(UIStrings.userActiveScreenUnlocked),
930
+ },
931
+ {
932
+ value: '{\"isUserActive\":true,\"isScreenUnlocked\":false}',
933
+ title: i18nLazyString(UIStrings.userActiveScreenLocked),
934
+ text: i18nLazyString(UIStrings.userActiveScreenLocked),
935
+ },
936
+ {
937
+ value: '{\"isUserActive\":false,\"isScreenUnlocked\":true}',
938
+ title: i18nLazyString(UIStrings.userIdleScreenUnlocked),
939
+ text: i18nLazyString(UIStrings.userIdleScreenUnlocked),
940
+ },
941
+ {
942
+ value: '{\"isUserActive\":false,\"isScreenUnlocked\":false}',
943
+ title: i18nLazyString(UIStrings.userIdleScreenLocked),
944
+ text: i18nLazyString(UIStrings.userIdleScreenLocked),
945
+ },
946
+ ],
947
+ });
948
+
788
949
  Common.Settings.registerSettingExtension({
789
950
  category: Common.Settings.SettingCategory.RENDERING,
790
951
  settingName: 'emulated-css-media-feature-prefers-color-scheme',
@@ -1277,3 +1438,12 @@ Common.Settings.registerSettingExtension({
1277
1438
  settingType: Common.Settings.SettingType.BOOLEAN,
1278
1439
  defaultValue: false,
1279
1440
  });
1441
+
1442
+ Common.Settings.registerSettingExtension({
1443
+ category: Common.Settings.SettingCategory.APPEARANCE,
1444
+ storageType: Common.Settings.SettingStorageType.SYNCED,
1445
+ title: i18nLazyString(UIStrings.disablePaused),
1446
+ settingName: 'disable-paused-state-overlay',
1447
+ settingType: Common.Settings.SettingType.BOOLEAN,
1448
+ defaultValue: false,
1449
+ });
@@ -644,11 +644,6 @@
644
644
  --source-code-font-family: ahem;
645
645
  }
646
646
 
647
- &.platform-screenshot-e2e-test {
648
- --default-font-family: roboto;
649
- --monospace-font-family: roboto;
650
- --source-code-font-family: roboto;
651
- }
652
647
 
653
648
  --ref-typeface-weight-regular: 400;
654
649
  --ref-typeface-weight-medium: 500;
@@ -33,4 +33,4 @@ import * as Main from '../main/main.js';
33
33
 
34
34
  // @ts-expect-error Exposed for legacy layout tests
35
35
  self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
36
- new Main.MainImpl.MainImpl();
36
+ new Main.MainImpl.MainImpl({supportsEmulation: true});
@@ -2,8 +2,6 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Platform from '../../core/platform/platform.js';
6
-
7
5
  import type {FormattedContentBuilder} from './FormattedContentBuilder.js';
8
6
  import {createTokenizer} from './FormatterWorker.js';
9
7
 
@@ -19,6 +17,7 @@ export class CSSFormatter {
19
17
  #fromOffset!: number;
20
18
  #lineEndings!: number[];
21
19
  #lastLine = -1;
20
+ #currentLineIndex = 0;
22
21
  #state: {
23
22
  eatWhitespace?: boolean,
24
23
  seenProperty?: boolean,
@@ -35,6 +34,7 @@ export class CSSFormatter {
35
34
  this.#toOffset = toOffset;
36
35
  this.#state = {};
37
36
  this.#lastLine = -1;
37
+ this.#currentLineIndex = 0;
38
38
  const tokenize = createTokenizer('text/css');
39
39
  const oldEnforce = this.#builder.setEnforceSpaceBetweenWords(false);
40
40
  tokenize(text.substring(this.#fromOffset, this.#toOffset), this.#tokenCallback.bind(this));
@@ -42,9 +42,18 @@ export class CSSFormatter {
42
42
  }
43
43
 
44
44
  #tokenCallback(token: string, type: string|null, startPosition: number): void {
45
+ // startPosition is relative to the start of the CSS block.
46
+ // Convert it to an absolute document offset to match this.#lineEndings.
45
47
  startPosition += this.#fromOffset;
46
- const startLine = Platform.ArrayUtilities.lowerBound(
47
- this.#lineEndings, startPosition, Platform.ArrayUtilities.DEFAULT_COMPARATOR);
48
+
49
+ // Find the line index containing startPosition.
50
+ // Since CodeMirror processes tokens sequentially in increasing order of their offset,
51
+ // we can perform an amortized O(1) linear scan forward by tracking the current index.
52
+ while (this.#currentLineIndex < this.#lineEndings.length &&
53
+ this.#lineEndings[this.#currentLineIndex] < startPosition) {
54
+ this.#currentLineIndex++;
55
+ }
56
+ const startLine = this.#currentLineIndex;
48
57
  if (startLine !== this.#lastLine) {
49
58
  this.#state.eatWhitespace = true;
50
59
  }
@@ -29,8 +29,11 @@ export class FormattedContentBuilder {
29
29
  addToken(token: string, offset: number): void {
30
30
  // Skip the regex check if `addSoftSpace` will be a no-op.
31
31
  if (this.#enforceSpaceBetweenWords && !this.#hardSpaces && !this.#softSpace) {
32
- const lastCharOfLastToken = this.#formattedContent.at(-1)?.at(-1) ?? '';
33
- if (this.#canBeIdentifierOrNumber.test(lastCharOfLastToken) && this.#canBeIdentifierOrNumber.test(token)) {
32
+ const lastToken = this.#formattedContent.at(-1) ?? '';
33
+ const lastCharOfLastToken = lastToken.at(-1) ?? '';
34
+ if ((this.#canBeIdentifierOrNumber.test(lastCharOfLastToken) ||
35
+ ['`', '}', ')', ']', '\'', '"', '/'].includes(lastCharOfLastToken)) &&
36
+ this.#canBeIdentifierOrNumber.test(token)) {
34
37
  this.addSoftSpace();
35
38
  }
36
39
  }