chrome-devtools-frontend 1.0.1535712 → 1.0.1537268

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 (231) hide show
  1. package/docs/contributing/images/issues-nearestslo.png +0 -0
  2. package/docs/contributing/issues.md +17 -21
  3. package/front_end/core/common/Console.ts +1 -8
  4. package/front_end/core/common/ParsedURL.ts +10 -20
  5. package/front_end/core/common/SegmentedRange.ts +1 -2
  6. package/front_end/core/common/StringOutputStream.ts +1 -4
  7. package/front_end/core/host/AidaClient.ts +64 -5
  8. package/front_end/core/host/DispatchHttpRequestClient.ts +62 -0
  9. package/front_end/core/host/GdpClient.ts +8 -57
  10. package/front_end/core/host/host.ts +2 -0
  11. package/front_end/core/i18n/i18nImpl.ts +0 -24
  12. package/front_end/core/protocol_client/CDPConnection.ts +10 -8
  13. package/front_end/core/protocol_client/InspectorBackend.ts +36 -42
  14. package/front_end/core/sdk/AnimationModel.ts +1 -2
  15. package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
  16. package/front_end/core/sdk/CSSModel.ts +1 -1
  17. package/front_end/core/sdk/CSSProperty.ts +3 -6
  18. package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -4
  19. package/front_end/core/sdk/DebuggerModel.ts +1 -2
  20. package/front_end/core/sdk/EnhancedTracesParser.ts +24 -5
  21. package/front_end/core/sdk/RehydratingConnection.ts +112 -4
  22. package/front_end/core/sdk/RehydratingObject.ts +8 -0
  23. package/front_end/core/sdk/SourceMap.ts +2 -3
  24. package/front_end/core/sdk/TraceObject.ts +5 -1
  25. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +2 -1
  26. package/front_end/generated/InspectorBackendCommands.js +1 -2
  27. package/front_end/generated/SupportedCSSProperties.js +19 -0
  28. package/front_end/generated/protocol.ts +0 -27
  29. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  30. package/front_end/models/trace/types/File.ts +9 -0
  31. package/front_end/panels/accessibility/AccessibilityNodeView.ts +18 -17
  32. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +9 -12
  33. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -9
  34. package/front_end/panels/ai_assistance/components/ChatView.ts +63 -74
  35. package/front_end/panels/application/AppManifestView.ts +7 -6
  36. package/front_end/panels/application/ApplicationPanelSidebar.ts +4 -4
  37. package/front_end/panels/application/BackForwardCacheTreeElement.ts +2 -6
  38. package/front_end/panels/application/OpenedWindowDetailsView.ts +6 -6
  39. package/front_end/panels/application/StorageView.ts +9 -8
  40. package/front_end/panels/application/components/BackForwardCacheView.ts +366 -342
  41. package/front_end/panels/application/components/FrameDetailsView.ts +8 -11
  42. package/front_end/panels/application/components/OriginTrialTreeView.ts +65 -69
  43. package/front_end/panels/application/components/ProtocolHandlersView.ts +3 -2
  44. package/front_end/panels/application/components/backForwardCacheView.css +4 -0
  45. package/front_end/panels/application/components/badge.css +1 -1
  46. package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -1
  47. package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +44 -53
  48. package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +8 -8
  49. package/front_end/panels/common/BadgeNotification.ts +2 -1
  50. package/front_end/panels/common/GdpSignUpDialog.ts +2 -1
  51. package/front_end/panels/console/ConsoleInsightTeaser.ts +8 -2
  52. package/front_end/panels/console/ConsolePinPane.ts +12 -7
  53. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +9 -9
  54. package/front_end/panels/elements/ComputedStyleWidget.ts +7 -7
  55. package/front_end/panels/elements/EventListenersWidget.ts +9 -9
  56. package/front_end/panels/elements/NodeStackTraceWidget.ts +6 -6
  57. package/front_end/panels/elements/PlatformFontsWidget.ts +5 -5
  58. package/front_end/panels/elements/PropertiesWidget.ts +8 -8
  59. package/front_end/panels/layer_viewer/Layers3DView.ts +2 -1
  60. package/front_end/panels/layer_viewer/PaintProfilerView.ts +3 -3
  61. package/front_end/panels/network/RequestCookiesView.ts +2 -1
  62. package/front_end/panels/network/RequestTimingView.ts +2 -1
  63. package/front_end/panels/recorder/RecorderController.ts +33 -23
  64. package/front_end/panels/recorder/components/CreateRecordingView.ts +259 -226
  65. package/front_end/panels/security/CookieControlsView.ts +2 -1
  66. package/front_end/panels/security/CookieReportView.ts +3 -2
  67. package/front_end/panels/settings/AISettingsTab.ts +164 -172
  68. package/front_end/panels/settings/KeybindsSettingsTab.ts +6 -0
  69. package/front_end/panels/settings/SettingsScreen.ts +3 -7
  70. package/front_end/panels/settings/aiSettingsTab.css +151 -148
  71. package/front_end/panels/settings/components/SyncSection.ts +2 -1
  72. package/front_end/panels/settings/settings-meta.ts +1 -2
  73. package/front_end/panels/sources/AddSourceMapURLDialog.ts +23 -26
  74. package/front_end/panels/sources/DebuggerPausedMessage.ts +4 -3
  75. package/front_end/panels/sources/ResourceOriginPlugin.ts +3 -2
  76. package/front_end/panels/sources/SourcesNavigator.ts +2 -1
  77. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -2
  78. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +9 -9
  79. package/front_end/panels/timeline/TimelinePanel.ts +60 -11
  80. package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
  81. package/front_end/panels/timeline/components/DetailsView.ts +5 -4
  82. package/front_end/panels/timeline/components/ExportTraceOptions.ts +33 -34
  83. package/front_end/panels/timeline/components/FieldSettingsDialog.ts +2 -1
  84. package/front_end/panels/timeline/components/LiveMetricsView.ts +5 -4
  85. package/front_end/panels/timeline/components/MetricCompareStrings.ts +25 -24
  86. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +2 -1
  87. package/front_end/third_party/chromium/README.chromium +2 -2
  88. package/front_end/third_party/puppeteer/README.chromium +2 -2
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +9 -1
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts +2 -2
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +13 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +2 -2
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js +5 -2
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +2 -2
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -1
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +1 -12
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +6 -0
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +1 -0
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +2 -2
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +6 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +2 -1
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js +2 -2
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +2 -2
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +3 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  126. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  127. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  129. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts +2 -2
  130. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.d.ts.map +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js +3 -1
  132. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/disposable.js.map +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts +1 -0
  134. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js +1 -0
  136. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/util.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +28 -3
  140. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +21 -10
  141. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +9 -1
  142. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts +2 -2
  145. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +13 -1
  150. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +2 -2
  153. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js +5 -2
  155. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +2 -2
  157. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  158. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -1
  159. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  160. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts +1 -12
  161. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  162. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts +6 -0
  163. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  164. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +1 -0
  165. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  166. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +2 -2
  167. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  168. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +6 -1
  169. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  170. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +2 -1
  171. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  172. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js +2 -2
  173. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
  174. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +2 -2
  175. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +3 -1
  177. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  179. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  180. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts +2 -2
  182. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.d.ts.map +1 -1
  183. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js +2 -2
  184. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/disposable.js.map +1 -1
  185. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts +1 -0
  186. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.d.ts.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js +1 -0
  188. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/util.js.map +1 -1
  189. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  190. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/types.d.ts +28 -3
  192. package/front_end/third_party/puppeteer/package/package.json +2 -2
  193. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
  194. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +7 -2
  195. package/front_end/third_party/puppeteer/package/src/api/Page.ts +14 -1
  196. package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +8 -5
  197. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +5 -2
  198. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +8 -0
  199. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +11 -2
  200. package/front_end/third_party/puppeteer/package/src/cdp/BrowserContext.ts +3 -2
  201. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +5 -5
  202. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  203. package/front_end/third_party/puppeteer/package/src/util/disposable.ts +2 -2
  204. package/front_end/third_party/puppeteer/package/src/util/util.ts +1 -0
  205. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  206. package/front_end/ui/components/docs/tooltip/basic.ts +1 -1
  207. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +280 -0
  208. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  209. package/front_end/ui/components/tooltips/Tooltip.ts +33 -18
  210. package/front_end/ui/i18n/i18n.ts +31 -0
  211. package/front_end/ui/legacy/Dialog.ts +0 -1
  212. package/front_end/ui/legacy/SettingsUI.ts +0 -14
  213. package/front_end/ui/legacy/SoftDropDown.ts +1 -12
  214. package/front_end/ui/legacy/ViewManager.ts +2 -4
  215. package/front_end/ui/legacy/Widget.ts +33 -17
  216. package/front_end/ui/legacy/XLink.ts +0 -3
  217. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +9 -0
  218. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -1
  219. package/front_end/ui/legacy/components/utils/Linkifier.ts +9 -3
  220. package/front_end/ui/legacy/legacy.ts +0 -2
  221. package/front_end/ui/visual_logging/KnownContextValues.ts +4 -1
  222. package/mcp/mcp.ts +6 -0
  223. package/package.json +1 -1
  224. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatterBounds.snapshot.txt +0 -4
  225. package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.html +0 -20
  226. package/front_end/ui/components/docs/breadcrumbs_perf/initial-breadcrumb-perf.ts +0 -25
  227. package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.html +0 -20
  228. package/front_end/ui/components/docs/breadcrumbs_perf/nested-breadcrumbs-perf.ts +0 -36
  229. package/front_end/ui/components/docs/recorder_create_recording_view/basic.html +0 -20
  230. package/front_end/ui/components/docs/recorder_create_recording_view/basic.ts +0 -27
  231. package/front_end/ui/legacy/ThrottledWidget.ts +0 -48
