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
@@ -1,7 +1,6 @@
1
1
  // Copyright 2024 The Chromium Authors
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
- import * as Common from '../../core/common/common.js';
5
4
  import * as Host from '../../core/host/host.js';
6
5
  import * as Platform from '../../core/platform/platform.js';
7
6
  import * as Root from '../../core/root/root.js';
@@ -46,14 +45,13 @@ export const NOT_FOUND_IMAGE_DATA = '';
46
45
  export const CONTEXT_TITLE = 'Analyzing data';
47
46
  const MAX_TITLE_LENGTH = 80;
48
47
  /**
49
- * List of page navigations that are allowed during an AI agent run.
50
- * These are page navigations triggered by agents themselves:
51
- * - `about://` : Navigated to before initiating a trace recording to ensure a clean state.
52
- * - `chrome://terms`: Navigated to by Lighthouse during its Back-Forward Cache
53
- * audit.
48
+ * Page URL prefixes permitted during an AI agent run.
49
+ * Agents trigger these navigations internally:
50
+ * - `about:blank`: Used before recording a performance trace to ensure a clean state.
51
+ * - `chrome://terms`: Used by Lighthouse during Back-Forward Cache audits.
54
52
  */
55
53
  export const ALLOWED_PAGE_NAVIGATIONS: Platform.DevToolsPath.UrlString[] = [
56
- Platform.DevToolsPath.urlString`about://`,
54
+ Platform.DevToolsPath.urlString`about:blank`,
57
55
  Platform.DevToolsPath.urlString`chrome://terms`,
58
56
  ];
59
57
 
