chrome-devtools-frontend 1.0.1689415 → 1.0.1690531

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 (318) hide show
  1. package/.gitmodules +4 -0
  2. package/eslint.config.mjs +8 -2
  3. package/front_end/core/common/Object.ts +10 -4
  4. package/front_end/core/i18n/collect-ui-strings.js +5 -5
  5. package/front_end/core/i18n/generate-locales-js.js +1 -1
  6. package/front_end/core/i18n/i18n.ts +6 -0
  7. package/front_end/core/root/Runtime.ts +1 -5
  8. package/front_end/core/sdk/CSSMetadata.ts +3 -5
  9. package/front_end/core/sdk/DOMModel.ts +46 -11
  10. package/front_end/core/sdk/EmulationModel.ts +18 -0
  11. package/front_end/core/sdk/NetworkRequest.ts +50 -4
  12. package/front_end/core/sdk/NetworkRequestAccess.ts +172 -0
  13. package/front_end/core/sdk/SDKSettings.ts +9 -0
  14. package/front_end/core/sdk/Script.ts +0 -1
  15. package/front_end/core/sdk/SecurityOrigin.ts +160 -25
  16. package/front_end/core/sdk/Target.ts +1 -5
  17. package/front_end/core/sdk/sdk.ts +2 -0
  18. package/front_end/generated/SupportedCSSProperties.ts +1 -1
  19. package/front_end/models/ai_assistance/AiAgent2.ts +4 -1
  20. package/front_end/models/ai_assistance/AiConversation.ts +29 -18
  21. package/front_end/models/ai_assistance/AiUtils.ts +0 -10
  22. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +6 -10
  23. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -1
  24. package/front_end/models/ai_assistance/injected.ts +0 -2
  25. package/front_end/models/javascript_metadata/NativeFunctions.ts +1 -1
  26. package/front_end/models/trace/insights/CLSCulprits.ts +1 -2
  27. package/front_end/models/trace/insights/Cache.ts +1 -3
  28. package/front_end/models/trace/insights/CharacterSet.ts +1 -3
  29. package/front_end/models/trace/insights/DOMSize.ts +1 -3
  30. package/front_end/models/trace/insights/DocumentLatency.ts +1 -3
  31. package/front_end/models/trace/insights/DuplicatedJavaScript.ts +1 -3
  32. package/front_end/models/trace/insights/FontDisplay.ts +1 -2
  33. package/front_end/models/trace/insights/ForcedReflow.ts +1 -2
  34. package/front_end/models/trace/insights/INPBreakdown.ts +1 -3
  35. package/front_end/models/trace/insights/ImageDelivery.ts +1 -3
  36. package/front_end/models/trace/insights/LCPBreakdown.ts +1 -3
  37. package/front_end/models/trace/insights/LCPDiscovery.ts +1 -3
  38. package/front_end/models/trace/insights/LegacyJavaScript.ts +1 -3
  39. package/front_end/models/trace/insights/ModernHTTP.ts +1 -2
  40. package/front_end/models/trace/insights/NetworkDependencyTree.ts +1 -2
  41. package/front_end/models/trace/insights/RenderBlocking.ts +1 -3
  42. package/front_end/models/trace/insights/SlowCSSSelector.ts +1 -3
  43. package/front_end/models/trace/insights/ThirdParties.ts +1 -3
  44. package/front_end/models/trace/insights/Viewport.ts +1 -2
  45. package/front_end/panels/accessibility/ARIAAttributesView.ts +1 -1
  46. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +3 -3
  47. package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -2
  48. package/front_end/panels/accessibility/AccessibilityStrings.ts +7 -3
  49. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -2
  50. package/front_end/panels/ai_assistance/components/AccessibilityAgentMarkdownRenderer.ts +1 -3
  51. package/front_end/panels/ai_assistance/components/chatMessage.css +3 -1
  52. package/front_end/panels/animation/AnimationGroupPreviewUI.ts +1 -1
  53. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  54. package/front_end/panels/animation/AnimationUI.ts +1 -1
  55. package/front_end/panels/application/AppManifestView.ts +6 -2
  56. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
  57. package/front_end/panels/application/BounceTrackingMitigationsTreeElement.ts +1 -1
  58. package/front_end/panels/application/FrameDetailsView.ts +1 -1
  59. package/front_end/panels/application/IndexedDBViews.ts +3 -2
  60. package/front_end/panels/application/ReportingApiTreeElement.ts +1 -1
  61. package/front_end/panels/application/ReportingApiView.ts +2 -2
  62. package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +1 -1
  63. package/front_end/panels/application/ServiceWorkersView.ts +1 -1
  64. package/front_end/panels/application/StorageBucketsTreeElement.ts +1 -1
  65. package/front_end/panels/application/StorageItemsToolbar.ts +6 -2
  66. package/front_end/panels/application/StorageView.ts +9 -8
  67. package/front_end/panels/application/TrustTokensTreeElement.ts +1 -1
  68. package/front_end/panels/application/WebMCPView.ts +2 -1
  69. package/front_end/panels/application/components/BackForwardCacheView.ts +1 -1
  70. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +1 -1
  71. package/front_end/panels/application/components/CrashReportContextGrid.ts +1 -1
  72. package/front_end/panels/application/components/EndpointsGrid.ts +3 -2
  73. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
  74. package/front_end/panels/application/components/ReportsGrid.ts +1 -1
  75. package/front_end/panels/application/components/ServiceWorkerRouterView.ts +1 -1
  76. package/front_end/panels/application/components/TrustTokensView.ts +2 -2
  77. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +1 -1
  78. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
  79. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +1 -1
  80. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -1
  81. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +7 -2
  82. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  83. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -0
  84. package/front_end/panels/autofill/AutofillView.ts +2 -2
  85. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +2 -3
  86. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +1 -1
  87. package/front_end/panels/changes/ChangesSidebar.ts +56 -15
  88. package/front_end/panels/changes/ChangesView.ts +1 -1
  89. package/front_end/panels/common/CPUThrottlingOption.ts +12 -6
  90. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  91. package/front_end/panels/common/ExtensionView.ts +2 -1
  92. package/front_end/panels/console/ConsolePinPane.ts +4 -2
  93. package/front_end/panels/console/ConsolePrompt.ts +6 -2
  94. package/front_end/panels/console/ConsoleSidebar.ts +12 -4
  95. package/front_end/panels/console/PromptBuilder.ts +1 -1
  96. package/front_end/panels/coverage/CoverageListView.ts +1 -1
  97. package/front_end/panels/coverage/CoverageModel.ts +6 -4
  98. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +9 -9
  99. package/front_end/panels/css_overview/CSSOverviewPanel.ts +3 -3
  100. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
  101. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +3 -3
  102. package/front_end/panels/css_overview/CSSOverviewStartView.ts +3 -3
  103. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  104. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -1
  105. package/front_end/panels/elements/ElementsTreeElement.ts +16 -3
  106. package/front_end/panels/elements/ElementsTreeOutline.ts +402 -130
  107. package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
  108. package/front_end/panels/elements/PropertyNameCategories.ts +1 -1
  109. package/front_end/panels/elements/PropertyRenderer.ts +22 -15
  110. package/front_end/panels/elements/ShortcutTreeElement.ts +2 -1
  111. package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -3
  112. package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
  113. package/front_end/panels/elements/StylePropertyTreeElement.ts +75 -26
  114. package/front_end/panels/elements/StylesSidebarPane.ts +9 -4
  115. package/front_end/panels/elements/components/StylePropertyEditor.ts +160 -148
  116. package/front_end/panels/elements/elementsTreeOutline.css +4 -0
  117. package/front_end/panels/emulation/DeviceModeView.ts +6 -1
  118. package/front_end/panels/emulation/InspectedPagePlaceholder.ts +6 -2
  119. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -1
  120. package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +1 -1
  121. package/front_end/panels/layer_viewer/LayerDetailsView.ts +6 -2
  122. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +7 -2
  123. package/front_end/panels/layer_viewer/Layers3DView.ts +8 -1
  124. package/front_end/panels/layer_viewer/PaintProfilerView.ts +6 -2
  125. package/front_end/panels/lighthouse/lighthousePanel.css +5 -5
  126. package/front_end/panels/lighthouse/lighthouseStartView.css +13 -13
  127. package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorPane.ts +6 -2
  128. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +6 -2
  129. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
  130. package/front_end/panels/linear_memory_inspector/components/linearMemoryNavigator.css +1 -1
  131. package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +5 -5
  132. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +6 -6
  133. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +6 -6
  134. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +2 -2
  135. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +6 -2
  136. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +25 -54
  137. package/front_end/panels/network/NetworkDataGridNode.ts +11 -9
  138. package/front_end/panels/network/NetworkLogView.ts +12 -4
  139. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  140. package/front_end/panels/network/RequestHeadersView.ts +1 -1
  141. package/front_end/panels/network/RequestPayloadView.ts +1 -1
  142. package/front_end/panels/network/RequestResponseView.ts +1 -1
  143. package/front_end/panels/network/RequestTimingView.ts +1 -1
  144. package/front_end/panels/network/ShowMoreDetailsWidget.ts +1 -1
  145. package/front_end/panels/network/components/RequestHeadersView.css +5 -0
  146. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  147. package/front_end/panels/network/networkLogView.css +4 -0
  148. package/front_end/panels/network/requestInitiatorViewTree.css +2 -0
  149. package/front_end/panels/performance_monitor/performanceMonitor.css +3 -3
  150. package/front_end/panels/profiler/HeapDetachedElementsView.ts +7 -2
  151. package/front_end/panels/profiler/HeapProfileView.ts +7 -2
  152. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +8 -4
  153. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +8 -4
  154. package/front_end/panels/profiler/HeapSnapshotView.ts +15 -6
  155. package/front_end/panels/profiler/HeapTimelineOverview.ts +6 -2
  156. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +12 -5
  157. package/front_end/panels/profiler/ProfileLauncherView.ts +6 -2
  158. package/front_end/panels/profiler/profilesPanel.css +8 -9
  159. package/front_end/panels/profiler/profilesSidebarTree.css +13 -13
  160. package/front_end/panels/protocol_monitor/JSONEditor.css +2 -2
  161. package/front_end/panels/protocol_monitor/JSONEditor.ts +6 -1
  162. package/front_end/panels/protocol_monitor/protocolMonitor.css +2 -2
  163. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
  164. package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
  165. package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -6
  166. package/front_end/panels/sources/ProfilePlugin.ts +2 -1
  167. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  168. package/front_end/panels/sources/SourcesView.ts +7 -2
  169. package/front_end/panels/sources/TabbedEditorContainer.ts +6 -2
  170. package/front_end/panels/sources/UISourceCodeFrame.ts +10 -3
  171. package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -1
  172. package/front_end/panels/timeline/AnnotationHelpers.ts +9 -9
  173. package/front_end/panels/timeline/CountersGraph.ts +8 -8
  174. package/front_end/panels/timeline/EventsTimelineTreeView.ts +3 -3
  175. package/front_end/panels/timeline/ExtensionTrackAppender.ts +1 -1
  176. package/front_end/panels/timeline/GPUTrackAppender.ts +1 -1
  177. package/front_end/panels/timeline/InteractionsTrackAppender.ts +1 -1
  178. package/front_end/panels/timeline/IsolateSelector.ts +3 -3
  179. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +4 -4
  180. package/front_end/panels/timeline/NetworkTrackAppender.ts +2 -2
  181. package/front_end/panels/timeline/StatusDialog.ts +5 -6
  182. package/front_end/panels/timeline/ThirdPartyTreeView.ts +4 -4
  183. package/front_end/panels/timeline/ThreadAppender.ts +12 -14
  184. package/front_end/panels/timeline/TimelineController.ts +5 -8
  185. package/front_end/panels/timeline/TimelineDetailsView.ts +13 -9
  186. package/front_end/panels/timeline/TimelineEventOverview.ts +4 -4
  187. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +18 -18
  188. package/front_end/panels/timeline/TimelineFlameChartView.ts +8 -3
  189. package/front_end/panels/timeline/TimelineHistoryManager.ts +9 -9
  190. package/front_end/panels/timeline/TimelineLoader.ts +1 -1
  191. package/front_end/panels/timeline/TimelineMiniMap.ts +7 -2
  192. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +7 -3
  193. package/front_end/panels/timeline/TimelinePanel.ts +60 -62
  194. package/front_end/panels/timeline/TimelineSelectorStatsView.ts +27 -27
  195. package/front_end/panels/timeline/TimelineTreeView.ts +47 -45
  196. package/front_end/panels/timeline/TimelineUIUtils.ts +146 -120
  197. package/front_end/panels/timeline/TimingsTrackAppender.ts +1 -1
  198. package/front_end/panels/timeline/TrackConfigBanner.ts +4 -4
  199. package/front_end/panels/timeline/UIDevtoolsUtils.ts +15 -15
  200. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +4 -3
  201. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  202. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +25 -24
  203. package/front_end/panels/timeline/components/RelatedInsightChips.ts +4 -3
  204. package/front_end/panels/timeline/components/Sidebar.ts +1 -1
  205. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +4 -3
  206. package/front_end/panels/timeline/components/insights/Table.ts +1 -1
  207. package/front_end/panels/timeline/enable-easter-egg.js +1 -1
  208. package/front_end/panels/timeline/timeline-meta.ts +30 -30
  209. package/front_end/panels/timeline/timelineFlameChartView.css +10 -10
  210. package/front_end/panels/timeline/timelineFlamechartPopover.css +5 -5
  211. package/front_end/panels/timeline/timelineHistoryManager.css +7 -7
  212. package/front_end/panels/timeline/timelinePaintProfiler.css +2 -2
  213. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  214. package/front_end/panels/timeline/utils/IgnoreList.ts +4 -4
  215. package/front_end/panels/timeline/utils/ImageCache.ts +5 -3
  216. package/front_end/panels/web_audio/WebAudioView.ts +3 -3
  217. package/front_end/panels/webauthn/WebauthnPane.ts +5 -11
  218. package/front_end/third_party/acorn/acorn.ts +3 -3
  219. package/front_end/third_party/chromium/README.chromium +1 -1
  220. package/front_end/third_party/chromium/ahem/ahem.d.ts +1 -0
  221. package/front_end/third_party/csp_evaluator/package/csp.ts +4 -4
  222. package/front_end/third_party/csp_evaluator/package/parser.ts +3 -1
  223. package/front_end/third_party/csp_evaluator/package/utils.ts +1 -1
  224. package/front_end/third_party/diff/diff_match_patch.d.ts +10 -0
  225. package/front_end/third_party/json5/json5.ts +2 -2
  226. package/front_end/ui/comments/CommentAnchorResolver.ts +12 -3
  227. package/front_end/ui/comments/CommentOverlayManager.ts +9 -1
  228. package/front_end/ui/components/buttons/Button.docs.ts +1 -1
  229. package/front_end/ui/components/buttons/button.css +21 -0
  230. package/front_end/ui/components/buttons/floatingButton.css +25 -0
  231. package/front_end/ui/components/report_view/ReportView.docs.ts +1 -1
  232. package/front_end/ui/components/snackbars/Snackbars.docs.ts +1 -1
  233. package/front_end/ui/components/spinners/Spinner.ts +1 -1
  234. package/front_end/ui/components/spinners/Spinners.docs.ts +1 -1
  235. package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
  236. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +46 -27
  237. package/front_end/ui/components/switch/Switch.docs.ts +1 -1
  238. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +10 -8
  239. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +2 -1
  240. package/front_end/ui/components/text_editor/ExecutionPositionHighlighter.ts +2 -2
  241. package/front_end/ui/components/text_editor/TextEditor.ts +19 -0
  242. package/front_end/ui/components/text_editor/config.ts +109 -96
  243. package/front_end/ui/components/text_editor/cursor_tooltip.ts +1 -1
  244. package/front_end/ui/components/text_editor/theme.ts +1 -1
  245. package/front_end/ui/components/tooltips/Tooltip.docs.ts +1 -1
  246. package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
  247. package/front_end/ui/components/tree_outline/TreeOutlineUtils.ts +4 -1
  248. package/front_end/ui/kit/cards/Card.ts +1 -1
  249. package/front_end/ui/kit/icons/Icon.ts +1 -1
  250. package/front_end/ui/kit/link/Link.docs.ts +1 -1
  251. package/front_end/ui/kit/link/Link.ts +1 -1
  252. package/front_end/ui/legacy/ContextMenu.docs.ts +1 -1
  253. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  254. package/front_end/ui/legacy/Dialog.ts +10 -2
  255. package/front_end/ui/legacy/DropTarget.ts +6 -1
  256. package/front_end/ui/legacy/EmptyWidget.ts +1 -1
  257. package/front_end/ui/legacy/FilterBar.ts +6 -1
  258. package/front_end/ui/legacy/GlassPane.ts +1 -1
  259. package/front_end/ui/legacy/RadioButton.docs.ts +1 -1
  260. package/front_end/ui/legacy/SelectMenu.docs.ts +1 -1
  261. package/front_end/ui/legacy/ShortcutRegistry.ts +2 -2
  262. package/front_end/ui/legacy/Slider.docs.ts +1 -1
  263. package/front_end/ui/legacy/SplitWidget.ts +7 -2
  264. package/front_end/ui/legacy/StackedPane.ts +1 -1
  265. package/front_end/ui/legacy/TabbedPane.ts +5 -1
  266. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -1
  267. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  268. package/front_end/ui/legacy/Toolbar.ts +1 -1
  269. package/front_end/ui/legacy/Treeoutline.ts +13 -37
  270. package/front_end/ui/legacy/UIUtils.ts +6 -3
  271. package/front_end/ui/legacy/ViewManager.ts +1 -1
  272. package/front_end/ui/legacy/Widget.ts +1 -1
  273. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +13 -2
  274. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  275. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -2
  276. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +6 -2
  277. package/front_end/ui/legacy/components/inline_editor/AnimationTimingModel.ts +1 -1
  278. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +54 -45
  279. package/front_end/ui/legacy/components/inline_editor/CSSAngleUtils.ts +1 -1
  280. package/front_end/ui/legacy/components/inline_editor/CSSShadowEditor.ts +6 -2
  281. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +141 -106
  282. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +1 -1
  283. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +10 -10
  284. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +2 -0
  285. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +6 -1
  286. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +6 -2
  287. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +8 -4
  288. package/front_end/ui/legacy/components/perf_ui/pieChart.css +7 -5
  289. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +8 -3
  290. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +6 -1
  291. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +15 -7
  292. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -1
  293. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -5
  294. package/front_end/ui/legacy/inspectorCommon.css +11 -0
  295. package/front_end/ui/visual_logging/Debugging.ts +2 -1
  296. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -1
  297. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  298. package/front_end/ui/visual_logging/LoggingEvents.ts +5 -5
  299. package/front_end/ui/visual_logging/LoggingState.ts +1 -1
  300. package/front_end/ui/visual_logging/visual_logging.ts +67 -56
  301. package/package.json +3 -2
  302. package/front_end/third_party/acorn/acorn-tsconfig.json +0 -12
  303. package/front_end/third_party/acorn/estree-tsconfig.json +0 -8
  304. package/front_end/third_party/chromium/client-variations/client-variations-tsconfig.json +0 -8
  305. package/front_end/third_party/codemirror/codemirror-legacy-types-tsconfig.json +0 -8
  306. package/front_end/third_party/codemirror/codemirror-tsconfig.json +0 -15
  307. package/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  308. package/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  309. package/front_end/third_party/json5/json5-tsconfig.json +0 -8
  310. package/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  311. package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +0 -11
  312. package/front_end/third_party/lighthouse/report/bundle-tsconfig.json +0 -8
  313. package/front_end/third_party/lit/lit-tsconfig.json +0 -15
  314. package/front_end/third_party/marked/marked-tsconfig.json +0 -8
  315. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +0 -191
  316. package/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  317. package/front_end/third_party/wasmparser/wasmparser-tsconfig.json +0 -9
  318. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +0 -47
