chrome-devtools-frontend 1.0.1650100 → 1.0.1650677

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 (290) hide show
  1. package/.agents/skills/version-control/SKILL.md +5 -1
  2. package/config/typescript/tsconfig.base.json +1 -0
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
  4. package/front_end/core/host/UserMetrics.ts +0 -26
  5. package/front_end/core/sdk/CSSMetadata.ts +72 -0
  6. package/front_end/devtools_compatibility.js +1 -2
  7. package/front_end/foundation/Universe.ts +7 -0
  8. package/front_end/models/ai_assistance/AiAgent2.ts +11 -1
  9. package/front_end/models/ai_assistance/README.md +4 -0
  10. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +2 -0
  11. package/front_end/models/ai_assistance/agents/AiAgent.ts +3 -0
  12. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +13 -4
  13. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -7
  14. package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
  15. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  16. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
  17. package/front_end/models/ai_assistance/skills/accessibility.md +13 -0
  18. package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +54 -0
  19. package/front_end/models/ai_assistance/tools/ResolveLighthousePath.ts +124 -0
  20. package/front_end/models/ai_assistance/tools/Tool.ts +12 -2
  21. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +4 -0
  22. package/front_end/models/persistence/NetworkPersistenceManager.ts +9 -1
  23. package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -11
  24. package/front_end/panels/common/ExtensionServer.ts +70 -50
  25. package/front_end/panels/elements/ElementsPanel.ts +1 -1
  26. package/front_end/panels/js_timeline/js_timeline-meta.ts +1 -2
  27. package/front_end/panels/network/RequestConditionsDrawer.ts +236 -198
  28. package/front_end/panels/network/RequestHeadersView.ts +2 -2
  29. package/front_end/panels/network/components/RequestHeadersView.css +1 -0
  30. package/front_end/panels/network/components/ResponseHeaderSection.css +5 -1
  31. package/front_end/panels/network/requestConditionsDrawer.css +3 -0
  32. package/front_end/panels/recorder/testing/RecorderHelpers.ts +2 -0
  33. package/front_end/panels/timeline/timeline-meta.ts +1 -1
  34. package/front_end/panels/whats_new/ReleaseNoteText.ts +12 -6
  35. package/front_end/panels/whats_new/resources/WNDT.md +8 -7
  36. package/front_end/third_party/chromium/README.chromium +1 -1
  37. package/front_end/third_party/puppeteer/README.chromium +2 -2
  38. package/front_end/third_party/puppeteer/package/README.md +14 -0
  39. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +60 -24
  40. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +271 -164
  41. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +2 -6
  42. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  43. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js +2 -2
  44. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +2 -2
  46. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js +11 -7
  48. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPRequest.js.map +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts.map +1 -1
  50. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js +3 -10
  51. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js.map +1 -1
  52. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +9 -4
  53. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  54. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +4 -4
  55. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  56. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.d.ts +13 -0
  57. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.d.ts.map +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.js +14 -0
  59. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/WebWorker.js.map +1 -1
  60. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js +5 -5
  61. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +2 -2
  63. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  64. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +3 -3
  65. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
  66. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js +5 -3
  67. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserConnector.js.map +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserContext.js +6 -6
  69. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BrowserContext.js.map +1 -1
  70. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.d.ts.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js +3 -3
  73. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Connection.js.map +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Deserializer.js +2 -2
  75. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Deserializer.js.map +1 -1
  76. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ExposedFunction.js +6 -6
  77. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ExposedFunction.js.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js +1 -1
  79. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Frame.js.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +1 -0
  81. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +3 -0
  83. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Realm.js.map +1 -1
  86. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
  87. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +11 -0
  89. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js +4 -4
  92. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Accessibility.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js +3 -3
  94. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Binding.js.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +13 -2
  97. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/BrowserConnector.js +2 -2
  99. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/BrowserConnector.js.map +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js +2 -2
  101. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Connection.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js +2 -2
  103. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Coverage.js.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ElementHandle.js +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ElementHandle.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.d.ts +1 -0
  107. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.js +25 -4
  109. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/EmulationManager.js.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExecutionContext.js +3 -3
  111. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ExecutionContext.js.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.js +9 -11
  114. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Extension.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +3 -3
  116. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +7 -7
  119. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPRequest.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/JSHandle.js +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/JSHandle.js.map +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts +3 -1
  125. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  126. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js +18 -10
  127. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/NetworkManager.js.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +1 -0
  129. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +17 -11
  131. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js +3 -3
  133. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js +28 -10
  136. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/TargetManager.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js +10 -6
  139. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
  140. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.d.ts +3 -0
  141. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  142. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.js +20 -5
  143. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebWorker.js.map +1 -1
  144. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.d.ts.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +11 -0
  146. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +2 -2
  148. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/CallbackRegistry.js +2 -2
  150. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/CallbackRegistry.js.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Configuration.d.ts +4 -2
  152. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Configuration.d.ts.map +1 -1
  153. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +26 -13
  154. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  155. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts +1 -6
  156. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.d.ts.map +1 -1
  157. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js +24 -33
  158. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Debug.js.map +1 -1
  159. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +2 -2
  160. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts +8 -1
  162. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.d.ts.map +1 -1
  163. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js +8 -1
  164. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/util.js.map +1 -1
  165. package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.d.ts +2 -0
  166. package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.d.ts.map +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.js +4 -2
  168. package/front_end/third_party/puppeteer/package/lib/puppeteer/environment.js.map +1 -1
  169. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts +1 -1
  170. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts.map +1 -1
  171. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js +1 -1
  172. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js.map +1 -1
  173. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.d.ts.map +1 -1
  174. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.js +15 -5
  175. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/TextContent.js.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +5 -1
  177. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +17 -16
  179. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  180. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  181. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js +14 -9
  182. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ChromeLauncher.js.map +1 -1
  183. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/FirefoxLauncher.js +2 -2
  184. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/FirefoxLauncher.js.map +1 -1
  185. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +2 -2
  186. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/PipeTransport.js +3 -3
  188. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/PipeTransport.js.map +1 -1
  189. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +20 -0
  190. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +38 -9
  192. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
  193. package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.d.ts +7 -0
  194. package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.d.ts.map +1 -0
  195. package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js +16 -0
  196. package/front_end/third_party/puppeteer/package/lib/puppeteer/node-env-setup.js.map +1 -0
  197. package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.d.ts +1 -0
  198. package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.d.ts.map +1 -1
  199. package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.js +3 -8
  200. package/front_end/third_party/puppeteer/package/lib/puppeteer/puppeteer-core.js.map +1 -1
  201. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  202. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  203. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js.map +1 -1
  204. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  205. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  206. package/front_end/third_party/puppeteer/package/lib/types.d.ts +60 -24
  207. package/front_end/third_party/puppeteer/package/package.json +4 -4
  208. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +4 -8
  209. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -2
  210. package/front_end/third_party/puppeteer/package/src/api/HTTPRequest.ts +10 -10
  211. package/front_end/third_party/puppeteer/package/src/api/JSHandle.ts +3 -10
  212. package/front_end/third_party/puppeteer/package/src/api/Page.ts +14 -8
  213. package/front_end/third_party/puppeteer/package/src/api/WebWorker.ts +30 -0
  214. package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +5 -5
  215. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +2 -2
  216. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +3 -3
  217. package/front_end/third_party/puppeteer/package/src/bidi/BrowserConnector.ts +5 -3
  218. package/front_end/third_party/puppeteer/package/src/bidi/BrowserContext.ts +6 -6
  219. package/front_end/third_party/puppeteer/package/src/bidi/Connection.ts +4 -4
  220. package/front_end/third_party/puppeteer/package/src/bidi/Deserializer.ts +2 -2
  221. package/front_end/third_party/puppeteer/package/src/bidi/ExposedFunction.ts +6 -6
  222. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -1
  223. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +4 -0
  224. package/front_end/third_party/puppeteer/package/src/bidi/Realm.ts +1 -1
  225. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +11 -0
  226. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +6 -4
  227. package/front_end/third_party/puppeteer/package/src/cdp/Binding.ts +3 -3
  228. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +14 -2
  229. package/front_end/third_party/puppeteer/package/src/cdp/BrowserConnector.ts +2 -2
  230. package/front_end/third_party/puppeteer/package/src/cdp/Connection.ts +2 -2
  231. package/front_end/third_party/puppeteer/package/src/cdp/Coverage.ts +2 -2
  232. package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +1 -1
  233. package/front_end/third_party/puppeteer/package/src/cdp/EmulationManager.ts +36 -4
  234. package/front_end/third_party/puppeteer/package/src/cdp/ExecutionContext.ts +3 -3
  235. package/front_end/third_party/puppeteer/package/src/cdp/Extension.ts +16 -17
  236. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +3 -3
  237. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +12 -7
  238. package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +1 -1
  239. package/front_end/third_party/puppeteer/package/src/cdp/JSHandle.ts +1 -1
  240. package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +22 -11
  241. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +18 -10
  242. package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +3 -3
  243. package/front_end/third_party/puppeteer/package/src/cdp/TargetManager.ts +37 -12
  244. package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +11 -9
  245. package/front_end/third_party/puppeteer/package/src/cdp/WebWorker.ts +33 -5
  246. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +11 -0
  247. package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +2 -2
  248. package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +2 -2
  249. package/front_end/third_party/puppeteer/package/src/common/Configuration.ts +4 -2
  250. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +26 -13
  251. package/front_end/third_party/puppeteer/package/src/common/Debug.ts +30 -40
  252. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +2 -2
  253. package/front_end/third_party/puppeteer/package/src/common/util.ts +9 -1
  254. package/front_end/third_party/puppeteer/package/src/environment.ts +7 -3
  255. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  256. package/front_end/third_party/puppeteer/package/src/injected/TextContent.ts +15 -5
  257. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +23 -23
  258. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +19 -13
  259. package/front_end/third_party/puppeteer/package/src/node/FirefoxLauncher.ts +2 -2
  260. package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +2 -2
  261. package/front_end/third_party/puppeteer/package/src/node/PipeTransport.ts +3 -3
  262. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +44 -9
  263. package/front_end/third_party/puppeteer/package/src/node-env-setup.ts +18 -0
  264. package/front_end/third_party/puppeteer/package/src/puppeteer-core.ts +5 -9
  265. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  266. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  267. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
  268. package/front_end/third_party/third-party-web/lib/nostats-subset.js +21 -15
  269. package/front_end/third_party/third-party-web/package/README.md +619 -582
  270. package/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -1
  271. package/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -1
  272. package/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -1
  273. package/front_end/third_party/third-party-web/package/dist/entities.json +1 -1
  274. package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +27 -15
  275. package/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +14 -0
  276. package/front_end/third_party/third-party-web/package/lib/entities.test.js +10 -0
  277. package/front_end/third_party/third-party-web/package/lib/index.test.js +6 -6
  278. package/front_end/third_party/third-party-web/package/lib/markdown/template.md +1 -3
  279. package/front_end/third_party/third-party-web/package/package.json +7 -3
  280. package/front_end/third_party/third-party-web/package.json +1 -1
  281. package/front_end/tsconfig.json +1 -2
  282. package/front_end/ui/components/buttons/floatingButton.css +3 -3
  283. package/front_end/ui/components/lists/list.css +2 -0
  284. package/front_end/ui/legacy/ListWidget.ts +8 -5
  285. package/front_end/ui/legacy/TextPrompt.ts +5 -2
  286. package/front_end/ui/legacy/textPrompt.css +1 -0
  287. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  288. package/inspector_overlay/tsconfig.json +3 -10
  289. package/mcp/tsconfig.json +1 -5
  290. package/package.json +1 -2
