chrome-devtools-frontend 1.0.1690116 → 1.0.1695017

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 (421) hide show
  1. package/.agents/skills/devtools-model-management/SKILL.md +3 -3
  2. package/.agents/skills/foundation-test-migration/SKILL.md +2 -2
  3. package/.agents/skills/merging-devtools-module/SKILL.md +5 -5
  4. package/AUTHORS +3 -0
  5. package/config/typescript/tsconfig.base.json +1 -0
  6. package/docs/get_the_code.md +4 -9
  7. package/front_end/Images/src/comment-mode-cursor.svg +23 -0
  8. package/front_end/Tests.js +1 -1
  9. package/front_end/application_tokens.css +5 -0
  10. package/front_end/core/common/ColorConverter.ts +3 -3
  11. package/front_end/core/host/UserMetrics.ts +27 -0
  12. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +0 -46
  13. package/front_end/core/protocol_client/InspectorBackend.ts +6 -6
  14. package/front_end/core/root/Runtime.ts +1 -0
  15. package/front_end/core/sdk/CSSLocation.ts +32 -0
  16. package/front_end/core/sdk/CSSModel.ts +2 -22
  17. package/front_end/core/sdk/CSSQuery.ts +2 -1
  18. package/front_end/core/sdk/CSSRule.ts +29 -0
  19. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  20. package/front_end/core/sdk/NetworkManager.ts +2 -0
  21. package/front_end/core/sdk/NetworkRequest.ts +63 -4
  22. package/front_end/core/sdk/NetworkRequestAccess.ts +191 -0
  23. package/front_end/core/sdk/ResourceTreeModel.ts +72 -23
  24. package/front_end/core/sdk/SecurityOrigin.ts +97 -12
  25. package/front_end/core/sdk/Target.ts +18 -0
  26. package/front_end/core/sdk/sdk.ts +4 -0
  27. package/front_end/entrypoints/main/MainImpl.ts +8 -1
  28. package/front_end/foundation/Universe.ts +14 -11
  29. package/front_end/generated/Deprecation.ts +8 -0
  30. package/front_end/generated/InspectorBackendCommands.ts +9 -8
  31. package/front_end/generated/SupportedCSSProperties.ts +14 -4
  32. package/front_end/generated/protocol.ts +24 -0
  33. package/front_end/models/ai_assistance/AiAgent2.ts +46 -10
  34. package/front_end/models/ai_assistance/AiConversation.ts +35 -24
  35. package/front_end/models/ai_assistance/README.md +5 -3
  36. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -0
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +28 -34
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +13 -17
  39. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +5 -3
  40. package/front_end/models/ai_assistance/agents/StorageAgent.ts +16 -10
  41. package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
  42. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  43. package/front_end/models/ai_assistance/contexts/AccessibilityContext.ts +11 -2
  44. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +17 -5
  45. package/front_end/models/ai_assistance/contexts/FileContext.ts +13 -6
  46. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +52 -25
  47. package/front_end/models/ai_assistance/contexts/RequestContext.ts +18 -34
  48. package/front_end/models/ai_assistance/contexts/StorageContext.ts +14 -3
  49. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +2 -5
  50. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +135 -58
  51. package/front_end/models/ai_assistance/tools/CookieUtils.ts +25 -35
  52. package/front_end/models/ai_assistance/tools/DOMStorageUtils.ts +6 -3
  53. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +9 -2
  54. package/front_end/models/ai_assistance/tools/GetCookieValues.ts +1 -1
  55. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +3 -2
  56. package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +3 -5
  57. package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +1 -1
  58. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +8 -11
  59. package/front_end/models/ai_assistance/tools/GetResourceContent.ts +2 -4
  60. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +6 -13
  61. package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +1 -1
  62. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +9 -9
  63. package/front_end/models/ai_assistance/tools/GetStyles.ts +3 -2
  64. package/front_end/models/ai_assistance/tools/ListCookies.ts +1 -1
  65. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +6 -14
  66. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +10 -15
  67. package/front_end/models/ai_assistance/tools/ListSources.ts +5 -7
  68. package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +9 -9
  69. package/front_end/models/ai_assistance/tools/README.md +4 -2
  70. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +3 -2
  71. package/front_end/models/ai_assistance/tools/Tool.ts +27 -3
  72. package/front_end/models/comment_manager/CD4ABridge.ts +128 -0
  73. package/front_end/models/comment_manager/CommentManager.ts +50 -8
  74. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  75. package/front_end/models/emulation/DeviceModeModel.ts +37 -47
  76. package/front_end/models/javascript_metadata/NativeFunctions.ts +9 -1
  77. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  78. package/front_end/models/source_map_scopes/NamesResolver.ts +9 -7
  79. package/front_end/models/trace/ModelImpl.ts +2 -0
  80. package/front_end/models/trace/Processor.ts +6 -4
  81. package/front_end/models/trace/handlers/LayerTreeHandler.ts +3 -3
  82. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
  83. package/front_end/models/trace/helpers/SyntheticEvents.ts +23 -1
  84. package/front_end/models/trace/types/Configuration.ts +7 -0
  85. package/front_end/models/trace/types/TraceEvents.ts +20 -4
  86. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -0
  87. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +177 -0
  88. package/front_end/panels/accessibility/accessibility.ts +2 -0
  89. package/front_end/panels/accessibility/accessibilityAnnouncementRecordingListView.css +33 -0
  90. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -15
  91. package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -35
  92. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +4 -3
  93. package/front_end/panels/ai_assistance/components/chatMessage.css +3 -1
  94. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  95. package/front_end/panels/application/CrashReportContextView.ts +0 -1
  96. package/front_end/panels/application/FrameDetailsView.ts +5 -4
  97. package/front_end/panels/application/IndexedDBViews.ts +4 -4
  98. package/front_end/panels/application/components/BackForwardCacheView.ts +1 -1
  99. package/front_end/panels/application/components/EndpointsGrid.ts +2 -1
  100. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -1
  101. package/front_end/panels/application/components/ServiceWorkerRouterView.ts +1 -1
  102. package/front_end/panels/application/components/TrustTokensView.ts +1 -1
  103. package/front_end/panels/application/indexedDBViews.css +0 -14
  104. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +2 -1
  105. package/front_end/panels/application/preloading/components/RuleSetDetailsView.ts +2 -1
  106. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +1 -1
  107. package/front_end/panels/common/CPUThrottlingOption.ts +12 -6
  108. package/front_end/panels/common/DOMLinkifier.ts +1 -1
  109. package/front_end/panels/common/ExtensionView.ts +2 -1
  110. package/front_end/panels/console/ConsoleContextSelector.ts +12 -5
  111. package/front_end/panels/console/ConsolePinPane.ts +4 -2
  112. package/front_end/panels/console/ConsoleSidebar.ts +6 -2
  113. package/front_end/panels/console/ConsoleViewMessage.ts +12 -8
  114. package/front_end/panels/console/PromptBuilder.ts +1 -1
  115. package/front_end/panels/coverage/CoverageListView.ts +1 -1
  116. package/front_end/panels/coverage/CoverageModel.ts +6 -4
  117. package/front_end/panels/coverage/coverageView.css +8 -8
  118. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +13 -14
  119. package/front_end/panels/css_overview/CSSOverviewPanel.ts +3 -3
  120. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
  121. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +3 -3
  122. package/front_end/panels/css_overview/CSSOverviewStartView.ts +3 -3
  123. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  124. package/front_end/panels/developer_resources/developerResourcesView.css +3 -3
  125. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -1
  126. package/front_end/panels/elements/ElementsTreeElement.ts +43 -15
  127. package/front_end/panels/elements/ElementsTreeOutline.ts +185 -109
  128. package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
  129. package/front_end/panels/elements/PropertyNameCategories.ts +1 -1
  130. package/front_end/panels/elements/ShortcutTreeElement.ts +6 -1
  131. package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
  132. package/front_end/panels/elements/StylePropertiesSection.ts +2 -35
  133. package/front_end/panels/elements/StylesSidebarPane.ts +3 -2
  134. package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +5 -4
  135. package/front_end/panels/elements/components/StylePropertyEditor.ts +161 -148
  136. package/front_end/panels/elements/components/computedStyleProperty.css +5 -5
  137. package/front_end/panels/elements/components/computedStyleTrace.css +5 -5
  138. package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
  139. package/front_end/panels/elements/components/cssPropertyDocsView.css +3 -3
  140. package/front_end/panels/elements/components/cssVariableValueView.css +4 -4
  141. package/front_end/panels/elements/components/elementsBreadcrumbs.css +3 -3
  142. package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -5
  143. package/front_end/panels/elements/components/queryContainer.css +2 -2
  144. package/front_end/panels/elements/elementsTreeOutline.css +20 -4
  145. package/front_end/panels/emulation/MediaQueryInspector.ts +2 -1
  146. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  147. package/front_end/panels/issues/AffectedElementsView.ts +3 -0
  148. package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +1 -1
  149. package/front_end/panels/issues/issues.ts +2 -0
  150. package/front_end/panels/layer_viewer/LayerDetailsView.ts +12 -10
  151. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +1 -0
  152. package/front_end/panels/layer_viewer/Layers3DView.ts +13 -11
  153. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +1 -1
  154. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspectorUtils.ts +2 -2
  155. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts +1 -1
  156. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
  157. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +11 -11
  158. package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
  159. package/front_end/panels/linear_memory_inspector/components/linearMemoryNavigator.css +1 -1
  160. package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +5 -5
  161. package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +6 -6
  162. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +6 -6
  163. package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +2 -2
  164. package/front_end/panels/media/PlayerPropertiesView.ts +1 -1
  165. package/front_end/panels/media/TickingFlameChart.ts +3 -2
  166. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -1
  167. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
  168. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +2 -1
  169. package/front_end/panels/network/NetworkDataGridNode.ts +11 -9
  170. package/front_end/panels/network/NetworkLogView.ts +4 -1
  171. package/front_end/panels/network/NetworkLogViewColumns.ts +5 -2
  172. package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
  173. package/front_end/panels/network/RequestHeadersView.ts +47 -11
  174. package/front_end/panels/network/RequestPayloadView.ts +1 -1
  175. package/front_end/panels/network/RequestResponseView.ts +1 -1
  176. package/front_end/panels/network/RequestTimingView.ts +1 -1
  177. package/front_end/panels/network/ShowMoreDetailsWidget.ts +1 -1
  178. package/front_end/panels/network/components/RequestHeadersView.css +12 -0
  179. package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
  180. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +3 -3
  181. package/front_end/panels/profiler/HeapProfileView.ts +1 -1
  182. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  183. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  184. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  185. package/front_end/panels/recorder/RecordingListView.ts +0 -6
  186. package/front_end/panels/recorder/RecordingView.ts +0 -6
  187. package/front_end/panels/recorder/controlButton.css +10 -10
  188. package/front_end/panels/recorder/startView.css +1 -1
  189. package/front_end/panels/screencast/ScreencastView.ts +4 -2
  190. package/front_end/panels/search/SearchView.ts +1 -1
  191. package/front_end/panels/security/SecurityPanel.ts +46 -35
  192. package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
  193. package/front_end/panels/sources/CallStackSidebarPane.ts +1 -1
  194. package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -6
  195. package/front_end/panels/sources/ProfilePlugin.ts +2 -1
  196. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  197. package/front_end/panels/timeline/IsolateSelector.ts +1 -1
  198. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +1 -1
  199. package/front_end/panels/timeline/NetworkTrackAppender.ts +1 -1
  200. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +1 -1
  201. package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -32
  202. package/front_end/panels/timeline/TimelineHistoryManager.ts +1 -1
  203. package/front_end/panels/timeline/TimelinePaintProfilerView.ts +7 -3
  204. package/front_end/panels/timeline/TimelinePanel.ts +3 -20
  205. package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
  206. package/front_end/panels/timeline/TimelineUIUtils.ts +4 -4
  207. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +4 -3
  208. package/front_end/panels/timeline/components/LiveMetricsView.ts +1 -1
  209. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +25 -24
  210. package/front_end/panels/timeline/components/RelatedInsightChips.ts +4 -3
  211. package/front_end/panels/timeline/components/Sidebar.ts +1 -1
  212. package/front_end/panels/timeline/components/SidebarAnnotationsTab.ts +4 -3
  213. package/front_end/panels/timeline/components/cwvMetrics.css +2 -2
  214. package/front_end/panels/timeline/components/insights/checklist.css +1 -1
  215. package/front_end/panels/timeline/components/insights/table.css +3 -3
  216. package/front_end/panels/timeline/overlays/components/entriesLinkOverlay.css +4 -4
  217. package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +4 -4
  218. package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +2 -2
  219. package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +4 -4
  220. package/front_end/panels/timeline/timelinePanel.css +0 -74
  221. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  222. package/front_end/panels/timeline/utils/ImageCache.ts +5 -3
  223. package/front_end/panels/web_audio/WebAudioView.ts +3 -3
  224. package/front_end/panels/web_audio/webAudio.css +5 -5
  225. package/front_end/panels/webauthn/WebauthnPane.ts +5 -11
  226. package/front_end/third_party/acorn/acorn.ts +3 -3
  227. package/front_end/third_party/chromium/README.chromium +1 -1
  228. package/front_end/third_party/chromium/ahem/ahem.d.ts +1 -0
  229. package/front_end/third_party/csp_evaluator/package/csp.ts +4 -4
  230. package/front_end/third_party/csp_evaluator/package/parser.ts +3 -1
  231. package/front_end/third_party/csp_evaluator/package/tsconfig.json +1 -0
  232. package/front_end/third_party/csp_evaluator/package/utils.ts +1 -1
  233. package/front_end/third_party/diff/DiffWrapper.ts +1 -8
  234. package/front_end/third_party/diff/diff_match_patch.d.ts +10 -0
  235. package/front_end/third_party/json5/json5.ts +2 -2
  236. package/front_end/third_party/puppeteer/README.chromium +2 -2
  237. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +183 -4
  238. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +708 -122
  239. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +85 -3
  240. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  241. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +84 -11
  242. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  243. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts +75 -0
  244. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts.map +1 -0
  245. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js +102 -0
  246. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js.map +1 -0
  247. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts +1 -0
  248. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js +1 -0
  250. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +6 -1
  252. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +7 -0
  254. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts +31 -0
  256. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts.map +1 -0
  257. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js +138 -0
  258. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js.map +1 -0
  259. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts +1 -0
  260. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js +1 -0
  262. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +6 -0
  264. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +23 -0
  266. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +6 -1
  268. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +7 -0
  270. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts +31 -0
  272. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -0
  273. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +131 -0
  274. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -0
  275. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
  276. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
  278. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +7 -4
  280. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
  282. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +5 -1
  284. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +42 -0
  286. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts +2 -2
  288. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts.map +1 -1
  289. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js +265 -1
  290. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js.map +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +4 -0
  292. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  293. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +24 -3
  294. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts +23 -2
  296. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +49 -3
  298. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  299. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  300. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  301. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts.map +1 -1
  303. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  304. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js.map +1 -1
  305. package/front_end/third_party/puppeteer/package/lib/types.d.ts +183 -4
  306. package/front_end/third_party/puppeteer/package/package.json +4 -4
  307. package/front_end/third_party/puppeteer/package/src/api/Page.ts +143 -11
  308. package/front_end/third_party/puppeteer/package/src/api/ScreenRecording.ts +145 -0
  309. package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
  310. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +11 -0
  311. package/front_end/third_party/puppeteer/package/src/bidi/ScreenRecording.ts +106 -0
  312. package/front_end/third_party/puppeteer/package/src/bidi/bidi.ts +1 -0
  313. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +41 -0
  314. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +11 -0
  315. package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +101 -0
  316. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  317. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +17 -9
  318. package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +4 -0
  319. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +46 -0
  320. package/front_end/third_party/puppeteer/package/src/common/Device.ts +287 -1
  321. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +30 -1
  322. package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +73 -2
  323. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  324. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  325. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +3 -0
  326. package/front_end/tsconfig.json +1 -2
  327. package/front_end/ui/comments/CommentAnchorResolver.ts +8 -3
  328. package/front_end/ui/comments/CommentOverlayManager.ts +53 -12
  329. package/front_end/ui/comments/CommentsOverlayWidget.ts +3 -3
  330. package/front_end/ui/comments/CommentsStatusBarPill.ts +96 -0
  331. package/front_end/ui/comments/comments-meta.ts +21 -0
  332. package/front_end/ui/comments/comments.ts +2 -0
  333. package/front_end/ui/comments/commentsOverlay.css +22 -3
  334. package/front_end/ui/components/buttons/floatingButton.css +25 -0
  335. package/front_end/ui/components/markdown_view/MarkdownView.ts +31 -1
  336. package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
  337. package/front_end/ui/components/suggestion_input/SuggestionInput.ts +45 -25
  338. package/front_end/ui/kit/icons/Icon.ts +0 -1
  339. package/front_end/ui/kit/link/Link.ts +8 -1
  340. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  341. package/front_end/ui/legacy/DropTarget.ts +6 -1
  342. package/front_end/ui/legacy/EmptyWidget.ts +1 -1
  343. package/front_end/ui/legacy/GlassPane.ts +1 -1
  344. package/front_end/ui/legacy/InspectorView.ts +17 -1
  345. package/front_end/ui/legacy/ShortcutRegistry.ts +2 -2
  346. package/front_end/ui/legacy/SplitWidget.ts +18 -3
  347. package/front_end/ui/legacy/StackedPane.ts +1 -1
  348. package/front_end/ui/legacy/StatusBar.ts +78 -0
  349. package/front_end/ui/legacy/TargetCrashedScreen.ts +1 -1
  350. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  351. package/front_end/ui/legacy/Toolbar.ts +5 -1
  352. package/front_end/ui/legacy/Treeoutline.ts +91 -48
  353. package/front_end/ui/legacy/UIUtils.ts +8 -4
  354. package/front_end/ui/legacy/ViewManager.ts +1 -1
  355. package/front_end/ui/legacy/ViewRegistration.ts +1 -0
  356. package/front_end/ui/legacy/Widget.ts +1 -1
  357. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +7 -1
  358. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  359. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -2
  360. package/front_end/ui/legacy/components/data_grid/dataGrid.css +23 -23
  361. package/front_end/ui/legacy/components/inline_editor/AnimationTimingModel.ts +1 -1
  362. package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +48 -44
  363. package/front_end/ui/legacy/components/inline_editor/CSSAngleUtils.ts +1 -1
  364. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.docs.ts +83 -0
  365. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +600 -0
  366. package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +1 -1
  367. package/front_end/ui/legacy/components/inline_editor/colorMixSwatch.css +4 -4
  368. package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +3 -3
  369. package/front_end/ui/legacy/components/inline_editor/inline_editor.ts +2 -0
  370. package/front_end/ui/legacy/components/inline_editor/linkSwatch.css +1 -1
  371. package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +154 -0
  372. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +224 -127
  373. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +10 -7
  374. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +25 -106
  375. package/front_end/ui/legacy/components/object_ui/customPreviewComponent.css +7 -3
  376. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +1 -1
  377. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -66
  378. package/front_end/ui/legacy/components/perf_ui/perf_ui.ts +0 -2
  379. package/front_end/ui/legacy/components/perf_ui/pieChart.css +7 -5
  380. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +8 -5
  381. package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +1 -1
  382. package/front_end/ui/legacy/components/utils/Linkifier.ts +5 -5
  383. package/front_end/ui/legacy/inspectorCommon.css +41 -6
  384. package/front_end/ui/legacy/legacy.ts +2 -0
  385. package/front_end/ui/legacy/statusBar.css +18 -0
  386. package/front_end/ui/visual_logging/Debugging.ts +2 -1
  387. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -1
  388. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  389. package/front_end/ui/visual_logging/LoggingEvents.ts +5 -5
  390. package/front_end/ui/visual_logging/LoggingState.ts +1 -1
  391. package/front_end/ui/visual_logging/visual_logging.ts +67 -56
  392. package/inspector_overlay/main.ts +8 -8
  393. package/mcp/mcp.ts +5 -0
  394. package/package.json +2 -8
  395. package/front_end/Images/generate-css-vars.js +0 -52
  396. package/front_end/Images/rollup.config.mjs +0 -36
  397. package/front_end/models/ai_assistance/AiOrigins.ts +0 -107
  398. package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +0 -20
  399. package/front_end/panels/recorder/injected/rollup.config.mjs +0 -20
  400. package/front_end/panels/timeline/EasterEgg.d.ts +0 -6
  401. package/front_end/panels/timeline/easter-egg-tsconfig.json +0 -8
  402. package/front_end/panels/timeline/enable-easter-egg.js +0 -20
  403. package/front_end/third_party/acorn/acorn-tsconfig.json +0 -12
  404. package/front_end/third_party/acorn/estree-tsconfig.json +0 -8
  405. package/front_end/third_party/chromium/client-variations/client-variations-tsconfig.json +0 -8
  406. package/front_end/third_party/codemirror/codemirror-legacy-types-tsconfig.json +0 -8
  407. package/front_end/third_party/codemirror/codemirror-tsconfig.json +0 -15
  408. package/front_end/third_party/codemirror.next/bundle-tsconfig.json +0 -24
  409. package/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +0 -16
  410. package/front_end/third_party/json5/json5-tsconfig.json +0 -8
  411. package/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +0 -8
  412. package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +0 -11
  413. package/front_end/third_party/lighthouse/report/bundle-tsconfig.json +0 -8
  414. package/front_end/third_party/lit/lit-tsconfig.json +0 -15
  415. package/front_end/third_party/marked/marked-tsconfig.json +0 -8
  416. package/front_end/third_party/puppeteer-replay/puppeteer-replay-tsconfig.json +0 -8
  417. package/front_end/third_party/third-party-web/third-party-web-tsconfig.json +0 -8
  418. package/front_end/third_party/wasmparser/wasmparser-tsconfig.json +0 -9
  419. package/front_end/third_party/web-vitals/web-vitals-tsconfig.json +0 -47
  420. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +0 -606
  421. package/inspector_overlay/loadCSS.rollup.js +0 -29