package/.gitmodules CHANGED
@@ -1,3 +1,7 @@
1
+ [submodule "test/ai_evals/eval_data"]
2
+ path = test/ai_evals/eval_data
3
+ url = https://chrome-internal.googlesource.com/devtools/chrome-devtools-evals
4
+ gclient-condition = checkout_ai_evals == True
1
5
  [submodule "third_party/clang-format/script"]
2
6
  path = third_party/clang-format/script
3
7
  url = https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format
package/eslint.config.mjs CHANGED
@@ -536,8 +536,6 @@ export default defineConfig([
536
536
  // certain TypeScript compilation errors after fixes
537
537
  '@typescript-eslint/no-unnecessary-type-assertion': 'off',
538
538
 
539
- '@typescript-eslint/no-inferrable-types': 'error',
540
-
541
539
  '@typescript-eslint/consistent-generic-constructors': 'off',
542
540
 
543
541
  // This is more performant
@@ -856,6 +854,14 @@ export default defineConfig([
856
854
  files: ['front_end/legacy_test_runner/**/*'],
857
855
  rules: {
858
856
  '@devtools/es-modules-import': 'off',
857
+ '@typescript-eslint/ban-ts-comment': 'off',
858
+ '@typescript-eslint/explicit-function-return-type': 'off',
859
+ '@typescript-eslint/naming-convention': 'off',
860
+ '@typescript-eslint/no-explicit-any': 'off',
861
+ '@typescript-eslint/no-floating-promises': 'off',
862
+ '@typescript-eslint/no-unused-vars': 'off',
863
+ '@devtools/no-imperative-dom-api': 'off',
864
+ 'jsdoc/require-returns-description': 'off',
859
865
  },
860
866
  },
861
867
  {
@@ -119,10 +119,16 @@ export type EventMixinBase = {
119
119
  dispatchDOMEvent ? (event: Event) : void,
120
120
  }&object;
121
121
 
122
- export function eventMixin<Events, Base extends Platform.Constructor.Constructor<EventMixinBase>>(base: Base):
123
- Platform.Constructor.Constructor<EventTarget<Events>>&Base {
124
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
125
- console.assert(base as any !== HTMLElement);
122
+ export type EventMixin<
123
+ Events,
124
+ Base extends Platform.Constructor.Constructor<EventMixinBase>,
125
+ > = Base & Platform.Constructor.Constructor<EventTarget<Events>>;
126
+
127
+ export function eventMixin<
128
+ Events,
129
+ Base extends Platform.Constructor.Constructor<EventMixinBase>,
130
+ >(base: Base): EventMixin<Events, Base> {
131
+ console.assert((base as unknown) !== HTMLElement);
126
132
  return class EventHandling extends base implements EventTarget<Events> {
127
133
  // Note that the weird name is due to TSC disallowing private/protected fields in
128
134
  // anonmous exported classes. We use a `__` prefix to prevent clashes with `base`.
@@ -37,7 +37,7 @@ const yargsObject = yargs(hideBin(process.argv))
37
37
  * @param locale
38
38
  * @param strings
39
39
  */
40
- function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
40
+ async function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
41
41
  const outputPath = path.join(outputDirectory, `${locale}.json`);
42
42
 
43
43
  /** @type {Record<string, CtcMessage>} */
@@ -50,7 +50,7 @@ function convertCtcToLhLAndSave(outputDirectory, locale, strings) {
50
50
  }
51
51
 
52
52
  const convertedStrings = bakePlaceholders(sortedCtcStrings);
53
- writeIfChanged(outputPath, JSON.stringify(convertedStrings, null, 2) + '\n');
53
+ await writeIfChanged(outputPath, JSON.stringify(convertedStrings, null, 2) + '\n');
54
54
  }
55
55
 
56
56
  const inputDirectories = yargsObject['input-directories'];
@@ -76,9 +76,9 @@ for (const directory of inputDirectories) {
76
76
  }
77
77
 
78
78
  const outputDirectory = yargsObject['output-directory'];
79
- convertCtcToLhLAndSave(outputDirectory, 'en-US', collectedStrings);
79
+ await convertCtcToLhLAndSave(outputDirectory, 'en-US', collectedStrings);
80
80
  if (yargsObject['include-en-xl']) {
81
- convertCtcToLhLAndSave(
81
+ await convertCtcToLhLAndSave(
82
82
  outputDirectory,
83
83
  'en-XL',
84
84
  createPsuedoLocaleStrings(collectedStrings),
@@ -92,4 +92,4 @@ const depfile = `
92
92
  ${path.join(outputDirectory, 'en-US.json')}: ${files.join(' ')}
93
93
  `;
94
94
 
95
- writeIfChanged(path.join(outputDirectory, 'collected-ui-strings.d'), depfile);
95
+ await writeIfChanged(path.join(outputDirectory, 'collected-ui-strings.d'), depfile);
@@ -53,4 +53,4 @@ export const REMOTE_FETCH_PATTERN = '${yargsObject['remote-fetch-pattern']}';
53
53
  export const LOCAL_FETCH_PATTERN = '${yargsObject['local-fetch-pattern']}';
54
54
  `;
55
55
 
56
- writeIfChanged(path.join(yargsObject['target-gen-dir'], 'locales.js'), content);
56
+ await writeIfChanged(path.join(yargsObject['target-gen-dir'], 'locales.js'), content);
@@ -2,12 +2,18 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import type * as Platform from '../platform/platform.js';
6
+
5
7
  import * as ByteUtilities from './ByteUtilities.js';
6
8
  import * as DevToolsLocale from './DevToolsLocale.js';
7
9
  import * as i18n from './i18nImpl.js';
10
+ import type * as i18nTypes from './i18nTypes.js';
8
11
  import * as NumberFormatter from './NumberFormatter.js';
9
12
  import * as TimeUtilities from './time-utilities.js';
10
13
 
14
+ export type LocalizeString = (id: string, values?: i18nTypes.Values) => Platform.UIString.LocalizedString;
15
+ export type LazyLocalizeString = () => Platform.UIString.LocalizedString;
16
+
11
17
  export {
12
18
  ByteUtilities,
13
19
  DevToolsLocale,
@@ -515,16 +515,13 @@ interface UseGcaApi {
515
515
 
516
516
  interface DevToolsAiV2Architecture {
517
517
  enabled: boolean;
518
+ userTier?: string;
518
519
  }
519
520
 
520
521
  interface DevToolsProtocolMonitor {
521
522
  enabled: boolean;
522
523
  }
523
524
 
524
- interface DevToolsWebMCPSupport {
525
- enabled: boolean;
526
- }
527
-
528
525
  interface DevToolsAdsPanel {
529
526
  enabled: boolean;
530
527
  }
@@ -599,7 +596,6 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
599
596
  devToolsConsoleInsightsTeasers: ConsoleInsightsTeasers,
600
597
  devToolsGeminiRebranding: HostConfigGeminiRebranding,
601
598
  devToolsProtocolMonitor: DevToolsProtocolMonitor,
602
- devToolsWebMCPSupport: DevToolsWebMCPSupport,
603
599
  devToolsAdsPanel: DevToolsAdsPanel,
604
600
  devToolsUseGcaApi: UseGcaApi,
605
601
  devToolsPlusButton: DevToolsPlusButton,
@@ -440,13 +440,12 @@ export const PositionTryOrderKeywords: PositionTryOrderKeyword[] = [
440
440
  PositionTryOrderKeyword.MOST_INLINE_SIZE,
441
441
  ];
442
442
 
443
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
444
443
  export const VariableNameRegex: RegExp = /(\s*--.*?)/gs;
445
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
444
+
446
445
  export const VariableRegex: RegExp = /(var\(\s*--.*?\))/gs;
447
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
446
+
448
447
  export const CustomVariableRegex: RegExp = /(var\(*--[\w\d]+-([\w]+-[\w]+)\))/g;
449
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
448
+
450
449
  export const URLRegex: RegExp = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g;
451
450
 
452
451
  /**
@@ -457,7 +456,6 @@ export const URLRegex: RegExp = /url\(\s*('.+?'|".+?"|[^)]+)\s*\)/g;
457
456
  * 'grid', 'grid-template', e.g.
458
457
  * [track-#name] "a a ." minmax(50px, auto) [track-#name]
459
458
  */
460
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
461
459
  export const GridAreaRowRegex: RegExp = /((?:\[[\w\- ]+\]\s*)*(?:"[^"]+"|'[^']+'))[^'"\[]*\[?[^'"\[]*/;
462
460
 
463
461
  let cssMetadataInstance: CSSMetadata|null = null;
@@ -48,6 +48,7 @@ import {RemoteObject} from './RemoteObject.js';
48
48
  import {Events as ResourceTreeModelEvents, type ResourceTreeFrame, ResourceTreeModel} from './ResourceTreeModel.js';
49
49
  import {RuntimeModel} from './RuntimeModel.js';
50
50
  import {SDKModel} from './SDKModel.js';
51
+ import {SecurityOrigin} from './SecurityOrigin.js';
51
52
  import {Capability, type Target} from './Target.js';
52
53
  import type {TargetManager} from './TargetManager.js';
53
54
 
@@ -387,6 +388,14 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
387
388
  return this.#topLayerIndex;
388
389
  }
389
390
 
391
+ /**
392
+ * Returns the security origin of the document owning this node, or `null` if
393
+ * this node is not attached to a document.
394
+ */
395
+ securityOrigin(): SecurityOrigin|null {
396
+ return this.ownerDocument?.securityOrigin() ?? null;
397
+ }
398
+
390
399
  adProvenance(): Protocol.Network.AdProvenance|undefined {
391
400
  if (this.#adProvenance !== undefined) {
392
401
  return this.#adProvenance;
@@ -1424,6 +1433,8 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
1424
1433
  nodeName: this.nodeName(),
1425
1434
  localName: this.localName(),
1426
1435
  nodeValue: this.nodeValueInternal,
1436
+ documentURL: this.documentURL,
1437
+ baseURL: this.baseURL,
1427
1438
  } as Protocol.DOM.Node) :
1428
1439
  new DOMNodeSnapshot(this.domModel());
1429
1440
  snapshot.id = this.id;
@@ -1445,11 +1456,6 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
1445
1456
  snapshot.#isInShadowTree = this.#isInShadowTree;
1446
1457
  snapshot.childNodeCountInternal = this.childNodeCountInternal;
1447
1458
 
1448
- if (snapshot instanceof DOMDocument && this instanceof DOMDocument) {
1449
- snapshot.documentURL = this.documentURL;
1450
- snapshot.baseURL = this.baseURL;
1451
- }
1452
-
1453
1459
  if (!this.childrenInternal && this.childNodeCountInternal > 0) {
1454
1460
  await this.getSubtree(1, false);
1455
1461
  }
@@ -1600,15 +1606,45 @@ export class DOMNodeShortcut {
1600
1606
  export class DOMDocument extends DOMNode {
1601
1607
  body: DOMNode|null;
1602
1608
  documentElement: DOMNode|null;
1603
- documentURL: Platform.DevToolsPath.UrlString;
1604
- baseURL: Platform.DevToolsPath.UrlString;
1609
+ #documentURL: Platform.DevToolsPath.UrlString;
1610
+ #baseURL: Platform.DevToolsPath.UrlString;
1611
+ #securityOrigin: SecurityOrigin;
1612
+
1605
1613
  constructor(domModel: DOMModel, payload: Protocol.DOM.Node) {
1606
1614
  super(domModel);
1607
1615
  this.body = null;
1608
1616
  this.documentElement = null;
1609
1617
  this.init(this, false, payload);
1610
- this.documentURL = (payload.documentURL || '') as Platform.DevToolsPath.UrlString;
1611
- this.baseURL = (payload.baseURL || '') as Platform.DevToolsPath.UrlString;
1618
+ this.#documentURL = (payload.documentURL || '') as Platform.DevToolsPath.UrlString;
1619
+ this.#baseURL = (payload.baseURL || '') as Platform.DevToolsPath.UrlString;
1620
+ this.#securityOrigin = SecurityOrigin.create(this.#documentURL);
1621
+ }
1622
+
1623
+ get documentURL(): Platform.DevToolsPath.UrlString {
1624
+ return this.#documentURL;
1625
+ }
1626
+
1627
+ get baseURL(): Platform.DevToolsPath.UrlString {
1628
+ return this.#baseURL;
1629
+ }
1630
+
1631
+ /**
1632
+ * Returns the security origin of this document.
1633
+ *
1634
+ * The security origin is derived from the document URL and is recomputed
1635
+ * when the document navigates to a new URL via `setDocumentURL`.
1636
+ */
1637
+ override securityOrigin(): SecurityOrigin {
1638
+ return this.#securityOrigin;
1639
+ }
1640
+
1641
+ /**
1642
+ * Updates the document and base URLs, and recomputes the document's security origin.
1643
+ */
1644
+ setDocumentURL(url: Platform.DevToolsPath.UrlString): void {
1645
+ this.#documentURL = url;
1646
+ this.#baseURL = url;
1647
+ this.#securityOrigin = SecurityOrigin.create(url);
1612
1648
  }
1613
1649
  }
1614
1650
 
@@ -1694,8 +1730,7 @@ export class DOMModel extends SDKModel<EventTypes> {
1694
1730
  if (node) {
1695
1731
  const contentDocument = node.contentDocument();
1696
1732
  if (contentDocument && contentDocument.documentURL !== frame.url) {
1697
- contentDocument.documentURL = frame.url;
1698
- contentDocument.baseURL = frame.url;
1733
+ contentDocument.setDocumentURL(frame.url);
1699
1734
  this.dispatchEventToListeners(Events.DocumentURLChanged, contentDocument);
1700
1735
  }
1701
1736
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
6
6
  import * as Protocol from '../../generated/protocol.js';
7
+ import type * as Common from '../common/common.js';
7
8
 
8
9
  import {CSSModel} from './CSSModel.js';
9
10
  import type {MultitargetNetworkManager} from './NetworkManager.js';
@@ -12,6 +13,7 @@ import {SDKModel} from './SDKModel.js';
12
13
  import {
13
14
  avifFormatDisabledSettingDescriptor,
14
15
  cpuPressureSettingDescriptor,
16
+ dataSaverSettingDescriptor,
15
17
  emulateAutoDarkModeSettingDescriptor,
16
18
  emulatedCSSMediaFeatureColorGamutSettingDescriptor,
17
19
  emulatedCSSMediaFeatureForcedColorsSettingDescriptor,
@@ -56,6 +58,8 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
56
58
  };
57
59
  #screenOrientationLocked: boolean;
58
60
  #lockedOrientation: Protocol.Emulation.ScreenOrientation|null;
61
+ readonly #dataSaverSetting: Common.Settings.Setting<DataSaverOverride>;
62
+ readonly #dataSaverChangeListener: () => void;
59
63
 
60
64
  constructor(target: Target) {
61
65
  super(target);
@@ -239,6 +243,15 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
239
243
  updateDisabledImageFormats();
240
244
  }
241
245
 
246
+ this.#dataSaverSetting = settings.resolve(dataSaverSettingDescriptor);
247
+ this.#dataSaverChangeListener = () => {
248
+ void this.setDataSaverOverride(this.#dataSaverSetting.get());
249
+ };
250
+ this.#dataSaverSetting.addChangeListener(this.#dataSaverChangeListener, this);
251
+ if (this.#dataSaverSetting.get() !== DataSaverOverride.UNSET) {
252
+ void this.setDataSaverOverride(this.#dataSaverSetting.get());
253
+ }
254
+
242
255
  this.#cpuPressureEnabled = false;
243
256
  this.#touchEmulationAllowed = true;
244
257
  this.#touchEnabled = false;
@@ -251,6 +264,11 @@ export class EmulationModel extends SDKModel<EmulationModelEventTypes> implement
251
264
  target.registerEmulationDispatcher(this);
252
265
  }
253
266
 
267
+ override dispose(): void {
268
+ super.dispose();
269
+ this.#dataSaverSetting.removeChangeListener(this.#dataSaverChangeListener, this);
270
+ }
271
+
254
272
  setTouchEmulationAllowed(touchEmulationAllowed: boolean): void {
255
273
  this.#touchEmulationAllowed = touchEmulationAllowed;
256
274
  }
@@ -16,6 +16,7 @@ import {
16
16
  Events as NetworkManagerEvents,
17
17
  NetworkManager,
18
18
  } from './NetworkManager.js';
19
+ import {SecurityOrigin} from './SecurityOrigin.js';
19
20
  import {ServerSentEvents} from './ServerSentEvents.js';
20
21
  import {ServerTiming} from './ServerTiming.js';
21
22
  import {Type} from './Target.js';
@@ -388,6 +389,55 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
388
389
  return this.#backendRequestId;
389
390
  }
390
391
 
392
+ /**
393
+ * Returns the security origin of the target resource URL (`request.url()`) for this network request.
394
+ *
395
+ * For example, if an inspected document at `https://example.com/index.html` initiates a fetch
396
+ * to `https://api.github.com/users`, `requestURLSecurityOrigin()` returns the origin for
397
+ * `https://api.github.com`.
398
+ *
399
+ * For imported HAR files, the origin is mapped to an isolated virtual domain
400
+ * (`imported-har://${authority}`) to ensure recorded network traffic never collides with
401
+ * live web origins.
402
+ *
403
+ * @see {@link initiatorSecurityOrigin} to obtain the origin of the document that initiated the request.
404
+ */
405
+ requestURLSecurityOrigin(): SecurityOrigin {
406
+ return this.#resolveSecurityOrigin(this.#url);
407
+ }
408
+
409
+ /**
410
+ * Returns the security origin of the document or context (`request.documentURL`) that initiated
411
+ * this network request.
412
+ *
413
+ * For example, if an inspected document at `https://example.com/index.html` initiates a fetch
414
+ * to `https://api.github.com/users`, `initiatorSecurityOrigin()` returns the origin for
415
+ * `https://example.com`.
416
+ *
417
+ * If `documentURL` is empty, invalid, or an opaque context (such as a `data:` URL or sandboxed
418
+ * iframe), this returns a unique opaque `SecurityOrigin`.
419
+ *
420
+ * For imported HAR files, the origin is mapped to an isolated virtual domain
421
+ * (`imported-har://${authority}`) matching the imported initiating document.
422
+ *
423
+ * @see {@link requestURLSecurityOrigin} to obtain the origin of the target resource URL being requested.
424
+ */
425
+ initiatorSecurityOrigin(): SecurityOrigin {
426
+ return this.#resolveSecurityOrigin(this.#documentURL);
427
+ }
428
+
429
+ #resolveSecurityOrigin(url: Platform.DevToolsPath.UrlString): SecurityOrigin {
430
+ if (this.#isImportedHar) {
431
+ const parsed = Common.ParsedURL.ParsedURL.fromString(url);
432
+ if (!parsed || !parsed.host) {
433
+ return SecurityOrigin.createUniqueOpaque();
434
+ }
435
+ const authority = parsed.host + (parsed.port ? ':' + parsed.port : '');
436
+ return SecurityOrigin.create(`imported-har://${authority}`);
437
+ }
438
+ return SecurityOrigin.create(url);
439
+ }
440
+
391
441
  url(): Platform.DevToolsPath.UrlString {
392
442
  return this.#url;
393
443
  }
@@ -486,10 +536,6 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
486
536
  return this.#securityDetails;
487
537
  }
488
538
 
489
- securityOrigin(): string {
490
- return this.#parsedURL.securityOrigin();
491
- }
492
-
493
539
  setSecurityDetails(securityDetails: Protocol.Network.SecurityDetails): void {
494
540
  this.#securityDetails = securityDetails;
495
541
  }
@@ -0,0 +1,172 @@
1
+ // Copyright 2026 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import type * as NetworkRequest from './NetworkRequest.js';
6
+ import * as SecurityOrigin from './SecurityOrigin.js';
7
+
8
+ /**
9
+ * Specifies how a network request's response data (body and headers) can be accessed
10
+ * relative to the initiating context's security origin.
11
+ *
12
+ * DevTools features that inspect network requests (such as AI Assistance) must respect
13
+ * the browser Same-Origin Policy (SOP) and Cross-Origin Resource Sharing (CORS) rules:
14
+ * - Same-origin responses are fully readable by the initiating document.
15
+ * - Cross-origin responses with valid CORS headers (`Access-Control-Allow-Origin`) are readable.
16
+ * - Opaque cross-origin responses (such as `no-cors` fetches to third-party endpoints) are NOT
17
+ * readable by the page and must never have their response bodies or restricted headers exposed
18
+ * to unauthorized contexts (b/513821237).
19
+ */
20
+ export const enum ResponseAccessMode {
21
+ /** The request target URL is same-origin with the initiator context. */
22
+ SAME_ORIGIN = 'SAME_ORIGIN',
23
+ /** The request is cross-origin, but explicit CORS response headers permit access by the initiator. */
24
+ CORS_ALLOWED = 'CORS_ALLOWED',
25
+ /** The request is cross-origin without CORS authorization; response body and unexposed headers are restricted. */
26
+ OPAQUE_CROSS_ORIGIN = 'OPAQUE_CROSS_ORIGIN',
27
+ }
28
+
29
+ /**
30
+ * Standard CORS-safelisted response headers that are exposed on cross-origin requests
31
+ * without requiring explicit `Access-Control-Expose-Headers`.
32
+ *
33
+ * @see https://fetch.spec.whatwg.org/#cors-safelisted-response-header-name
34
+ */
35
+ export const CORS_SAFELISTED_RESPONSE_HEADERS: ReadonlySet<string> = new Set([
36
+ 'cache-control',
37
+ 'content-language',
38
+ 'content-length',
39
+ 'content-type',
40
+ 'expires',
41
+ 'last-modified',
42
+ 'pragma',
43
+ ]);
44
+
45
+ /**
46
+ * Placeholder text replacing response body content when cross-origin access is forbidden.
47
+ */
48
+ export const REDACTED_RESPONSE_BODY = '<redacted cross-origin response body>';
49
+
50
+ /**
51
+ * Returns whether a network request used credentials (cookies, authorization headers,
52
+ * or server-indicated credentials mode).
53
+ *
54
+ * @param request The network request to inspect.
55
+ * @returns True if the request included credentials or requires credentialed CORS.
56
+ * @see https://fetch.spec.whatwg.org/#credentials
57
+ */
58
+ export function isRequestCredentialed(request: NetworkRequest.NetworkRequest): boolean {
59
+ const hasAuthHeaders = Boolean(
60
+ request.requestHeaderValue('authorization') || request.requestHeaderValue('proxy-authorization'),
61
+ );
62
+ const hasCookies = request.includedRequestCookies().length > 0 || request.responseCookies.length > 0 ||
63
+ Boolean(request.requestHeaderValue('cookie')) || Boolean(request.responseHeaderValue('set-cookie'));
64
+ const hasAllowCredentials =
65
+ request.responseHeaderValue('access-control-allow-credentials')?.trim().toLowerCase() === 'true';
66
+
67
+ return hasAuthHeaders || hasCookies || hasAllowCredentials;
68
+ }
69
+
70
+ /**
71
+ * Evaluates the response access mode for a network request relative to an initiator origin.
72
+ *
73
+ * Evaluation rules:
74
+ * 1. If `initiatorOrigin` is omitted, the origin is derived from `request.documentURL`. If
75
+ * `documentURL` is invalid or opaque, access mode defaults to `OPAQUE_CROSS_ORIGIN`.
76
+ * 2. If the initiator origin is opaque (e.g. sandboxed iframe or `data:` URL), returns `OPAQUE_CROSS_ORIGIN`.
77
+ * 3. If the initiator origin is same-origin with the request URL, returns `SAME_ORIGIN`.
78
+ * 4. If Chrome's network stack flagged a CORS error (`corsErrorStatus`), returns `OPAQUE_CROSS_ORIGIN`.
79
+ * 5. If the server provided an `Access-Control-Allow-Origin` header:
80
+ * - Wildcard `*` grants `CORS_ALLOWED` only if the request does not include credentials. Under the
81
+ * Fetch specification, wildcard `*` is invalid for credentialed requests.
82
+ * - An explicit match against the initiator origin grants `CORS_ALLOWED`.
83
+ * 6. Otherwise, returns `OPAQUE_CROSS_ORIGIN`.
84
+ *
85
+ * @param request The network request being inspected.
86
+ * @param initiatorOrigin The security origin of the initiating context (e.g. page or conversation origin).
87
+ * @returns The evaluated `ResponseAccessMode`.
88
+ */
89
+ export function evaluateResponseAccessMode(
90
+ request: NetworkRequest.NetworkRequest,
91
+ initiatorOrigin?: SecurityOrigin.SecurityOrigin,
92
+ ): ResponseAccessMode {
93
+ const effectiveInitiatorOrigin = initiatorOrigin ?? SecurityOrigin.SecurityOrigin.create(request.documentURL);
94
+
95
+ // Opaque initiator contexts (e.g. data: URLs, sandboxed iframes) are never permitted
96
+ // to inspect cross-origin response content.
97
+ if (effectiveInitiatorOrigin.isOpaque()) {
98
+ return ResponseAccessMode.OPAQUE_CROSS_ORIGIN;
99
+ }
100
+
101
+ const resourceOrigin = SecurityOrigin.SecurityOrigin.create(request.url());
102
+ if (effectiveInitiatorOrigin.isSameOriginWith(resourceOrigin)) {
103
+ return ResponseAccessMode.SAME_ORIGIN;
104
+ }
105
+
106
+ // If the browser blocked the request with a CORS error, treat the response
107
+ // as opaque regardless of any Access-Control-Allow-Origin header value.
108
+ if (request.corsErrorStatus()) {
109
+ return ResponseAccessMode.OPAQUE_CROSS_ORIGIN;
110
+ }
111
+
112
+ const allowOriginHeader = request.responseHeaderValue('access-control-allow-origin')?.trim();
113
+ if (!allowOriginHeader) {
114
+ return ResponseAccessMode.OPAQUE_CROSS_ORIGIN;
115
+ }
116
+
117
+ const isCredentialed = isRequestCredentialed(request);
118
+
119
+ // Under the Fetch specification, wildcard '*' is forbidden from exposing responses if credentials are used.
120
+ if (allowOriginHeader === '*' && !isCredentialed) {
121
+ return ResponseAccessMode.CORS_ALLOWED;
122
+ }
123
+
124
+ if (allowOriginHeader.toLowerCase() === effectiveInitiatorOrigin.siteId().toLowerCase()) {
125
+ return ResponseAccessMode.CORS_ALLOWED;
126
+ }
127
+
128
+ return ResponseAccessMode.OPAQUE_CROSS_ORIGIN;
129
+ }
130
+
131
+ /**
132
+ * Filters the response headers of a network request based on its access mode.
133
+ *
134
+ * - `SAME_ORIGIN`: Returns all response headers.
135
+ * - `CORS_ALLOWED`: Returns CORS-safelisted headers plus headers exposed via
136
+ * `Access-Control-Expose-Headers`.
137
+ * - `OPAQUE_CROSS_ORIGIN`: Returns only CORS-safelisted response headers. Under the Fetch
138
+ * specification, opaque responses do not expose headers configured by `Access-Control-Expose-Headers`.
139
+ *
140
+ * @param request The network request whose headers are being filtered.
141
+ * @param accessMode The evaluated response access mode for this request.
142
+ * @returns Array of allowed header name/value pairs.
143
+ */
144
+ export function getFilterableResponseHeaders(
145
+ request: NetworkRequest.NetworkRequest,
146
+ accessMode: ResponseAccessMode,
147
+ ): Array<{name: string, value: string}> {
148
+ if (accessMode === ResponseAccessMode.SAME_ORIGIN) {
149
+ return request.responseHeaders;
150
+ }
151
+
152
+ if (accessMode === ResponseAccessMode.OPAQUE_CROSS_ORIGIN) {
153
+ return request.responseHeaders.filter(header => {
154
+ const lowerName = header.name.toLowerCase().trim();
155
+ return CORS_SAFELISTED_RESPONSE_HEADERS.has(lowerName);
156
+ });
157
+ }
158
+
159
+ // For CORS_ALLOWED requests, parse Access-Control-Expose-Headers.
160
+ const exposeHeadersValue = request.responseHeaderValue('access-control-expose-headers')?.trim() || '';
161
+ const exposedSet = new Set(
162
+ exposeHeadersValue.split(',').map(h => h.trim().toLowerCase()).filter(Boolean),
163
+ );
164
+
165
+ const isCredentialed = isRequestCredentialed(request);
166
+ const allowWildcardExposure = !isCredentialed && exposedSet.has('*');
167
+
168
+ return request.responseHeaders.filter(header => {
169
+ const lowerName = header.name.toLowerCase().trim();
170
+ return CORS_SAFELISTED_RESPONSE_HEADERS.has(lowerName) || allowWildcardExposure || exposedSet.has(lowerName);
171
+ });
172
+ }
@@ -5,6 +5,8 @@
5
5
  import type * as Protocol from '../../generated/protocol.js';
6
6
  import * as Common from '../common/common.js';
7
7
 
8
+ import {DataSaverOverride} from './EmulationModel.js';
9
+
8
10
  export const jsSourceMapsEnabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
9
11
  name: 'js-source-maps-enabled',
10
12
  type: Common.Settings.SettingType.BOOLEAN,
@@ -221,6 +223,13 @@ export const emulatedCSSMediaFeaturePrefersReducedDataSettingDescriptor: Common.
221
223
  storageType: Common.Settings.SettingStorageType.SESSION,
222
224
  };
223
225
 
226
+ export const dataSaverSettingDescriptor: Common.Settings.SettingDescriptor<DataSaverOverride> = {
227
+ name: 'emulation.data-saver',
228
+ type: Common.Settings.SettingType.ENUM,
229
+ defaultValue: DataSaverOverride.UNSET,
230
+ storageType: Common.Settings.SettingStorageType.SESSION,
231
+ };
232
+
224
233
  export const emulatedCSSMediaFeaturePrefersReducedTransparencySettingDescriptor:
225
234
  Common.Settings.SettingDescriptor<string> = {
226
235
  name: 'emulated-css-media-feature-prefers-reduced-transparency',
@@ -457,7 +457,6 @@ function frameIdForScript(script: Script): Protocol.Page.FrameId|null {
457
457
  return resourceTreeModel.mainFrame.id;
458
458
  }
459
459
 
460
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
461
460
  export const sourceURLRegex: RegExp = /^[\x20\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/;
462
461
 
463
462
  export async function disassembleWasm(content: string): Promise<TextUtils.WasmDisassembly.WasmDisassembly> {