@@ -48,10 +48,11 @@ to Markdown (with a preview below the text input box).
48
48
  1. Replace `<from chrome://version/>` and `<OS version>` with the relevant
49
49
  version information.
50
50
  1. Outline exact steps to reproduce the problem. Make sure to provide steps
51
- that are easy and accessible. Ideally create a minified test case on
52
- [glitch.com](http://glitch.com) or [GitHub](http://github.com). Also
53
- make sure to include screenshots and videos that help us to reproduce
54
- and understand the problem you are facing.
51
+ that are easy and accessible. Ideally create a [minimal, reproducible
52
+ example](https://stackoverflow.com/help/minimal-reproducible-example), e.g.
53
+ on [codepen.io](https://codepen.io), [jsbin.com](https://jsbin.com) or
54
+ [GitHub](https://github.com). Also make sure to include screenshots and
55
+ videos that help us to reproduce and understand the problem you are facing.
55
56
 
56
57
  ## Overview
57
58
 
@@ -173,25 +174,21 @@ DevTools we want to
173
174
  1. reduce the number of regressions that ship to the (Chrome) Stable channel, and
174
175
  2. reduce the number of bugs overall.
175
176
 
176
- The following SLOs (Service Level Objectives) apply to issues of type Bug,
177
- Vulnerability, and Privacy Issue. other types of issues such as Feature Request
178
- or Task are out of scope for SLOs (with the notable exception of Postmortem action
179
- items, where Chrome also enforces SLOs for non-bug issues). We also explicitly
180
- restrict these SLOs to bugs in [crbug], and are not concerned with bugs that are
181
- tracked in other places such as GitHub. Below is a high level summary of our SLOs
182
- (Googlers can check the [Chrome DevTools SLO Policy] and [Chrome SLO Policy] for
183
- more details):
177
+ The following SLOs (Service Level Objectives) apply to issues of type "Bug",
178
+ "Vulnerability", and "Privacy Issue". other types of issues such as "Feature
179
+ Request" or "Task" are out of scope for SLOs (with the notable exception of
180
+ Postmortem action items, where Chrome also enforces SLOs for non-bug issues).
181
+ We also explicitly restrict these SLOs to bugs in [crbug], and are not concerned
182
+ with bugs that are tracked in other places such as GitHub. Below is a high level
183
+ summary of our SLOs (Googlers can check the [Chrome SLO Policy] for details):
184
184
 
185
185
  | | Assignment | Response | Closure
186
186
  | ---- | -------------- | ------------------ | --------
187
187
  | `P0` | 1 business day | Every business day | 1 week
188
188
  | `P1` | 1 week | 1 week | 4 weeks
189
- | `P2` | 2 months | - | 6 months
190
- | `P3` | 1 year | - | -
191
189
 
192
- The first two rows are identical to [go/chrome-slo], with the last two rows being
193
- specific to Chrome DevTools. [crbug] provides a **Nearest SLO** column that
194
- surfaces SLO violations easily:
190
+ These are identical to [go/chrome-slo]. [crbug] provides a **Nearest SLO**
191
+ column that surfaces SLO violations easily:
195
192
 
196
193
  ![Nearest SLO in crbug](./images/issues-nearestslo.png "Nearest SLO in crbug")
197
194
 
@@ -200,7 +197,7 @@ surfaces SLO violations easily:
200
197
 
201
198
  ### Release Blocking Issues
202
199
 
203
- In accordance with go/chrome-slo there are special SLOs for issues that are
200
+ In compliance with [go/chrome-slo] there are special SLOs for issues that are
204
201
  severe enough to block a release shipping to users (see [go/chrome-release-slos]).
205
202
  They apply to bug types in the same way as the above SLOs.
206
203
 
@@ -237,12 +234,11 @@ refreshed every 2-4 hours, to see SLO compliance for a given lead.
237
234
  [How to file a good browser bug]: https://web.dev/articles/how-to-file-a-good-bug
238
235
  [Open Chromium DevTools Bugs]: https://issues.chromium.org/issues?q=status:open%20componentid:1457055%2B%20type:bug
239
236
  [goo.gle/devtools-bug]: https://goo.gle/devtools-bug
240
- [Chrome DevTools SLO Policy]: https://b.corp.google.com/slos/61348
241
- [Chrome SLO Policy]: https://b.corp.google.com/slos/1834
237
+ [Chrome SLO Policy]: http://b/slos/1834
242
238
  [go/chrome-slo]: http://go/chrome-slo
243
239
  [go/chrome-release-slos]: http://go/chrome-release-slos
244
240
  [go/chrome-tooling/project-management]: http://go/chrome-tooling/project-management
245
- [Buganizer SLO Compliance]: go/b-slo-compliance
241
+ [Buganizer SLO Compliance]: http://go/b-slo-compliance
246
242
  [TaskFlow]: http://go/chrome-devtools:taskflow
247
243
  [TaskFlow Inbox]: http://go/chrome-devtools:taskflow/inbox
248
244
  [Chromium>Platform>DevTools]: https://issues.chromium.org/components/1457055
@@ -8,14 +8,7 @@ import {reveal} from './Revealer.js';
8
8
  let consoleInstance: Console|undefined;
9
9
 
10
10
  export class Console extends ObjectWrapper<EventTypes> {
11
- readonly #messages: Message[];
12
- /**
13
- * Instantiable via the instance() factory below.
14
- */
15
- constructor() {
16
- super();
17
- this.#messages = [];
18
- }
11
+ readonly #messages: Message[] = [];
19
12
 
20
13
  static instance(opts?: {forceNew: boolean}): Console {
21
14
  if (!consoleInstance || opts?.forceNew) {
@@ -57,33 +57,23 @@ type BrandedPathString =
57
57
  Platform.DevToolsPath.UrlString|Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.EncodedPathString;
58
58
 
59
59
  export class ParsedURL {
60
- isValid: boolean;
60
+ isValid = false;
61
61
  url: string;
62
- scheme: string;
63
- user: string;
64
- host: string;
65
- port: string;
66
- path: string;
67
- queryParams: string;
68
- fragment: string;
69
- folderPathComponents: string;
70
- lastPathComponent: string;
62
+ scheme = '';
63
+ user = '';
64
+ host = '';
65
+ port = '';
66
+ path = '';
67
+ queryParams = '';
68
+ fragment = '';
69
+ folderPathComponents = '';
70
+ lastPathComponent = '';
71
71
  readonly blobInnerScheme: string|undefined;
72
72
  #displayName?: string;
73
73
  #dataURLDisplayName?: string;
74
74
 
75
75
  constructor(url: string) {
76
- this.isValid = false;
77
76
  this.url = url;
78
- this.scheme = '';
79
- this.user = '';
80
- this.host = '';
81
- this.port = '';
82
- this.path = '';
83
- this.queryParams = '';
84
- this.fragment = '';
85
- this.folderPathComponents = '';
86
- this.lastPathComponent = '';
87
77
 
88
78
  const isBlobUrl = this.url.startsWith('blob:');
89
79
  const urlToMatch = isBlobUrl ? url.substring(5) : url;
@@ -24,11 +24,10 @@ export class Segment<T> {
24
24
  }
25
25
 
26
26
  export class SegmentedRange<T> {
27
- #segments: Array<Segment<T>>;
27
+ #segments: Array<Segment<T>> = [];
28
28
  readonly #mergeCallback: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)|undefined;
29
29
 
30
30
  constructor(mergeCallback?: ((arg0: Segment<T>, arg1: Segment<T>) => Segment<T>| null)) {
31
- this.#segments = [];
32
31
  this.#mergeCallback = mergeCallback;
33
32
  }
34
33
 
@@ -8,10 +8,7 @@ export interface OutputStream {
8
8
  }
9
9
 
10
10
  export class StringOutputStream implements OutputStream {
11
- #data: string;
12
- constructor() {
13
- this.#data = '';
14
- }
11
+ #data = '';
15
12
 
16
13
  async write(chunk: string): Promise<void> {
17
14
  this.#data += chunk;
@@ -5,6 +5,7 @@
5
5
  import * as Common from '../common/common.js';
6
6
  import * as Root from '../root/root.js';
7
7
 
8
+ import * as DispatchHttpRequestClient from './DispatchHttpRequestClient.js';
8
9
  import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
9
10
  import type {AidaClientResult, AidaCodeCompleteResult, SyncInformation} from './InspectorFrontendHostAPI.js';
10
11
  import {bindOutputStream} from './ResourceLoader.js';
@@ -213,6 +214,24 @@ export interface CompleteCodeOptions {
213
214
  }
214
215
  /* eslint-enable @typescript-eslint/naming-convention */
215
216
 
217
+ /* eslint-disable @typescript-eslint/naming-convention */
218
+ export interface GenerateCodeOptions {
219
+ temperature?: number;
220
+ model_id?: string;
221
+ inference_language?: AidaInferenceLanguage;
222
+ expect_code_output?: boolean;
223
+ }
224
+ /* eslint-enable @typescript-eslint/naming-convention */
225
+
226
+ /* eslint-disable @typescript-eslint/naming-convention */
227
+ export interface ContextFile {
228
+ path: string;
229
+ full_content: string;
230
+ selected_content?: string;
231
+ programming_language: AidaInferenceLanguage;
232
+ }
233
+ /* eslint-enable @typescript-eslint/naming-convention */
234
+
216
235
  export enum EditType {
217
236
  // Unknown edit type
218
237
  EDIT_TYPE_UNSPECIFIED = 0,
@@ -252,6 +271,12 @@ export enum Reason {
252
271
  }
253
272
 
254
273
  /* eslint-disable @typescript-eslint/naming-convention */
274
+ export interface AdditionalFile {
275
+ path: string;
276
+ content: string;
277
+ included_reason: Reason;
278
+ }
279
+
255
280
  export interface CompletionRequest {
256
281
  client: string;
257
282
  prefix: string;
@@ -259,11 +284,28 @@ export interface CompletionRequest {
259
284
  options?: CompleteCodeOptions;
260
285
  metadata: RequestMetadata;
261
286
  last_user_action?: EditType;
262
- additional_files?: Array<{
263
- path: string,
264
- content: string,
265
- included_reason: Reason,
266
- }>;
287
+ additional_files?: AdditionalFile[];
288
+ }
289
+ /* eslint-enable @typescript-eslint/naming-convention */
290
+
291
+ export enum UseCase {
292
+ // Unspecified usecase.
293
+ USE_CASE_UNSPECIFIED = 0,
294
+
295
+ // Code generation use case is expected to generate code from scratch
296
+ CODE_GENERATION = 1,
297
+ }
298
+
299
+ /* eslint-disable @typescript-eslint/naming-convention */
300
+ export interface GenerateCodeRequest {
301
+ client: string;
302
+ preamble: string;
303
+ current_message: Content;
304
+ options?: GenerateCodeOptions;
305
+ context_files?: ContextFile[];
306
+ use_case: UseCase;
307
+ metadata: RequestMetadata;
308
+ client_feature?: ClientFeature;
267
309
  }
268
310
  /* eslint-enable @typescript-eslint/naming-convention */
269
311
 
@@ -363,6 +405,11 @@ export interface CompletionResponse {
363
405
  metadata: ResponseMetadata;
364
406
  }
365
407
 
408
+ export interface GenerateCodeResponse {
409
+ samples: GenerationSample[];
410
+ metadata: ResponseMetadata;
411
+ }
412
+
366
413
  export interface GenerationSample {
367
414
  generationString: string;
368
415
  score: number;
@@ -416,6 +463,7 @@ const AidaLanguageToMarkdown: Record<AidaInferenceLanguage, string> = {
416
463
  };
417
464
 
418
465
  export const CLIENT_NAME = 'CHROME_DEVTOOLS';
466
+ export const SERVICE_NAME = 'aidaService';
419
467
 
420
468
  const CODE_CHUNK_SEPARATOR = (lang = ''): string => ('\n`````' + lang + '\n');
421
469
 
@@ -657,6 +705,17 @@ export class AidaClient {
657
705
 
658
706
  return {generatedSamples, metadata};
659
707
  }
708
+
709
+ async generateCode(request: GenerateCodeRequest): Promise<GenerateCodeResponse|null> {
710
+ const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateCodeResponse>({
711
+ service: SERVICE_NAME,
712
+ path: '/v1/aida:generateCode',
713
+ method: 'POST',
714
+ body: JSON.stringify(request),
715
+ });
716
+
717
+ return response;
718
+ }
660
719
  }
661
720
 
662
721
  export function convertToUserTierEnum(userTier: string|undefined): UserTier {
@@ -0,0 +1,62 @@
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 {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
6
+ import type {DispatchHttpRequestRequest, DispatchHttpRequestResult} from './InspectorFrontendHostAPI.js';
7
+
8
+ export enum ErrorType {
9
+ HTTP_RESPONSE_UNAVAILABLE = 'HTTP_RESPONSE_UNAVAILABLE',
10
+ NOT_FOUND = 'NOT_FOUND',
11
+ }
12
+
13
+ export class DispatchHttpRequestError extends Error {
14
+ constructor(readonly type: ErrorType, options?: ErrorOptions) {
15
+ super(undefined, options);
16
+ }
17
+ }
18
+
19
+ export async function makeHttpRequest<R>(request: DispatchHttpRequestRequest): Promise<R> {
20
+ const response = await new Promise<DispatchHttpRequestResult>(resolve => {
21
+ InspectorFrontendHostInstance.dispatchHttpRequest(request, resolve);
22
+ });
23
+
24
+ debugLog({request, response});
25
+ if (response.statusCode === 404) {
26
+ throw new DispatchHttpRequestError(ErrorType.NOT_FOUND);
27
+ }
28
+
29
+ if ('response' in response && response.statusCode === 200) {
30
+ try {
31
+ return JSON.parse(response.response) as R;
32
+ } catch (err) {
33
+ throw new DispatchHttpRequestError(ErrorType.HTTP_RESPONSE_UNAVAILABLE, {cause: err});
34
+ }
35
+ }
36
+
37
+ throw new DispatchHttpRequestError(ErrorType.HTTP_RESPONSE_UNAVAILABLE);
38
+ }
39
+
40
+ function isDebugMode(): boolean {
41
+ return Boolean(localStorage.getItem('debugDispatchHttpRequestEnabled'));
42
+ }
43
+
44
+ function debugLog(...log: unknown[]): void {
45
+ if (!isDebugMode()) {
46
+ return;
47
+ }
48
+
49
+ // eslint-disable-next-line no-console
50
+ console.log('debugLog', ...log);
51
+ }
52
+
53
+ function setDebugDispatchHttpRequestEnabled(enabled: boolean): void {
54
+ if (enabled) {
55
+ localStorage.setItem('debugDispatchHttpRequestEnabled', 'true');
56
+ } else {
57
+ localStorage.removeItem('debugDispatchHttpRequestEnabled');
58
+ }
59
+ }
60
+
61
+ // @ts-expect-error
62
+ globalThis.setDebugDispatchHttpRequestEnabled = setDebugDispatchHttpRequestEnabled;
@@ -4,8 +4,8 @@
4
4
 
5
5
  import * as Root from '../root/root.js';
6
6
 
7
- import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
8
- import type {DispatchHttpRequestRequest, DispatchHttpRequestResult} from './InspectorFrontendHostAPI.js';
7
+ import * as DispatchHttpRequestClient from './DispatchHttpRequestClient.js';
8
+ import type {DispatchHttpRequestRequest} from './InspectorFrontendHostAPI.js';
9
9
 
10
10
  export enum SubscriptionStatus {
11
11
  ENABLED = 'SUBSCRIPTION_STATE_ENABLED',
@@ -73,17 +73,6 @@ export interface GetProfileResponse {
73
73
  isEligible: boolean;
74
74
  }
75
75
 
76
- export enum GdpErrorType {
77
- HTTP_RESPONSE_UNAVAILABLE = 'HTTP_RESPONSE_UNAVAILABLE',
78
- NOT_FOUND = 'NOT_FOUND',
79
- }
80
-
81
- class GdpError extends Error {
82
- constructor(readonly type: GdpErrorType, options?: ErrorOptions) {
83
- super(undefined, options);
84
- }
85
- }
86
-
87
76
  /**
88
77
  * The `batchGet` awards endpoint returns badge names with an
89
78
  * obfuscated user ID (e.g., `profiles/12345/awards/badge-name`).
@@ -99,27 +88,12 @@ export const GOOGLE_DEVELOPER_PROGRAM_PROFILE_LINK = 'https://developers.google.
99
88
 
100
89
  async function makeHttpRequest<R>(request: DispatchHttpRequestRequest): Promise<R> {
101
90
  if (!isGdpProfilesAvailable()) {
102
- throw new GdpError(GdpErrorType.HTTP_RESPONSE_UNAVAILABLE);
103
- }
104
-
105
- const response = await new Promise<DispatchHttpRequestResult>(resolve => {
106
- InspectorFrontendHostInstance.dispatchHttpRequest(request, resolve);
107
- });
108
-
109
- debugLog({request, response});
110
- if (response.statusCode === 404) {
111
- throw new GdpError(GdpErrorType.NOT_FOUND);
112
- }
113
-
114
- if ('response' in response && response.statusCode === 200) {
115
- try {
116
- return JSON.parse(response.response) as R;
117
- } catch (err) {
118
- throw new GdpError(GdpErrorType.HTTP_RESPONSE_UNAVAILABLE, {cause: err});
119
- }
91
+ throw new DispatchHttpRequestClient.DispatchHttpRequestError(
92
+ DispatchHttpRequestClient.ErrorType.HTTP_RESPONSE_UNAVAILABLE);
120
93
  }
121
94
 
122
- throw new GdpError(GdpErrorType.HTTP_RESPONSE_UNAVAILABLE);
95
+ const response = await DispatchHttpRequestClient.makeHttpRequest(request) as R;
96
+ return response;
123
97
  }
124
98
 
125
99
  const SERVICE_NAME = 'gdpService';
@@ -158,7 +132,8 @@ export class GdpClient {
158
132
  isEligible: true,
159
133
  };
160
134
  } catch (err: unknown) {
161
- if (err instanceof GdpError && err.type === GdpErrorType.HTTP_RESPONSE_UNAVAILABLE) {
135
+ if (err instanceof DispatchHttpRequestClient.DispatchHttpRequestError &&
136
+ err.type === DispatchHttpRequestClient.ErrorType.HTTP_RESPONSE_UNAVAILABLE) {
162
137
  return null;
163
138
  }
164
139
  }
@@ -265,27 +240,6 @@ export class GdpClient {
265
240
  }
266
241
  }
267
242
 
268
- function isDebugMode(): boolean {
269
- return Boolean(localStorage.getItem('debugGdpIntegrationEnabled'));
270
- }
271
-
272
- function debugLog(...log: unknown[]): void {
273
- if (!isDebugMode()) {
274
- return;
275
- }
276
-
277
- // eslint-disable-next-line no-console
278
- console.log('debugLog', ...log);
279
- }
280
-
281
- function setDebugGdpIntegrationEnabled(enabled: boolean): void {
282
- if (enabled) {
283
- localStorage.setItem('debugGdpIntegrationEnabled', 'true');
284
- } else {
285
- localStorage.removeItem('debugGdpIntegrationEnabled');
286
- }
287
- }
288
-
289
243
  export function isGdpProfilesAvailable(): boolean {
290
244
  const isBaseFeatureEnabled = Boolean(Root.Runtime.hostConfig.devToolsGdpProfiles?.enabled);
291
245
  const isBrandedBuild = Boolean(Root.Runtime.hostConfig.devToolsGdpProfilesAvailability?.enabled);
@@ -311,6 +265,3 @@ export function isBadgesEnabled(): boolean {
311
265
  export function isStarterBadgeEnabled(): boolean {
312
266
  return Boolean(Root.Runtime.hostConfig.devToolsGdpProfiles?.starterBadgeEnabled);
313
267
  }
314
-
315
- // @ts-expect-error
316
- globalThis.setDebugGdpIntegrationEnabled = setDebugGdpIntegrationEnabled;
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as AidaClient from './AidaClient.js';
6
+ import * as DispatchHttpRequestClient from './DispatchHttpRequestClient.js';
6
7
  import * as GdpClient from './GdpClient.js';
7
8
  import * as InspectorFrontendHost from './InspectorFrontendHost.js';
8
9
  import * as InspectorFrontendHostAPI from './InspectorFrontendHostAPI.js';
@@ -12,6 +13,7 @@ import * as UserMetrics from './UserMetrics.js';
12
13
 
13
14
  export {
14
15
  AidaClient,
16
+ DispatchHttpRequestClient,
15
17
  GdpClient,
16
18
  InspectorFrontendHost,
17
19
  InspectorFrontendHostAPI,
@@ -1,7 +1,6 @@
1
1
  // Copyright 2020 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
- /* eslint-disable @devtools/no-imperative-dom-api */
5
4
 
6
5
  import * as I18n from '../../third_party/i18n/i18n.js';
7
6
  import type * as Platform from '../platform/platform.js';
@@ -117,29 +116,6 @@ export function registerUIStrings(
117
116
  return i18nInstance.registerFileStrings(path, stringStructure);
118
117
  }
119
118
 
120
- /**
121
- * Returns a span element that may contains other DOM element as placeholders
122
- */
123
- export function getFormatLocalizedString(
124
- registeredStrings: I18n.LocalizedStringSet.RegisteredFileStrings, stringId: string,
125
- placeholders: Record<string, Object>): HTMLSpanElement {
126
- const formatter =
127
- registeredStrings.getLocalizedStringSetFor(DevToolsLocale.instance().locale).getMessageFormatterFor(stringId);
128
-
129
- const element = document.createElement('span');
130
- for (const icuElement of formatter.getAst()) {
131
- if (icuElement.type === /* argumentElement */ 1) {
132
- const placeholderValue = placeholders[icuElement.value];
133
- if (placeholderValue) {
134
- element.append(placeholderValue as Node | string);
135
- }
136
- } else if ('value' in icuElement) {
137
- element.append(String(icuElement.value));
138
- }
139
- }
140
- return element;
141
- }
142
-
143
119
  export function serializeUIString(string: string, values: Record<string, Object> = {}): string {
144
120
  const serializedMessage = {string, values};
145
121
  return JSON.stringify(serializedMessage);
@@ -41,17 +41,19 @@ export const enum CDPErrorStatus {
41
41
  SESSION_NOT_FOUND = SERVER_ERROR - 1,
42
42
  }
43
43
 
44
- export interface CDPError extends CDPBaseMessage {
44
+ export interface CDPError {
45
+ code: CDPErrorStatus;
46
+ message: string;
47
+ data?: string;
48
+ }
49
+
50
+ export interface CDPErrorMessage extends CDPBaseMessage {
45
51
  id?: number;
46
- error: {
47
- code: CDPErrorStatus,
48
- message: string,
49
- data?: string,
50
- };
52
+ error: CDPError;
51
53
  }
52
54
 
53
55
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
54
- export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent<any>|CDPError;
56
+ export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent<any>|CDPErrorMessage;
55
57
 
56
58
  /**
57
59
  * Allows the sending and receiving of CDP commands and the notification of CDP events to observers.
@@ -62,7 +64,7 @@ export type CDPMessage = CDPCommandRequest<any>|CDPCommandResponse<any>|CDPEvent
62
64
  */
63
65
  export interface CDPConnection {
64
66
  send<T extends keyof ProtocolMapping.Commands>(method: T, params: CommandParams<T>, sessionId: string|undefined):
65
- Promise<CommandResult<T>|{getError(): string}>;
67
+ Promise<{result: CommandResult<T>}|{error: CDPError}>;
66
68
 
67
69
  observe(observer: CDPConnectionObserver): void;
68
70
  unobserve(observer: CDPConnectionObserver): void;
@@ -67,9 +67,13 @@ interface CommandParameter {
67
67
  }
68
68
 
69
69
  type Callback = (error: MessageError|null, arg1: Object|null) => void;
70
+ interface ResponseWithError {
71
+ error: MessageError|null;
72
+ result: Object|null;
73
+ }
70
74
 
71
75
  interface CallbackWithDebugInfo {
72
- callback: Callback;
76
+ resolve: (response: ResponseWithError) => void;
73
77
  method: string;
74
78
  }
75
79
 
@@ -241,8 +245,15 @@ export class SessionRouter {
241
245
  if (!session) {
242
246
  return;
243
247
  }
244
- for (const callback of session.callbacks.values()) {
245
- SessionRouter.dispatchUnregisterSessionError(callback);
248
+ for (const {resolve, method} of session.callbacks.values()) {
249
+ resolve({
250
+ result: null,
251
+ error: {
252
+ message: `Session is unregistering, can\'t dispatch pending call to ${method}`,
253
+ code: ConnectionClosedErrorCode,
254
+ data: null,
255
+ }
256
+ });
246
257
  }
247
258
  this.#sessions.delete(sessionId);
248
259
  }
@@ -255,7 +266,8 @@ export class SessionRouter {
255
266
  return this.#connection;
256
267
  }
257
268
 
258
- sendMessage(sessionId: string, domain: string, method: QualifiedName, params: Object|null, callback: Callback): void {
269
+ sendMessage(sessionId: string, domain: string, method: QualifiedName, params: Object|null):
270
+ Promise<ResponseWithError> {
259
271
  const messageId = this.nextMessageId();
260
272
  const messageObject: Message = {
261
273
  id: messageId,
@@ -285,16 +297,19 @@ export class SessionRouter {
285
297
 
286
298
  const session = this.#sessions.get(sessionId);
287
299
  if (!session) {
288
- return;
300
+ return Promise.resolve({error: null, result: null});
289
301
  }
290
- session.callbacks.set(messageId, {callback, method});
291
- this.#connection.sendRawMessage(JSON.stringify(messageObject));
302
+
303
+ return new Promise(resolve => {
304
+ session.callbacks.set(messageId, {resolve, method});
305
+ this.#connection.sendRawMessage(JSON.stringify(messageObject));
306
+ });
292
307
  }
293
308
 
294
309
  private sendRawMessageForTesting(method: QualifiedName, params: Object|null, callback: Callback|null, sessionId = ''):
295
310
  void {
296
311
  const domain = method.split('.')[0];
297
- this.sendMessage(sessionId, domain, method, params, callback || (() => {}));
312
+ void this.sendMessage(sessionId, domain, method, params).then(({error, result}) => callback?.(error, result));
298
313
  }
299
314
 
300
315
  private onMessage(message: string|Object): void {
@@ -357,7 +372,7 @@ export class SessionRouter {
357
372
  return;
358
373
  }
359
374
 
360
- callback.callback(messageObject.error || null, messageObject.result || null);
375
+ callback.resolve({error: messageObject.error || null, result: messageObject.result || null});
361
376
  --this.#pendingResponsesCount;
362
377
  this.#pendingLongPollingMessageIds.delete(messageObject.id);
363
378
 
@@ -403,24 +418,6 @@ export class SessionRouter {
403
418
  }
404
419
  }
405
420
  }
406
-
407
- static dispatchConnectionError(callback: Callback, method: string): void {
408
- const error = {
409
- message: `Connection is closed, can\'t dispatch pending call to ${method}`,
410
- code: ConnectionClosedErrorCode,
411
- data: null,
412
- };
413
- window.setTimeout(() => callback(error, null), 0);
414
- }
415
-
416
- static dispatchUnregisterSessionError({callback, method}: CallbackWithDebugInfo): void {
417
- const error = {
418
- message: `Session is unregistering, can\'t dispatch pending call to ${method}`,
419
- code: ConnectionClosedErrorCode,
420
- data: null,
421
- };
422
- window.setTimeout(() => callback(error, null), 0);
423
- }
424
421
  }
425
422
 
426
423
  /**
@@ -878,23 +875,20 @@ class AgentPrototype {
878
875
  }
879
876
 
880
877
  private invoke(method: QualifiedName, request: Object|null): Promise<Protocol.ProtocolResponseWithError> {
881
- return new Promise(fulfill => {
882
- const callback: Callback = (error: MessageError|undefined|null, result: Object|null): void => {
883
- if (error && !test.suppressRequestErrors && error.code !== DevToolsStubErrorCode &&
884
- error.code !== GenericErrorCode && error.code !== ConnectionClosedErrorCode) {
885
- console.error('Request ' + method + ' failed. ' + JSON.stringify(error));
886
- }
887
-
888
- const errorMessage = error?.message;
889
- fulfill({...result, getError: () => errorMessage});
890
- };
878
+ const router = this.target.router();
879
+ if (!router) {
880
+ return Promise.resolve(
881
+ {result: null, getError: () => `Connection is closed, can\'t dispatch pending call to ${method}`});
882
+ }
891
883
 
892
- const router = this.target.router();
893
- if (!router) {
894
- SessionRouter.dispatchConnectionError(callback, method);
895
- } else {
896
- router.sendMessage(this.target.sessionId, this.domain, method, request, callback);
884
+ return router.sendMessage(this.target.sessionId, this.domain, method, request).then(({error, result}) => {
885
+ if (error && !test.suppressRequestErrors && error.code !== DevToolsStubErrorCode &&
886
+ error.code !== GenericErrorCode && error.code !== ConnectionClosedErrorCode) {
887
+ console.error('Request ' + method + ' failed. ' + JSON.stringify(error));
897
888
  }
889
+
890
+ const errorMessage = error?.message;
891
+ return {...result, getError: () => errorMessage};
898
892
  });
899
893
  }
900
894
  }