@@ -107,7 +105,7 @@ export class AiConversation {
107
105
 
108
106
  #aidaClient: Host.AidaClient.AidaClient;
109
107
  #changeManager: ChangeManager|undefined;
110
- #origin?: string|SDK.SecurityOrigin.SecurityOrigin;
108
+ #origin?: SDK.SecurityOrigin.SecurityOrigin;
111
109
  #navigationOccurredDuringRun = false;
112
110
 
113
111
  #contexts: Array<ConversationContext<unknown>> = [];
@@ -181,7 +179,7 @@ export class AiConversation {
181
179
  return this.history.length === 0;
182
180
  }
183
181
 
184
- #setOriginIfEmpty(newOrigin: string|SDK.SecurityOrigin.SecurityOrigin|undefined): void {
182
+ #setOriginIfEmpty(newOrigin: SDK.SecurityOrigin.SecurityOrigin|undefined): void {
185
183
  if (!this.#origin) {
186
184
  this.#origin = newOrigin;
187
185
  }
@@ -431,14 +429,17 @@ export class AiConversation {
431
429
  } = {},
432
430
  ): AsyncGenerator<ResponseData, void, void> {
433
431
  this.#navigationOccurredDuringRun = false;
434
- const originAtRunStart = getPrimaryPageOrigin(this.#targetManager);
432
+ const originAtRunStart = getPrimaryPageSecurityOrigin(this.#targetManager);
435
433
  const listener = (): void => {
436
- // If an unexpected navigation to a different origin occurred
437
- // during processing the user's request, we don't want to allow
438
- // the agent to run any function calls and retrieve data from the new origin.
439
- // Performance agent and accessibility agent navigate to 'about://' or 'chrome://terms'
440
- const newOrigin = getPrimaryPageOrigin(this.#targetManager);
441
- if (originAtRunStart !== newOrigin && newOrigin && !ALLOWED_PAGE_NAVIGATIONS.includes(newOrigin)) {
434
+ // Prevent the agent from executing tools or reading data from an untrusted origin
435
+ // if the page navigates unexpectedly during execution.
436
+ const newInspectedURL = this.#targetManager.primaryPageTarget()?.inspectedURL();
437
+ const newOrigin = newInspectedURL ? SDK.SecurityOrigin.SecurityOrigin.create(newInspectedURL) : undefined;
438
+ const isSameOrigin = Boolean(originAtRunStart && newOrigin && originAtRunStart.isSameOriginWith(newOrigin));
439
+ const isAllowedNavigation =
440
+ Boolean(newInspectedURL && ALLOWED_PAGE_NAVIGATIONS.some(allowed => newInspectedURL.startsWith(allowed)));
441
+
442
+ if (!isSameOrigin && !isAllowedNavigation) {
442
443
  this.#navigationOccurredDuringRun = true;
443
444
  }
444
445
  };
@@ -543,24 +544,28 @@ export class AiConversation {
543
544
  return !this.#contexts.every(context => context.isOriginAllowed(this.#origin));
544
545
  }
545
546
 
546
- get origin(): string|undefined {
547
- return this.#origin instanceof SDK.SecurityOrigin.SecurityOrigin ? this.#origin.siteId() : this.#origin;
547
+ get origin(): SDK.SecurityOrigin.SecurityOrigin|undefined {
548
+ return this.#origin;
548
549
  }
549
550
 
550
551
  get type(): ConversationType {
551
552
  return this.#type;
552
553
  }
553
554
 
555
+ /**
556
+ * Returns the permitted origin for agent tool execution, or blocks execution
557
+ * if an unapproved cross-origin navigation occurred during the current run.
558
+ */
554
559
  allowedOrigin = (): AllowedOriginResult => {
555
560
  if (this.#navigationOccurredDuringRun) {
556
561
  return {blocked: true};
557
562
  }
558
563
  if (this.#origin) {
559
- return {origin: this.origin};
564
+ return {origin: this.#origin};
560
565
  }
561
- this.#origin = getPrimaryPageOrigin(this.#targetManager);
566
+ this.#origin = getPrimaryPageSecurityOrigin(this.#targetManager);
562
567
 
563
- return {origin: this.origin};
568
+ return {origin: this.#origin};
564
569
  };
565
570
  }
566
571
 
@@ -574,10 +579,16 @@ function isAiAssistanceServerSideLoggingAllowed(): boolean {
574
579
  return !Root.Runtime.hostConfig.aidaAvailability?.disallowLogging;
575
580
  }
576
581
 
577
- function getPrimaryPageOrigin(
582
+ /**
583
+ * Returns the security origin of the primary page target.
584
+ *
585
+ * @param targetManager Target manager used to locate the primary page target.
586
+ * @returns The parsed SecurityOrigin, or undefined if no target or inspected URL exists.
587
+ */
588
+ function getPrimaryPageSecurityOrigin(
578
589
  targetManager: SDK.TargetManager.TargetManager,
579
- ): Platform.DevToolsPath.UrlString|undefined {
590
+ ): SDK.SecurityOrigin.SecurityOrigin|undefined {
580
591
  const target = targetManager.primaryPageTarget();
581
592
  const inspectedURL = target?.inspectedURL();
582
- return inspectedURL ? new Common.ParsedURL.ParsedURL(inspectedURL).securityOrigin() : undefined;
593
+ return inspectedURL ? SDK.SecurityOrigin.SecurityOrigin.create(inspectedURL) : undefined;
583
594
  }
@@ -60,10 +60,12 @@ Example from `PerformanceAgent`:
60
60
  To prevent prompt injection attacks and cross-origin data leaks, the AI Assistance panel enforces strict origin-lock boundaries:
61
61
 
62
62
  - **Origin Locking**: Once a conversation session begins, it locks to the origin of the initial data context (e.g. `https://google.com` or a specific file path).
63
- - **Opaque Origins**: Any origin classified as opaque (e.g. `data:`, `about:`, `detached` nodes, unparsed `undefined://` or empty origins) is blocked from starting AI assistance (`isOpaqueOrigin()`).
63
+ - **Opaque Origins**: Any origin classified as opaque (e.g. `data:`, `about:`, `detached` nodes, or synthetic opaque origins) is blocked from starting AI assistance (`SecurityOrigin.isOpaque()`).
64
64
  - **File Isolation**: Local files (`file://`) do not share a single wildcard origin. Instead, the path is appended (e.g. `file:///path/to/file.js`) to treat each local file as its own unique origin. Swapping local files in the same conversation is blocked.
65
- - **Trace Isolation**: Imported performance trace recordings are isolated using the virtual origin `imported-trace://${domain}`. This ensures that loaded local trace files do not share origins with live pages, preventing potential cross-origin prompt injection attacks when switching contexts.
66
- - **Equivalence**: `areOriginsEquivalent()` ensures opaque origins are never equivalent to anything (including themselves), forcing a conversation reset on transitions.
65
+ - **Trace Isolation**: Imported performance trace recordings are isolated using the virtual origin `imported-trace://${host}`. This ensures that loaded local trace files do not share origins with live pages, preventing potential cross-origin prompt injection attacks when switching contexts.
66
+ - **HAR Isolation**: Imported HAR network recordings use the virtual origin `imported-har://${host}` to isolate imported network traffic from live pages.
67
+ - **CORS Response Gating**: Network requests initiated cross-origin without valid CORS authorization (`Access-Control-Allow-Origin`) are classified as `OPAQUE_CROSS_ORIGIN`. DevTools redacts the response body and restricts response headers to CORS-safelisted names to prevent cross-origin data disclosure (b/513821237).
68
+ - **Equivalence**: `SecurityOrigin.isSameOriginWith()` ensures opaque origins never match any other origin (even with identical URL representations), forcing a conversation reset on context switch.
67
69
 
68
70
  ## AIAgentV2 (Unified Architecture)
69
71
 
@@ -253,6 +253,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
253
253
  createExtensionScope: this.#createExtensionScope.bind(this),
254
254
  execJs: this.#execJs,
255
255
  getExecutionContextNode: () => this.#getDocumentBodyNode(),
256
+ getEstablishedOrigin: () => this.context?.getOrigin(),
256
257
  },
257
258
  options,
258
259
  );
@@ -11,7 +11,6 @@ import type * as Protocol from '../../../generated/protocol.js';
11
11
  import type * as LHModel from '../../lighthouse/lighthouse.js';
12
12
  import type * as Trace from '../../trace/trace.js';
13
13
  import type * as Workspace from '../../workspace/workspace.js';
14
- import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiOrigins.js';
15
14
  import {debugLog, isStructuredLogEnabled} from '../debug.js';
16
15
  import type {ContextHandlerResult, DataHandlerResult} from '../tools/Tool.js';
17
16
 
@@ -158,7 +157,7 @@ export interface RequestOptions {
158
157
  }
159
158
 
160
159
  export type AllowedOriginResult = {
161
- origin: string|undefined,
160
+ origin: SDK.SecurityOrigin.SecurityOrigin|undefined,
162
161
  }|{
163
162
  blocked: true,
164
163
  };
@@ -193,7 +192,6 @@ export interface ConversationSuggestion {
193
192
  export type ConversationSuggestions = [ConversationSuggestion, ...ConversationSuggestion[]];
194
193
 
195
194
  export abstract class ConversationContext<T> {
196
- abstract getURL(): string;
197
195
  abstract getItem(): T;
198
196
  abstract getTitle(): string;
199
197
 
@@ -205,47 +203,43 @@ export abstract class ConversationContext<T> {
205
203
  return true;
206
204
  }
207
205
 
208
- getOrigin(): string|SDK.SecurityOrigin.SecurityOrigin {
209
- return extractContextOrigin(this.getURL());
210
- }
206
+ /**
207
+ * Returns the security origin that owns this context data.
208
+ *
209
+ * The AI Assistance panel locks each conversation to the origin of the initial
210
+ * context. If the user selects a context with a different origin, DevTools
211
+ * blocks access to prevent unauthorized cross-origin data exposure.
212
+ *
213
+ * Subclasses must implement this method. If a context is detached, invalid,
214
+ * or anonymous, the method must return a unique opaque origin
215
+ * (`SDK.SecurityOrigin.SecurityOrigin.createUniqueOpaque()`).
216
+ *
217
+ * @returns The {@link SDK.SecurityOrigin.SecurityOrigin} that owns this context.
218
+ */
219
+ abstract getOrigin(): SDK.SecurityOrigin.SecurityOrigin;
211
220
 
212
221
  /**
213
- * Returns true if this data context (e.g., a DOM node or Network Request) is
214
- * allowed to be included in a conversation that is locked to the provided
215
- * `establishedOrigin`.
222
+ * Checks whether this context can participate in a conversation locked to `establishedOrigin`.
216
223
  *
217
- * A conversation is "locked" to an origin once the first query is made.
218
- * This method ensures that we don't mix data from different origins in the
219
- * same conversation.
224
+ * Evaluation rules:
225
+ * 1. Returns `false` if this context origin is opaque. Opaque contexts can never
226
+ * participate in AI conversations.
227
+ * 2. Returns `true` if `establishedOrigin` is `undefined` (conversation is not yet locked).
228
+ * 3. Returns `true` if this context origin is same-origin with `establishedOrigin`.
220
229
  *
221
- * @param establishedOrigin The origin that the current conversation is locked to.
222
- * If undefined, the conversation has not yet been locked to an origin.
230
+ * @param establishedOrigin The locked origin of the current conversation, or `undefined`
231
+ * if the conversation has not made its first query.
223
232
  */
224
- isOriginAllowed(establishedOrigin: string|SDK.SecurityOrigin.SecurityOrigin|undefined): boolean {
233
+ isOriginAllowed(establishedOrigin: SDK.SecurityOrigin.SecurityOrigin|undefined): boolean {
225
234
  const origin = this.getOrigin();
226
235
 
227
- if (origin instanceof SDK.SecurityOrigin.SecurityOrigin) {
228
- if (origin.isOpaque()) {
229
- return false;
230
- }
231
- if (!establishedOrigin) {
232
- return true;
233
- }
234
- const established = establishedOrigin instanceof SDK.SecurityOrigin.SecurityOrigin ?
235
- establishedOrigin :
236
- SDK.SecurityOrigin.SecurityOrigin.create(establishedOrigin);
237
- return origin.isSameOriginWith(established);
236
+ if (origin.isOpaque()) {
237
+ return false;
238
238
  }
239
-
240
- // If no origin is established yet, this context will be the one to lock the conversation.
241
- // Opaque origins are never allowed to be used as context.
242
239
  if (!establishedOrigin) {
243
- return !isOpaqueOrigin(origin);
240
+ return true;
244
241
  }
245
- // Only allow data that matches the origin the conversation is already locked to.
246
- const establishedString =
247
- establishedOrigin instanceof SDK.SecurityOrigin.SecurityOrigin ? establishedOrigin.siteId() : establishedOrigin;
248
- return areOriginsEquivalent(origin, establishedString);
242
+ return origin.isSameOriginWith(establishedOrigin);
249
243
  }
250
244
 
251
245
  /**
@@ -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 * as Host from '../../../core/host/host.js';
7
6
  import * as i18n from '../../../core/i18n/i18n.js';
8
7
  import * as Root from '../../../core/root/root.js';
@@ -12,12 +11,11 @@ import * as Logs from '../../logs/logs.js';
12
11
  import * as NetworkTimeCalculator from '../../network_time_calculator/network_time_calculator.js';
13
12
  import type * as Trace from '../../trace/trace.js';
14
13
  import * as Workspace from '../../workspace/workspace.js';
15
- import {isOpaqueOrigin} from '../AiOrigins.js';
16
14
  import {AccessibilityContext} from '../contexts/AccessibilityContext.js';
17
15
  import {DOMNodeContext} from '../contexts/DOMNodeContext.js';
18
16
  import {FileContext} from '../contexts/FileContext.js';
19
17
  import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
20
- import {getRequestContextOrigin, RequestContext} from '../contexts/RequestContext.js';
18
+ import {RequestContext} from '../contexts/RequestContext.js';
21
19
  import {StorageContext} from '../contexts/StorageContext.js';
22
20
  import {formatBytesToKb, seconds} from '../data_formatters/UnitFormatters.js';
23
21
  import {debugLog} from '../debug.js';
@@ -149,16 +147,16 @@ export class ContextSelectionAgent extends AiAgent<never> {
149
147
  };
150
148
  }
151
149
  const origin = allowedOriginResult.origin;
152
- if (origin && isOpaqueOrigin(origin)) {
150
+ if (origin?.isOpaque()) {
153
151
  return {
154
152
  error: 'No requests recorded by DevTools',
155
153
  };
156
154
  }
157
155
 
156
+ const allowedSecurityOrigin = origin ?? null;
158
157
  let hasCrossOriginRequest = false;
159
158
  const requestsToShow: NetworkRequest[] = [];
160
159
  for (const request of this.#networkLog.requests()) {
161
- const requestOrigin = getRequestContextOrigin(request);
162
160
  /**
163
161
  * NOTE: this origin check does not ensure that all the requests are
164
162
  * from the same origin as the target page. Instead, it ensures that
@@ -167,7 +165,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
167
165
  * during the loading of the target page, and do not leak URLs from
168
166
  * other pages.
169
167
  */
170
- if (origin && requestOrigin !== origin) {
168
+ if (allowedSecurityOrigin && !request.initiatorSecurityOrigin().isSameOriginWith(allowedSecurityOrigin)) {
171
169
  hasCrossOriginRequest = true;
172
170
  continue;
173
171
  }
@@ -185,7 +183,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
185
183
  if (requests.length === 0) {
186
184
  return {
187
185
  error: hasCrossOriginRequest ?
188
- `No requests showing with origin ${origin}. Tell the user to start a new chat` :
186
+ `No requests showing with origin ${origin?.siteId() ?? ''}. Tell the user to start a new chat` :
189
187
  'No requests recorded by DevTools',
190
188
  };
191
189
  }
@@ -232,18 +230,18 @@ export class ContextSelectionAgent extends AiAgent<never> {
232
230
  };
233
231
  }
234
232
  const origin = allowedOriginResult.origin;
235
- if (origin && isOpaqueOrigin(origin)) {
233
+ if (origin?.isOpaque()) {
236
234
  return {
237
235
  error: 'No request found',
238
236
  };
239
237
  }
238
+ const allowedSecurityOrigin = origin ?? null;
240
239
  const request = this.#networkLog.requests().find(req => {
241
240
  if (req.requestId() !== id) {
242
241
  return false;
243
242
  }
244
243
 
245
- const requestOrigin = getRequestContextOrigin(req);
246
- return !origin || requestOrigin === origin;
244
+ return !allowedSecurityOrigin || req.initiatorSecurityOrigin().isSameOriginWith(allowedSecurityOrigin);
247
245
  });
248
246
 
249
247
  if (request) {
@@ -293,10 +291,9 @@ export class ContextSelectionAgent extends AiAgent<never> {
293
291
  const files: Array<{file: string, id: number | undefined}> = [];
294
292
  const uiSourceCodes: Workspace.UISourceCode.UISourceCode[] = [];
295
293
  for (const file of ContextSelectionAgent.getUISourceCodes(this.#workspace)) {
296
- const fileUrl = file.url();
297
- const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
294
+ const fileSecurityOrigin = FileContext.originForUISourceCode(file);
298
295
 
299
- if (origin && fileOrigin !== origin) {
296
+ if (origin && !fileSecurityOrigin.isSameOriginWith(origin)) {
300
297
  continue;
301
298
  }
302
299
 
@@ -354,9 +351,8 @@ export class ContextSelectionAgent extends AiAgent<never> {
354
351
  if (ContextSelectionAgent.uiSourceCodeId.get(file) !== params.id) {
355
352
  return false;
356
353
  }
357
- const fileUrl = file.url();
358
- const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
359
- return !origin || fileOrigin === origin;
354
+ const fileSecurityOrigin = FileContext.originForUISourceCode(file);
355
+ return !origin || fileSecurityOrigin.isSameOriginWith(origin);
360
356
  });
361
357
 
362
358
  if (!file) {
@@ -534,7 +530,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
534
530
  }
535
531
 
536
532
  return {
537
- context: new StorageContext(new StorageItem(origin, origin)),
533
+ context: new StorageContext(new StorageItem(origin.siteId(), origin.siteId())),
538
534
  description: 'User selected page storage',
539
535
  };
540
536
  },
@@ -12,7 +12,6 @@ import * as TextUtils from '../../../core/text_utils/text_utils.js';
12
12
  import * as Tracing from '../../../services/tracing/tracing.js';
13
13
  import * as Logs from '../../logs/logs.js';
14
14
  import * as Trace from '../../trace/trace.js';
15
- import {canResourceContentsBeReadForTrace} from '../AiOrigins.js';
16
15
  import type {MainThreadSectionLabel, PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
17
16
  import {
18
17
  PerformanceInsightFormatter,
@@ -1053,6 +1052,10 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1053
1052
  return {error: 'Missing arg: column'};
1054
1053
  }
1055
1054
 
1055
+ if (!context.canAccessResource(args.scriptUrl)) {
1056
+ return {error: 'Resource not found'};
1057
+ }
1058
+
1056
1059
  if (!this.#formatter) {
1057
1060
  throw new Error('missing formatter');
1058
1061
  }
@@ -1115,8 +1118,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1115
1118
  }
1116
1119
 
1117
1120
  const url = args.url;
1118
- const allowedOrigin = context.getOrigin();
1119
- if (!canResourceContentsBeReadForTrace(url, allowedOrigin)) {
1121
+ if (!context.canAccessResource(url)) {
1120
1122
  return {error: 'Resource not found'};
1121
1123
  }
1122
1124
 
@@ -71,16 +71,19 @@ export function isSamePageOrigin(target: SDK.Target.Target|null, context?: Conve
71
71
  if (!target || !context) {
72
72
  return false;
73
73
  }
74
- const pageOrigin = Common.ParsedURL.ParsedURL.extractOrigin(target.inspectedURL());
75
- return pageOrigin !== '' && context.isOriginAllowed(pageOrigin);
74
+ const inspectedURL = target.inspectedURL();
75
+ if (!inspectedURL) {
76
+ return false;
77
+ }
78
+ const pageOrigin = SDK.SecurityOrigin.SecurityOrigin.create(inspectedURL);
79
+ return !pageOrigin.isOpaque() && context.isOriginAllowed(pageOrigin);
76
80
  }
77
81
 
78
82
  const MAX_TARGET_ORIGINS = 100;
79
83
 
80
84
  function resolveTargetOrigins(context?: ConversationContext<StorageItem>, origins?: string[]): string[] {
81
85
  const primaryOrigin = context?.getOrigin();
82
- const primaryString =
83
- primaryOrigin instanceof SDK.SecurityOrigin.SecurityOrigin ? primaryOrigin.siteId() : primaryOrigin;
86
+ const primaryString = primaryOrigin?.siteId();
84
87
  const rawList = (origins && origins.length > 0) ? origins : (primaryString ? [primaryString] : []);
85
88
  const uniqueOrigins = Array.from(new Set(rawList));
86
89
  return uniqueOrigins.slice(0, MAX_TARGET_ORIGINS);
@@ -145,19 +148,21 @@ export class StorageAgent extends AiAgent<StorageItem> {
145
148
  return {error: 'No origin available or not allowed.'};
146
149
  }
147
150
 
148
- const origins = new Set<string>();
151
+ const origins: SDK.SecurityOrigin.SecurityOrigin[] = [];
149
152
  for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(this.targetManager)) {
150
153
  if (!isSamePageOrigin(frame.resourceTreeModel().target().outermostTarget(), this.context)) {
151
154
  continue;
152
155
  }
153
- const origin = frame.securityOrigin;
154
- if (!origin || origins.has(origin)) {
156
+ const origin = frame.securityOrigin();
157
+ if (origin.isOpaque()) {
155
158
  continue;
156
159
  }
157
- origins.add(origin);
160
+ if (!origins.some(existing => existing.isSameOriginWith(origin))) {
161
+ origins.push(origin);
162
+ }
158
163
  }
159
164
 
160
- return {result: {origins: Array.from(origins)}};
165
+ return {result: {origins: origins.map(o => o.siteId())}};
161
166
  },
162
167
  });
163
168
 
@@ -679,8 +684,9 @@ export async function getCookiesForDomain(target: SDK.Target.Target,
679
684
  export function findFrameForOrigin(
680
685
  context: ConversationContext<StorageItem>|undefined, origin: string,
681
686
  targetManager: SDK.TargetManager.TargetManager): SDK.ResourceTreeModel.ResourceTreeFrame|null {
687
+ const parsedOrigin = SDK.SecurityOrigin.SecurityOrigin.create(origin);
682
688
  for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(targetManager)) {
683
- if (frame.securityOrigin === origin) {
689
+ if (frame.securityOrigin().isSameOriginWith(parsedOrigin)) {
684
690
  const target = frame.resourceTreeModel().target();
685
691
  if (isSamePageOrigin(target.outermostTarget(), context)) {
686
692
  return frame;
@@ -4,7 +4,7 @@
4
4
 
5
5
  import * as Host from '../../../core/host/host.js';
6
6
  import * as Root from '../../../core/root/root.js';
7
- import * as SDK from '../../../core/sdk/sdk.js';
7
+ import type * as SDK from '../../../core/sdk/sdk.js';
8
8
  import {ChangeManager} from '../ChangeManager.js';
9
9
  import {ExtensionScope} from '../ExtensionScope.js';
10
10
  import {AI_ASSISTANCE_CSS_CLASS_NAME} from '../injected.js';
@@ -155,8 +155,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
155
155
  return await getStylesTool.handler(args, {
156
156
  getTarget: () => this.targetManager.primaryPageTarget() ?? context.getItem().domModel().target(),
157
157
  getEstablishedOrigin: () => {
158
- const origin = context.getOrigin();
159
- return origin instanceof SDK.SecurityOrigin.SecurityOrigin ? origin.siteId() : origin;
158
+ return context.getOrigin();
160
159
  },
161
160
  });
162
161
  },
@@ -177,11 +176,11 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
177
176
  createExtensionScope: this.#createExtensionScope.bind(this),
178
177
  execJs: this.#execJs,
179
178
  getExecutionContextNode: () => this.context?.getItem() ?? null,
179
+ getEstablishedOrigin: () => this.context?.getOrigin(),
180
180
  },
181
181
  options,
182
182
  ),
183
183
  });
184
-
185
184
  }
186
185
 
187
186
  override preambleFeatures(): string[] {
@@ -12,7 +12,6 @@ import * as StylingAgent from './agents/StylingAgent.js';
12
12
  import * as AiAgent2 from './AiAgent2.js';
13
13
  import * as AiConversation from './AiConversation.js';
14
14
  import * as AiHistoryStorage from './AiHistoryStorage.js';
15
- import * as AiOrigins from './AiOrigins.js';
16
15
  import * as AiSetting from './AiSetting.js';
17
16
  import * as AiUtils from './AiUtils.js';
18
17
  import * as BuiltInAi from './BuiltInAi.js';
@@ -80,7 +79,6 @@ export {
80
79
  AIContext,
81
80
  AiConversation,
82
81
  AiHistoryStorage,
83
- AiOrigins,
84
82
  AIQueries,
85
83
  AiSetting,
86
84
  AiUtils,
@@ -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 type * as LHModel from '../../lighthouse/lighthouse.js';
6
7
  import {
7
8
  type AiWidget,
@@ -23,8 +24,16 @@ export class AccessibilityContext extends ConversationContext<LHModel.ReporterTy
23
24
  return this.#lh.finalUrl ?? this.#lh.finalDisplayedUrl;
24
25
  }
25
26
 
26
- override getURL(): string {
27
- return this.#url();
27
+ /**
28
+ * Returns the security origin of the audited page from the Lighthouse report.
29
+ *
30
+ * Derives the origin from the report URL (`finalUrl` or `finalDisplayedUrl`).
31
+ * If the report does not contain a valid URL, returns a unique opaque origin.
32
+ *
33
+ * @returns The security origin of the audited page.
34
+ */
35
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
36
+ return SDK.SecurityOrigin.SecurityOrigin.create(this.#url());
28
37
  }
29
38
 
30
39
  override getItem(): LHModel.ReporterTypes.ReportJSON {
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../core/i18n/i18n.js';
6
- import type * as SDK from '../../../core/sdk/sdk.js';
6
+ import * as SDK from '../../../core/sdk/sdk.js';
7
7
  import {
8
8
  type ContextDetail,
9
9
  ConversationContext,
@@ -21,19 +21,31 @@ const lockedString = i18n.i18n.lockedString;
21
21
 
22
22
  export class DOMNodeContext extends ConversationContext<SDK.DOMModel.DOMNode> {
23
23
  #node: SDK.DOMModel.DOMNode;
24
+ #opaqueOrigin?: SDK.SecurityOrigin.SecurityOrigin;
24
25
 
25
26
  constructor(node: SDK.DOMModel.DOMNode) {
26
27
  super();
27
28
  this.#node = node;
28
29
  }
29
30
 
30
- override getURL(): string {
31
+ /**
32
+ * Returns the security origin of the node's owner document.
33
+ *
34
+ * If the node is detached from a document, returns a unique opaque origin to
35
+ * prevent unauthorized cross-origin access in AI conversations.
36
+ *
37
+ * @returns The security origin of the owner document, or a unique opaque origin.
38
+ */
39
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
31
40
  const ownerDocument = this.#node.ownerDocument;
32
41
  if (!ownerDocument) {
33
- // The node is detached from a document.
34
- return 'detached';
42
+ // Detached nodes have no security document; isolate them with a unique opaque origin.
43
+ if (!this.#opaqueOrigin) {
44
+ this.#opaqueOrigin = SDK.SecurityOrigin.SecurityOrigin.createUniqueOpaque();
45
+ }
46
+ return this.#opaqueOrigin;
35
47
  }
36
- return ownerDocument.documentURL;
48
+ return SDK.SecurityOrigin.SecurityOrigin.create(ownerDocument.documentURL);
37
49
  }
38
50
 
39
51
  getItem(): SDK.DOMModel.DOMNode {
@@ -2,7 +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 type * as SDK from '../../../core/sdk/sdk.js';
5
+ import * as SDK from '../../../core/sdk/sdk.js';
6
6
  import type * as Bindings from '../../bindings/bindings.js';
7
7
  import type * as Workspace from '../../workspace/workspace.js';
8
8
  import {type ContextDetail, ConversationContext} from '../agents/AiAgent.js';
@@ -19,13 +19,20 @@ export class FileContext extends ConversationContext<Workspace.UISourceCode.UISo
19
19
  this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
20
20
  }
21
21
 
22
- override getOrigin(): string|SDK.SecurityOrigin.SecurityOrigin {
23
- const fallbackOrigin = super.getOrigin();
24
- return this.#file.project()?.securityOrigin?.() ?? fallbackOrigin;
22
+ /**
23
+ * Resolves the security origin of a given UISourceCode.
24
+ * Prefers the project security origin, falling back to the origin of the file URL.
25
+ */
26
+ static originForUISourceCode(file: Workspace.UISourceCode.UISourceCode): SDK.SecurityOrigin.SecurityOrigin {
27
+ return file.project()?.securityOrigin?.() ?? SDK.SecurityOrigin.SecurityOrigin.create(file.url());
25
28
  }
26
29
 
27
- override getURL(): string {
28
- return this.#file.url();
30
+ /**
31
+ * Returns the security origin of the project containing the file, falling
32
+ * back to the origin derived from the file URL.
33
+ */
34
+ override getOrigin(): SDK.SecurityOrigin.SecurityOrigin {
35
+ return FileContext.originForUISourceCode(this.#file);
29
36
  }
30
37
 
31
38
  override getItem(): Workspace.UISourceCode.UISourceCode {