chrome-devtools-frontend 1.0.1522145 → 1.0.1524741

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 (348) hide show
  1. package/AUTHORS +1 -0
  2. package/docs/README.md +1 -0
  3. package/docs/policy/README.md +1 -0
  4. package/docs/policy/console-policy.md +144 -0
  5. package/docs/policy/images/console-policy1.png +0 -0
  6. package/docs/policy/images/console-policy2.png +0 -0
  7. package/docs/policy/images/console-policy3.png +0 -0
  8. package/docs/ui_engineering.md +98 -0
  9. package/front_end/Tests.js +1 -1
  10. package/front_end/core/common/Color.ts +13 -9
  11. package/front_end/core/common/ColorConverter.ts +9 -7
  12. package/front_end/core/common/Gzip.ts +1 -1
  13. package/front_end/core/common/MapWithDefault.ts +5 -3
  14. package/front_end/core/common/ResourceType.ts +0 -12
  15. package/front_end/core/common/ReturnToPanel.ts +6 -4
  16. package/front_end/core/common/Trie.ts +4 -2
  17. package/front_end/core/host/AidaClient.ts +3 -3
  18. package/front_end/core/host/GdpClient.ts +7 -5
  19. package/front_end/core/host/InspectorFrontendHostAPI.ts +7 -5
  20. package/front_end/core/host/Platform.ts +5 -3
  21. package/front_end/core/host/UserMetrics.ts +6 -4
  22. package/front_end/core/platform/ArrayUtilities.ts +1 -1
  23. package/front_end/core/platform/StringUtilities.ts +34 -31
  24. package/front_end/core/root/Runtime.ts +1 -1
  25. package/front_end/core/sdk/CSSMetadata.ts +6 -4
  26. package/front_end/core/sdk/CSSPropertyParser.ts +17 -13
  27. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +19 -13
  28. package/front_end/core/sdk/ChildTargetManager.ts +35 -0
  29. package/front_end/core/sdk/DOMModel.ts +1 -1
  30. package/front_end/core/sdk/EnhancedTracesParser.ts +13 -6
  31. package/front_end/core/sdk/EventBreakpointsModel.ts +4 -2
  32. package/front_end/core/sdk/HttpReasonPhraseStrings.ts +4 -2
  33. package/front_end/core/sdk/NetworkManager.ts +8 -48
  34. package/front_end/core/sdk/NetworkRequest.ts +0 -28
  35. package/front_end/core/sdk/PageResourceLoader.ts +1 -1
  36. package/front_end/core/sdk/PreloadingModel.ts +22 -18
  37. package/front_end/core/sdk/RehydratingConnection.ts +1 -1
  38. package/front_end/core/sdk/RehydratingObject.ts +1 -1
  39. package/front_end/core/sdk/RemoteObject.ts +1 -1
  40. package/front_end/core/sdk/ResourceTreeModel.ts +2 -0
  41. package/front_end/core/sdk/ScreenCaptureModel.ts +24 -20
  42. package/front_end/core/sdk/Target.ts +7 -1
  43. package/front_end/core/sdk/TraceObject.ts +2 -2
  44. package/front_end/entrypoints/formatter_worker/Substitute.ts +6 -4
  45. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +24 -16
  46. package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +2 -1
  47. package/front_end/entrypoints/main/MainImpl.ts +6 -4
  48. package/front_end/generated/Deprecation.ts +4 -4
  49. package/front_end/generated/InspectorBackendCommands.js +2 -2
  50. package/front_end/generated/protocol-mapping.d.ts +3 -2
  51. package/front_end/generated/protocol-proxy-api.d.ts +3 -1
  52. package/front_end/generated/protocol.ts +7 -1
  53. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +600 -0
  54. package/front_end/models/ai_assistance/agents/StylingAgent.ts +83 -222
  55. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +23 -0
  56. package/front_end/models/ai_assistance/performance/AIContext.ts +19 -4
  57. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +4 -2
  58. package/front_end/models/autofill_manager/AutofillManager.ts +4 -2
  59. package/front_end/models/cpu_profile/CPUProfileDataModel.ts +1 -1
  60. package/front_end/models/crux-manager/CrUXManager.ts +1 -1
  61. package/front_end/models/extensions/HostUrlPattern.ts +13 -5
  62. package/front_end/models/issues_manager/CookieDeprecationMetadataIssue.ts +1 -1
  63. package/front_end/models/issues_manager/CookieIssue.ts +2 -2
  64. package/front_end/models/issues_manager/MarkdownIssueDescription.ts +1 -1
  65. package/front_end/models/issues_manager/SharedDictionaryIssue.ts +20 -0
  66. package/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorInvalidTTLField.md +1 -0
  67. package/front_end/models/issues_manager/descriptions/sharedDictionaryWriteErrorNonIntegerTTLField.md +1 -0
  68. package/front_end/models/javascript_metadata/NativeFunctions.js +9 -1
  69. package/front_end/models/network_time_calculator/Calculator.ts +4 -2
  70. package/front_end/models/network_time_calculator/RequestTimeRanges.ts +6 -4
  71. package/front_end/models/source_map_scopes/NamesResolver.ts +7 -5
  72. package/front_end/models/text_utils/ContentProvider.ts +6 -4
  73. package/front_end/models/trace/LanternComputationData.ts +1 -0
  74. package/front_end/models/trace/extras/TraceTree.ts +1 -1
  75. package/front_end/models/trace/handlers/FramesHandler.ts +7 -5
  76. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +13 -7
  77. package/front_end/models/trace/handlers/MetaHandler.ts +16 -14
  78. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +30 -8
  79. package/front_end/models/trace/handlers/helpers.ts +1 -1
  80. package/front_end/models/trace/handlers/types.ts +23 -19
  81. package/front_end/models/trace/helpers/Timing.ts +4 -2
  82. package/front_end/models/trace/helpers/Trace.ts +8 -4
  83. package/front_end/models/trace/insights/DocumentLatency.ts +10 -11
  84. package/front_end/models/trace/insights/INPBreakdown.ts +13 -2
  85. package/front_end/models/trace/insights/LCPBreakdown.ts +14 -2
  86. package/front_end/models/trace/insights/NetworkDependencyTree.ts +2 -2
  87. package/front_end/models/trace/types/File.ts +12 -8
  88. package/front_end/models/trace/types/Timing.ts +1 -1
  89. package/front_end/models/trace/types/TraceEvents.ts +43 -28
  90. package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +1 -1
  91. package/front_end/panels/ai_assistance/components/MarkdownRendererWithCodeBlock.ts +12 -10
  92. package/front_end/panels/application/KeyValueStorageItemsView.ts +31 -33
  93. package/front_end/panels/application/components/InterestGroupAccessGrid.ts +6 -11
  94. package/front_end/panels/application/components/OriginTrialTreeView.ts +7 -5
  95. package/front_end/panels/application/components/PermissionsPolicySection.ts +1 -0
  96. package/front_end/panels/application/components/ReportsGrid.ts +4 -10
  97. package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -13
  98. package/front_end/panels/application/preloading/components/MismatchedPreloadingGrid.ts +1 -1
  99. package/front_end/panels/application/preloading/components/PreloadingGrid.ts +3 -7
  100. package/front_end/panels/application/preloading/components/PreloadingString.ts +2 -2
  101. package/front_end/panels/application/preloading/components/RuleSetGrid.ts +3 -10
  102. package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -2
  103. package/front_end/panels/browser_debugger/browser_debugger-meta.ts +7 -5
  104. package/front_end/panels/changes/ChangesSidebar.ts +97 -95
  105. package/front_end/panels/changes/changesSidebar.css +3 -0
  106. package/front_end/panels/console/ConsoleView.ts +2 -2
  107. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +22 -35
  108. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -1
  109. package/front_end/panels/elements/ElementStatePaneWidget.ts +12 -0
  110. package/front_end/panels/elements/ElementsTreeElement.ts +9 -5
  111. package/front_end/panels/elements/ElementsTreeOutline.ts +11 -8
  112. package/front_end/panels/elements/PropertyRenderer.ts +19 -15
  113. package/front_end/panels/elements/StylePropertyTreeElement.ts +6 -4
  114. package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
  115. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +4 -2
  116. package/front_end/panels/elements/components/AdornerManager.ts +5 -3
  117. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +6 -4
  118. package/front_end/panels/media/PlayerPropertiesView.ts +1 -1
  119. package/front_end/panels/network/NetworkDataGridNode.ts +2 -44
  120. package/front_end/panels/network/NetworkLogView.ts +6 -4
  121. package/front_end/panels/network/RequestPreviewView.ts +0 -7
  122. package/front_end/panels/network/components/RequestHeadersView.ts +0 -6
  123. package/front_end/panels/network/components/components.ts +0 -2
  124. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +1 -1
  125. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
  126. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +40 -48
  127. package/front_end/panels/search/SearchResultsPane.ts +2 -3
  128. package/front_end/panels/security/IPProtectionView.ts +1 -1
  129. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +4 -0
  130. package/front_end/panels/settings/emulation/utils/StructuredHeaders.ts +45 -37
  131. package/front_end/panels/sources/BreakpointsViewUtils.ts +11 -9
  132. package/front_end/panels/sources/DebuggerPlugin.ts +8 -4
  133. package/front_end/panels/sources/SourcesPanel.ts +1 -1
  134. package/front_end/panels/sources/UISourceCodeFrame.ts +1 -1
  135. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +4 -2
  136. package/front_end/panels/timeline/CountersGraph.ts +12 -5
  137. package/front_end/panels/timeline/EasterEgg.d.ts +5 -3
  138. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +8 -6
  139. package/front_end/panels/timeline/ModificationsManager.ts +5 -3
  140. package/front_end/panels/timeline/ThreadAppender.ts +7 -5
  141. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +10 -8
  142. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -1
  143. package/front_end/panels/timeline/TimelineFlameChartView.ts +17 -0
  144. package/front_end/panels/timeline/TimelinePanel.ts +15 -8
  145. package/front_end/panels/timeline/TimelineSelection.ts +4 -2
  146. package/front_end/panels/timeline/TimelineUIUtils.ts +17 -6
  147. package/front_end/panels/timeline/components/BreadcrumbsUI.ts +6 -4
  148. package/front_end/panels/timeline/components/ExportTraceOptions.ts +21 -9
  149. package/front_end/panels/timeline/components/Utils.ts +1 -1
  150. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +5 -3
  151. package/front_end/panels/timeline/timelineDetailsView.css +5 -0
  152. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  153. package/front_end/panels/utils/utils.ts +1 -7
  154. package/front_end/services/trace_bounds/TraceBounds.ts +4 -2
  155. package/front_end/services/tracing/PerformanceTracing.ts +1 -1
  156. package/front_end/third_party/chromium/README.chromium +1 -1
  157. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  158. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  159. package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
  160. package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
  161. package/front_end/third_party/codemirror.next/package.json +3 -2
  162. package/front_end/third_party/puppeteer/README.chromium +2 -2
  163. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Dialog.d.ts +8 -10
  164. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Dialog.d.ts.map +1 -1
  165. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Dialog.js +8 -10
  166. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Dialog.js.map +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +28 -30
  168. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  169. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +27 -29
  170. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  171. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts +34 -38
  172. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
  173. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js +34 -38
  174. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
  175. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPRequest.d.ts +8 -1
  176. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPRequest.d.ts.map +1 -1
  177. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPRequest.js +12 -14
  178. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/HTTPRequest.js.map +1 -1
  179. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +92 -108
  180. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js +33 -39
  182. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  183. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
  184. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +5 -3
  185. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
  186. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
  188. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  189. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +4 -2
  190. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js +14 -5
  192. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
  193. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
  194. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  195. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +12 -6
  196. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  197. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Browser.d.ts.map +1 -1
  198. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Browser.js +24 -2
  199. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Browser.js.map +1 -1
  200. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  201. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  202. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  203. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js +3 -0
  204. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.d.ts +13 -22
  206. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.d.ts.map +1 -1
  207. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.js +13 -22
  208. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/PredefinedNetworkConditions.js.map +1 -1
  209. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Device.d.ts +6 -8
  210. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Device.d.ts.map +1 -1
  211. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Device.js +6 -8
  212. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Device.js.map +1 -1
  213. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  214. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  215. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +1 -1
  217. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js +6 -3
  219. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PuppeteerNode.d.ts +5 -7
  221. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PuppeteerNode.d.ts.map +1 -1
  222. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PuppeteerNode.js +5 -7
  223. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PuppeteerNode.js.map +1 -1
  224. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  225. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  226. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  227. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  228. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +188 -224
  229. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +140 -166
  230. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Dialog.d.ts +8 -10
  231. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Dialog.d.ts.map +1 -1
  232. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Dialog.js +8 -10
  233. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Dialog.js.map +1 -1
  234. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts +28 -30
  235. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  236. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +27 -29
  237. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  238. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts +34 -38
  239. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
  240. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js +34 -38
  241. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js.map +1 -1
  242. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPRequest.d.ts +8 -1
  243. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPRequest.d.ts.map +1 -1
  244. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPRequest.js +12 -14
  245. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/HTTPRequest.js.map +1 -1
  246. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +92 -108
  247. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js +33 -39
  249. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  250. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +5 -3
  252. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  254. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  256. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +4 -2
  257. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  258. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js +15 -6
  259. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
  260. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
  261. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  262. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +12 -6
  263. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  264. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Browser.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Browser.js +24 -2
  266. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Browser.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  268. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js +3 -0
  270. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.d.ts +13 -22
  272. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.d.ts.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.js +13 -22
  274. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/PredefinedNetworkConditions.js.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Device.d.ts +6 -8
  276. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Device.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Device.js +6 -8
  278. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Device.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  280. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +1 -1
  282. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js +6 -3
  284. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PuppeteerNode.d.ts +5 -7
  286. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PuppeteerNode.d.ts.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PuppeteerNode.js +5 -7
  288. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PuppeteerNode.js.map +1 -1
  289. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  290. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  291. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/types.d.ts +188 -224
  293. package/front_end/third_party/puppeteer/package/package.json +3 -3
  294. package/front_end/third_party/puppeteer/package/src/api/Dialog.ts +8 -10
  295. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +27 -29
  296. package/front_end/third_party/puppeteer/package/src/api/Frame.ts +34 -38
  297. package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +17 -14
  298. package/front_end/third_party/puppeteer/package/src/api/Page.ts +92 -108
  299. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +5 -3
  300. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +5 -1
  301. package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +28 -3
  302. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +16 -7
  303. package/front_end/third_party/puppeteer/package/src/bidi/core/Browser.ts +28 -2
  304. package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +4 -0
  305. package/front_end/third_party/puppeteer/package/src/cdp/PredefinedNetworkConditions.ts +13 -22
  306. package/front_end/third_party/puppeteer/package/src/common/Device.ts +6 -8
  307. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  308. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +6 -3
  309. package/front_end/third_party/puppeteer/package/src/node/PuppeteerNode.ts +5 -7
  310. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  311. package/front_end/ui/components/chrome_link/ChromeLink.ts +4 -2
  312. package/front_end/ui/components/dialogs/Dialog.ts +13 -9
  313. package/front_end/ui/components/highlighting/HighlightElement.ts +77 -0
  314. package/front_end/ui/components/highlighting/HighlightManager.ts +37 -0
  315. package/front_end/ui/components/highlighting/highlighting.ts +2 -0
  316. package/front_end/ui/components/markdown_view/MarkdownImagesMap.ts +5 -3
  317. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +5 -3
  318. package/front_end/ui/components/menus/SelectMenu.ts +6 -4
  319. package/front_end/ui/components/survey_link/SurveyLink.ts +4 -2
  320. package/front_end/ui/components/text_editor/config.ts +10 -6
  321. package/front_end/ui/components/text_editor/javascript.ts +8 -4
  322. package/front_end/ui/components/tooltips/Tooltip.ts +13 -4
  323. package/front_end/ui/legacy/ForwardedInputEventHandler.ts +4 -2
  324. package/front_end/ui/legacy/GlassPane.ts +1 -1
  325. package/front_end/ui/legacy/SettingsUI.ts +1 -5
  326. package/front_end/ui/legacy/Treeoutline.ts +12 -33
  327. package/front_end/ui/legacy/UIUtils.ts +19 -1
  328. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +12 -10
  329. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +30 -32
  330. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -1
  331. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +25 -25
  332. package/front_end/ui/legacy/components/data_grid/dataGrid.css +5 -0
  333. package/front_end/ui/legacy/components/inline_editor/AnimationTimingModel.ts +4 -2
  334. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +4 -2
  335. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +8 -6
  336. package/front_end/ui/legacy/components/perf_ui/PieChart.ts +6 -4
  337. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -3
  338. package/front_end/ui/legacy/components/source_frame/XMLView.ts +22 -16
  339. package/front_end/ui/legacy/components/source_frame/xmlView.css +0 -2
  340. package/front_end/ui/legacy/components/utils/Linkifier.ts +6 -4
  341. package/front_end/ui/visual_logging/Debugging.ts +10 -6
  342. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -3
  343. package/inspector_overlay/common.ts +5 -3
  344. package/inspector_overlay/highlight_grid_common.ts +1 -1
  345. package/package.json +1 -1
  346. package/front_end/Images/src/bundle.svg +0 -3
  347. package/front_end/panels/network/components/WebBundleInfoView.css +0 -27
  348. package/front_end/panels/network/components/WebBundleInfoView.ts +0 -95