@@ -1,11 +1,10 @@
1
1
  // Copyright 2015 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-lit-render-outside-of-view */
5
- /* eslint-disable @devtools/no-imperative-dom-api */
6
4
 
7
- import '../../ui/legacy/legacy.js';
5
+ import '../../ui/components/lists/lists.js';
8
6
  import '../../ui/components/tooltips/tooltips.js';
7
+ import '../../ui/legacy/legacy.js';
9
8
 
10
9
  import type * as Common from '../../core/common/common.js';
11
10
  import * as i18n from '../../core/i18n/i18n.js';
@@ -14,7 +13,6 @@ import * as SDK from '../../core/sdk/sdk.js';
14
13
  import * as Logs from '../../models/logs/logs.js';
15
14
  import * as Buttons from '../../ui/components/buttons/buttons.js';
16
15
  import * as uiI18n from '../../ui/i18n/i18n.js';
17
- import {Link} from '../../ui/kit/kit.js';
18
16
  import * as UI from '../../ui/legacy/legacy.js';
19
17
  import {Directives, html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
20
18
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
@@ -23,7 +21,7 @@ import * as PanelUtils from '../utils/utils.js';
23
21
 
24
22
  import requestConditionsDrawerStyles from './requestConditionsDrawer.css.js';
25
23
 
26
- const {ref, live} = Directives;
24
+ const {ref, live, ifDefined} = Directives;
27
25
  const {widget} = UI.Widget;
28
26
 
29
27
  const UIStrings = {
@@ -87,10 +85,6 @@ const UIStrings = {
87
85
  * @description Message to be announced for a when list item is removed from list widget
88
86
  */
89
87
  learnMore: 'Learn more',
90
- /**
91
- * @description Accessibility label on a `Learn more` link
92
- */
93
- learnMoreLabel: 'Learn more about URL pattern syntax',
94
88
  /**
95
89
  * @description Tooltip on a button moving an entry up
96
90
  * @example {*://example.com} PH1
@@ -118,38 +112,42 @@ const UIStrings = {
118
112
  * @description Aria announcemenet when a pattern was moved down
119
113
  */
120
114
  patternMovedDown: 'URL pattern was moved down',
121
- /**
122
- * @description Text on a button to start editing text
123
- * @example {*://example.com} PH1
124
- */
125
- editPattern: 'Edit {PH1}',
126
- /**
127
- * @description Label for an item to remove something
128
- * @example {*://example.com} PH1
129
- */
130
- removePattern: 'Remove {PH1}',
131
115
  } as const;
132
116
  const str_ = i18n.i18n.registerUIStrings('panels/network/RequestConditionsDrawer.ts', UIStrings);
133
117
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
134
118
 
135
119
  const NETWORK_REQUEST_BLOCKING_EXPLANATION_URL =
136
120
  'https://developer.chrome.com/docs/devtools/network-request-blocking' as Platform.DevToolsPath.UrlString;
137
- const PATTERN_API_DOCS_URL =
138
- 'https://developer.mozilla.org/en-US/docs/Web/API/URL_Pattern_API' as Platform.DevToolsPath.UrlString;
139
121
 
140
122
  const {bindToAction} = UI.UIUtils;
141
123
 
142
124
  interface ViewInput {
143
- list: UI.ListWidget.ListWidget<SDK.NetworkManager.RequestCondition>;
125
+ conditions: SDK.NetworkManager.RequestCondition[];
126
+ editingCondition?: SDK.NetworkManager.RequestCondition;
144
127
  enabled: boolean;
145
128
  toggleEnabled: () => void;
146
129
  addPattern: () => void;
130
+ onToggle: (condition: SDK.NetworkManager.RequestCondition) => void;
131
+ onConditionsChanged: (condition: SDK.NetworkManager.RequestCondition,
132
+ conditions: SDK.NetworkManager.ThrottlingConditions) => void;
133
+ onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void;
134
+ onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void;
135
+ onCommit: (condition: SDK.NetworkManager.RequestCondition, value: string) => void;
136
+ onCancel: (condition: SDK.NetworkManager.RequestCondition) => void;
137
+ onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => void;
138
+ onRemove: (condition: SDK.NetworkManager.RequestCondition) => void;
139
+ validator: (condition: SDK.NetworkManager.RequestCondition, value: string) => Common.UIString.LocalizedString | null;
140
+ lookUpRequestCount: (condition: SDK.NetworkManager.RequestCondition) => number;
141
+ }
142
+ interface ViewOutput {
143
+ itemRefs: Map<SDK.NetworkManager.RequestCondition, HTMLElement|undefined>;
147
144
  }
148
- type View = (input: ViewInput, output: object, target: HTMLElement) => void;
145
+ type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
149
146
  export const DEFAULT_VIEW: View = (input, output, target) => {
150
147
  render(
151
148
  // clang-format off
152
149
  html`
150
+ <style>${requestConditionsDrawerStyles}</style>
153
151
  <devtools-toolbar jslog=${VisualLogging.toolbar()}>
154
152
  <devtools-checkbox
155
153
  ?checked=${input.enabled}
@@ -161,7 +159,9 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
161
159
  <devtools-button ${bindToAction('network.add-network-request-blocking-pattern')}></devtools-button>
162
160
  <devtools-button ${bindToAction('network.remove-all-network-request-blocking-patterns')}></devtools-button>
163
161
  </devtools-toolbar>
164
- <div class=empty-state ${ref(e => input.list.setEmptyPlaceholder(e ?? null))}>
162
+ ${input.conditions.length === 0 ? html`
163
+ <div class="list">
164
+ <div class=empty-state>
165
165
  <span class=empty-state-header>${i18nString(UIStrings.noPattern)}</span>
166
166
  <div class=empty-state-description>
167
167
  ${uiI18n.getFormatLocalizedStringTemplate(str_, UIStrings.noThrottlingOrBlockingPattern, {PH1: learnMore()})}
@@ -175,22 +175,71 @@ export const DEFAULT_VIEW: View = (input, output, target) => {
175
175
  ${i18nString(UIStrings.addRule)}
176
176
  </devtools-button>
177
177
  </div>
178
- <devtools-widget ${widget(UI.Widget.VBox)}>
179
- ${input.list.element}
180
- </devtools-widget>
178
+ </div>
179
+ ` : html`
180
+ <devtools-list
181
+ class="blocked-urls list square-corners"
182
+ ?deletable=${input.enabled}
183
+ @edit=${(e: CustomEvent<{index: number}>) => input.onBeginEdit(input.conditions[e.detail.index])}
184
+ @delete=${(e: CustomEvent<{index: number}>) => input.onRemove(input.conditions[e.detail.index])}>
185
+ ${input.conditions.map((condition, index) => html`
186
+ <div class="blocked-url" ${ref(e => {
187
+ output.itemRefs.set(condition, e as HTMLElement | undefined);
188
+ })}>
189
+ ${renderItem({
190
+ condition,
191
+ editing: input.editingCondition === condition,
192
+ editable: input.enabled,
193
+ index,
194
+ onToggle: input.onToggle,
195
+ onConditionsChanged: input.onConditionsChanged,
196
+ onIncreasePriority: input.onIncreasePriority,
197
+ onDecreasePriority: input.onDecreasePriority,
198
+ onCommit: input.onCommit,
199
+ onCancel: input.onCancel,
200
+ onBeginEdit: input.onBeginEdit,
201
+ validator: val => input.validator(condition, val),
202
+ lookUpRequestCount: input.lookUpRequestCount
203
+ })}
204
+ </div>
205
+ `)}
206
+ </devtools-list>
207
+ `}
181
208
  `,
182
209
  // clang-format on
183
- target);
210
+ target, {container: {classes: (!input.enabled && input.conditions.length > 0) ? ['blocking-disabled'] : []}});
184
211
  };
185
212
 
186
- function renderItem(
187
- condition: SDK.NetworkManager.RequestCondition, editable: boolean, index: number,
188
- onToggle: (condition: SDK.NetworkManager.RequestCondition) => void,
189
- onConditionsChanged: (
190
- condition: SDK.NetworkManager.RequestCondition, conditions: SDK.NetworkManager.ThrottlingConditions) => void,
191
- onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
192
- onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
193
- lookUpRequestCount: (condition: SDK.NetworkManager.RequestCondition) => number): LitTemplate {
213
+ function renderItem({
214
+ condition,
215
+ editing,
216
+ editable,
217
+ index,
218
+ onToggle,
219
+ onConditionsChanged,
220
+ onIncreasePriority,
221
+ onDecreasePriority,
222
+ onCommit,
223
+ onCancel,
224
+ onBeginEdit,
225
+ validator,
226
+ lookUpRequestCount
227
+ }: {
228
+ condition: SDK.NetworkManager.RequestCondition,
229
+ editing: boolean,
230
+ editable: boolean,
231
+ index: number,
232
+ onToggle: (condition: SDK.NetworkManager.RequestCondition) => void,
233
+ onConditionsChanged:
234
+ (condition: SDK.NetworkManager.RequestCondition, conditions: SDK.NetworkManager.ThrottlingConditions) => void,
235
+ onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
236
+ onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => void,
237
+ onCommit: (condition: SDK.NetworkManager.RequestCondition, value: string) => void,
238
+ onCancel: (condition: SDK.NetworkManager.RequestCondition) => void,
239
+ onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => void,
240
+ validator: (value: string) => Common.UIString.LocalizedString | null,
241
+ lookUpRequestCount: (condition: SDK.NetworkManager.RequestCondition) => number,
242
+ }): LitTemplate {
194
243
  const {enabled, originalOrUpgradedURLPattern, constructorStringOrWildcardURL, wildcardURL} = condition;
195
244
  const toggle = (e: Event): void => {
196
245
  e.consume(true);
@@ -207,6 +256,25 @@ function renderItem(
207
256
  onDecreasePriority(condition);
208
257
  };
209
258
 
259
+ const onPromptActivate = (e: Event): void => {
260
+ if (!editable || editing) {
261
+ return;
262
+ }
263
+ onBeginEdit(condition);
264
+ e.consume(true);
265
+ };
266
+
267
+ const promptKeyDown = (e: Event): void => {
268
+ if (!editable || editing) {
269
+ return;
270
+ }
271
+ const keyboardEvent = e as KeyboardEvent;
272
+ if (keyboardEvent.key === 'Enter') {
273
+ onBeginEdit(condition);
274
+ e.consume(true);
275
+ }
276
+ };
277
+
210
278
  // clang-format off
211
279
  return html`
212
280
  <input class=blocked-url-checkbox
@@ -231,7 +299,7 @@ function renderItem(
231
299
  .jslogContext=${'increase-priority'}
232
300
  ?disabled=${!editable || !originalOrUpgradedURLPattern}
233
301
  @click=${moveDown}></devtools-button>
234
- ${originalOrUpgradedURLPattern ? html`
302
+ ${!editing && originalOrUpgradedURLPattern ? html`
235
303
  <devtools-tooltip variant=rich jslogcontext=url-pattern id=url-pattern-${index}>
236
304
  <div>hash: ${originalOrUpgradedURLPattern.hash}</div>
237
305
  <div>hostname: ${originalOrUpgradedURLPattern.hostname}</div>
@@ -244,14 +312,14 @@ function renderItem(
244
312
  <hr />
245
313
  ${learnMore()}
246
314
  </devtools-tooltip>` : nothing}
247
- ${wildcardURL ? html`
315
+ ${!editing && wildcardURL ? html`
248
316
  <devtools-icon name=warning-filled class="small warning" aria-details=url-pattern-warning-${index}>
249
317
  </devtools-icon>
250
318
  <devtools-tooltip variant=rich jslogcontext=url-pattern-warning id=url-pattern-warning-${index}>
251
319
  ${i18nString(UIStrings.patternWasUpgraded, {PH1: wildcardURL})}
252
320
  </devtools-tooltip>
253
321
  `: nothing}
254
- ${!originalOrUpgradedURLPattern ? html`
322
+ ${!editing && !originalOrUpgradedURLPattern ? html`
255
323
  <devtools-icon name=cross-circle-filled class=small aria-details=url-pattern-error-${index}>
256
324
  </devtools-icon>
257
325
  <devtools-tooltip variant=rich jslogcontext=url-pattern-warning id=url-pattern-error-${index}>
@@ -261,13 +329,22 @@ function renderItem(
261
329
  : i18nString(UIStrings.patternFailedToParse)}
262
330
  ${learnMore()}
263
331
  </devtools-tooltip>`: nothing}
264
- <div
265
- @click=${toggle}
266
- ?disabled=${!editable || !originalOrUpgradedURLPattern}
332
+ <devtools-prompt
333
+ @click=${onPromptActivate}
334
+ @keydown=${promptKeyDown}
335
+ @focus=${onPromptActivate}
336
+ tabindex=${ifDefined(editing ? undefined : 0)}
337
+ @commit=${(e: UI.TextPrompt.TextPromptElement.CommitEvent) => onCommit(condition, e.detail)}
338
+ @cancel=${() => onCancel(condition)}
339
+ ?disabled=${!editable}
340
+ placeholder=${i18nString(UIStrings.textEditPattern)}
341
+ value=${constructorStringOrWildcardURL}
342
+ ?editing=${editable && editing}
343
+ .validator=${validator}
267
344
  class=blocked-url-label
268
345
  aria-details=url-pattern-${index}>
269
346
  ${constructorStringOrWildcardURL}
270
- </div>
347
+ </devtools-prompt>
271
348
  <select
272
349
  class=conditions-selector
273
350
  title=${i18nString(UIStrings.requestConditionsLabel)}
@@ -293,9 +370,8 @@ interface AffectedCountViewInput {
293
370
  }
294
371
  type AffectedCountView = (input: AffectedCountViewInput, output: object, target: HTMLElement) => void;
295
372
  export const AFFECTED_COUNT_DEFAULT_VIEW: AffectedCountView = (input, output, target) => {
296
- render(
297
- html`${i18nString(UIStrings.dAffected, {PH1: input.count})}`, target,
298
- {container: {classes: ['blocked-url-count']}});
373
+ render(html`${i18nString(UIStrings.dAffected, {PH1: input.count})}`, target,
374
+ {container: {classes: ['blocked-url-count']}});
299
375
  };
300
376
 
301
377
  function matchesUrl(conditions: SDK.NetworkManager.RequestCondition, url: string): boolean {
@@ -338,9 +414,9 @@ export class AffectedCountWidget extends UI.Widget.Widget {
338
414
  }
339
415
 
340
416
  override wasShown(): void {
341
- SDK.TargetManager.TargetManager.instance().addModelListener(
342
- SDK.NetworkManager.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this.#onRequestFinished, this,
343
- {scoped: true});
417
+ SDK.TargetManager.TargetManager.instance().addModelListener(SDK.NetworkManager.NetworkManager,
418
+ SDK.NetworkManager.Events.RequestFinished,
419
+ this.#onRequestFinished, this, {scoped: true});
344
420
  Logs.NetworkLog.NetworkLog.instance().addEventListener(Logs.NetworkLog.Events.Reset, this.requestUpdate, this);
345
421
  super.wasShown();
346
422
  }
@@ -375,15 +451,13 @@ function learnMore(): LitTemplate {
375
451
  </devtools-link>`;
376
452
  }
377
453
 
378
- export class RequestConditionsDrawer extends UI.Widget.VBox implements
379
- UI.ListWidget.Delegate<SDK.NetworkManager.RequestCondition> {
454
+ export class RequestConditionsDrawer extends UI.Widget.VBox {
380
455
  private manager: SDK.NetworkManager.MultitargetNetworkManager;
381
- private readonly list: UI.ListWidget.ListWidget<SDK.NetworkManager.RequestCondition>;
382
- private editor: UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition>|null;
383
456
  private blockedCountForUrl: Map<Platform.DevToolsPath.UrlString, number>;
384
457
  #throttledCount = new Map<string, number>();
385
458
  #view: View;
386
- #listElements = new WeakMap<SDK.NetworkManager.RequestCondition, HTMLElement>();
459
+ #viewOutput: ViewOutput = {itemRefs: new Map()};
460
+ #editingCondition?: SDK.NetworkManager.RequestCondition;
387
461
 
388
462
  constructor(target?: HTMLElement, view = DEFAULT_VIEW) {
389
463
  super(target, {
@@ -393,187 +467,147 @@ export class RequestConditionsDrawer extends UI.Widget.VBox implements
393
467
  this.#view = view;
394
468
 
395
469
  this.manager = SDK.NetworkManager.MultitargetNetworkManager.instance();
396
- this.manager.addEventListener(
397
- SDK.NetworkManager.MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED, this.update, this);
398
-
399
- this.list = new UI.ListWidget.ListWidget(this);
400
- this.list.registerRequiredCSS(requestConditionsDrawerStyles);
401
- this.list.element.classList.add('blocked-urls');
402
-
403
- this.editor = null;
470
+ this.manager.addEventListener(SDK.NetworkManager.MultitargetNetworkManager.Events.BLOCKED_PATTERNS_CHANGED,
471
+ this.requestUpdate, this);
404
472
 
405
473
  this.blockedCountForUrl = new Map();
406
- SDK.TargetManager.TargetManager.instance().addModelListener(
407
- SDK.NetworkManager.NetworkManager, SDK.NetworkManager.Events.RequestFinished, this.onRequestFinished, this,
408
- {scoped: true});
474
+ SDK.TargetManager.TargetManager.instance().addModelListener(SDK.NetworkManager.NetworkManager,
475
+ SDK.NetworkManager.Events.RequestFinished,
476
+ this.onRequestFinished, this, {scoped: true});
409
477
 
410
- this.update();
478
+ this.requestUpdate();
411
479
  Logs.NetworkLog.NetworkLog.instance().addEventListener(Logs.NetworkLog.Events.Reset, this.onNetworkLogReset, this);
412
480
  }
413
481
 
414
482
  override performUpdate(): void {
483
+ this.#viewOutput.itemRefs.clear();
415
484
  const enabled = this.manager.requestConditions.conditionsEnabled;
416
- this.list.element.classList.toggle('blocking-disabled', !enabled && Boolean(this.manager.requestConditions.count));
485
+ const conditions = Array.from(this.manager.requestConditions.conditions);
486
+ if (this.#editingCondition && !conditions.includes(this.#editingCondition)) {
487
+ conditions.unshift(this.#editingCondition);
488
+ }
417
489
 
418
490
  const input: ViewInput = {
419
491
  addPattern: this.addPattern.bind(this),
420
492
  toggleEnabled: this.toggleEnabled.bind(this),
421
493
  enabled,
422
- list: this.list,
494
+ conditions,
495
+ editingCondition: this.#editingCondition,
496
+ onToggle: (condition: SDK.NetworkManager.RequestCondition) => {
497
+ if (enabled) {
498
+ condition.enabled = !condition.enabled;
499
+ }
500
+ },
501
+ onConditionsChanged:
502
+ (condition: SDK.NetworkManager.RequestCondition, conditions: SDK.NetworkManager.ThrottlingConditions) => {
503
+ if (enabled) {
504
+ condition.conditions = conditions;
505
+ }
506
+ },
507
+ onIncreasePriority: (condition: SDK.NetworkManager.RequestCondition) => {
508
+ if (enabled) {
509
+ UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedUp));
510
+ this.manager.requestConditions.increasePriority(condition);
511
+ }
512
+ },
513
+ onDecreasePriority: (condition: SDK.NetworkManager.RequestCondition) => {
514
+ if (enabled) {
515
+ UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedDown));
516
+ this.manager.requestConditions.decreasePriority(condition);
517
+ }
518
+ },
519
+ onBeginEdit: (condition: SDK.NetworkManager.RequestCondition) => {
520
+ if (this.#editingCondition) {
521
+ this.#cancelEdit(this.#editingCondition);
522
+ }
523
+ this.#editingCondition = condition;
524
+ this.requestUpdate();
525
+ },
526
+ onRemove: (condition: SDK.NetworkManager.RequestCondition) => {
527
+ this.manager.requestConditions.delete(condition);
528
+ UI.ARIAUtils.LiveAnnouncer.alert(UIStrings.itemDeleted);
529
+ },
530
+ onCommit: this.#commitEdit.bind(this),
531
+ onCancel: this.#cancelEdit.bind(this),
532
+ validator: this.#validator.bind(this),
533
+ lookUpRequestCount: this.#getRequestCount.bind(this),
423
534
  };
424
- this.#view(input, {}, this.contentElement);
535
+ this.#view(input, this.#viewOutput, this.contentElement);
425
536
  }
426
537
 
427
538
  addPattern(): void {
428
539
  this.manager.requestConditions.conditionsEnabled = true;
429
- this.list.addNewItem(
430
- 0,
431
- SDK.NetworkManager.RequestCondition.createFromSetting(
432
- {url: Platform.DevToolsPath.EmptyUrlString, enabled: true}));
540
+ if (this.#editingCondition) {
541
+ this.#cancelEdit(this.#editingCondition);
542
+ }
543
+ const condition = SDK.NetworkManager.RequestCondition.createFromSetting(
544
+ {url: Platform.DevToolsPath.EmptyUrlString, enabled: true});
545
+ this.#editingCondition = condition;
546
+ this.requestUpdate();
433
547
  }
434
548
 
435
549
  removeAllPatterns(): void {
436
550
  this.manager.requestConditions.clear();
437
551
  }
438
552
 
439
- renderItem(condition: SDK.NetworkManager.RequestCondition, editable: boolean, index: number): Element {
440
- const element = document.createElement('div');
441
- this.#listElements.set(condition, element);
442
- element.classList.add('blocked-url');
443
- this.updateItem(element, condition, editable, index);
444
- return element;
445
- }
446
-
447
- updateItem(element: HTMLElement, condition: SDK.NetworkManager.RequestCondition, editable: boolean, index: number):
448
- void {
449
- const onToggle = (condition: {enabled: boolean}): void => {
450
- if (editable) {
451
- condition.enabled = !condition.enabled;
452
- }
453
- };
454
-
455
- const onConditionsChanged =
456
- (condition: {conditions: SDK.NetworkManager.ThrottlingConditions},
457
- conditions: SDK.NetworkManager.ThrottlingConditions): void => {
458
- if (editable) {
459
- condition.conditions = conditions;
460
- }
461
- };
462
-
463
- const onIncreasePriority = (condition: SDK.NetworkManager.RequestCondition): void => {
464
- if (this.manager.requestConditions.conditionsEnabled) {
465
- UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedUp));
466
- this.manager.requestConditions.increasePriority(condition);
467
- }
468
- };
469
-
470
- const onDecreasePriority = (condition: SDK.NetworkManager.RequestCondition): void => {
471
- if (this.manager.requestConditions.conditionsEnabled) {
472
- UI.ARIAUtils.LiveAnnouncer.status(i18nString(UIStrings.patternMovedDown));
473
- this.manager.requestConditions.decreasePriority(condition);
474
- }
475
- };
476
-
477
- render(
478
- renderItem(
479
- condition, editable, index, onToggle, onConditionsChanged, onIncreasePriority, onDecreasePriority,
480
- this.#getRequestCount.bind(this)),
481
- element);
553
+ #validator(condition: SDK.NetworkManager.RequestCondition, value: string): Common.UIString.LocalizedString|null {
554
+ if (!value) {
555
+ return i18nString(UIStrings.patternInputCannotBeEmpty);
556
+ }
557
+ const parsedPattern =
558
+ SDK.NetworkManager.RequestURLPattern.create(value as SDK.NetworkManager.URLPatternConstructorString);
559
+ const stringToCheck = parsedPattern ? parsedPattern.constructorString : value;
560
+ const existingCondition = this.manager.requestConditions.findCondition(stringToCheck);
561
+ if (existingCondition && existingCondition !== condition) {
562
+ return i18nString(UIStrings.patternAlreadyExists);
563
+ }
564
+ const isValid = SDK.NetworkManager.RequestURLPattern.isValidPattern(value);
565
+ switch (isValid) {
566
+ case SDK.NetworkManager.RequestURLPatternValidity.FAILED_TO_PARSE:
567
+ return i18nString(UIStrings.patternFailedToParse);
568
+ case SDK.NetworkManager.RequestURLPatternValidity.HAS_REGEXP_GROUPS:
569
+ return i18nString(UIStrings.patternFailedWithRegExpGroups);
570
+ }
571
+ return null;
482
572
  }
483
573
 
484
574
  private toggleEnabled(): void {
485
575
  this.manager.requestConditions.conditionsEnabled = !this.manager.requestConditions.conditionsEnabled;
486
- this.update();
487
- }
488
-
489
- removeItemRequested(condition: SDK.NetworkManager.RequestCondition): void {
490
- this.manager.requestConditions.delete(condition);
491
- UI.ARIAUtils.LiveAnnouncer.alert(UIStrings.itemDeleted);
576
+ this.requestUpdate();
492
577
  }
493
578
 
494
- beginEdit(pattern: SDK.NetworkManager.RequestCondition): UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition> {
495
- this.editor = this.createEditor();
496
- this.editor.control('url').value = pattern.constructorStringOrWildcardURL;
497
- return this.editor;
498
- }
579
+ #commitEdit(condition: SDK.NetworkManager.RequestCondition, value: string): void {
580
+ if (this.#editingCondition !== condition) {
581
+ return;
582
+ }
499
583
 
500
- commitEdit(
501
- item: SDK.NetworkManager.RequestCondition, editor: UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition>,
502
- isNew: boolean): void {
503
- const constructorString = editor.control('url').value as SDK.NetworkManager.URLPatternConstructorString;
584
+ if (condition.constructorStringOrWildcardURL === value &&
585
+ Array.from(this.manager.requestConditions.conditions).includes(condition)) {
586
+ this.#editingCondition = undefined;
587
+ this.requestUpdate();
588
+ return;
589
+ }
590
+ const constructorString = value as SDK.NetworkManager.URLPatternConstructorString;
504
591
  const pattern = SDK.NetworkManager.RequestURLPattern.create(constructorString);
505
592
  if (!pattern) {
506
- throw new Error('Failed to parse pattern');
507
- }
508
- item.pattern = pattern;
509
- if (isNew) {
510
- this.manager.requestConditions.add(item);
593
+ return;
511
594
  }
512
- }
595
+ condition.pattern = pattern;
513
596
 
514
- private createEditor(): UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition> {
515
- if (this.editor) {
516
- return this.editor;
597
+ // If it's a new item, it isn't in the manager yet. Add it.
598
+ if (!Array.from(this.manager.requestConditions.conditions).includes(condition)) {
599
+ this.manager.requestConditions.add(condition);
517
600
  }
518
601
 
519
- const editor = new UI.ListWidget.Editor<SDK.NetworkManager.RequestCondition>();
520
- const content = editor.contentElement();
521
- const titles = content.createChild('div', 'blocked-url-edit-row');
522
- const label = titles.createChild('label');
523
- const learnMore = Link.create(PATTERN_API_DOCS_URL, i18nString(UIStrings.learnMore), undefined, 'learn-more');
524
- learnMore.title = i18nString(UIStrings.learnMoreLabel);
525
- titles.append('\xA0', learnMore);
526
- label.textContent = i18nString(UIStrings.textEditPattern);
527
- const fields = content.createChild('div', 'blocked-url-edit-row');
528
- const validator =
529
- (_item: SDK.NetworkManager.RequestCondition, _index: number, input: UI.ListWidget.EditorControl): {
530
- valid: boolean,
531
- errorMessage?: Common.UIString.LocalizedString,
532
- } => {
533
- if (!input.value) {
534
- return {errorMessage: i18nString(UIStrings.patternInputCannotBeEmpty), valid: false};
535
- }
536
- if (this.manager.requestConditions.has(input.value)) {
537
- return {errorMessage: i18nString(UIStrings.patternAlreadyExists), valid: false};
538
- }
539
- const isValid = SDK.NetworkManager.RequestURLPattern.isValidPattern(input.value);
540
- switch (isValid) {
541
- case SDK.NetworkManager.RequestURLPatternValidity.FAILED_TO_PARSE:
542
- return {errorMessage: i18nString(UIStrings.patternFailedToParse), valid: false};
543
- case SDK.NetworkManager.RequestURLPatternValidity.HAS_REGEXP_GROUPS:
544
- return {errorMessage: i18nString(UIStrings.patternFailedWithRegExpGroups), valid: false};
545
- }
546
- return {valid: true};
547
- };
548
- const urlInput = editor.createInput('url', 'text', '', validator);
549
- label.htmlFor = urlInput.id = 'editor-url-input';
550
- fields.createChild('div', 'blocked-url-edit-value').appendChild(urlInput);
551
- return editor;
602
+ this.#editingCondition = undefined;
603
+ this.requestUpdate();
552
604
  }
553
605
 
554
- update(): void {
555
- const enabled = this.manager.requestConditions.conditionsEnabled;
556
- const newItems = Array.from(this.manager.requestConditions.conditions);
557
-
558
- let oldIndex = 0;
559
- for (; oldIndex < newItems.length; ++oldIndex) {
560
- const pattern = newItems[oldIndex];
561
- this.list.updateItem(
562
- oldIndex,
563
- pattern,
564
- enabled,
565
- /* focusable=*/ false,
566
- {
567
- edit: i18nString(UIStrings.editPattern, {PH1: pattern.constructorStringOrWildcardURL}),
568
- delete: i18nString(UIStrings.removePattern, {PH1: pattern.constructorStringOrWildcardURL})
569
- },
570
- );
571
- }
572
-
573
- while (oldIndex < this.list.items.length) {
574
- this.list.removeItem(oldIndex);
606
+ #cancelEdit(condition: SDK.NetworkManager.RequestCondition): void {
607
+ if (this.#editingCondition === condition) {
608
+ this.#editingCondition = undefined;
609
+ this.requestUpdate();
575
610
  }
576
- this.requestUpdate();
577
611
  }
578
612
 
579
613
  #getRequestCount(condition: SDK.NetworkManager.RequestCondition): number {
@@ -628,11 +662,15 @@ export class RequestConditionsDrawer extends UI.Widget.VBox implements
628
662
  console.assert(!!drawer, 'Drawer not initialized');
629
663
  return;
630
664
  }
631
- const conditions = drawer.manager.requestConditions.conditions.find(
665
+ const condition = drawer.manager.requestConditions.conditions.find(
632
666
  condition => condition.ruleIds.has(appliedConditions.appliedNetworkConditionsId) &&
633
667
  condition.constructorString && condition.constructorString === appliedConditions.urlPattern);
634
- const element = (conditions && drawer.#listElements.get(conditions));
635
- element && PanelUtils.PanelUtils.highlightElement(element);
668
+ if (condition) {
669
+ const element = drawer.#viewOutput.itemRefs.get(condition);
670
+ if (element) {
671
+ PanelUtils.PanelUtils.highlightElement(element);
672
+ }
673
+ }
636
674
  }
637
675
  }
638
676
 
@@ -412,7 +412,7 @@ function renderHeaderOverridesLink(input: ViewInput): Lit.LitTemplate {
412
412
  class="link devtools-link"
413
413
  jslogcontext="devtools-override"
414
414
  >
415
- <devtools-icon name="help" class="inline-icon medium">
415
+ <devtools-icon name="help" class="inline-icon">
416
416
  </devtools-icon>
417
417
  </devtools-link>
418
418
  <devtools-link
@@ -424,7 +424,7 @@ function renderHeaderOverridesLink(input: ViewInput): Lit.LitTemplate {
424
424
  ${fileIcon}${Persistence.NetworkPersistenceManager.HEADERS_FILENAME}
425
425
  </devtools-link>
426
426
  `;
427
- // clang-format on
427
+ // clang-format on
428
428
  }
429
429
 
430
430
  function renderRawHeaders(text: string): Lit.TemplateResult {
@@ -153,6 +153,7 @@ devtools-link {
153
153
 
154
154
  devtools-link .inline-icon {
155
155
  padding-right: 3px;
156
+ vertical-align: middle;
156
157
  }
157
158
 
158
159
  .purple.dot::before {
@@ -17,5 +17,9 @@ devtools-header-section-row:first-of-type {
17
17
  }
18
18
 
19
19
  .add-header-button {
20
- margin: -4px 0 10px 5px;
20
+ margin: var(--sys-size-5) 0 var(--sys-size-5) var(--sys-size-4);
21
+ }
22
+
23
+ devtools-header-section-row + .add-header-button {
24
+ margin-top: calc(-1 * var(--sys-size-3));
21
25
  }
@@ -58,6 +58,9 @@
58
58
  overflow: hidden;
59
59
  flex: auto;
60
60
  padding: 0 3px;
61
+ cursor: text;
62
+
63
+ --devtools-text-prompt-min-width: 6em;
61
64
  }
62
65
 
63
66
  .blocked-url-edit-row {