@@ -2,7 +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 Common from '../../../core/common/common.js';
6
5
  import type * as Platform from '../../../core/platform/platform.js';
7
6
  import * as SDK from '../../../core/sdk/sdk.js';
8
7
  import * as Tracing from '../../../services/tracing/tracing.js';
@@ -15,7 +14,6 @@ import {
15
14
  ConversationContext,
16
15
  type ConversationSuggestions,
17
16
  } from '../agents/AiAgent.js';
18
- import {extractContextOrigin} from '../AiOrigins.js';
19
17
  import {
20
18
  PerformanceInsightFormatter,
21
19
  } from '../data_formatters/PerformanceInsightFormatter.js';
@@ -88,6 +86,7 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
88
86
  readonly #targetManager: SDK.TargetManager.TargetManager;
89
87
  readonly #freshRecordingTracker: Tracing.FreshRecording.Tracker;
90
88
  readonly #debuggerWorkspaceBinding: Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding;
89
+ #origin?: SDK.SecurityOrigin.SecurityOrigin;
91
90
 
92
91
  constructor(focus: AgentFocus,
93
92
  // eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
@@ -128,36 +127,64 @@ export class PerformanceTraceContext extends ConversationContext<AgentFocus> {
128
127
  return formatter;
129
128
  }
130
129
 
131
- override getURL(): string {
132
- const url = this.#focus.parsedTrace.data.Meta.mainFrameURL;
133
- try {
134
- new URL(url);
135
- return url;
136
- } catch {
137
- const {min, max} = this.#focus.parsedTrace.data.Meta.traceBounds;
138
- return `trace-${min}-${max}`;
130
+ /**
131
+ * Returns whether this trace was imported rather than recorded live in the current session.
132
+ */
133
+ isImported(): boolean {
134
+ return !this.#freshRecordingTracker.recordingIsFresh(this.#focus.parsedTrace);
135
+ }
136
+
137
+ /**
138
+ * Checks whether the AI can access the resource at the specified URL.
139
+ *
140
+ * Access requires the resource origin to match the trace origin.
141
+ * Always rejects `file://` URLs to prevent local file leaks (b/523743289).
142
+ *
143
+ * @param url The URL of the resource to access.
144
+ * @returns `true` if the resource is same-origin with the trace and not a `file://` URL; otherwise `false`.
145
+ */
146
+ canAccessResource(url: string): boolean {
147
+ const traceOrigin = this.getOrigin();
148
+ const targetOrigin = SDK.SecurityOrigin.SecurityOrigin.create(url);
149
+
150
+ // We explicitly block all file:// URLs even if same-origin (b/523743289).
151
+ // Allowing local file access in trace AI risks leaking local system files
152
+ // (such as /etc/passwd) via prompt injection across filesystem edge cases.
153
+ if (traceOrigin.isFile() || targetOrigin.isFile()) {
154
+ return false;
139
155
  }
156
+
157
+ return traceOrigin.isSameOriginWith(targetOrigin);
140
158
  }
141
159
 
142
160
  /**
143
- * Returns the origin for a performance trace in the AI context.
161
+ * Returns the security origin for the performance trace.
162
+ *
163
+ * Live traces use the origin of the main frame URL.
144
164
  *
145
- * To prevent cross-origin prompt injection attacks, imported traces
146
- * are isolated from live pages. We assign them a virtual origin
147
- * (`imported-trace://${domain}`) so they do not share the origin of live pages
148
- * (e.g., `https://${domain}`). This forces a conversation reset when transitioning
149
- * between imported trace data and live pages.
165
+ * Imported traces use a custom scheme (`imported-trace://${host}`) to isolate
166
+ * them from live pages (such as `https://${host}`). This isolation prevents
167
+ * cross-origin prompt injection and requires a new conversation when switching
168
+ * between imported traces and live pages.
169
+ *
170
+ * If an imported trace origin does not contain a host, this method returns a
171
+ * unique opaque origin.
172
+ *
173
+ * @returns The security origin for the trace.
150
174
  */
151
- override getOrigin(): string {
152
- const parsedTrace = this.#focus.parsedTrace;
153
- const url = this.getURL();
154
- const origin = extractContextOrigin(url);
155
- const isFresh = this.#freshRecordingTracker.recordingIsFresh(parsedTrace);
156
- if (!isFresh) {
157
- const parsed = Common.ParsedURL.ParsedURL.fromString(origin as Platform.DevToolsPath.UrlString);
158
- return `imported-trace://${parsed ? parsed.domain() : origin}`;
175
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
176
+ if (!this.#origin) {
177
+ if (this.isImported()) {
178
+ this.#origin = SDK.SecurityOrigin.SecurityOrigin.createForImportedTrace(
179
+ this.#focus.parsedTrace.data.Meta.mainFrameURL,
180
+ );
181
+ } else {
182
+ this.#origin = SDK.SecurityOrigin.SecurityOrigin.create(
183
+ this.#focus.parsedTrace.data.Meta.mainFrameURL,
184
+ );
185
+ }
159
186
  }
160
- return origin;
187
+ return this.#origin;
161
188
  }
162
189
 
163
190
  override getItem(): AgentFocus {
@@ -2,17 +2,16 @@
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 Common from '../../../core/common/common.js';
6
5
  import * as i18n from '../../../core/i18n/i18n.js';
7
- import type * as Platform from '../../../core/platform/platform.js';
8
6
  import type * as SDK from '../../../core/sdk/sdk.js';
9
7
  import type * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
10
8
  import {
11
9
  type ContextDetail,
12
10
  ConversationContext,
13
11
  } from '../agents/AiAgent.js';
14
- import {extractContextOrigin} from '../AiOrigins.js';
15
- import {NetworkRequestFormatter} from '../data_formatters/NetworkRequestFormatter.js';
12
+ import {
13
+ NetworkRequestFormatter,
14
+ } from '../data_formatters/NetworkRequestFormatter.js';
16
15
 
17
16
  const UIStringsNotTranslate = {
18
17
  request: 'Request',
@@ -24,24 +23,6 @@ const UIStringsNotTranslate = {
24
23
 
25
24
  const lockedString = i18n.i18n.lockedString;
26
25
 
27
- /**
28
- * Returns the origin for a network request in the AI context.
29
- *
30
- * To prevent cross-origin prompt injection attacks, HAR-imported requests
31
- * are isolated from live pages. We assign them a virtual origin
32
- * (`imported-har://${domain}`) so they do not share the origin of live pages
33
- * (e.g., `https://${domain}`). This forces a conversation reset when transitioning
34
- * between imported HAR data and live pages.
35
- */
36
- export function getRequestContextOrigin(request: SDK.NetworkRequest.NetworkRequest): string {
37
- const origin = extractContextOrigin(request.documentURL);
38
- if (request.isImportedHar()) {
39
- const parsed = Common.ParsedURL.ParsedURL.fromString(origin as Platform.DevToolsPath.UrlString);
40
- return `imported-har://${parsed ? parsed.domain() : origin}`;
41
- }
42
- return origin;
43
- }
44
-
45
26
  export class RequestContext extends ConversationContext<SDK.NetworkRequest.NetworkRequest> {
46
27
  #request: SDK.NetworkRequest.NetworkRequest;
47
28
  #calculator: NetworkTimeCalculator.NetworkTransferTimeCalculator;
@@ -56,17 +37,14 @@ export class RequestContext extends ConversationContext<SDK.NetworkRequest.Netwo
56
37
  }
57
38
 
58
39
  /**
59
- * Note: this is not the literal origin of the network request. This URL
60
- * is used to determine when we should force the user to start a new AI
61
- * conversation when the context changes. We allow a single AI conversation to
62
- * inspect all network requests that were made for that given target URL.
40
+ * Returns the security origin of the document that initiated the request.
41
+ *
42
+ * Network requests to third-party endpoints share the origin of the page
43
+ * that initiated them. This permits the AI to inspect third-party subresources
44
+ * without triggering a cross-origin conversation reset.
63
45
  */
64
- override getURL(): string {
65
- return this.#request.documentURL;
66
- }
67
-
68
- override getOrigin(): string {
69
- return getRequestContextOrigin(this.#request);
46
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
47
+ return this.#request.initiatorSecurityOrigin();
70
48
  }
71
49
 
72
50
  override getItem(): SDK.NetworkRequest.NetworkRequest {
@@ -77,13 +55,19 @@ export class RequestContext extends ConversationContext<SDK.NetworkRequest.Netwo
77
55
  return this.#request.name();
78
56
  }
79
57
 
58
+ #createFormatter(): NetworkRequestFormatter {
59
+ return new NetworkRequestFormatter(this.#request, this.#calculator, {
60
+ accessingSecurityOrigin: this.#request.initiatorSecurityOrigin(),
61
+ });
62
+ }
63
+
80
64
  override async getPromptDetails(): Promise<string|null> {
81
- const formatter = new NetworkRequestFormatter(this.#request, this.#calculator);
65
+ const formatter = this.#createFormatter();
82
66
  return `# Selected network request\n${await formatter.formatNetworkRequest()}`;
83
67
  }
84
68
 
85
69
  override async getUserFacingDetails(): Promise<[ContextDetail, ...ContextDetail[]]|null> {
86
- const formatter = new NetworkRequestFormatter(this.#request, this.#calculator);
70
+ const formatter = this.#createFormatter();
87
71
  const requestContextDetail: ContextDetail = {
88
72
  title: lockedString(UIStringsNotTranslate.request),
89
73
  text: lockedString(UIStringsNotTranslate.requestUrl) + ': ' + this.#request.url() + '\n\n' +
@@ -2,6 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as SDK from '../../../core/sdk/sdk.js';
5
6
  import {
6
7
  ConversationContext,
7
8
  type ConversationSuggestions,
@@ -16,8 +17,18 @@ export class StorageContext extends ConversationContext<StorageItem> {
16
17
  this.#item = item;
17
18
  }
18
19
 
19
- override getURL(): string {
20
- return this.#item.primaryTargetOrigin;
20
+ /**
21
+ * Returns the security origin of the primary inspected page target.
22
+ *
23
+ * The storage context binds to `primaryTargetOrigin` rather than the specific
24
+ * item origin (`this.#item.origin`). This allows generic storage views
25
+ * (which have an empty origin) and third-party storage items to be inspected
26
+ * within the current page conversation.
27
+ *
28
+ * @returns The security origin of the primary page target.
29
+ */
30
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
31
+ return SDK.SecurityOrigin.SecurityOrigin.create(this.#item.primaryTargetOrigin);
21
32
  }
22
33
 
23
34
  override getItem(): StorageItem {
@@ -38,7 +49,7 @@ export class StorageContext extends ConversationContext<StorageItem> {
38
49
  const prefix = this.#item.type === 'localStorage' ? 'local storage' : 'session storage';
39
50
  return `${prefix}${this.#item.isGenericContext ? '' : `: ${this.#item.origin}`}`;
40
51
  }
41
- return `Storage: ${this.getOrigin()}`;
52
+ return `Storage: ${this.getOrigin().siteId()}`;
42
53
  }
43
54
 
44
55
  /**
@@ -4,10 +4,9 @@
4
4
 
5
5
  import * as Bindings from '../../bindings/bindings.js';
6
6
  import * as Logs from '../../logs/logs.js';
7
- import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
8
7
  import type * as Workspace from '../../workspace/workspace.js';
9
8
 
10
- import {NetworkRequestFormatter} from './NetworkRequestFormatter.js';
9
+ import {formatRequestInitiatorChain} from './NetworkRequestFormatter.js';
11
10
 
12
11
  const MAX_FILE_SIZE = 10000;
13
12
 
@@ -75,10 +74,8 @@ export class FileFormatter {
75
74
  ];
76
75
  const resource = Bindings.ResourceUtils.resourceForURL(this.#file.url());
77
76
  if (resource?.request) {
78
- const calculator = new NetworkTimeCalculator.NetworkTransferTimeCalculator();
79
- calculator.updateBoundaries(resource.request);
80
77
  lines.push(`Request initiator chain:
81
- ${new NetworkRequestFormatter(resource.request, calculator, this.#networkLog).formatRequestInitiatorChain()}`);
78
+ ${formatRequestInitiatorChain(resource.request, this.#networkLog)}`);
82
79
  }
83
80
  lines.push(`File content:
84
81
  ${this.#formatFileContent()}`);
@@ -2,9 +2,8 @@
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 Common from '../../../core/common/common.js';
6
5
  import type * as Platform from '../../../core/platform/platform.js';
7
- import type * as SDK from '../../../core/sdk/sdk.js';
6
+ import * as SDK from '../../../core/sdk/sdk.js';
8
7
  import * as TextUtils from '../../../core/text_utils/text_utils.js';
9
8
  import * as Protocol from '../../../generated/protocol.js';
10
9
  import * as Logs from '../../logs/logs.js';
@@ -16,7 +15,10 @@ const MAX_HEADERS_SIZE = 1000;
16
15
  const MAX_BODY_SIZE = 10000;
17
16
 
18
17
  /**
19
- * Sanitizes the set of headers, removing values that are not on the allow-list and replacing them with '<redacted>'.
18
+ * Sanitizes headers by replacing unapproved header values with '<redacted>'.
19
+ *
20
+ * @param headers List of header name/value pairs to sanitize.
21
+ * @returns Sanitized list of headers with unapproved values redacted.
20
22
  */
21
23
  export function sanitizeHeaders(headers: Array<{name: string, value: string}>): Array<{name: string, value: string}> {
22
24
  return headers.map(header => {
@@ -27,9 +29,60 @@ export function sanitizeHeaders(headers: Array<{name: string, value: string}>):
27
29
  });
28
30
  }
29
31
 
32
+ /**
33
+ * Options for configuring {@link NetworkRequestFormatter}.
34
+ */
35
+ export interface NetworkRequestFormatterOptions {
36
+ /**
37
+ * The security origin used to evaluate Same-Origin Policy (SOP) and Cross-Origin
38
+ * Resource Sharing (CORS) access.
39
+ *
40
+ * This is required because evaluating access solely against `request.initiatorSecurityOrigin()`
41
+ * is unsafe in cross-origin embedded contexts.
42
+ *
43
+ * Example:
44
+ * When debugging a page at `https://example.com` (the active conversation origin), an embedded
45
+ * `<iframe>` at `https://third-party.com` may fetch `https://third-party.com/api/user.json`.
46
+ * Relative to the iframe, that request is same-origin (`request.initiatorSecurityOrigin() === https://third-party.com`).
47
+ * However, from the perspective of the top-level conversation (`https://example.com`), that request
48
+ * is cross-origin. Its response body and unexposed headers must be redacted to prevent leaking
49
+ * unauthorized data into the prompt.
50
+ */
51
+ accessingSecurityOrigin: SDK.SecurityOrigin.SecurityOrigin;
52
+ /** Optional network log instance for resolving initiator graphs. */
53
+ networkLog?: Logs.NetworkLog.NetworkLog;
54
+ }
55
+
30
56
  export class NetworkRequestFormatter {
31
57
  #calculator: NetworkTimeCalculator.NetworkTransferTimeCalculator;
32
58
  #request: SDK.NetworkRequest.NetworkRequest;
59
+ readonly #networkLog?: Logs.NetworkLog.NetworkLog;
60
+ readonly #accessingSecurityOrigin: SDK.SecurityOrigin.SecurityOrigin;
61
+
62
+ /**
63
+ * @param request The network request to format.
64
+ * @param calculator Calculator for request timing metrics.
65
+ * @param options Configuration options specifying the accessing security origin.
66
+ */
67
+ constructor(
68
+ request: SDK.NetworkRequest.NetworkRequest,
69
+ calculator: NetworkTimeCalculator.NetworkTransferTimeCalculator,
70
+ options: NetworkRequestFormatterOptions,
71
+ ) {
72
+ this.#request = request;
73
+ this.#calculator = calculator;
74
+ this.#networkLog = options.networkLog;
75
+ this.#accessingSecurityOrigin = options.accessingSecurityOrigin;
76
+ }
77
+
78
+ /**
79
+ * Evaluates the response access mode for this network request relative to the accessing security origin.
80
+ *
81
+ * @returns The evaluated `ResponseAccessMode`.
82
+ */
83
+ responseAccessMode(): SDK.NetworkRequestAccess.ResponseAccessMode {
84
+ return SDK.NetworkRequestAccess.evaluateResponseAccessMode(this.#request, this.#accessingSecurityOrigin);
85
+ }
33
86
 
34
87
  static allowHeader(headerName: string): boolean {
35
88
  return allowedHeaders.has(headerName.toLowerCase().trim());
@@ -73,9 +126,9 @@ export class NetworkRequestFormatter {
73
126
  initiatorUrl: Platform.DevToolsPath.UrlString,
74
127
  allowedOrigin: Platform.DevToolsPath.UrlString,
75
128
  ): string {
76
- // We extract the origin, and if it is invalid/empty we default to redacting.
77
- const initiatorOrigin = Common.ParsedURL.ParsedURL.extractOrigin(initiatorUrl);
78
- if (initiatorOrigin && initiatorOrigin === allowedOrigin) {
129
+ const initiatorOrigin = SDK.SecurityOrigin.SecurityOrigin.create(initiatorUrl);
130
+ const targetOrigin = SDK.SecurityOrigin.SecurityOrigin.create(allowedOrigin);
131
+ if (initiatorOrigin.isSameOriginWith(targetOrigin)) {
79
132
  return initiatorUrl;
80
133
  }
81
134
  return '<redacted cross-origin initiator URL>';
@@ -131,28 +184,35 @@ export class NetworkRequestFormatter {
131
184
  return lines.length > 0 ? `${lines.join('\n')}\n` : '';
132
185
  }
133
186
 
134
- readonly #networkLog: Logs.NetworkLog.NetworkLog;
135
-
136
- constructor(
137
- request: SDK.NetworkRequest.NetworkRequest,
138
- calculator: NetworkTimeCalculator.NetworkTransferTimeCalculator,
139
- // eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
140
- networkLog: Logs.NetworkLog.NetworkLog = Logs.NetworkLog.NetworkLog.instance(),
141
- ) {
142
- this.#request = request;
143
- this.#calculator = calculator;
144
- this.#networkLog = networkLog;
145
- }
146
-
147
187
  formatRequestHeaders(): string {
148
188
  return NetworkRequestFormatter.formatHeaders('Request headers:', this.#request.requestHeaders());
149
189
  }
150
190
 
191
+ /**
192
+ * Formats response headers for the AI prompt.
193
+ *
194
+ * Headers are filtered based on the request's evaluated ResponseAccessMode:
195
+ * - Opaque cross-origin requests only include CORS-safelisted response headers.
196
+ * - CORS-authorized requests include CORS-safelisted and Access-Control-Expose-Headers.
197
+ * - Same-origin requests include all response headers.
198
+ * Values of headers not present on the global allowedHeaders list are then redacted.
199
+ */
151
200
  formatResponseHeaders(): string {
152
- return NetworkRequestFormatter.formatHeaders('Response headers:', this.#request.responseHeaders);
201
+ const accessMode = this.responseAccessMode();
202
+ const headers = SDK.NetworkRequestAccess.getFilterableResponseHeaders(this.#request, accessMode);
203
+ return NetworkRequestFormatter.formatHeaders('Response headers:', headers);
153
204
  }
154
205
 
206
+ /**
207
+ * Formats the response body for the AI prompt.
208
+ *
209
+ * For opaque cross-origin requests, the response body is redacted because the accessing
210
+ * security origin is forbidden by the Same-Origin Policy from reading it.
211
+ */
155
212
  async formatResponseBody(): Promise<string> {
213
+ if (this.responseAccessMode() === SDK.NetworkRequestAccess.ResponseAccessMode.OPAQUE_CROSS_ORIGIN) {
214
+ return SDK.NetworkRequestAccess.REDACTED_RESPONSE_BODY;
215
+ }
156
216
  return await NetworkRequestFormatter.formatBody('Response body:', this.#request, MAX_BODY_SIZE);
157
217
  }
158
218
 
@@ -203,22 +263,9 @@ Request initiator chain:\n${this.formatRequestInitiatorChain()}`;
203
263
  * the request's origin.
204
264
  */
205
265
  formatRequestInitiatorChain(): string {
206
- const allowedOrigin = Common.ParsedURL.ParsedURL.extractOrigin(this.#request.url());
207
- let initiatorChain = '';
208
- let lineStart = '- URL: ';
209
- const graph = this.#networkLog.initiatorGraphForRequest(this.#request);
210
-
211
- for (const initiator of Array.from(graph.initiators).reverse()) {
212
- initiatorChain = initiatorChain + lineStart +
213
- NetworkRequestFormatter.formatInitiatorUrl(initiator.url(), allowedOrigin) + '\n';
214
- lineStart = '\t' + lineStart;
215
- if (initiator === this.#request) {
216
- initiatorChain =
217
- this.#formatRequestInitiated(graph.initiated, this.#request, initiatorChain, lineStart, allowedOrigin);
218
- }
219
- }
220
-
221
- return initiatorChain.trim();
266
+ // eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
267
+ const networkLog = this.#networkLog ?? Logs.NetworkLog.NetworkLog.instance();
268
+ return formatRequestInitiatorChain(this.#request, networkLog);
222
269
  }
223
270
 
224
271
  formatNetworkRequestTiming(): string {
@@ -269,32 +316,62 @@ Request initiator chain:\n${this.formatRequestInitiatorChain()}`;
269
316
 
270
317
  return labels.filter(label => !!label.value).map(label => `${label.label}: ${label.value}`).join('\n');
271
318
  }
319
+ }
272
320
 
273
- #formatRequestInitiated(
274
- initiated: Map<SDK.NetworkRequest.NetworkRequest, SDK.NetworkRequest.NetworkRequest>,
275
- parentRequest: SDK.NetworkRequest.NetworkRequest,
276
- initiatorChain: string,
277
- lineStart: string,
278
- allowedOrigin: Platform.DevToolsPath.UrlString,
279
- ): string {
280
- const visited = new Set<SDK.NetworkRequest.NetworkRequest>();
281
-
282
- // this.request should be already in the tree when build initiator part
283
- visited.add(this.#request);
284
- for (const [keyRequest, initiatedRequest] of initiated.entries()) {
285
- if (initiatedRequest === parentRequest) {
286
- if (!visited.has(keyRequest)) {
287
- visited.add(keyRequest);
288
- initiatorChain = initiatorChain + lineStart +
289
- NetworkRequestFormatter.formatInitiatorUrl(keyRequest.url(), allowedOrigin) + '\n';
290
- initiatorChain =
291
- this.#formatRequestInitiated(initiated, keyRequest, initiatorChain, '\t' + lineStart, allowedOrigin);
292
- }
293
- }
321
+ /**
322
+ * Formats the initiator chain for a given network request into a formatted string.
323
+ *
324
+ * @param request The network request to format the initiator chain for.
325
+ * @param networkLog Network log instance used to build the initiator graph.
326
+ * @returns Formatted initiator chain.
327
+ */
328
+ export function formatRequestInitiatorChain(
329
+ request: SDK.NetworkRequest.NetworkRequest,
330
+ networkLog: Logs.NetworkLog.NetworkLog,
331
+ ): string {
332
+ const allowedOrigin = request.url();
333
+ let initiatorChain = '';
334
+ let lineStart = '- URL: ';
335
+ const graph = networkLog.initiatorGraphForRequest(request);
336
+
337
+ for (const initiator of Array.from(graph.initiators).reverse()) {
338
+ initiatorChain =
339
+ initiatorChain + lineStart + NetworkRequestFormatter.formatInitiatorUrl(initiator.url(), allowedOrigin) + '\n';
340
+ lineStart = '\t' + lineStart;
341
+ if (initiator === request) {
342
+ initiatorChain =
343
+ formatRequestInitiated(graph.initiated, request, request, initiatorChain, lineStart, allowedOrigin);
294
344
  }
345
+ }
295
346
 
296
- return initiatorChain;
347
+ return initiatorChain.trim();
348
+ }
349
+
350
+ function formatRequestInitiated(
351
+ initiated: Map<SDK.NetworkRequest.NetworkRequest, SDK.NetworkRequest.NetworkRequest>,
352
+ rootRequest: SDK.NetworkRequest.NetworkRequest,
353
+ parentRequest: SDK.NetworkRequest.NetworkRequest,
354
+ initiatorChain: string,
355
+ lineStart: string,
356
+ allowedOrigin: Platform.DevToolsPath.UrlString,
357
+ ): string {
358
+ const visited = new Set<SDK.NetworkRequest.NetworkRequest>();
359
+
360
+ // rootRequest should be already in the tree when building initiator part
361
+ visited.add(rootRequest);
362
+ for (const [keyRequest, initiatedRequest] of initiated.entries()) {
363
+ if (initiatedRequest === parentRequest) {
364
+ if (!visited.has(keyRequest)) {
365
+ visited.add(keyRequest);
366
+ initiatorChain = initiatorChain + lineStart +
367
+ NetworkRequestFormatter.formatInitiatorUrl(keyRequest.url(), allowedOrigin) + '\n';
368
+ initiatorChain =
369
+ formatRequestInitiated(initiated, rootRequest, keyRequest, initiatorChain, '\t' + lineStart, allowedOrigin);
370
+ }
371
+ }
297
372
  }
373
+
374
+ return initiatorChain;
298
375
  }
299
376
 
300
377
  // Header names that could be included in the prompt, lowercase.
@@ -2,10 +2,8 @@
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 Common from '../../../core/common/common.js';
6
5
  import * as SDK from '../../../core/sdk/sdk.js';
7
6
  import type * as Protocol from '../../../generated/protocol.js';
8
- import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiOrigins.js';
9
7
 
10
8
  import {MAX_TARGET_ORIGINS} from './DOMStorageUtils.js';
11
9
  import type {OriginLockCapability} from './Tool.js';
@@ -27,8 +25,16 @@ export interface CookieDetails {
27
25
  }
28
26
 
29
27
  /**
30
- * Resolves and validates target origins against origin-lock constraints and primary page target.
31
- * If `requestedOrigins` is omitted or empty, defaults to the established context origin.
28
+ * Resolves and validates target origins against the established context origin and primary page target.
29
+ *
30
+ * When `requestedOrigins` is empty or omitted, defaults to the established context origin.
31
+ * Rejects opaque origins, mismatches with the primary page origin, and cross-origin targets.
32
+ * Limits results to at most `MAX_TARGET_ORIGINS` unique origins.
33
+ *
34
+ * @param requestedOrigins Optional list of origin URLs to validate.
35
+ * @param context The origin lock capability containing the established origin.
36
+ * @param targetManager The target manager used to resolve the primary page target.
37
+ * @returns An object with validated target origins and the primary page target, or an error object.
32
38
  */
33
39
  export function resolveAllowedTargetOrigins(
34
40
  requestedOrigins: string[]|undefined,
@@ -38,8 +44,8 @@ export function resolveAllowedTargetOrigins(
38
44
  error: string,
39
45
  }
40
46
  {
41
- const allowedOrigin = context.getEstablishedOrigin();
42
- if (!allowedOrigin || isOpaqueOrigin(allowedOrigin) || isOpaqueOrigin(extractContextOrigin(allowedOrigin))) {
47
+ const establishedOrigin = context.getEstablishedOrigin();
48
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
43
49
  return {error: 'No origin available or not allowed.'};
44
50
  }
45
51
 
@@ -48,15 +54,19 @@ export function resolveAllowedTargetOrigins(
48
54
  return {error: 'Primary page target not found.'};
49
55
  }
50
56
 
51
- const pageOrigin = Common.ParsedURL.ParsedURL.extractOrigin(primaryPageTarget.inspectedURL());
52
- if (!pageOrigin || !areOriginsEquivalent(pageOrigin, allowedOrigin)) {
57
+ const pageOrigin = primaryPageTarget.inspectedSecurityOrigin();
58
+ if (!pageOrigin.isSameOriginWith(establishedOrigin)) {
53
59
  return {error: 'Page origin does not match allowed origin.'};
54
60
  }
55
61
 
56
- const rawOrigins =
57
- (Array.isArray(requestedOrigins) && requestedOrigins.length > 0) ? requestedOrigins : [allowedOrigin];
58
- const validOrigins = rawOrigins.map(origin => extractContextOrigin(origin))
59
- .filter(origin => areOriginsEquivalent(origin, allowedOrigin));
62
+ const candidateOrigins: SDK.SecurityOrigin.SecurityOrigin[] =
63
+ (Array.isArray(requestedOrigins) && requestedOrigins.length > 0) ?
64
+ requestedOrigins.map(origin => SDK.SecurityOrigin.SecurityOrigin.create(origin)) :
65
+ [establishedOrigin];
66
+
67
+ const validOrigins =
68
+ candidateOrigins.filter(origin => origin.isSameOriginWith(establishedOrigin)).map(origin => origin.siteId());
69
+
60
70
  const targetOrigins = Array.from(new Set(validOrigins)).slice(0, MAX_TARGET_ORIGINS);
61
71
  if (targetOrigins.length === 0) {
62
72
  return {error: 'No valid origins found.'};
@@ -72,36 +82,16 @@ export type GetCookiesForOriginResult = {
72
82
  };
73
83
 
74
84
  /**
75
- * Finds the resource tree frame matching the target origin within the primary page's outermost target tree.
76
- */
77
- export function findFrameForOrigin(
78
- origin: string,
79
- targetManager: SDK.TargetManager.TargetManager,
80
- primaryPageTarget: SDK.Target.Target,
81
- ): SDK.ResourceTreeModel.ResourceTreeFrame|null {
82
- const targetOrigin = extractContextOrigin(origin);
83
- for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(targetManager)) {
84
- if (frame.resourceTreeModel().target().outermostTarget() !== primaryPageTarget) {
85
- continue;
86
- }
87
- if (frame.securityOrigin && areOriginsEquivalent(frame.securityOrigin, targetOrigin)) {
88
- return frame;
89
- }
90
- }
91
- return null;
92
- }
93
-
94
- /**
95
- * Retrieves all cookies accessible to the target origin, strictly excluding HttpOnly cookies.
85
+ * Retrieves all cookies accessible to the target origin, excluding HttpOnly cookies.
96
86
  * Locates the matching frame within the primary page target tree, queries its CookieModel,
97
87
  * and filters cookies by security origin.
98
88
  */
99
89
  export async function getCookiesForOrigin(
100
90
  origin: string,
101
- targetManager: SDK.TargetManager.TargetManager,
102
91
  primaryPageTarget: SDK.Target.Target,
103
92
  ): Promise<GetCookiesForOriginResult> {
104
- const frame = findFrameForOrigin(origin, targetManager, primaryPageTarget);
93
+ const targetOrigin = SDK.SecurityOrigin.SecurityOrigin.create(origin);
94
+ const frame = SDK.ResourceTreeModel.ResourceTreeModel.frameForOrigin(primaryPageTarget, targetOrigin);
105
95
  if (!frame) {
106
96
  return {error: `Frame not found or origin disallowed for ${origin}`};
107
97
  }
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as SDK from '../../../core/sdk/sdk.js';
6
- import {areOriginsEquivalent, extractContextOrigin} from '../AiOrigins.js';
7
6
 
8
7
  /**
9
8
  * Maximum number of target origins allowed in a single batch query to bound
@@ -42,7 +41,10 @@ export function resolveDOMStorages(
42
41
  const resolvedStorages: SDK.DOMStorageModel.DOMStorage[] = [];
43
42
  const seenStorageKeys = new Set<string>();
44
43
  const isLocalStorage = type === 'localStorage';
45
- const targetOrigin = extractContextOrigin(origin);
44
+ const targetOrigin = SDK.SecurityOrigin.SecurityOrigin.create(origin);
45
+ if (targetOrigin.isOpaque()) {
46
+ return [];
47
+ }
46
48
 
47
49
  const domStorageModels = targetManager.models(SDK.DOMStorageModel.DOMStorageModel);
48
50
  for (const domStorageModel of domStorageModels) {
@@ -78,7 +80,8 @@ export function resolveDOMStorages(
78
80
  // Parse the serialized StorageKey (e.g. "https://example.com/^0https://top.com") to
79
81
  // extract the partition's origin for equivalence comparison.
80
82
  const parsedKey = SDK.StorageKeyManager.parseStorageKey(currentStorageKey);
81
- if (areOriginsEquivalent(parsedKey.origin, targetOrigin)) {
83
+ const parsedOrigin = SDK.SecurityOrigin.SecurityOrigin.create(parsedKey.origin);
84
+ if (parsedOrigin.isSameOriginWith(targetOrigin)) {
82
85
  resolvedStorages.push(storage);
83
86
  }
84
87
  }