@@ -245,7 +245,7 @@ export class BidiPage extends Page {
245
245
  }
246
246
 
247
247
  override async setBypassCSP(enabled: boolean): Promise<void> {
248
- // TODO: handle CDP-specific cases such as mprach.
248
+ // TODO: handle CDP-specific cases such as MPArch.
249
249
  await this._client().send('Page.setBypassCSP', {enabled});
250
250
  }
251
251
 
@@ -626,7 +626,7 @@ export class BidiPage extends Page {
626
626
  );
627
627
  return;
628
628
  }
629
- // TODO: handle CDP-specific cases such as mprach.
629
+ // TODO: handle CDP-specific cases such as MPArch.
630
630
  await this._client().send('Network.setCacheDisabled', {
631
631
  cacheDisabled: !enabled,
632
632
  });
@@ -711,11 +711,20 @@ export class BidiPage extends Page {
711
711
  return [...this.#workers];
712
712
  }
713
713
 
714
- #userInterception?: string;
714
+ get isNetworkInterceptionEnabled(): boolean {
715
+ return (
716
+ Boolean(this.#requestInterception) ||
717
+ Boolean(this.#extraHeadersInterception) ||
718
+ Boolean(this.#authInterception) ||
719
+ Boolean(this.#userAgentInterception)
720
+ );
721
+ }
722
+
723
+ #requestInterception?: string;
715
724
  override async setRequestInterception(enable: boolean): Promise<void> {
716
- this.#userInterception = await this.#toggleInterception(
725
+ this.#requestInterception = await this.#toggleInterception(
717
726
  [Bidi.Network.InterceptPhase.BeforeRequestSent],
718
- this.#userInterception,
727
+ this.#requestInterception,
719
728
  enable,
720
729
  );
721
730
  }
@@ -1054,7 +1063,7 @@ export function bidiToPuppeteerCookie(
1054
1063
  ): Cookie {
1055
1064
  const partitionKey = bidiCookie[CDP_SPECIFIC_PREFIX + 'partitionKey'];
1056
1065
 
1057
- function getParitionKey(): {partitionKey?: Cookie['partitionKey']} {
1066
+ function getPartitionKey(): {partitionKey?: Cookie['partitionKey']} {
1058
1067
  if (typeof partitionKey === 'string') {
1059
1068
  return {partitionKey};
1060
1069
  }
@@ -1096,7 +1105,7 @@ export function bidiToPuppeteerCookie(
1096
1105
  'partitionKeyOpaque',
1097
1106
  'priority',
1098
1107
  ),
1099
- ...getParitionKey(),
1108
+ ...getPartitionKey(),
1100
1109
  };
1101
1110
  }
1102
1111
 
@@ -7,6 +7,7 @@
7
7
  import type * as Bidi from 'webdriver-bidi-protocol';
8
8
 
9
9
  import type {BrowserContextOptions} from '../../api/Browser.js';
10
+ import {UnsupportedOperation} from '../../common/Errors.js';
10
11
  import {EventEmitter} from '../../common/EventEmitter.js';
11
12
  import {inertIfDisposed, throwIfDisposed} from '../../util/decorators.js';
12
13
  import {DisposableStack, disposeSymbol} from '../../util/disposable.js';
@@ -232,11 +233,36 @@ export class Browser extends EventEmitter<{
232
233
  noProxy: options.proxyBypassList,
233
234
  };
234
235
  const {
235
- result: {userContext: context},
236
+ result: {userContext},
236
237
  } = await this.session.send('browser.createUserContext', {
237
238
  proxy: proxyConfig,
238
239
  });
239
- return this.#createUserContext(context);
240
+ if (options.downloadBehavior?.policy === 'allowAndName') {
241
+ throw new UnsupportedOperation(
242
+ '`allowAndName` is not supported in WebDriver BiDi',
243
+ );
244
+ }
245
+ if (options.downloadBehavior?.policy === 'allow') {
246
+ if (options.downloadBehavior.downloadPath === undefined) {
247
+ throw new UnsupportedOperation(
248
+ '`downloadPath` is required in `allow` download behavior',
249
+ );
250
+ }
251
+ await this.session.send('browser.setDownloadBehavior', {
252
+ downloadBehavior: {
253
+ type: 'allowed',
254
+ destinationFolder: options.downloadBehavior.downloadPath,
255
+ },
256
+ userContexts: [userContext],
257
+ });
258
+ }
259
+ if (options.downloadBehavior?.policy === 'deny') {
260
+ await this.session.send('browser.setDownloadBehavior', {
261
+ downloadBehavior: {type: 'denied'},
262
+ userContexts: [userContext],
263
+ });
264
+ }
265
+ return this.#createUserContext(userContext);
240
266
  }
241
267
 
242
268
  @throwIfDisposed<Browser>(browser => {
@@ -170,6 +170,10 @@ export class CdpHTTPRequest extends HTTPRequest {
170
170
  };
171
171
  }
172
172
 
173
+ protected canBeIntercepted(): boolean {
174
+ return !this.url().startsWith('data:') && !this._fromMemoryCache;
175
+ }
176
+
173
177
  /**
174
178
  * @internal
175
179
  */
@@ -14,28 +14,19 @@ import type {NetworkConditions} from './NetworkManager.js';
14
14
  *
15
15
  * ```ts
16
16
  * import {PredefinedNetworkConditions} from 'puppeteer';
17
- * (async () => {
18
- * const browser = await puppeteer.launch();
19
- * const page = await browser.newPage();
20
- * await page.emulateNetworkConditions(
21
- * PredefinedNetworkConditions['Slow 3G'],
22
- * );
23
- * await page.goto('https://www.google.com');
24
- * await page.emulateNetworkConditions(
25
- * PredefinedNetworkConditions['Fast 3G'],
26
- * );
27
- * await page.goto('https://www.google.com');
28
- * await page.emulateNetworkConditions(
29
- * PredefinedNetworkConditions['Slow 4G'],
30
- * ); // alias to Fast 3G.
31
- * await page.goto('https://www.google.com');
32
- * await page.emulateNetworkConditions(
33
- * PredefinedNetworkConditions['Fast 4G'],
34
- * );
35
- * await page.goto('https://www.google.com');
36
- * // other actions...
37
- * await browser.close();
38
- * })();
17
+ * const browser = await puppeteer.launch();
18
+ * const page = await browser.newPage();
19
+ * await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 3G']);
20
+ * await page.goto('https://www.google.com');
21
+ * await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 3G']);
22
+ * await page.goto('https://www.google.com');
23
+ * // alias to Fast 3G.
24
+ * await page.emulateNetworkConditions(PredefinedNetworkConditions['Slow 4G']);
25
+ * await page.goto('https://www.google.com');
26
+ * await page.emulateNetworkConditions(PredefinedNetworkConditions['Fast 4G']);
27
+ * await page.goto('https://www.google.com');
28
+ * // other actions...
29
+ * await browser.close();
39
30
  * ```
40
31
  *
41
32
  * @public
@@ -1738,14 +1738,12 @@ for (const device of knownDevices) {
1738
1738
  * import {KnownDevices} from 'puppeteer';
1739
1739
  * const iPhone = KnownDevices['iPhone 15 Pro'];
1740
1740
  *
1741
- * (async () => {
1742
- * const browser = await puppeteer.launch();
1743
- * const page = await browser.newPage();
1744
- * await page.emulate(iPhone);
1745
- * await page.goto('https://www.google.com');
1746
- * // other actions...
1747
- * await browser.close();
1748
- * })();
1741
+ * const browser = await puppeteer.launch();
1742
+ * const page = await browser.newPage();
1743
+ * await page.emulate(iPhone);
1744
+ * await page.goto('https://www.google.com');
1745
+ * // other actions...
1746
+ * await browser.close();
1749
1747
  * ```
1750
1748
  *
1751
1749
  * @public
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * @internal
3
3
  */
4
- export const packageVersion = '24.22.3';
4
+ export const packageVersion = '24.23.0';
@@ -372,7 +372,7 @@ export abstract class BrowserLauncher {
372
372
  */
373
373
  protected async createBiDiOverCdpBrowser(
374
374
  browserProcess: ReturnType<typeof launch>,
375
- connection: Connection,
375
+ cdpConnection: Connection,
376
376
  closeCallback: BrowserCloseCallback,
377
377
  opts: {
378
378
  defaultViewport: Viewport | null;
@@ -380,11 +380,14 @@ export abstract class BrowserLauncher {
380
380
  networkEnabled: boolean;
381
381
  },
382
382
  ): Promise<Browser> {
383
+ const bidiOnly = process.env['PUPPETEER_WEBDRIVER_BIDI_ONLY'] === 'true';
383
384
  const BiDi = await import(/* webpackIgnore: true */ '../bidi/bidi.js');
384
- const bidiConnection = await BiDi.connectBidiOverCdp(connection);
385
+ const bidiConnection = await BiDi.connectBidiOverCdp(cdpConnection);
385
386
  return await BiDi.BidiBrowser.create({
386
387
  connection: bidiConnection,
387
- cdpConnection: connection,
388
+ // Do not provide CDP connection to Browser, if BiDi-only mode is enabled. This
389
+ // would restrict Browser to use only BiDi endpoint.
390
+ cdpConnection: bidiOnly ? undefined : cdpConnection,
388
391
  closeCallback,
389
392
  process: browserProcess.nodeProcess,
390
393
  defaultViewport: opts.defaultViewport,
@@ -44,13 +44,11 @@ import type {ChromeReleaseChannel, LaunchOptions} from './LaunchOptions.js';
44
44
  * ```ts
45
45
  * import puppeteer from 'puppeteer';
46
46
  *
47
- * (async () => {
48
- * const browser = await puppeteer.launch();
49
- * const page = await browser.newPage();
50
- * await page.goto('https://www.google.com');
51
- * // other actions...
52
- * await browser.close();
53
- * })();
47
+ * const browser = await puppeteer.launch();
48
+ * const page = await browser.newPage();
49
+ * await page.goto('https://www.google.com');
50
+ * // other actions...
51
+ * await browser.close();
54
52
  * ```
55
53
  *
56
54
  * Once you have created a `page` you have access to a large API to interact
@@ -8,7 +8,7 @@
8
8
  * @internal
9
9
  */
10
10
  export const PUPPETEER_REVISIONS = Object.freeze({
11
- chrome: '140.0.7339.207',
12
- 'chrome-headless-shell': '140.0.7339.207',
13
- firefox: 'stable_143.0.1',
11
+ chrome: '141.0.7390.54',
12
+ 'chrome-headless-shell': '141.0.7390.54',
13
+ firefox: 'stable_143.0.3',
14
14
  });
@@ -19,8 +19,10 @@ declare global {
19
19
  }
20
20
  }
21
21
 
22
- // Use this component to render links to 'chrome://...'-URLs
23
- // (for which regular <x-link>s do not work).
22
+ /**
23
+ * Use this component to render links to 'chrome://...'-URLs
24
+ * (for which regular <x-link>s do not work).
25
+ **/
24
26
  export class ChromeLink extends HTMLElement {
25
27
  readonly #shadow = this.attachShadow({mode: 'open'});
26
28
  #href = '';
@@ -29,9 +29,11 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
29
29
 
30
30
  const IS_DIALOG_SUPPORTED = 'HTMLDialogElement' in globalThis;
31
31
 
32
- // Height in pixels of the dialog's connector. The connector is represented as
33
- // as a diamond and the height corresponds to half the height of the diamond.
34
- // (the visible height is only half of the diamond).
32
+ /**
33
+ * Height in pixels of the dialog's connector. The connector is represented as
34
+ * as a diamond and the height corresponds to half the height of the diamond.
35
+ * (the visible height is only half of the diamond).
36
+ **/
35
37
  export const CONNECTOR_HEIGHT = 10;
36
38
  const CONNECTOR_WIDTH = 2 * CONNECTOR_HEIGHT;
37
39
 
@@ -41,12 +43,14 @@ const DIALOG_ANIMATION_OFFSET = 20;
41
43
  export const DIALOG_SIDE_PADDING = 5;
42
44
  export const DIALOG_VERTICAL_PADDING = 3;
43
45
 
44
- // If the content of the dialog cannot be completely shown because otherwise
45
- // the dialog would overflow the window, the dialog's max width and height are
46
- // set such that the dialog remains inside the visible bounds. In this cases
47
- // some extra, determined by this constant, is added so that the dialog's borders
48
- // remain clearly visible. This constant accounts for the padding of the dialog's
49
- // content (20 px) and a 5px gap left on each extreme of the dialog from the viewport.
46
+ /**
47
+ * If the content of the dialog cannot be completely shown because otherwise
48
+ * the dialog would overflow the window, the dialog's max width and height are
49
+ * set such that the dialog remains inside the visible bounds. In this cases
50
+ * some extra, determined by this constant, is added so that the dialog's borders
51
+ * remain clearly visible. This constant accounts for the padding of the dialog's
52
+ * content (20 px) and a 5px gap left on each extreme of the dialog from the viewport.
53
+ **/
50
54
  export const DIALOG_PADDING_FROM_WINDOW = 3 * CONNECTOR_HEIGHT;
51
55
  interface DialogData {
52
56
  /**
@@ -0,0 +1,77 @@
1
+ // Copyright 2025 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as TextUtils from '../../../models/text_utils/text_utils.js';
6
+
7
+ import {HighlightManager} from './HighlightManager.js';
8
+
9
+ export class HighlightElement extends HTMLElement {
10
+ static readonly observedAttributes = ['ranges', 'current-range'];
11
+ #ranges: TextUtils.TextRange.SourceRange[] = [];
12
+ #currentRange: TextUtils.TextRange.SourceRange|undefined;
13
+
14
+ attributeChangedCallback(name: string, oldValue: string|null, newValue: string|null): void {
15
+ if (oldValue === newValue) {
16
+ return;
17
+ }
18
+ switch (name) {
19
+ case 'ranges':
20
+ this.#ranges = parseRanges(newValue);
21
+ break;
22
+ case 'current-range':
23
+ this.#currentRange = parseRanges(newValue)[0];
24
+ break;
25
+ }
26
+ HighlightManager.instance().set(this, this.#ranges, this.#currentRange);
27
+ }
28
+ }
29
+
30
+ function parseRanges(value: string|null): TextUtils.TextRange.SourceRange[] {
31
+ if (!value) {
32
+ return [];
33
+ }
34
+ const ranges = value.split(' ')
35
+ .filter(rangeString => {
36
+ const parts = rangeString.split(',');
37
+ // A valid range string must have exactly two parts.
38
+ if (parts.length !== 2) {
39
+ return false;
40
+ }
41
+ // Both parts must be convertible to valid numbers.
42
+ const num1 = Number(parts[0]);
43
+ const num2 = Number(parts[1]);
44
+ return !isNaN(num1) && !isNaN(num2);
45
+ })
46
+ .map(rangeString => {
47
+ const parts = rangeString.split(',').map(part => Number(part));
48
+ return new TextUtils.TextRange.SourceRange(parts[0], parts[1]);
49
+ });
50
+ return sortAndMergeRanges(ranges);
51
+ }
52
+
53
+ function sortAndMergeRanges(ranges: TextUtils.TextRange.SourceRange[]): TextUtils.TextRange.SourceRange[] {
54
+ // Sort by start position.
55
+ ranges.sort((a, b) => a.offset - b.offset);
56
+
57
+ if (ranges.length === 0) {
58
+ return [];
59
+ }
60
+
61
+ // Merge overlapping ranges.
62
+ const merged = [ranges[0]];
63
+ for (let i = 1; i < ranges.length; i++) {
64
+ const last = merged[merged.length - 1];
65
+ const current = ranges[i];
66
+ if (current.offset <= last.offset + last.length) {
67
+ const newEnd = Math.max(last.offset + last.length, current.offset + current.length);
68
+ const newLength = newEnd - last.offset;
69
+ merged[merged.length - 1] = new TextUtils.TextRange.SourceRange(last.offset, newLength);
70
+ } else {
71
+ merged.push(current);
72
+ }
73
+ }
74
+ return merged;
75
+ }
76
+
77
+ customElements.define('devtools-highlight', HighlightElement);
@@ -62,10 +62,17 @@ export class RangeWalker {
62
62
  export const HIGHLIGHT_REGISTRY = 'highlighted-search-result';
63
63
  export const CURRENT_HIGHLIGHT_REGISTRY = 'current-search-result';
64
64
 
65
+ interface HighlightState {
66
+ activeRanges: Range[];
67
+ ranges: TextUtils.TextRange.SourceRange[];
68
+ currentRange: TextUtils.TextRange.SourceRange|undefined;
69
+ }
70
+
65
71
  let highlightManagerInstance: HighlightManager;
66
72
  export class HighlightManager {
67
73
  #highlights = new Highlight();
68
74
  #currentHighlights = new Highlight();
75
+ #stateByNode = new WeakMap<Node, HighlightState>();
69
76
 
70
77
  constructor() {
71
78
  CSS.highlights.set(HIGHLIGHT_REGISTRY, this.#highlights);
@@ -119,4 +126,34 @@ export class HighlightManager {
119
126
  }
120
127
  return ranges;
121
128
  }
129
+
130
+ #getOrCreateState(node: Node): HighlightState {
131
+ let state = this.#stateByNode.get(node);
132
+ if (!state) {
133
+ state = {
134
+ activeRanges: [],
135
+ ranges: [],
136
+ currentRange: undefined,
137
+ };
138
+ this.#stateByNode.set(node, state);
139
+ }
140
+ return state;
141
+ }
142
+
143
+ apply(node: Node): void {
144
+ const state = this.#getOrCreateState(node);
145
+ this.removeHighlights(state.activeRanges);
146
+ state.activeRanges = this.highlightOrderedTextRanges(node, state.ranges);
147
+ if (state.currentRange) {
148
+ state.activeRanges.push(...this.highlightOrderedTextRanges(node, [state.currentRange], /* isCurrent=*/ true));
149
+ }
150
+ }
151
+
152
+ set(element: Node, ranges: TextUtils.TextRange.SourceRange[],
153
+ currentRange: TextUtils.TextRange.SourceRange|undefined): void {
154
+ const state = this.#getOrCreateState(element);
155
+ state.ranges = ranges;
156
+ state.currentRange = currentRange;
157
+ this.apply(element);
158
+ }
122
159
  }
@@ -2,6 +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 './HighlightElement.js';
6
+
5
7
  import * as HighlightManager from './HighlightManager.js';
6
8
 
7
9
  export {HighlightManager};
@@ -32,9 +32,11 @@ export interface ImageData {
32
32
  *
33
33
  */
34
34
 
35
- // NOTE: This is only exported for tests, and it should not be
36
- // imported in any component, instead add image data in map and
37
- // use getMarkdownImage to get the appropriate image data.
35
+ /**
36
+ * NOTE: This is only exported for tests, and it should not be
37
+ * imported in any component, instead add image data in map and
38
+ * use getMarkdownImage to get the appropriate image data.
39
+ **/
38
40
  export const markdownImages = new Map<string, ImageData>([]);
39
41
 
40
42
  export const getMarkdownImage = (key: string): ImageData => {
@@ -9,9 +9,11 @@
9
9
  * Find more information about web development at [Learn more](exampleLink)
10
10
  */
11
11
 
12
- // This is only exported for tests, and it should not be
13
- // imported in any component, instead add link in map and
14
- // use getMarkdownLink to get the appropriate link.
12
+ /**
13
+ * This is only exported for tests, and it should not be
14
+ * imported in any component, instead add link in map and
15
+ * use getMarkdownLink to get the appropriate link.
16
+ **/
15
17
  export const markdownLinks = new Map<string, string>([
16
18
  ['issuesContrastWCAG21AA', 'https://www.w3.org/TR/WCAG21/#contrast-minimum'],
17
19
  ['issuesContrastWCAG21AAA', 'https://www.w3.org/TR/WCAG21/#contrast-enhanced'],
@@ -463,9 +463,11 @@ export class SelectMenuButtonTriggerEvent extends Event {
463
463
  }
464
464
  }
465
465
 
466
- // Exported artifacts used in this component and that belong to the Menu are
467
- // renamed to only make reference to the SelectMenu. This way, the Menu API
468
- // doesn't have to be used in SelectMenu usages and the SelectMenu implementation
469
- // can remain transparent to its users.
466
+ /**
467
+ * Exported artifacts used in this component and that belong to the Menu are
468
+ * renamed to only make reference to the SelectMenu. This way, the Menu API
469
+ * doesn't have to be used in SelectMenu usages and the SelectMenu implementation
470
+ * can remain transparent to its users.
471
+ **/
470
472
  export type SelectMenuItemValue = MenuItemValue;
471
473
  export {MenuGroup as SelectMenuGroup};
@@ -48,8 +48,10 @@ const enum State {
48
48
  DONT_SHOW_LINK = 'DontShowLink',
49
49
  }
50
50
 
51
- // A link to a survey. The link is rendered aysnchronously because we need to first check if
52
- // canShowSurvey succeeds.
51
+ /**
52
+ * A link to a survey. The link is rendered asynchronously because we need to first check if
53
+ * canShowSurvey succeeds.
54
+ **/
53
55
  export class SurveyLink extends HTMLElement {
54
56
  readonly #shadow = this.attachShadow({mode: 'open'});
55
57
  #trigger = '';
@@ -86,9 +86,11 @@ export const tabMovesFocus = DynamicSetting.bool('text-editor-tab-moves-focus',
86
86
 
87
87
  const disableConservativeCompletion = CM.StateEffect.define();
88
88
 
89
- // When enabled, this suppresses the behavior of showCompletionHint
90
- // and accepting of completions with Enter until the user selects a
91
- // completion beyond the initially selected one. Used in the console.
89
+ /**
90
+ * When enabled, this suppresses the behavior of showCompletionHint
91
+ * and accepting of completions with Enter until the user selects a
92
+ * completion beyond the initially selected one. Used in the console.
93
+ **/
92
94
  export const conservativeCompletion = CM.StateField.define<boolean>({
93
95
  create() {
94
96
  return true;
@@ -123,9 +125,11 @@ function acceptCompletionIfAtEndOfLine(view: CM.EditorView): boolean {
123
125
  return false;
124
126
  }
125
127
 
126
- // This is a wrapper around CodeMirror's own moveCompletionSelection command, which
127
- // selects the first selection if the state of the selection is conservative, and
128
- // otherwise behaves as normal.
128
+ /**
129
+ * This is a wrapper around CodeMirror's own moveCompletionSelection command, which
130
+ * selects the first selection if the state of the selection is conservative, and
131
+ * otherwise behaves as normal.
132
+ **/
129
133
  function moveCompletionSelectionIfNotConservative(
130
134
  forward: boolean, by: 'option'|'page' = 'option'): ((view: CM.EditorView) => boolean) {
131
135
  return view => {
@@ -268,8 +268,10 @@ const maxCacheAge = 30_000;
268
268
 
269
269
  let cacheInstance: PropertyCache|null = null;
270
270
 
271
- // Store recent collections of property completions. The empty string
272
- // is used to store the set of global bindings.
271
+ /**
272
+ * Store recent collections of property completions. The empty string
273
+ * is used to store the set of global bindings.
274
+ **/
273
275
  class PropertyCache {
274
276
  readonly #cache = new Map<string, Promise<CompletionSet>>();
275
277
 
@@ -713,8 +715,10 @@ async function prototypesFromObject(object: SDK.RemoteObject.RemoteObject): Prom
713
715
  }, []) ?? [];
714
716
  }
715
717
 
716
- // Given a function object that is probably a bound function, try to
717
- // retrieve the argument list from its target function.
718
+ /**
719
+ * Given a function object that is probably a bound function, try to
720
+ * retrieve the argument list from its target function.
721
+ **/
718
722
  async function getArgumentsForBoundFunction(object: SDK.RemoteObject.RemoteObject): Promise<string[][]|null> {
719
723
  const {internalProperties} = await object.getOwnProperties(false);
720
724
  if (!internalProperties) {
@@ -480,7 +480,13 @@ export class Tooltip extends HTMLElement {
480
480
  };
481
481
 
482
482
  #keyDown = (event: KeyboardEvent): void => {
483
- if ((event.altKey && event.key === 'ArrowDown') || (event.key === 'Escape' && this.open)) {
483
+ // There are two scenarios when we care about keydown:
484
+ // 1. The tooltip is open, and the user presses ESC
485
+ // 2. "use-hotkey" is set, and the user presses Alt+ArrowDown.
486
+ const shouldToggleVisibility =
487
+ (event.key === 'Escape' && this.open) || (this.useHotkey && event.altKey && event.key === 'ArrowDown');
488
+
489
+ if (shouldToggleVisibility) {
484
490
  this.#openedViaHotkey = !this.open;
485
491
  this.toggle();
486
492
  event.consume(true);
@@ -489,15 +495,18 @@ export class Tooltip extends HTMLElement {
489
495
 
490
496
  #registerEventListeners(): void {
491
497
  if (this.#anchor) {
498
+ // We bind the keydown listener regardless of if use-hotkey is enabled
499
+ // as we always want to support ESC to close.
500
+ this.#anchor.addEventListener('keydown', this.#keyDown);
501
+
492
502
  if (this.useClick) {
493
503
  this.#anchor.addEventListener('click', this.toggle);
494
504
  } else {
495
505
  this.#anchor.addEventListener('mouseenter', this.showTooltip);
496
- if (this.useHotkey) {
497
- this.#anchor.addEventListener('keydown', this.#keyDown);
498
- } else {
506
+ if (!this.useHotkey) {
499
507
  this.#anchor.addEventListener('focus', this.showTooltip);
500
508
  }
509
+
501
510
  this.#anchor.addEventListener('blur', this.hideTooltip);
502
511
  this.#anchor.addEventListener('mouseleave', this.hideTooltip);
503
512
  this.addEventListener('mouseleave', this.hideTooltip);
@@ -9,8 +9,10 @@ import {Context} from './Context.js';
9
9
  import {KeyboardShortcut} from './KeyboardShortcut.js';
10
10
  import {ForwardedShortcut, ShortcutRegistry} from './ShortcutRegistry.js';
11
11
 
12
- // This handler only forwards the keystrokes if DevTools front-end is
13
- // not running in hosted mode.
12
+ /**
13
+ * This handler only forwards the keystrokes if DevTools front-end is
14
+ * not running in hosted mode.
15
+ **/
14
16
  export class ForwardedInputEventHandler {
15
17
  constructor() {
16
18
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
@@ -347,5 +347,5 @@ export const enum MarginBehavior {
347
347
  const containers = new Map<Document, Element>();
348
348
  const panes = new Set<GlassPane>();
349
349
 
350
- // Exported for layout tests.
350
+ /** Exported for layout tests. **/
351
351
  export const GlassPanePanes = panes;
@@ -232,11 +232,7 @@ export const createControlForSetting = function(
232
232
  return component;
233
233
  }
234
234
  case Common.Settings.SettingType.ENUM:
235
- if (Array.isArray(setting.options())) {
236
- return createSettingSelect(uiTitle, setting.options(), setting.reloadRequired(), setting, subtitle);
237
- }
238
- console.error('Enum setting defined without options');
239
- return null;
235
+ return createSettingSelect(uiTitle, setting.options(), setting.reloadRequired(), setting, subtitle);
240
236
  default:
241
237
  console.error('Invalid setting type: ' + setting.type());
242
238
  return null;