brave-real-puppeteer-core 24.26.1 → 24.33.0

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 (436) hide show
  1. package/README.md +5 -5
  2. package/advanced-stealth.js +1 -1
  3. package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  4. package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  5. package/lib/cjs/puppeteer/api/BluetoothEmulation.js +8 -0
  6. package/lib/cjs/puppeteer/api/BluetoothEmulation.js.map +1 -0
  7. package/lib/cjs/puppeteer/api/Browser.d.ts +111 -2
  8. package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  9. package/lib/cjs/puppeteer/api/Browser.js +4 -2
  10. package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  11. package/lib/cjs/puppeteer/api/BrowserContext.d.ts +5 -3
  12. package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
  13. package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
  14. package/lib/cjs/puppeteer/api/CDPSession.d.ts.map +1 -1
  15. package/lib/cjs/puppeteer/api/CDPSession.js.map +1 -1
  16. package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts +62 -0
  17. package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -0
  18. package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js +38 -0
  19. package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js.map +1 -0
  20. package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  21. package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  22. package/lib/cjs/puppeteer/api/Frame.d.ts +1 -1
  23. package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
  24. package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
  25. package/lib/cjs/puppeteer/api/Page.d.ts +39 -5
  26. package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  27. package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  28. package/lib/cjs/puppeteer/api/api.d.ts +2 -0
  29. package/lib/cjs/puppeteer/api/api.d.ts.map +1 -1
  30. package/lib/cjs/puppeteer/api/api.js +1 -0
  31. package/lib/cjs/puppeteer/api/api.js.map +1 -1
  32. package/lib/cjs/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  33. package/lib/cjs/puppeteer/bidi/BidiOverCdp.js +1 -1
  34. package/lib/cjs/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  35. package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  36. package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  37. package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js +42 -0
  38. package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  39. package/lib/cjs/puppeteer/bidi/Browser.d.ts +6 -1
  40. package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
  41. package/lib/cjs/puppeteer/bidi/Browser.js +16 -0
  42. package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
  43. package/lib/cjs/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
  44. package/lib/cjs/puppeteer/bidi/BrowserConnector.js +4 -3
  45. package/lib/cjs/puppeteer/bidi/BrowserConnector.js.map +1 -1
  46. package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +3 -3
  47. package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  48. package/lib/cjs/puppeteer/bidi/BrowserContext.js +6 -3
  49. package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
  50. package/lib/cjs/puppeteer/bidi/Connection.d.ts +2 -1
  51. package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
  52. package/lib/cjs/puppeteer/bidi/Connection.js +3 -2
  53. package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
  54. package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  55. package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  56. package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js +90 -0
  57. package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  58. package/lib/cjs/puppeteer/bidi/Frame.d.ts +3 -1
  59. package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  60. package/lib/cjs/puppeteer/bidi/Frame.js +3 -2
  61. package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  62. package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +0 -1
  63. package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  64. package/lib/cjs/puppeteer/bidi/HTTPRequest.js +0 -25
  65. package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
  66. package/lib/cjs/puppeteer/bidi/Page.d.ts +10 -8
  67. package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  68. package/lib/cjs/puppeteer/bidi/Page.js +63 -47
  69. package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  70. package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +8 -0
  71. package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  72. package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +55 -2
  73. package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  74. package/lib/cjs/puppeteer/bidi/core/Connection.d.ts.map +1 -1
  75. package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +1 -12
  76. package/lib/cjs/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  77. package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
  78. package/lib/cjs/puppeteer/bidi/util.js +7 -0
  79. package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
  80. package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +6 -0
  81. package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  82. package/lib/cjs/puppeteer/cdp/Accessibility.js +11 -3
  83. package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  84. package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  85. package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  86. package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js +30 -0
  87. package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  88. package/lib/cjs/puppeteer/cdp/Browser.d.ts +10 -5
  89. package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  90. package/lib/cjs/puppeteer/cdp/Browser.js +61 -8
  91. package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  92. package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  93. package/lib/cjs/puppeteer/cdp/BrowserConnector.js +4 -2
  94. package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
  95. package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +3 -2
  96. package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  97. package/lib/cjs/puppeteer/cdp/BrowserContext.js +4 -4
  98. package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
  99. package/lib/cjs/puppeteer/cdp/CdpSession.d.ts +1 -1
  100. package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  101. package/lib/cjs/puppeteer/cdp/CdpSession.js +2 -1
  102. package/lib/cjs/puppeteer/cdp/CdpSession.js.map +1 -1
  103. package/lib/cjs/puppeteer/cdp/Connection.d.ts +6 -1
  104. package/lib/cjs/puppeteer/cdp/Connection.d.ts.map +1 -1
  105. package/lib/cjs/puppeteer/cdp/Connection.js +11 -2
  106. package/lib/cjs/puppeteer/cdp/Connection.js.map +1 -1
  107. package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts +5 -64
  108. package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  109. package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js +10 -76
  110. package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  111. package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts +1 -0
  112. package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
  113. package/lib/cjs/puppeteer/cdp/EmulationManager.js +22 -0
  114. package/lib/cjs/puppeteer/cdp/EmulationManager.js.map +1 -1
  115. package/lib/cjs/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  116. package/lib/cjs/puppeteer/cdp/ExtensionTransport.js +5 -1
  117. package/lib/cjs/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  118. package/lib/cjs/puppeteer/cdp/Frame.d.ts +1 -1
  119. package/lib/cjs/puppeteer/cdp/Frame.d.ts.map +1 -1
  120. package/lib/cjs/puppeteer/cdp/Frame.js.map +1 -1
  121. package/lib/cjs/puppeteer/cdp/FrameManager.d.ts +2 -2
  122. package/lib/cjs/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  123. package/lib/cjs/puppeteer/cdp/FrameManager.js +1 -1
  124. package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
  125. package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  126. package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  127. package/lib/cjs/puppeteer/cdp/HTTPRequest.js +4 -1
  128. package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
  129. package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
  130. package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
  131. package/lib/cjs/puppeteer/cdp/NetworkEventManager.js +8 -0
  132. package/lib/cjs/puppeteer/cdp/NetworkEventManager.js.map +1 -1
  133. package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  134. package/lib/cjs/puppeteer/cdp/NetworkManager.js +25 -1
  135. package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
  136. package/lib/cjs/puppeteer/cdp/Page.d.ts +9 -4
  137. package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  138. package/lib/cjs/puppeteer/cdp/Page.js +29 -6
  139. package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  140. package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
  141. package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  142. package/lib/cjs/puppeteer/cdp/TargetManager.js +29 -27
  143. package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
  144. package/lib/cjs/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  145. package/lib/cjs/puppeteer/cdp/WebWorker.js +8 -3
  146. package/lib/cjs/puppeteer/cdp/WebWorker.js.map +1 -1
  147. package/lib/cjs/puppeteer/cdp/cdp.d.ts +1 -0
  148. package/lib/cjs/puppeteer/cdp/cdp.d.ts.map +1 -1
  149. package/lib/cjs/puppeteer/cdp/cdp.js +1 -0
  150. package/lib/cjs/puppeteer/cdp/cdp.js.map +1 -1
  151. package/lib/cjs/puppeteer/common/BrowserConnector.js +47 -3
  152. package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  153. package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +2 -0
  154. package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  155. package/lib/cjs/puppeteer/common/CallbackRegistry.js +4 -3
  156. package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
  157. package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +22 -0
  158. package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  159. package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +8 -1
  160. package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  161. package/lib/cjs/puppeteer/common/ConsoleMessage.js +11 -1
  162. package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
  163. package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
  164. package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  165. package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +4 -0
  166. package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  167. package/lib/cjs/puppeteer/node/BrowserLauncher.js +10 -4
  168. package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
  169. package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts +1 -1
  170. package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  171. package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -13
  172. package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  173. package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +5 -3
  174. package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  175. package/lib/cjs/puppeteer/node/LaunchOptions.js +17 -0
  176. package/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -1
  177. package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  178. package/lib/cjs/puppeteer/revisions.js +3 -3
  179. package/lib/cjs/puppeteer/revisions.js.map +1 -1
  180. package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  181. package/lib/cjs/puppeteer/util/disposable.d.ts +2 -2
  182. package/lib/cjs/puppeteer/util/disposable.d.ts.map +1 -1
  183. package/lib/cjs/puppeteer/util/disposable.js +3 -1
  184. package/lib/cjs/puppeteer/util/disposable.js.map +1 -1
  185. package/lib/cjs/puppeteer/util/util.d.ts +1 -0
  186. package/lib/cjs/puppeteer/util/util.d.ts.map +1 -1
  187. package/lib/cjs/puppeteer/util/util.js +1 -0
  188. package/lib/cjs/puppeteer/util/util.js.map +1 -1
  189. package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  190. package/lib/cjs/puppeteer/util/version.js +1 -1
  191. package/lib/es5-iife/puppeteer-core-browser.d.ts +297 -19
  192. package/lib/es5-iife/puppeteer-core-browser.js +456 -215
  193. package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts +96 -0
  194. package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
  195. package/lib/esm/puppeteer/api/BluetoothEmulation.js +7 -0
  196. package/lib/esm/puppeteer/api/BluetoothEmulation.js.map +1 -0
  197. package/lib/esm/puppeteer/api/Browser.d.ts +111 -2
  198. package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  199. package/lib/esm/puppeteer/api/Browser.js +4 -2
  200. package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  201. package/lib/esm/puppeteer/api/BrowserContext.d.ts +5 -3
  202. package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
  203. package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
  204. package/lib/esm/puppeteer/api/CDPSession.d.ts.map +1 -1
  205. package/lib/esm/puppeteer/api/CDPSession.js.map +1 -1
  206. package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts +62 -0
  207. package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -0
  208. package/lib/esm/puppeteer/api/DeviceRequestPrompt.js +34 -0
  209. package/lib/esm/puppeteer/api/DeviceRequestPrompt.js.map +1 -0
  210. package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  211. package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  212. package/lib/esm/puppeteer/api/Frame.d.ts +1 -1
  213. package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
  214. package/lib/esm/puppeteer/api/Frame.js.map +1 -1
  215. package/lib/esm/puppeteer/api/Input.d.ts +1 -1
  216. package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
  217. package/lib/esm/puppeteer/api/Page.d.ts +39 -5
  218. package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  219. package/lib/esm/puppeteer/api/Page.js.map +1 -1
  220. package/lib/esm/puppeteer/api/api.d.ts +2 -0
  221. package/lib/esm/puppeteer/api/api.d.ts.map +1 -1
  222. package/lib/esm/puppeteer/api/api.js +1 -0
  223. package/lib/esm/puppeteer/api/api.js.map +1 -1
  224. package/lib/esm/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  225. package/lib/esm/puppeteer/bidi/BidiOverCdp.js +1 -1
  226. package/lib/esm/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  227. package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
  228. package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
  229. package/lib/esm/puppeteer/bidi/BluetoothEmulation.js +38 -0
  230. package/lib/esm/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
  231. package/lib/esm/puppeteer/bidi/Browser.d.ts +6 -1
  232. package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
  233. package/lib/esm/puppeteer/bidi/Browser.js +16 -0
  234. package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
  235. package/lib/esm/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
  236. package/lib/esm/puppeteer/bidi/BrowserConnector.js +4 -3
  237. package/lib/esm/puppeteer/bidi/BrowserConnector.js.map +1 -1
  238. package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +3 -3
  239. package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
  240. package/lib/esm/puppeteer/bidi/BrowserContext.js +6 -3
  241. package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
  242. package/lib/esm/puppeteer/bidi/Connection.d.ts +2 -1
  243. package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
  244. package/lib/esm/puppeteer/bidi/Connection.js +3 -2
  245. package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
  246. package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
  247. package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
  248. package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js +85 -0
  249. package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
  250. package/lib/esm/puppeteer/bidi/Frame.d.ts +3 -1
  251. package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  252. package/lib/esm/puppeteer/bidi/Frame.js +3 -2
  253. package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  254. package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +0 -1
  255. package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  256. package/lib/esm/puppeteer/bidi/HTTPRequest.js +0 -25
  257. package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
  258. package/lib/esm/puppeteer/bidi/Page.d.ts +10 -8
  259. package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  260. package/lib/esm/puppeteer/bidi/Page.js +64 -48
  261. package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  262. package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +8 -0
  263. package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  264. package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +55 -2
  265. package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  266. package/lib/esm/puppeteer/bidi/core/Connection.d.ts.map +1 -1
  267. package/lib/esm/puppeteer/bidi/core/Realm.d.ts +1 -12
  268. package/lib/esm/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  269. package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
  270. package/lib/esm/puppeteer/bidi/util.js +7 -0
  271. package/lib/esm/puppeteer/bidi/util.js.map +1 -1
  272. package/lib/esm/puppeteer/cdp/Accessibility.d.ts +6 -0
  273. package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
  274. package/lib/esm/puppeteer/cdp/Accessibility.js +11 -3
  275. package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  276. package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
  277. package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
  278. package/lib/esm/puppeteer/cdp/BluetoothEmulation.js +26 -0
  279. package/lib/esm/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
  280. package/lib/esm/puppeteer/cdp/Browser.d.ts +10 -5
  281. package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  282. package/lib/esm/puppeteer/cdp/Browser.js +61 -8
  283. package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  284. package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
  285. package/lib/esm/puppeteer/cdp/BrowserConnector.js +4 -2
  286. package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
  287. package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +3 -2
  288. package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
  289. package/lib/esm/puppeteer/cdp/BrowserContext.js +4 -4
  290. package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
  291. package/lib/esm/puppeteer/cdp/CdpSession.d.ts +1 -1
  292. package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
  293. package/lib/esm/puppeteer/cdp/CdpSession.js +2 -1
  294. package/lib/esm/puppeteer/cdp/CdpSession.js.map +1 -1
  295. package/lib/esm/puppeteer/cdp/Connection.d.ts +6 -1
  296. package/lib/esm/puppeteer/cdp/Connection.d.ts.map +1 -1
  297. package/lib/esm/puppeteer/cdp/Connection.js +11 -2
  298. package/lib/esm/puppeteer/cdp/Connection.js.map +1 -1
  299. package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts +5 -64
  300. package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
  301. package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js +7 -72
  302. package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
  303. package/lib/esm/puppeteer/cdp/EmulationManager.d.ts +1 -0
  304. package/lib/esm/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
  305. package/lib/esm/puppeteer/cdp/EmulationManager.js +22 -0
  306. package/lib/esm/puppeteer/cdp/EmulationManager.js.map +1 -1
  307. package/lib/esm/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
  308. package/lib/esm/puppeteer/cdp/ExtensionTransport.js +5 -1
  309. package/lib/esm/puppeteer/cdp/ExtensionTransport.js.map +1 -1
  310. package/lib/esm/puppeteer/cdp/Frame.d.ts +1 -1
  311. package/lib/esm/puppeteer/cdp/Frame.d.ts.map +1 -1
  312. package/lib/esm/puppeteer/cdp/Frame.js.map +1 -1
  313. package/lib/esm/puppeteer/cdp/FrameManager.d.ts +2 -2
  314. package/lib/esm/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  315. package/lib/esm/puppeteer/cdp/FrameManager.js +2 -2
  316. package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
  317. package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
  318. package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
  319. package/lib/esm/puppeteer/cdp/HTTPRequest.js +4 -1
  320. package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
  321. package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
  322. package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
  323. package/lib/esm/puppeteer/cdp/NetworkEventManager.js +8 -0
  324. package/lib/esm/puppeteer/cdp/NetworkEventManager.js.map +1 -1
  325. package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
  326. package/lib/esm/puppeteer/cdp/NetworkManager.js +25 -1
  327. package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
  328. package/lib/esm/puppeteer/cdp/Page.d.ts +9 -4
  329. package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  330. package/lib/esm/puppeteer/cdp/Page.js +29 -6
  331. package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  332. package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
  333. package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
  334. package/lib/esm/puppeteer/cdp/TargetManager.js +30 -28
  335. package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
  336. package/lib/esm/puppeteer/cdp/WebWorker.d.ts.map +1 -1
  337. package/lib/esm/puppeteer/cdp/WebWorker.js +8 -3
  338. package/lib/esm/puppeteer/cdp/WebWorker.js.map +1 -1
  339. package/lib/esm/puppeteer/cdp/cdp.d.ts +1 -0
  340. package/lib/esm/puppeteer/cdp/cdp.d.ts.map +1 -1
  341. package/lib/esm/puppeteer/cdp/cdp.js +1 -0
  342. package/lib/esm/puppeteer/cdp/cdp.js.map +1 -1
  343. package/lib/esm/puppeteer/common/BrowserConnector.js +48 -4
  344. package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  345. package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +2 -0
  346. package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  347. package/lib/esm/puppeteer/common/CallbackRegistry.js +4 -3
  348. package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
  349. package/lib/esm/puppeteer/common/ConnectOptions.d.ts +22 -0
  350. package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  351. package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +8 -1
  352. package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  353. package/lib/esm/puppeteer/common/ConsoleMessage.js +11 -1
  354. package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
  355. package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
  356. package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +4 -0
  357. package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  358. package/lib/esm/puppeteer/node/BrowserLauncher.js +10 -4
  359. package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
  360. package/lib/esm/puppeteer/node/ChromeLauncher.d.ts +1 -1
  361. package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  362. package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -13
  363. package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  364. package/lib/esm/puppeteer/node/LaunchOptions.d.ts +5 -3
  365. package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  366. package/lib/esm/puppeteer/node/LaunchOptions.js +16 -1
  367. package/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -1
  368. package/lib/esm/puppeteer/revisions.d.ts +3 -3
  369. package/lib/esm/puppeteer/revisions.js +3 -3
  370. package/lib/esm/puppeteer/revisions.js.map +1 -1
  371. package/lib/esm/puppeteer/util/disposable.d.ts +2 -2
  372. package/lib/esm/puppeteer/util/disposable.d.ts.map +1 -1
  373. package/lib/esm/puppeteer/util/disposable.js +2 -2
  374. package/lib/esm/puppeteer/util/disposable.js.map +1 -1
  375. package/lib/esm/puppeteer/util/util.d.ts +1 -0
  376. package/lib/esm/puppeteer/util/util.d.ts.map +1 -1
  377. package/lib/esm/puppeteer/util/util.js +1 -0
  378. package/lib/esm/puppeteer/util/util.js.map +1 -1
  379. package/lib/esm/puppeteer/util/version.d.ts +1 -1
  380. package/lib/esm/puppeteer/util/version.js +1 -1
  381. package/lib/types.d.ts +297 -19
  382. package/package.json +15 -15
  383. package/src/api/BluetoothEmulation.ts +103 -0
  384. package/src/api/Browser.ts +130 -3
  385. package/src/api/BrowserContext.ts +10 -3
  386. package/src/api/CDPSession.ts +1 -2
  387. package/src/api/DeviceRequestPrompt.ts +71 -0
  388. package/src/api/ElementHandle.ts +2 -4
  389. package/src/api/Frame.ts +3 -5
  390. package/src/api/Page.ts +46 -9
  391. package/src/api/api.ts +2 -0
  392. package/src/bidi/BidiOverCdp.ts +1 -0
  393. package/src/bidi/BluetoothEmulation.ts +52 -0
  394. package/src/bidi/Browser.ts +28 -0
  395. package/src/bidi/BrowserConnector.ts +8 -1
  396. package/src/bidi/BrowserContext.ts +9 -6
  397. package/src/bidi/Connection.ts +4 -1
  398. package/src/bidi/DeviceRequestPrompt.ts +138 -0
  399. package/src/bidi/Frame.ts +7 -3
  400. package/src/bidi/HTTPRequest.ts +0 -41
  401. package/src/bidi/Page.ts +86 -71
  402. package/src/bidi/core/BrowsingContext.ts +80 -2
  403. package/src/bidi/core/Connection.ts +3 -2
  404. package/src/bidi/util.ts +8 -0
  405. package/src/cdp/Accessibility.ts +17 -3
  406. package/src/cdp/BluetoothEmulation.ts +47 -0
  407. package/src/cdp/Browser.ts +95 -10
  408. package/src/cdp/BrowserConnector.ts +4 -0
  409. package/src/cdp/BrowserContext.ts +5 -4
  410. package/src/cdp/CdpSession.ts +3 -2
  411. package/src/cdp/Connection.ts +15 -1
  412. package/src/cdp/DeviceRequestPrompt.ts +8 -79
  413. package/src/cdp/EmulationManager.ts +30 -0
  414. package/src/cdp/ExtensionTransport.ts +5 -1
  415. package/src/cdp/Frame.ts +3 -5
  416. package/src/cdp/FrameManager.ts +9 -4
  417. package/src/cdp/HTTPRequest.ts +5 -1
  418. package/src/cdp/NetworkEventManager.ts +16 -1
  419. package/src/cdp/NetworkManager.ts +31 -1
  420. package/src/cdp/Page.ts +48 -13
  421. package/src/cdp/TargetManager.ts +36 -43
  422. package/src/cdp/WebWorker.ts +8 -3
  423. package/src/cdp/cdp.ts +1 -0
  424. package/src/common/BrowserConnector.ts +67 -4
  425. package/src/common/CallbackRegistry.ts +7 -5
  426. package/src/common/ConnectOptions.ts +28 -0
  427. package/src/common/ConsoleMessage.ts +14 -0
  428. package/src/common/EventEmitter.ts +3 -3
  429. package/src/node/BrowserLauncher.ts +22 -1
  430. package/src/node/ChromeLauncher.ts +5 -17
  431. package/src/node/LaunchOptions.ts +23 -7
  432. package/src/revisions.ts +3 -3
  433. package/src/util/disposable.ts +2 -2
  434. package/src/util/util.ts +1 -0
  435. package/src/util/version.ts +1 -1
  436. package/src/templates/version.ts.tmpl +0 -4
@@ -3048,7 +3048,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
3048
3048
  */
3049
3049
  // If moved update release-please config
3050
3050
  // x-release-please-start-version
3051
- const packageVersion = '24.26.1';
3051
+ const packageVersion = '24.33.0';
3052
3052
  // x-release-please-end
3053
3053
 
3054
3054
  /**
@@ -3833,12 +3833,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
3833
3833
  * returns all {@link Page | pages} in all
3834
3834
  * {@link BrowserContext | browser contexts}.
3835
3835
  *
3836
+ * @param includeAll - experimental, setting to true includes all kinds of pages.
3837
+ *
3836
3838
  * @remarks Non-visible {@link Page | pages}, such as `"background_page"`,
3837
3839
  * will not be listed here. You can find them using {@link Target.page}.
3838
3840
  */
3839
- async pages() {
3841
+ async pages(includeAll = false) {
3840
3842
  const contextPages = await Promise.all(this.browserContexts().map(context => {
3841
- return context.pages();
3843
+ return context.pages(includeAll);
3842
3844
  }));
3843
3845
  // Flatten array.
3844
3846
  return contextPages.reduce((acc, x) => {
@@ -4322,6 +4324,42 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
4322
4324
  }
4323
4325
  }
4324
4326
 
4327
+ /**
4328
+ * @license
4329
+ * Copyright 2025 Google Inc.
4330
+ * SPDX-License-Identifier: Apache-2.0
4331
+ */
4332
+ /**
4333
+ * Device request prompts let you respond to the page requesting for a device
4334
+ * through an API like WebBluetooth.
4335
+ *
4336
+ * @remarks
4337
+ * `DeviceRequestPrompt` instances are returned via the
4338
+ * {@link Page.waitForDevicePrompt} method.
4339
+ *
4340
+ * @example
4341
+ *
4342
+ * ```ts
4343
+ * const [devicePrompt] = Promise.all([
4344
+ * page.waitForDevicePrompt(),
4345
+ * page.click('#connect-bluetooth'),
4346
+ * ]);
4347
+ * await devicePrompt.select(
4348
+ * await devicePrompt.waitForDevice(({name}) => name.includes('My Device')),
4349
+ * );
4350
+ * ```
4351
+ *
4352
+ * @public
4353
+ */
4354
+ class DeviceRequestPrompt {
4355
+ constructor() {
4356
+ /**
4357
+ * Current list of selectable devices.
4358
+ */
4359
+ _defineProperty(this, "devices", []);
4360
+ }
4361
+ }
4362
+
4325
4363
  /**
4326
4364
  * @license
4327
4365
  * Copyright 2017 Google Inc.
@@ -12715,8 +12753,13 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
12715
12753
  if (!frame) {
12716
12754
  return;
12717
12755
  }
12718
- const iframeSnapshot = await frame.accessibility.snapshot(options);
12719
- root.iframeSnapshot = iframeSnapshot ?? undefined;
12756
+ try {
12757
+ const iframeSnapshot = await frame.accessibility.snapshot(options);
12758
+ root.iframeSnapshot = iframeSnapshot ?? undefined;
12759
+ } catch (error) {
12760
+ // Frames can get detached at any time resulting in errors.
12761
+ debugError(error);
12762
+ }
12720
12763
  } catch (e_1) {
12721
12764
  env_1.error = e_1;
12722
12765
  env_1.hasError = true;
@@ -12975,7 +13018,8 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
12975
13018
  } finally {
12976
13019
  __disposeResources$4(env_2);
12977
13020
  }
12978
- }
13021
+ },
13022
+ backendNodeId: this.payload.backendDOMNodeId
12979
13023
  };
12980
13024
  const userStringProperties = ['name', 'value', 'description', 'keyshortcuts', 'roledescription', 'valuetext', 'url'];
12981
13025
  const getUserStringPropertyValue = key => {
@@ -12999,7 +13043,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
12999
13043
  continue;
13000
13044
  }
13001
13045
  const value = getBooleanPropertyValue(booleanProperty);
13002
- if (!value) {
13046
+ if (value === undefined) {
13003
13047
  continue;
13004
13048
  }
13005
13049
  node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
@@ -13240,6 +13284,33 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13240
13284
  }
13241
13285
  }
13242
13286
 
13287
+ /**
13288
+ * @internal
13289
+ */
13290
+ var _connection = /*#__PURE__*/new WeakMap();
13291
+ class CdpBluetoothEmulation {
13292
+ constructor(connection) {
13293
+ _classPrivateFieldInitSpec(this, _connection, void 0);
13294
+ _classPrivateFieldSet(_connection, this, connection);
13295
+ }
13296
+ async emulateAdapter(state, leSupported = true) {
13297
+ // Bluetooth spec requires overriding the existing adapter (step 6). From the CDP
13298
+ // perspective, it means disabling the emulation first.
13299
+ // https://webbluetoothcg.github.io/web-bluetooth/#bluetooth-simulateAdapter-command
13300
+ await _classPrivateFieldGet(_connection, this).send('BluetoothEmulation.disable');
13301
+ await _classPrivateFieldGet(_connection, this).send('BluetoothEmulation.enable', {
13302
+ state,
13303
+ leSupported
13304
+ });
13305
+ }
13306
+ async disableEmulation() {
13307
+ await _classPrivateFieldGet(_connection, this).send('BluetoothEmulation.disable');
13308
+ }
13309
+ async simulatePreconnectedPeripheral(preconnectedPeripheral) {
13310
+ await _classPrivateFieldGet(_connection, this).send('BluetoothEmulation.simulatePreconnectedPeripheral', preconnectedPeripheral);
13311
+ }
13312
+ }
13313
+
13243
13314
  /**
13244
13315
  * @license
13245
13316
  * Copyright 2020 Google Inc.
@@ -13254,21 +13325,24 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13254
13325
  var _args2 = /*#__PURE__*/new WeakMap();
13255
13326
  var _stackTraceLocations = /*#__PURE__*/new WeakMap();
13256
13327
  var _frame = /*#__PURE__*/new WeakMap();
13328
+ var _rawStackTrace = /*#__PURE__*/new WeakMap();
13257
13329
  class ConsoleMessage {
13258
13330
  /**
13259
13331
  * @internal
13260
13332
  */
13261
- constructor(type, text, args, stackTraceLocations, frame) {
13333
+ constructor(type, text, args, stackTraceLocations, frame, rawStackTrace) {
13262
13334
  _classPrivateFieldInitSpec(this, _type2, void 0);
13263
13335
  _classPrivateFieldInitSpec(this, _text, void 0);
13264
13336
  _classPrivateFieldInitSpec(this, _args2, void 0);
13265
13337
  _classPrivateFieldInitSpec(this, _stackTraceLocations, void 0);
13266
13338
  _classPrivateFieldInitSpec(this, _frame, void 0);
13339
+ _classPrivateFieldInitSpec(this, _rawStackTrace, void 0);
13267
13340
  _classPrivateFieldSet(_type2, this, type);
13268
13341
  _classPrivateFieldSet(_text, this, text);
13269
13342
  _classPrivateFieldSet(_args2, this, args);
13270
13343
  _classPrivateFieldSet(_stackTraceLocations, this, stackTraceLocations);
13271
13344
  _classPrivateFieldSet(_frame, this, frame);
13345
+ _classPrivateFieldSet(_rawStackTrace, this, rawStackTrace);
13272
13346
  }
13273
13347
  /**
13274
13348
  * The type of the console message.
@@ -13302,6 +13376,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13302
13376
  stackTrace() {
13303
13377
  return _classPrivateFieldGet(_stackTraceLocations, this);
13304
13378
  }
13379
+ /**
13380
+ * The underlying protocol stack trace if available.
13381
+ *
13382
+ * @internal
13383
+ */
13384
+ _rawStackTrace() {
13385
+ return _classPrivateFieldGet(_rawStackTrace, this);
13386
+ }
13305
13387
  }
13306
13388
 
13307
13389
  /**
@@ -13409,7 +13491,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13409
13491
  * Copyright 2023 Google Inc.
13410
13492
  * SPDX-License-Identifier: Apache-2.0
13411
13493
  */
13412
- const idGenerator = createIncrementalIdGenerator();
13413
13494
  /**
13414
13495
  * Manages callbacks and their IDs for the protocol request/response communication.
13415
13496
  *
@@ -13418,9 +13499,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13418
13499
  var _callbacks = /*#__PURE__*/new WeakMap();
13419
13500
  var _idGenerator = /*#__PURE__*/new WeakMap();
13420
13501
  class CallbackRegistry {
13421
- constructor() {
13502
+ constructor(idGenerator) {
13422
13503
  _classPrivateFieldInitSpec(this, _callbacks, new Map());
13423
- _classPrivateFieldInitSpec(this, _idGenerator, idGenerator);
13504
+ _classPrivateFieldInitSpec(this, _idGenerator, void 0);
13505
+ _classPrivateFieldSet(_idGenerator, this, idGenerator);
13424
13506
  }
13425
13507
  create(label, timeout, request) {
13426
13508
  const callback = new Callback(_classPrivateFieldGet(_idGenerator, this).call(this), label, timeout);
@@ -13549,7 +13631,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13549
13631
  var _sessionId = /*#__PURE__*/new WeakMap();
13550
13632
  var _targetType = /*#__PURE__*/new WeakMap();
13551
13633
  var _callbacks2 = /*#__PURE__*/new WeakMap();
13552
- var _connection = /*#__PURE__*/new WeakMap();
13634
+ var _connection2 = /*#__PURE__*/new WeakMap();
13553
13635
  var _parentSessionId = /*#__PURE__*/new WeakMap();
13554
13636
  var _target = /*#__PURE__*/new WeakMap();
13555
13637
  var _rawErrors = /*#__PURE__*/new WeakMap();
@@ -13562,14 +13644,15 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13562
13644
  super();
13563
13645
  _classPrivateFieldInitSpec(this, _sessionId, void 0);
13564
13646
  _classPrivateFieldInitSpec(this, _targetType, void 0);
13565
- _classPrivateFieldInitSpec(this, _callbacks2, new CallbackRegistry());
13566
- _classPrivateFieldInitSpec(this, _connection, void 0);
13647
+ _classPrivateFieldInitSpec(this, _callbacks2, void 0);
13648
+ _classPrivateFieldInitSpec(this, _connection2, void 0);
13567
13649
  _classPrivateFieldInitSpec(this, _parentSessionId, void 0);
13568
13650
  _classPrivateFieldInitSpec(this, _target, void 0);
13569
13651
  _classPrivateFieldInitSpec(this, _rawErrors, false);
13570
13652
  _classPrivateFieldInitSpec(this, _detached, false);
13571
- _classPrivateFieldSet(_connection, this, connection);
13653
+ _classPrivateFieldSet(_connection2, this, connection);
13572
13654
  _classPrivateFieldSet(_targetType, this, targetType);
13655
+ _classPrivateFieldSet(_callbacks2, this, new CallbackRegistry(connection._idGenerator));
13573
13656
  _classPrivateFieldSet(_sessionId, this, sessionId);
13574
13657
  _classPrivateFieldSet(_parentSessionId, this, parentSessionId);
13575
13658
  _classPrivateFieldSet(_rawErrors, this, rawErrors);
@@ -13592,10 +13675,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13592
13675
  return _classPrivateFieldGet(_target, this);
13593
13676
  }
13594
13677
  connection() {
13595
- return _classPrivateFieldGet(_connection, this);
13678
+ return _classPrivateFieldGet(_connection2, this);
13596
13679
  }
13597
13680
  get detached() {
13598
- return _classPrivateFieldGet(_connection, this)._closed || _classPrivateFieldGet(_detached, this);
13681
+ return _classPrivateFieldGet(_connection2, this)._closed || _classPrivateFieldGet(_detached, this);
13599
13682
  }
13600
13683
  parentSession() {
13601
13684
  if (!_classPrivateFieldGet(_parentSessionId, this)) {
@@ -13603,14 +13686,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13603
13686
  // case, we treat the current session as the parent session.
13604
13687
  return this;
13605
13688
  }
13606
- const parent = _classPrivateFieldGet(_connection, this)?.session(_classPrivateFieldGet(_parentSessionId, this));
13689
+ const parent = _classPrivateFieldGet(_connection2, this)?.session(_classPrivateFieldGet(_parentSessionId, this));
13607
13690
  return parent ?? undefined;
13608
13691
  }
13609
13692
  send(method, params, options) {
13610
13693
  if (this.detached) {
13611
13694
  return Promise.reject(new TargetCloseError(`Protocol error (${method}): Session closed. Most likely the ${_classPrivateFieldGet(_targetType, this)} has been closed.`));
13612
13695
  }
13613
- return _classPrivateFieldGet(_connection, this)._rawSend(_classPrivateFieldGet(_callbacks2, this), method, params, _classPrivateFieldGet(_sessionId, this), options);
13696
+ return _classPrivateFieldGet(_connection2, this)._rawSend(_classPrivateFieldGet(_callbacks2, this), method, params, _classPrivateFieldGet(_sessionId, this), options);
13614
13697
  }
13615
13698
  /**
13616
13699
  * @internal
@@ -13639,7 +13722,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13639
13722
  if (this.detached) {
13640
13723
  throw new Error(`Session already detached. Most likely the ${_classPrivateFieldGet(_targetType, this)} has been closed.`);
13641
13724
  }
13642
- await _classPrivateFieldGet(_connection, this).send('Target.detachFromTarget', {
13725
+ await _classPrivateFieldGet(_connection2, this).send('Target.detachFromTarget', {
13643
13726
  sessionId: _classPrivateFieldGet(_sessionId, this)
13644
13727
  });
13645
13728
  _classPrivateFieldSet(_detached, this, true);
@@ -13685,9 +13768,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13685
13768
  var _manuallyAttached = /*#__PURE__*/new WeakMap();
13686
13769
  var _callbacks3 = /*#__PURE__*/new WeakMap();
13687
13770
  var _rawErrors2 = /*#__PURE__*/new WeakMap();
13771
+ var _idGenerator2 = /*#__PURE__*/new WeakMap();
13688
13772
  var _Connection_brand = /*#__PURE__*/new WeakSet();
13689
13773
  class Connection extends EventEmitter {
13690
- constructor(url, transport, delay = 0, timeout, rawErrors = false) {
13774
+ constructor(url, transport, delay = 0, timeout, rawErrors = false, idGenerator = createIncrementalIdGenerator()) {
13691
13775
  super();
13692
13776
  _classPrivateMethodInitSpec(this, _Connection_brand);
13693
13777
  _classPrivateFieldInitSpec(this, _url2, void 0);
@@ -13699,8 +13783,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13699
13783
  _classPrivateFieldInitSpec(this, _manuallyAttached, new Set());
13700
13784
  _classPrivateFieldInitSpec(this, _callbacks3, void 0);
13701
13785
  _classPrivateFieldInitSpec(this, _rawErrors2, false);
13786
+ _classPrivateFieldInitSpec(this, _idGenerator2, void 0);
13702
13787
  _classPrivateFieldSet(_rawErrors2, this, rawErrors);
13703
- _classPrivateFieldSet(_callbacks3, this, new CallbackRegistry());
13788
+ _classPrivateFieldSet(_idGenerator2, this, idGenerator);
13789
+ _classPrivateFieldSet(_callbacks3, this, new CallbackRegistry(idGenerator));
13704
13790
  _classPrivateFieldSet(_url2, this, url);
13705
13791
  _classPrivateFieldSet(_delay2, this, delay);
13706
13792
  _classPrivateFieldSet(_timeout2, this, timeout ?? 180_000);
@@ -13726,6 +13812,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
13726
13812
  get _closed() {
13727
13813
  return _classPrivateFieldGet(_closed, this);
13728
13814
  }
13815
+ /**
13816
+ * @internal
13817
+ */
13818
+ get _idGenerator() {
13819
+ return _classPrivateFieldGet(_idGenerator2, this);
13820
+ }
13729
13821
  /**
13730
13822
  * @internal
13731
13823
  */
@@ -14403,7 +14495,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14403
14495
  /**
14404
14496
  * @internal
14405
14497
  */
14406
- let EmulationManager = ((_EmulationManager, _client5, _emulatingMobile, _hasTouch, _states, _viewportState, _idleOverridesState, _timezoneState, _visionDeficiencyState, _cpuThrottlingState, _mediaFeaturesState, _mediaTypeState, _geoLocationState, _defaultBackgroundColorState, _javascriptEnabledState, _secondaryClients, _EmulationManager_brand) => {
14498
+ let EmulationManager = ((_EmulationManager, _client5, _emulatingMobile, _hasTouch, _states, _viewportState, _idleOverridesState, _timezoneState, _visionDeficiencyState, _cpuThrottlingState, _mediaFeaturesState, _mediaTypeState, _geoLocationState, _defaultBackgroundColorState, _javascriptEnabledState, _focusState, _secondaryClients, _EmulationManager_brand) => {
14407
14499
  let _instanceExtraInitializers = [];
14408
14500
  let _private_applyViewport_decorators;
14409
14501
  let _private_applyViewport_descriptor;
@@ -14425,7 +14517,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14425
14517
  let _private_setDefaultBackgroundColor_descriptor;
14426
14518
  let _private_setJavaScriptEnabled_decorators;
14427
14519
  let _private_setJavaScriptEnabled_descriptor;
14428
- return _client5 = /*#__PURE__*/new WeakMap(), _emulatingMobile = /*#__PURE__*/new WeakMap(), _hasTouch = /*#__PURE__*/new WeakMap(), _states = /*#__PURE__*/new WeakMap(), _viewportState = /*#__PURE__*/new WeakMap(), _idleOverridesState = /*#__PURE__*/new WeakMap(), _timezoneState = /*#__PURE__*/new WeakMap(), _visionDeficiencyState = /*#__PURE__*/new WeakMap(), _cpuThrottlingState = /*#__PURE__*/new WeakMap(), _mediaFeaturesState = /*#__PURE__*/new WeakMap(), _mediaTypeState = /*#__PURE__*/new WeakMap(), _geoLocationState = /*#__PURE__*/new WeakMap(), _defaultBackgroundColorState = /*#__PURE__*/new WeakMap(), _javascriptEnabledState = /*#__PURE__*/new WeakMap(), _secondaryClients = /*#__PURE__*/new WeakMap(), _EmulationManager_brand = /*#__PURE__*/new WeakSet(), _EmulationManager = class EmulationManager {
14520
+ let _private_emulateFocus_decorators;
14521
+ let _private_emulateFocus_descriptor;
14522
+ return _client5 = /*#__PURE__*/new WeakMap(), _emulatingMobile = /*#__PURE__*/new WeakMap(), _hasTouch = /*#__PURE__*/new WeakMap(), _states = /*#__PURE__*/new WeakMap(), _viewportState = /*#__PURE__*/new WeakMap(), _idleOverridesState = /*#__PURE__*/new WeakMap(), _timezoneState = /*#__PURE__*/new WeakMap(), _visionDeficiencyState = /*#__PURE__*/new WeakMap(), _cpuThrottlingState = /*#__PURE__*/new WeakMap(), _mediaFeaturesState = /*#__PURE__*/new WeakMap(), _mediaTypeState = /*#__PURE__*/new WeakMap(), _geoLocationState = /*#__PURE__*/new WeakMap(), _defaultBackgroundColorState = /*#__PURE__*/new WeakMap(), _javascriptEnabledState = /*#__PURE__*/new WeakMap(), _focusState = /*#__PURE__*/new WeakMap(), _secondaryClients = /*#__PURE__*/new WeakMap(), _EmulationManager_brand = /*#__PURE__*/new WeakSet(), _EmulationManager = class EmulationManager {
14429
14523
  constructor(client) {
14430
14524
  _classPrivateMethodInitSpec(this, _EmulationManager_brand);
14431
14525
  _classPrivateFieldInitSpec(this, _client5, __runInitializers$2(this, _instanceExtraInitializers));
@@ -14463,6 +14557,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14463
14557
  javaScriptEnabled: true,
14464
14558
  active: false
14465
14559
  }, this, _classPrivateGetter(_EmulationManager_brand, this, _get_setJavaScriptEnabled)));
14560
+ _classPrivateFieldInitSpec(this, _focusState, new EmulatedState({
14561
+ enabled: true,
14562
+ active: false
14563
+ }, this, _classPrivateGetter(_EmulationManager_brand, this, _get_emulateFocus)));
14466
14564
  _classPrivateFieldInitSpec(this, _secondaryClients, new Set());
14467
14565
  _classPrivateFieldSet(_client5, this, client);
14468
14566
  }
@@ -14607,6 +14705,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14607
14705
  javaScriptEnabled: enabled
14608
14706
  });
14609
14707
  }
14708
+ async emulateFocus(enabled) {
14709
+ await _classPrivateFieldGet(_focusState, this).setState({
14710
+ active: true,
14711
+ enabled
14712
+ });
14713
+ }
14610
14714
  }, (() => {
14611
14715
  const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
14612
14716
  _private_applyViewport_decorators = [invokeAtMostOnceForArguments];
@@ -14619,6 +14723,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14619
14723
  _private_setGeolocation_decorators = [invokeAtMostOnceForArguments];
14620
14724
  _private_setDefaultBackgroundColor_decorators = [invokeAtMostOnceForArguments];
14621
14725
  _private_setJavaScriptEnabled_decorators = [invokeAtMostOnceForArguments];
14726
+ _private_emulateFocus_decorators = [invokeAtMostOnceForArguments];
14622
14727
  __esDecorate$2(_EmulationManager, _private_applyViewport_descriptor = {
14623
14728
  value: __setFunctionName(async function (client, viewportState) {
14624
14729
  if (!viewportState.viewport) {
@@ -14863,6 +14968,26 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14863
14968
  },
14864
14969
  metadata: _metadata
14865
14970
  }, null, _instanceExtraInitializers);
14971
+ __esDecorate$2(_EmulationManager, _private_emulateFocus_descriptor = {
14972
+ value: __setFunctionName(async function (client, state) {
14973
+ if (!state.active) {
14974
+ return;
14975
+ }
14976
+ await client.send('Emulation.setFocusEmulationEnabled', {
14977
+ enabled: state.enabled
14978
+ });
14979
+ }, "#emulateFocus")
14980
+ }, _private_emulateFocus_decorators, {
14981
+ kind: "method",
14982
+ name: "#emulateFocus",
14983
+ static: false,
14984
+ private: true,
14985
+ access: {
14986
+ has: obj => _EmulationManager_brand.has(_checkInRHS(obj)),
14987
+ get: obj => _classPrivateGetter(_EmulationManager_brand, obj, _get_emulateFocus)
14988
+ },
14989
+ metadata: _metadata
14990
+ }, null, _instanceExtraInitializers);
14866
14991
  if (_metadata) Object.defineProperty(_EmulationManager, Symbol.metadata, {
14867
14992
  enumerable: true,
14868
14993
  configurable: true,
@@ -14900,6 +15025,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14900
15025
  function _get_setJavaScriptEnabled(_this12) {
14901
15026
  return _private_setJavaScriptEnabled_descriptor.value;
14902
15027
  }
15028
+ function _get_emulateFocus(_this13) {
15029
+ return _private_emulateFocus_descriptor.value;
15030
+ }
14903
15031
  })();
14904
15032
 
14905
15033
  /**
@@ -14950,48 +15078,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14950
15078
  * SPDX-License-Identifier: Apache-2.0
14951
15079
  */
14952
15080
  /**
14953
- * Device in a request prompt.
14954
- *
14955
- * @public
14956
- */
14957
- class DeviceRequestPromptDevice {
14958
- /**
14959
- * @internal
14960
- */
14961
- constructor(id, name) {
14962
- /**
14963
- * Device id during a prompt.
14964
- */
14965
- _defineProperty(this, "id", void 0);
14966
- /**
14967
- * Device name as it appears in a prompt.
14968
- */
14969
- _defineProperty(this, "name", void 0);
14970
- this.id = id;
14971
- this.name = name;
14972
- }
14973
- }
14974
- /**
14975
- * Device request prompts let you respond to the page requesting for a device
14976
- * through an API like WebBluetooth.
14977
- *
14978
- * @remarks
14979
- * `DeviceRequestPrompt` instances are returned via the
14980
- * {@link Page.waitForDevicePrompt} method.
14981
- *
14982
- * @example
14983
- *
14984
- * ```ts
14985
- * const [devicePrompt] = Promise.all([
14986
- * page.waitForDevicePrompt(),
14987
- * page.click('#connect-bluetooth'),
14988
- * ]);
14989
- * await devicePrompt.select(
14990
- * await devicePrompt.waitForDevice(({name}) => name.includes('My Device')),
14991
- * );
14992
- * ```
14993
- *
14994
- * @public
15081
+ * @internal
14995
15082
  */
14996
15083
  var _client6 = /*#__PURE__*/new WeakMap();
14997
15084
  var _timeoutSettings = /*#__PURE__*/new WeakMap();
@@ -14999,23 +15086,17 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
14999
15086
  var _handled2 = /*#__PURE__*/new WeakMap();
15000
15087
  var _updateDevicesHandle = /*#__PURE__*/new WeakMap();
15001
15088
  var _waitForDevicePromises = /*#__PURE__*/new WeakMap();
15002
- var _DeviceRequestPrompt_brand = /*#__PURE__*/new WeakSet();
15003
- class DeviceRequestPrompt {
15004
- /**
15005
- * @internal
15006
- */
15089
+ var _CdpDeviceRequestPrompt_brand = /*#__PURE__*/new WeakSet();
15090
+ class CdpDeviceRequestPrompt extends DeviceRequestPrompt {
15007
15091
  constructor(client, timeoutSettings, firstEvent) {
15008
- _classPrivateMethodInitSpec(this, _DeviceRequestPrompt_brand);
15092
+ super();
15093
+ _classPrivateMethodInitSpec(this, _CdpDeviceRequestPrompt_brand);
15009
15094
  _classPrivateFieldInitSpec(this, _client6, void 0);
15010
15095
  _classPrivateFieldInitSpec(this, _timeoutSettings, void 0);
15011
15096
  _classPrivateFieldInitSpec(this, _id4, void 0);
15012
15097
  _classPrivateFieldInitSpec(this, _handled2, false);
15013
- _classPrivateFieldInitSpec(this, _updateDevicesHandle, _assertClassBrand(_DeviceRequestPrompt_brand, this, _updateDevices).bind(this));
15098
+ _classPrivateFieldInitSpec(this, _updateDevicesHandle, _assertClassBrand(_CdpDeviceRequestPrompt_brand, this, _updateDevices).bind(this));
15014
15099
  _classPrivateFieldInitSpec(this, _waitForDevicePromises, new Set());
15015
- /**
15016
- * Current list of selectable devices.
15017
- */
15018
- _defineProperty(this, "devices", []);
15019
15100
  _classPrivateFieldSet(_client6, this, client);
15020
15101
  _classPrivateFieldSet(_timeoutSettings, this, timeoutSettings);
15021
15102
  _classPrivateFieldSet(_id4, this, firstEvent.id);
@@ -15023,11 +15104,8 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15023
15104
  _classPrivateFieldGet(_client6, this).on('Target.detachedFromTarget', () => {
15024
15105
  _classPrivateFieldSet(_client6, this, null);
15025
15106
  });
15026
- _assertClassBrand(_DeviceRequestPrompt_brand, this, _updateDevices).call(this, firstEvent);
15107
+ _assertClassBrand(_CdpDeviceRequestPrompt_brand, this, _updateDevices).call(this, firstEvent);
15027
15108
  }
15028
- /**
15029
- * Resolve to the first device in the prompt matching a filter.
15030
- */
15031
15109
  async waitForDevice(filter, options = {}) {
15032
15110
  for (const device of this.devices) {
15033
15111
  if (filter(device)) {
@@ -15059,9 +15137,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15059
15137
  _classPrivateFieldGet(_waitForDevicePromises, this).delete(handle);
15060
15138
  }
15061
15139
  }
15062
- /**
15063
- * Select a device in the prompt's list.
15064
- */
15065
15140
  async select(device) {
15066
15141
  assert(_classPrivateFieldGet(_client6, this) !== null, 'Cannot select device through detached session!');
15067
15142
  assert(this.devices.includes(device), 'Cannot select unknown device!');
@@ -15073,9 +15148,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15073
15148
  deviceId: device.id
15074
15149
  });
15075
15150
  }
15076
- /**
15077
- * Cancel the prompt.
15078
- */
15079
15151
  async cancel() {
15080
15152
  assert(_classPrivateFieldGet(_client6, this) !== null, 'Cannot cancel prompt through detached session!');
15081
15153
  assert(!_classPrivateFieldGet(_handled2, this), 'Cannot cancel DeviceRequestPrompt which is already handled!');
@@ -15099,7 +15171,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15099
15171
  })) {
15100
15172
  continue;
15101
15173
  }
15102
- const newDevice = new DeviceRequestPromptDevice(rawDevice.id, rawDevice.name);
15174
+ const newDevice = {
15175
+ id: rawDevice.id,
15176
+ name: rawDevice.name
15177
+ };
15103
15178
  this.devices.push(newDevice);
15104
15179
  for (const waitForDevicePromise of _classPrivateFieldGet(_waitForDevicePromises, this)) {
15105
15180
  if (waitForDevicePromise.filter(newDevice)) {
@@ -15111,32 +15186,22 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15111
15186
  var _client7 = /*#__PURE__*/new WeakMap();
15112
15187
  var _timeoutSettings2 = /*#__PURE__*/new WeakMap();
15113
15188
  var _deviceRequestPromptDeferreds = /*#__PURE__*/new WeakMap();
15114
- var _DeviceRequestPromptManager_brand = /*#__PURE__*/new WeakSet();
15115
- class DeviceRequestPromptManager {
15116
- /**
15117
- * @internal
15118
- */
15189
+ var _CdpDeviceRequestPromptManager_brand = /*#__PURE__*/new WeakSet();
15190
+ class CdpDeviceRequestPromptManager {
15119
15191
  constructor(client, timeoutSettings) {
15120
- /**
15121
- * @internal
15122
- */
15123
- _classPrivateMethodInitSpec(this, _DeviceRequestPromptManager_brand);
15192
+ _classPrivateMethodInitSpec(this, _CdpDeviceRequestPromptManager_brand);
15124
15193
  _classPrivateFieldInitSpec(this, _client7, void 0);
15125
15194
  _classPrivateFieldInitSpec(this, _timeoutSettings2, void 0);
15126
15195
  _classPrivateFieldInitSpec(this, _deviceRequestPromptDeferreds, new Set());
15127
15196
  _classPrivateFieldSet(_client7, this, client);
15128
15197
  _classPrivateFieldSet(_timeoutSettings2, this, timeoutSettings);
15129
15198
  _classPrivateFieldGet(_client7, this).on('DeviceAccess.deviceRequestPrompted', event => {
15130
- _assertClassBrand(_DeviceRequestPromptManager_brand, this, _onDeviceRequestPrompted).call(this, event);
15199
+ _assertClassBrand(_CdpDeviceRequestPromptManager_brand, this, _onDeviceRequestPrompted).call(this, event);
15131
15200
  });
15132
15201
  _classPrivateFieldGet(_client7, this).on('Target.detachedFromTarget', () => {
15133
15202
  _classPrivateFieldSet(_client7, this, null);
15134
15203
  });
15135
15204
  }
15136
- /**
15137
- * Wait for device prompt created by an action like calling WebBluetooth's
15138
- * requestDevice.
15139
- */
15140
15205
  async waitForDevicePrompt(options = {}) {
15141
15206
  assert(_classPrivateFieldGet(_client7, this) !== null, 'Cannot wait for device prompt through detached session!');
15142
15207
  const needsEnable = _classPrivateFieldGet(_deviceRequestPromptDeferreds, this).size === 0;
@@ -15181,7 +15246,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15181
15246
  return;
15182
15247
  }
15183
15248
  assert(_classPrivateFieldGet(_client7, this) !== null);
15184
- const devicePrompt = new DeviceRequestPrompt(_classPrivateFieldGet(_client7, this), _classPrivateFieldGet(_timeoutSettings2, this), event);
15249
+ const devicePrompt = new CdpDeviceRequestPrompt(_classPrivateFieldGet(_client7, this), _classPrivateFieldGet(_timeoutSettings2, this), event);
15185
15250
  for (const promise of _classPrivateFieldGet(_deviceRequestPromptDeferreds, this)) {
15186
15251
  promise.resolve(devicePrompt);
15187
15252
  }
@@ -15715,8 +15780,8 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
15715
15780
  value: _metadata
15716
15781
  });
15717
15782
  })(), _CdpElementHandle;
15718
- function _get_frameManager(_this13) {
15719
- return _this13.frame._frameManager;
15783
+ function _get_frameManager(_this14) {
15784
+ return _this14.frame._frameManager;
15720
15785
  }
15721
15786
  })();
15722
15787
 
@@ -17334,7 +17399,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17334
17399
  this._redirectChain = redirectChain;
17335
17400
  _classPrivateFieldSet(_initiator, this, data.initiator);
17336
17401
  this.interception.enabled = allowInterception;
17337
- for (const [key, value] of Object.entries(data.request.headers)) {
17402
+ this.updateHeaders(data.request.headers);
17403
+ }
17404
+ updateHeaders(headers) {
17405
+ for (const [key, value] of Object.entries(headers)) {
17338
17406
  _classPrivateFieldGet(_headers, this)[key.toLowerCase()] = value;
17339
17407
  }
17340
17408
  }
@@ -17681,6 +17749,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17681
17749
  var _requestWillBeSentMap = /*#__PURE__*/new WeakMap();
17682
17750
  var _requestPausedMap = /*#__PURE__*/new WeakMap();
17683
17751
  var _httpRequestsMap = /*#__PURE__*/new WeakMap();
17752
+ var _requestWillBeSentExtraInfoMap = /*#__PURE__*/new WeakMap();
17684
17753
  var _responseReceivedExtraInfoMap = /*#__PURE__*/new WeakMap();
17685
17754
  var _queuedRedirectInfoMap = /*#__PURE__*/new WeakMap();
17686
17755
  var _queuedEventGroupMap = /*#__PURE__*/new WeakMap();
@@ -17721,6 +17790,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17721
17790
  _classPrivateFieldInitSpec(this, _requestWillBeSentMap, new Map());
17722
17791
  _classPrivateFieldInitSpec(this, _requestPausedMap, new Map());
17723
17792
  _classPrivateFieldInitSpec(this, _httpRequestsMap, new Map());
17793
+ _classPrivateFieldInitSpec(this, _requestWillBeSentExtraInfoMap, new Map());
17724
17794
  /*
17725
17795
  * The below maps are used to reconcile Network.responseReceivedExtraInfo
17726
17796
  * events with their corresponding request. Each response and redirect
@@ -17737,10 +17807,17 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17737
17807
  forget(networkRequestId) {
17738
17808
  _classPrivateFieldGet(_requestWillBeSentMap, this).delete(networkRequestId);
17739
17809
  _classPrivateFieldGet(_requestPausedMap, this).delete(networkRequestId);
17810
+ _classPrivateFieldGet(_requestWillBeSentExtraInfoMap, this).delete(networkRequestId);
17740
17811
  _classPrivateFieldGet(_queuedEventGroupMap, this).delete(networkRequestId);
17741
17812
  _classPrivateFieldGet(_queuedRedirectInfoMap, this).delete(networkRequestId);
17742
17813
  _classPrivateFieldGet(_responseReceivedExtraInfoMap, this).delete(networkRequestId);
17743
17814
  }
17815
+ requestExtraInfo(networkRequestId) {
17816
+ if (!_classPrivateFieldGet(_requestWillBeSentExtraInfoMap, this).has(networkRequestId)) {
17817
+ _classPrivateFieldGet(_requestWillBeSentExtraInfoMap, this).set(networkRequestId, []);
17818
+ }
17819
+ return _classPrivateFieldGet(_requestWillBeSentExtraInfoMap, this).get(networkRequestId);
17820
+ }
17744
17821
  responseExtraInfo(networkRequestId) {
17745
17822
  if (!_classPrivateFieldGet(_responseReceivedExtraInfoMap, this).has(networkRequestId)) {
17746
17823
  _classPrivateFieldGet(_responseReceivedExtraInfoMap, this).set(networkRequestId, []);
@@ -17868,7 +17945,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17868
17945
  _classPrivateFieldInitSpec(this, _userAgent, void 0);
17869
17946
  _classPrivateFieldInitSpec(this, _userAgentMetadata, void 0);
17870
17947
  _classPrivateFieldInitSpec(this, _platform, void 0);
17871
- _classPrivateFieldInitSpec(this, _handlers3, [['Fetch.requestPaused', _assertClassBrand(_NetworkManager_brand, this, _onRequestPaused)], ['Fetch.authRequired', _assertClassBrand(_NetworkManager_brand, this, _onAuthRequired)], ['Network.requestWillBeSent', _assertClassBrand(_NetworkManager_brand, this, _onRequestWillBeSent)], ['Network.requestServedFromCache', _assertClassBrand(_NetworkManager_brand, this, _onRequestServedFromCache)], ['Network.responseReceived', _assertClassBrand(_NetworkManager_brand, this, _onResponseReceived)], ['Network.loadingFinished', _assertClassBrand(_NetworkManager_brand, this, _onLoadingFinished)], ['Network.loadingFailed', _assertClassBrand(_NetworkManager_brand, this, _onLoadingFailed)], ['Network.responseReceivedExtraInfo', _assertClassBrand(_NetworkManager_brand, this, _onResponseReceivedExtraInfo)], [exports.CDPSessionEvent.Disconnected, _assertClassBrand(_NetworkManager_brand, this, _removeClient)]]);
17948
+ _classPrivateFieldInitSpec(this, _handlers3, [['Fetch.requestPaused', _assertClassBrand(_NetworkManager_brand, this, _onRequestPaused)], ['Fetch.authRequired', _assertClassBrand(_NetworkManager_brand, this, _onAuthRequired)], ['Network.requestWillBeSent', _assertClassBrand(_NetworkManager_brand, this, _onRequestWillBeSent)], ['Network.requestWillBeSentExtraInfo', _assertClassBrand(_NetworkManager_brand, this, _onRequestWillBeSentExtraInfo)], ['Network.requestServedFromCache', _assertClassBrand(_NetworkManager_brand, this, _onRequestServedFromCache)], ['Network.responseReceived', _assertClassBrand(_NetworkManager_brand, this, _onResponseReceived)], ['Network.loadingFinished', _assertClassBrand(_NetworkManager_brand, this, _onLoadingFinished)], ['Network.loadingFailed', _assertClassBrand(_NetworkManager_brand, this, _onLoadingFailed)], ['Network.responseReceivedExtraInfo', _assertClassBrand(_NetworkManager_brand, this, _onResponseReceivedExtraInfo)], [exports.CDPSessionEvent.Disconnected, _assertClassBrand(_NetworkManager_brand, this, _removeClient)]]);
17872
17949
  _classPrivateFieldInitSpec(this, _clients, new Map());
17873
17950
  _classPrivateFieldInitSpec(this, _networkEnabled, true);
17874
17951
  _classPrivateFieldSet(_frameManager, this, frameManager);
@@ -17973,7 +18050,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
17973
18050
  * SPDX-License-Identifier: Apache-2.0
17974
18051
  */
17975
18052
  function _canIgnoreError(error) {
17976
- return isErrorLike(error) && (isTargetClosedError(error) || error.message.includes('Not supported'));
18053
+ return isErrorLike(error) && (isTargetClosedError(error) || error.message.includes('Not supported') || error.message.includes("wasn't found"));
17977
18054
  }
17978
18055
  async function _removeClient(client) {
17979
18056
  _classPrivateFieldGet(_clients, this).get(client)?.dispose();
@@ -18200,15 +18277,31 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
18200
18277
  if (request) {
18201
18278
  _assertClassBrand(_NetworkManager_brand, this, _handleRequestRedirect).call(this, client, request, event.redirectResponse, redirectResponseExtraInfo);
18202
18279
  redirectChain = request._redirectChain;
18280
+ const extraInfo = _classPrivateFieldGet(_networkEventManager, this).requestExtraInfo(event.requestId).shift();
18281
+ if (extraInfo) {
18282
+ request.updateHeaders(extraInfo.headers);
18283
+ }
18203
18284
  }
18204
18285
  }
18205
18286
  const frame = event.frameId ? _classPrivateFieldGet(_frameManager, this).frame(event.frameId) : null;
18206
18287
  const request = new CdpHTTPRequest(client, frame, fetchRequestId, _classPrivateFieldGet(_userRequestInterceptionEnabled, this), event, redirectChain);
18288
+ const extraInfo = _classPrivateFieldGet(_networkEventManager, this).requestExtraInfo(event.requestId).shift();
18289
+ if (extraInfo) {
18290
+ request.updateHeaders(extraInfo.headers);
18291
+ }
18207
18292
  request._fromMemoryCache = fromMemoryCache;
18208
18293
  _classPrivateFieldGet(_networkEventManager, this).storeRequest(event.requestId, request);
18209
18294
  this.emit(exports.NetworkManagerEvent.Request, request);
18210
18295
  void request.finalizeInterceptions();
18211
18296
  }
18297
+ function _onRequestWillBeSentExtraInfo(_client, event) {
18298
+ const request = _classPrivateFieldGet(_networkEventManager, this).getRequest(event.requestId);
18299
+ if (request) {
18300
+ request.updateHeaders(event.headers);
18301
+ } else {
18302
+ _classPrivateFieldGet(_networkEventManager, this).requestExtraInfo(event.requestId).push(event);
18303
+ }
18304
+ }
18212
18305
  function _onRequestServedFromCache(client, event) {
18213
18306
  const requestWillBeSentEvent = _classPrivateFieldGet(_networkEventManager, this).getRequestWillBeSent(event.requestId);
18214
18307
  let request = _classPrivateFieldGet(_networkEventManager, this).getRequest(event.requestId);
@@ -18628,7 +18721,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
18628
18721
  _deviceRequestPromptManager(client) {
18629
18722
  let manager = _classPrivateFieldGet(_deviceRequestPromptManagerMap, this).get(client);
18630
18723
  if (manager === undefined) {
18631
- manager = new DeviceRequestPromptManager(client, _classPrivateFieldGet(_timeoutSettings3, this));
18724
+ manager = new CdpDeviceRequestPromptManager(client, _classPrivateFieldGet(_timeoutSettings3, this));
18632
18725
  _classPrivateFieldGet(_deviceRequestPromptManagerMap, this).set(client, manager);
18633
18726
  }
18634
18727
  return manager;
@@ -20690,10 +20783,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
20690
20783
  /**
20691
20784
  * @internal
20692
20785
  */
20693
- function _get_state(_this14) {
20786
+ function _get_state(_this15) {
20694
20787
  return Object.assign({
20695
- ..._classPrivateFieldGet(_state2, _this14)
20696
- }, ..._classPrivateFieldGet(_transactions, _this14));
20788
+ ..._classPrivateFieldGet(_state2, _this15)
20789
+ }, ..._classPrivateFieldGet(_transactions, _this15));
20697
20790
  }
20698
20791
  function _createTransaction() {
20699
20792
  const transaction = {};
@@ -20980,9 +21073,8 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
20980
21073
  async close() {
20981
21074
  switch (_classPrivateFieldGet(_targetType2, this)) {
20982
21075
  case exports.TargetType.SERVICE_WORKER:
20983
- case exports.TargetType.SHARED_WORKER:
20984
21076
  {
20985
- // For service and shared workers we need to close the target and detach to allow
21077
+ // For service workers we need to close the target and detach to allow
20986
21078
  // the worker to stop.
20987
21079
  await this.client.connection()?.send('Target.closeTarget', {
20988
21080
  targetId: _classPrivateFieldGet(_id6, this)
@@ -20992,6 +21084,13 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
20992
21084
  });
20993
21085
  break;
20994
21086
  }
21087
+ case exports.TargetType.SHARED_WORKER:
21088
+ {
21089
+ await this.client.connection()?.send('Target.closeTarget', {
21090
+ targetId: _classPrivateFieldGet(_id6, this)
21091
+ });
21092
+ break;
21093
+ }
20995
21094
  default:
20996
21095
  await this.evaluate(() => {
20997
21096
  self.close();
@@ -21083,6 +21182,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21083
21182
  */
21084
21183
  var _closed2 = /*#__PURE__*/new WeakMap();
21085
21184
  var _targetManager = /*#__PURE__*/new WeakMap();
21185
+ var _cdpBluetoothEmulation = /*#__PURE__*/new WeakMap();
21086
21186
  var _primaryTargetClient = /*#__PURE__*/new WeakMap();
21087
21187
  var _primaryTarget = /*#__PURE__*/new WeakMap();
21088
21188
  var _tabTargetClient = /*#__PURE__*/new WeakMap();
@@ -21127,6 +21227,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21127
21227
  _classPrivateMethodInitSpec(this, _CdpPage_brand);
21128
21228
  _classPrivateFieldInitSpec(this, _closed2, false);
21129
21229
  _classPrivateFieldInitSpec(this, _targetManager, void 0);
21230
+ _classPrivateFieldInitSpec(this, _cdpBluetoothEmulation, void 0);
21130
21231
  _classPrivateFieldInitSpec(this, _primaryTargetClient, void 0);
21131
21232
  _classPrivateFieldInitSpec(this, _primaryTarget, void 0);
21132
21233
  _classPrivateFieldInitSpec(this, _tabTargetClient, void 0);
@@ -21180,6 +21281,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21180
21281
  _classPrivateFieldSet(_tracing, this, new Tracing(client));
21181
21282
  _classPrivateFieldSet(_coverage, this, new Coverage(client));
21182
21283
  _classPrivateFieldSet(_viewport, this, null);
21284
+ // Use browser context's connection, as current Bluetooth emulation in Chromium is
21285
+ // implemented on the browser context level, and not tight to the specific tab.
21286
+ _classPrivateFieldSet(_cdpBluetoothEmulation, this, new CdpBluetoothEmulation(_classPrivateFieldGet(_primaryTargetClient, this).connection()));
21183
21287
  const frameManagerEmitter = new EventEmitter(_classPrivateFieldGet(_frameManager2, this));
21184
21288
  frameManagerEmitter.on(exports.FrameManagerEvent.FrameAttached, frame => {
21185
21289
  this.emit("frameattached" /* PageEvent.FrameAttached */, frame);
@@ -21224,15 +21328,19 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21224
21328
  _assertClassBrand(_CdpPage_brand, this, _attachExistingTargets).call(this);
21225
21329
  }
21226
21330
  async resize(params) {
21227
- const {
21228
- windowId
21229
- } = await _classPrivateFieldGet(_primaryTargetClient, this).send('Browser.getWindowForTarget');
21331
+ const windowId = await this.windowId();
21230
21332
  await _classPrivateFieldGet(_primaryTargetClient, this).send('Browser.setContentsSize', {
21231
- windowId,
21333
+ windowId: Number(windowId),
21232
21334
  width: params.contentWidth,
21233
21335
  height: params.contentHeight
21234
21336
  });
21235
21337
  }
21338
+ async windowId() {
21339
+ const {
21340
+ windowId
21341
+ } = await _classPrivateFieldGet(_primaryTargetClient, this).send('Browser.getWindowForTarget');
21342
+ return windowId.toString();
21343
+ }
21236
21344
  _client() {
21237
21345
  return _classPrivateFieldGet(_primaryTargetClient, this);
21238
21346
  }
@@ -21245,6 +21353,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21245
21353
  isJavaScriptEnabled() {
21246
21354
  return _classPrivateFieldGet(_emulationManager, this).javascriptEnabled;
21247
21355
  }
21356
+ async openDevTools() {
21357
+ const pageTargetId = this.target()._targetId;
21358
+ const browser = this.browser();
21359
+ const devtoolsPage = await browser._createDevToolsPage(pageTargetId);
21360
+ return devtoolsPage;
21361
+ }
21248
21362
  async waitForFileChooser(options = {}) {
21249
21363
  const needsEnable = _classPrivateFieldGet(_fileChooserDeferreds, this).size === 0;
21250
21364
  const {
@@ -21330,6 +21444,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21330
21444
  async emulateNetworkConditions(networkConditions) {
21331
21445
  return await _classPrivateFieldGet(_frameManager2, this).networkManager.emulateNetworkConditions(networkConditions);
21332
21446
  }
21447
+ async emulateFocusedPage(enabled) {
21448
+ return await _classPrivateFieldGet(_emulationManager, this).emulateFocus(enabled);
21449
+ }
21333
21450
  setDefaultNavigationTimeout(timeout) {
21334
21451
  this._timeoutSettings.setDefaultNavigationTimeout(timeout);
21335
21452
  }
@@ -21473,7 +21590,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21473
21590
  const [result] = await Promise.all([this.waitForNavigation({
21474
21591
  ...options,
21475
21592
  ignoreSameDocumentNavigation: true
21476
- }), _classPrivateFieldGet(_primaryTargetClient, this).send('Page.reload')]);
21593
+ }), _classPrivateFieldGet(_primaryTargetClient, this).send('Page.reload', {
21594
+ ignoreCache: options?.ignoreCache ?? false
21595
+ })]);
21477
21596
  return result;
21478
21597
  }
21479
21598
  async createCDPSession() {
@@ -21725,6 +21844,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21725
21844
  async waitForDevicePrompt(options = {}) {
21726
21845
  return await this.mainFrame().waitForDevicePrompt(options);
21727
21846
  }
21847
+ get bluetooth() {
21848
+ return _classPrivateFieldGet(_cdpBluetoothEmulation, this);
21849
+ }
21728
21850
  }
21729
21851
  function _attachExistingTargets() {
21730
21852
  const queue = [];
@@ -21837,7 +21959,8 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21837
21959
  args,
21838
21960
  source,
21839
21961
  url,
21840
- lineNumber
21962
+ lineNumber,
21963
+ stackTrace
21841
21964
  } = event.entry;
21842
21965
  if (args) {
21843
21966
  args.map(arg => {
@@ -21848,7 +21971,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21848
21971
  this.emit("console" /* PageEvent.Console */, new ConsoleMessage(convertConsoleMessageLevel(level), text, [], [{
21849
21972
  url,
21850
21973
  lineNumber
21851
- }]));
21974
+ }], undefined, stackTrace));
21852
21975
  }
21853
21976
  }
21854
21977
  function _emitMetrics(event) {
@@ -21929,7 +22052,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
21929
22052
  });
21930
22053
  }
21931
22054
  }
21932
- const message = new ConsoleMessage(convertConsoleMessageLevel(eventType), textTokens.join(' '), args, stackTraceLocations);
22055
+ const message = new ConsoleMessage(convertConsoleMessageLevel(eventType), textTokens.join(' '), args, stackTraceLocations, undefined, stackTrace);
21933
22056
  this.emit("console" /* PageEvent.Console */, message);
21934
22057
  }
21935
22058
  function _onDialog(event) {
@@ -22053,16 +22176,16 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22053
22176
  /**
22054
22177
  * @internal
22055
22178
  */
22056
- var _connection2 = /*#__PURE__*/new WeakMap();
22179
+ var _connection3 = /*#__PURE__*/new WeakMap();
22057
22180
  var _browser = /*#__PURE__*/new WeakMap();
22058
22181
  var _id7 = /*#__PURE__*/new WeakMap();
22059
22182
  class CdpBrowserContext extends BrowserContext {
22060
22183
  constructor(connection, browser, contextId) {
22061
22184
  super();
22062
- _classPrivateFieldInitSpec(this, _connection2, void 0);
22185
+ _classPrivateFieldInitSpec(this, _connection3, void 0);
22063
22186
  _classPrivateFieldInitSpec(this, _browser, void 0);
22064
22187
  _classPrivateFieldInitSpec(this, _id7, void 0);
22065
- _classPrivateFieldSet(_connection2, this, connection);
22188
+ _classPrivateFieldSet(_connection3, this, connection);
22066
22189
  _classPrivateFieldSet(_browser, this, browser);
22067
22190
  _classPrivateFieldSet(_id7, this, contextId);
22068
22191
  }
@@ -22074,9 +22197,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22074
22197
  return target.browserContext() === this;
22075
22198
  });
22076
22199
  }
22077
- async pages() {
22200
+ async pages(includeAll = false) {
22078
22201
  const pages = await Promise.all(this.targets().filter(target => {
22079
- return target.type() === 'page' || target.type() === 'other' && _classPrivateFieldGet(_browser, this)._getIsPageTargetCallback()?.(target);
22202
+ return target.type() === 'page' || (target.type() === 'other' || includeAll) && _classPrivateFieldGet(_browser, this)._getIsPageTargetCallback()?.(target);
22080
22203
  }).map(target => {
22081
22204
  return target.page();
22082
22205
  }));
@@ -22092,18 +22215,18 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22092
22215
  }
22093
22216
  return protocolPermission;
22094
22217
  });
22095
- await _classPrivateFieldGet(_connection2, this).send('Browser.grantPermissions', {
22218
+ await _classPrivateFieldGet(_connection3, this).send('Browser.grantPermissions', {
22096
22219
  origin,
22097
22220
  browserContextId: _classPrivateFieldGet(_id7, this) || undefined,
22098
22221
  permissions: protocolPermissions
22099
22222
  });
22100
22223
  }
22101
22224
  async clearPermissionOverrides() {
22102
- await _classPrivateFieldGet(_connection2, this).send('Browser.resetPermissions', {
22225
+ await _classPrivateFieldGet(_connection3, this).send('Browser.resetPermissions', {
22103
22226
  browserContextId: _classPrivateFieldGet(_id7, this) || undefined
22104
22227
  });
22105
22228
  }
22106
- async newPage() {
22229
+ async newPage(options) {
22107
22230
  const env_1 = {
22108
22231
  stack: [],
22109
22232
  error: void 0,
@@ -22111,7 +22234,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22111
22234
  };
22112
22235
  try {
22113
22236
  const _guard = __addDisposableResource(env_1, await this.waitForScreenshotOperations(), false);
22114
- return await _classPrivateFieldGet(_browser, this)._createPageInContext(_classPrivateFieldGet(_id7, this));
22237
+ return await _classPrivateFieldGet(_browser, this)._createPageInContext(_classPrivateFieldGet(_id7, this), options);
22115
22238
  } catch (e_1) {
22116
22239
  env_1.error = e_1;
22117
22240
  env_1.hasError = true;
@@ -22129,7 +22252,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22129
22252
  async cookies() {
22130
22253
  const {
22131
22254
  cookies
22132
- } = await _classPrivateFieldGet(_connection2, this).send('Storage.getCookies', {
22255
+ } = await _classPrivateFieldGet(_connection3, this).send('Storage.getCookies', {
22133
22256
  browserContextId: _classPrivateFieldGet(_id7, this)
22134
22257
  });
22135
22258
  return cookies.map(cookie => {
@@ -22143,7 +22266,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22143
22266
  });
22144
22267
  }
22145
22268
  async setCookie(...cookies) {
22146
- return await _classPrivateFieldGet(_connection2, this).send('Storage.setCookies', {
22269
+ return await _classPrivateFieldGet(_connection3, this).send('Storage.setCookies', {
22147
22270
  browserContextId: _classPrivateFieldGet(_id7, this),
22148
22271
  cookies: cookies.map(cookie => {
22149
22272
  return {
@@ -22154,7 +22277,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22154
22277
  });
22155
22278
  }
22156
22279
  async setDownloadBehavior(downloadBehavior) {
22157
- await _classPrivateFieldGet(_connection2, this).send('Browser.setDownloadBehavior', {
22280
+ await _classPrivateFieldGet(_connection3, this).send('Browser.setDownloadBehavior', {
22158
22281
  behavior: downloadBehavior.policy,
22159
22282
  downloadPath: downloadBehavior.downloadPath,
22160
22283
  browserContextId: _classPrivateFieldGet(_id7, this)
@@ -22422,7 +22545,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22422
22545
  *
22423
22546
  * @internal
22424
22547
  */
22425
- var _connection3 = /*#__PURE__*/new WeakMap();
22548
+ var _connection4 = /*#__PURE__*/new WeakMap();
22426
22549
  var _discoveredTargetsByTargetId = /*#__PURE__*/new WeakMap();
22427
22550
  var _attachedTargetsByTargetId = /*#__PURE__*/new WeakMap();
22428
22551
  var _attachedTargetsBySessionId = /*#__PURE__*/new WeakMap();
@@ -22432,10 +22555,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22432
22555
  var _attachedToTargetListenersBySession = /*#__PURE__*/new WeakMap();
22433
22556
  var _detachedFromTargetListenersBySession = /*#__PURE__*/new WeakMap();
22434
22557
  var _initializeDeferred = /*#__PURE__*/new WeakMap();
22435
- var _targetsIdsForInit = /*#__PURE__*/new WeakMap();
22436
22558
  var _waitForInitiallyDiscoveredTargets = /*#__PURE__*/new WeakMap();
22437
22559
  var _discoveryFilter = /*#__PURE__*/new WeakMap();
22438
- var _storeExistingTargetsForInit = /*#__PURE__*/new WeakMap();
22560
+ var _targetsIdsForInit = /*#__PURE__*/new WeakMap();
22561
+ var _initialAttachDone = /*#__PURE__*/new WeakMap();
22439
22562
  var _TargetManager_brand = /*#__PURE__*/new WeakSet();
22440
22563
  var _onSessionDetached = /*#__PURE__*/new WeakMap();
22441
22564
  var _onTargetCreated = /*#__PURE__*/new WeakMap();
@@ -22447,7 +22570,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22447
22570
  constructor(connection, targetFactory, targetFilterCallback, waitForInitiallyDiscoveredTargets = true) {
22448
22571
  super();
22449
22572
  _classPrivateMethodInitSpec(this, _TargetManager_brand);
22450
- _classPrivateFieldInitSpec(this, _connection3, void 0);
22573
+ _classPrivateFieldInitSpec(this, _connection4, void 0);
22451
22574
  /**
22452
22575
  * Keeps track of the following events: 'Target.targetCreated',
22453
22576
  * 'Target.targetDestroyed', 'Target.targetInfoChanged'.
@@ -22478,24 +22601,19 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22478
22601
  _classPrivateFieldInitSpec(this, _attachedToTargetListenersBySession, new WeakMap());
22479
22602
  _classPrivateFieldInitSpec(this, _detachedFromTargetListenersBySession, new WeakMap());
22480
22603
  _classPrivateFieldInitSpec(this, _initializeDeferred, Deferred.create());
22481
- _classPrivateFieldInitSpec(this, _targetsIdsForInit, new Set());
22482
22604
  _classPrivateFieldInitSpec(this, _waitForInitiallyDiscoveredTargets, true);
22483
22605
  _classPrivateFieldInitSpec(this, _discoveryFilter, [{}]);
22484
- _classPrivateFieldInitSpec(this, _storeExistingTargetsForInit, () => {
22485
- if (!_classPrivateFieldGet(_waitForInitiallyDiscoveredTargets, this)) {
22486
- return;
22487
- }
22488
- for (const [targetId, targetInfo] of _classPrivateFieldGet(_discoveredTargetsByTargetId, this).entries()) {
22489
- const targetForFilter = new CdpTarget(targetInfo, undefined, undefined, this, undefined);
22490
- // Only wait for pages and frames (except those from extensions)
22491
- // to auto-attach.
22492
- const isPageOrFrame = targetInfo.type === 'page' || targetInfo.type === 'iframe';
22493
- const isExtension = targetInfo.url.startsWith('chrome-extension://');
22494
- if ((!_classPrivateFieldGet(_targetFilterCallback, this) || _classPrivateFieldGet(_targetFilterCallback, this).call(this, targetForFilter)) && isPageOrFrame && !isExtension) {
22495
- _classPrivateFieldGet(_targetsIdsForInit, this).add(targetId);
22496
- }
22497
- }
22498
- });
22606
+ // IDs of tab targets detected while running the initial Target.setAutoAttach
22607
+ // request. These are the targets whose initialization we want to await for
22608
+ // before resolving puppeteer.connect() or launch() to avoid flakiness.
22609
+ // Whenever a sub-target whose parent is a tab target is attached, we remove
22610
+ // the tab target from this list. Once the list is empty, we resolve the
22611
+ // initializeDeferred.
22612
+ _classPrivateFieldInitSpec(this, _targetsIdsForInit, new Set());
22613
+ // This is false until the connection-level Target.setAutoAttach request is
22614
+ // done. It indicates whethere we are running the initial auto-attach step or
22615
+ // if we are handling targets after that.
22616
+ _classPrivateFieldInitSpec(this, _initialAttachDone, false);
22499
22617
  _classPrivateFieldInitSpec(this, _onSessionDetached, session => {
22500
22618
  _assertClassBrand(_TargetManager_brand, this, _removeAttachmentListeners).call(this, session);
22501
22619
  });
@@ -22555,7 +22673,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22555
22673
  });
22556
22674
  _classPrivateFieldInitSpec(this, _onAttachedToTarget2, async (parentSession, event) => {
22557
22675
  const targetInfo = event.targetInfo;
22558
- const session = _classPrivateFieldGet(_connection3, this)._session(event.sessionId);
22676
+ const session = _classPrivateFieldGet(_connection4, this)._session(event.sessionId);
22559
22677
  if (!session) {
22560
22678
  throw new Error(`Session ${event.sessionId} was not created.`);
22561
22679
  }
@@ -22567,7 +22685,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22567
22685
  sessionId: session.id()
22568
22686
  }).catch(debugError);
22569
22687
  };
22570
- if (!_classPrivateFieldGet(_connection3, this).isAutoAttached(targetInfo.targetId)) {
22688
+ if (!_classPrivateFieldGet(_connection4, this).isAutoAttached(targetInfo.targetId)) {
22571
22689
  return;
22572
22690
  }
22573
22691
  // Special case for service workers: being attached to service workers will
@@ -22578,7 +22696,6 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22578
22696
  // should determine if a target is auto-attached or not with the help of
22579
22697
  // CDP.
22580
22698
  if (targetInfo.type === 'service_worker') {
22581
- _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this, targetInfo.targetId);
22582
22699
  await silentDetach();
22583
22700
  if (_classPrivateFieldGet(_attachedTargetsByTargetId, this).has(targetInfo.targetId)) {
22584
22701
  return;
@@ -22591,12 +22708,18 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22591
22708
  }
22592
22709
  const isExistingTarget = _classPrivateFieldGet(_attachedTargetsByTargetId, this).has(targetInfo.targetId);
22593
22710
  const target = isExistingTarget ? _classPrivateFieldGet(_attachedTargetsByTargetId, this).get(targetInfo.targetId) : _classPrivateFieldGet(_targetFactory, this).call(this, targetInfo, session, parentSession instanceof CdpCDPSession ? parentSession : undefined);
22711
+ const parentTarget = parentSession instanceof CdpCDPSession ? parentSession.target() : null;
22594
22712
  if (_classPrivateFieldGet(_targetFilterCallback, this) && !_classPrivateFieldGet(_targetFilterCallback, this).call(this, target)) {
22595
22713
  _classPrivateFieldGet(_ignoredTargets, this).add(targetInfo.targetId);
22596
- _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this, targetInfo.targetId);
22714
+ if (parentTarget?.type() === 'tab') {
22715
+ _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this, parentTarget._targetId);
22716
+ }
22597
22717
  await silentDetach();
22598
22718
  return;
22599
22719
  }
22720
+ if (_classPrivateFieldGet(_waitForInitiallyDiscoveredTargets, this) && event.targetInfo.type === 'tab' && !_classPrivateFieldGet(_initialAttachDone, this)) {
22721
+ _classPrivateFieldGet(_targetsIdsForInit, this).add(event.targetInfo.targetId);
22722
+ }
22600
22723
  _assertClassBrand(_TargetManager_brand, this, _setupAttachmentListeners).call(this, session);
22601
22724
  if (isExistingTarget) {
22602
22725
  session.setTarget(target);
@@ -22606,14 +22729,14 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22606
22729
  _classPrivateFieldGet(_attachedTargetsByTargetId, this).set(targetInfo.targetId, target);
22607
22730
  _classPrivateFieldGet(_attachedTargetsBySessionId, this).set(session.id(), target);
22608
22731
  }
22609
- const parentTarget = parentSession instanceof CDPSession ? parentSession.target() : null;
22610
22732
  parentTarget?._addChildTarget(target);
22611
22733
  parentSession.emit(exports.CDPSessionEvent.Ready, session);
22612
- _classPrivateFieldGet(_targetsIdsForInit, this).delete(target._targetId);
22613
22734
  if (!isExistingTarget) {
22614
22735
  this.emit("targetAvailable" /* TargetManagerEvent.TargetAvailable */, target);
22615
22736
  }
22616
- _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this);
22737
+ if (parentTarget?.type() === 'tab') {
22738
+ _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this, parentTarget._targetId);
22739
+ }
22617
22740
  // TODO: the browser might be shutting down here. What do we do with the
22618
22741
  // error?
22619
22742
  await Promise.all([session.send('Target.setAutoAttach', {
@@ -22635,23 +22758,22 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22635
22758
  _classPrivateFieldGet(_attachedTargetsByTargetId, this).delete(target._targetId);
22636
22759
  this.emit("targetGone" /* TargetManagerEvent.TargetGone */, target);
22637
22760
  });
22638
- _classPrivateFieldSet(_connection3, this, connection);
22761
+ _classPrivateFieldSet(_connection4, this, connection);
22639
22762
  _classPrivateFieldSet(_targetFilterCallback, this, targetFilterCallback);
22640
22763
  _classPrivateFieldSet(_targetFactory, this, targetFactory);
22641
22764
  _classPrivateFieldSet(_waitForInitiallyDiscoveredTargets, this, waitForInitiallyDiscoveredTargets);
22642
- _classPrivateFieldGet(_connection3, this).on('Target.targetCreated', _classPrivateFieldGet(_onTargetCreated, this));
22643
- _classPrivateFieldGet(_connection3, this).on('Target.targetDestroyed', _classPrivateFieldGet(_onTargetDestroyed, this));
22644
- _classPrivateFieldGet(_connection3, this).on('Target.targetInfoChanged', _classPrivateFieldGet(_onTargetInfoChanged, this));
22645
- _classPrivateFieldGet(_connection3, this).on(exports.CDPSessionEvent.SessionDetached, _classPrivateFieldGet(_onSessionDetached, this));
22646
- _assertClassBrand(_TargetManager_brand, this, _setupAttachmentListeners).call(this, _classPrivateFieldGet(_connection3, this));
22765
+ _classPrivateFieldGet(_connection4, this).on('Target.targetCreated', _classPrivateFieldGet(_onTargetCreated, this));
22766
+ _classPrivateFieldGet(_connection4, this).on('Target.targetDestroyed', _classPrivateFieldGet(_onTargetDestroyed, this));
22767
+ _classPrivateFieldGet(_connection4, this).on('Target.targetInfoChanged', _classPrivateFieldGet(_onTargetInfoChanged, this));
22768
+ _classPrivateFieldGet(_connection4, this).on(exports.CDPSessionEvent.SessionDetached, _classPrivateFieldGet(_onSessionDetached, this));
22769
+ _assertClassBrand(_TargetManager_brand, this, _setupAttachmentListeners).call(this, _classPrivateFieldGet(_connection4, this));
22647
22770
  }
22648
22771
  async initialize() {
22649
- await _classPrivateFieldGet(_connection3, this).send('Target.setDiscoverTargets', {
22772
+ await _classPrivateFieldGet(_connection4, this).send('Target.setDiscoverTargets', {
22650
22773
  discover: true,
22651
22774
  filter: _classPrivateFieldGet(_discoveryFilter, this)
22652
22775
  });
22653
- _classPrivateFieldGet(_storeExistingTargetsForInit, this).call(this);
22654
- await _classPrivateFieldGet(_connection3, this).send('Target.setAutoAttach', {
22776
+ await _classPrivateFieldGet(_connection4, this).send('Target.setAutoAttach', {
22655
22777
  waitForDebuggerOnStart: true,
22656
22778
  flatten: true,
22657
22779
  autoAttach: true,
@@ -22660,6 +22782,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22660
22782
  exclude: true
22661
22783
  }, ..._classPrivateFieldGet(_discoveryFilter, this)]
22662
22784
  });
22785
+ _classPrivateFieldSet(_initialAttachDone, this, true);
22663
22786
  _assertClassBrand(_TargetManager_brand, this, _finishInitializationIfReady).call(this);
22664
22787
  await _classPrivateFieldGet(_initializeDeferred, this).valueOrThrow();
22665
22788
  }
@@ -22667,11 +22790,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22667
22790
  return target._childTargets();
22668
22791
  }
22669
22792
  dispose() {
22670
- _classPrivateFieldGet(_connection3, this).off('Target.targetCreated', _classPrivateFieldGet(_onTargetCreated, this));
22671
- _classPrivateFieldGet(_connection3, this).off('Target.targetDestroyed', _classPrivateFieldGet(_onTargetDestroyed, this));
22672
- _classPrivateFieldGet(_connection3, this).off('Target.targetInfoChanged', _classPrivateFieldGet(_onTargetInfoChanged, this));
22673
- _classPrivateFieldGet(_connection3, this).off(exports.CDPSessionEvent.SessionDetached, _classPrivateFieldGet(_onSessionDetached, this));
22674
- _assertClassBrand(_TargetManager_brand, this, _removeAttachmentListeners).call(this, _classPrivateFieldGet(_connection3, this));
22793
+ _classPrivateFieldGet(_connection4, this).off('Target.targetCreated', _classPrivateFieldGet(_onTargetCreated, this));
22794
+ _classPrivateFieldGet(_connection4, this).off('Target.targetDestroyed', _classPrivateFieldGet(_onTargetDestroyed, this));
22795
+ _classPrivateFieldGet(_connection4, this).off('Target.targetInfoChanged', _classPrivateFieldGet(_onTargetInfoChanged, this));
22796
+ _classPrivateFieldGet(_connection4, this).off(exports.CDPSessionEvent.SessionDetached, _classPrivateFieldGet(_onSessionDetached, this));
22797
+ _assertClassBrand(_TargetManager_brand, this, _removeAttachmentListeners).call(this, _classPrivateFieldGet(_connection4, this));
22675
22798
  }
22676
22799
  getAvailableTargets() {
22677
22800
  return _classPrivateFieldGet(_attachedTargetsByTargetId, this);
@@ -22715,13 +22838,18 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22715
22838
  if (targetId !== undefined) {
22716
22839
  _classPrivateFieldGet(_targetsIdsForInit, this).delete(targetId);
22717
22840
  }
22841
+ // If we are still initializing it might be that we have not learned about
22842
+ // some targets yet.
22843
+ if (!_classPrivateFieldGet(_initialAttachDone, this)) {
22844
+ return;
22845
+ }
22718
22846
  if (_classPrivateFieldGet(_targetsIdsForInit, this).size === 0) {
22719
22847
  _classPrivateFieldGet(_initializeDeferred, this).resolve();
22720
22848
  }
22721
22849
  }
22722
22850
  var _defaultViewport2 = /*#__PURE__*/new WeakMap();
22723
22851
  var _process = /*#__PURE__*/new WeakMap();
22724
- var _connection4 = /*#__PURE__*/new WeakMap();
22852
+ var _connection5 = /*#__PURE__*/new WeakMap();
22725
22853
  var _closeCallback = /*#__PURE__*/new WeakMap();
22726
22854
  var _targetFilterCallback2 = /*#__PURE__*/new WeakMap();
22727
22855
  var _isPageTargetCallback = /*#__PURE__*/new WeakMap();
@@ -22754,7 +22882,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22754
22882
  _defineProperty(this, "protocol", 'cdp');
22755
22883
  _classPrivateFieldInitSpec(this, _defaultViewport2, void 0);
22756
22884
  _classPrivateFieldInitSpec(this, _process, void 0);
22757
- _classPrivateFieldInitSpec(this, _connection4, void 0);
22885
+ _classPrivateFieldInitSpec(this, _connection5, void 0);
22758
22886
  _classPrivateFieldInitSpec(this, _closeCallback, void 0);
22759
22887
  _classPrivateFieldInitSpec(this, _targetFilterCallback2, void 0);
22760
22888
  _classPrivateFieldInitSpec(this, _isPageTargetCallback, void 0);
@@ -22775,7 +22903,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22775
22903
  throw new Error('Missing browser context');
22776
22904
  }
22777
22905
  const createSession = isAutoAttachEmulated => {
22778
- return _classPrivateFieldGet(_connection4, this)._createSession(targetInfo, isAutoAttachEmulated);
22906
+ return _classPrivateFieldGet(_connection5, this)._createSession(targetInfo, isAutoAttachEmulated);
22779
22907
  };
22780
22908
  const otherTarget = new OtherTarget(targetInfo, session, context, _classPrivateFieldGet(_targetManager3, this), createSession);
22781
22909
  if (targetInfo.url?.startsWith('devtools://')) {
@@ -22815,7 +22943,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22815
22943
  _classPrivateFieldSet(_networkEnabled2, this, networkEnabled);
22816
22944
  _classPrivateFieldSet(_defaultViewport2, this, defaultViewport);
22817
22945
  _classPrivateFieldSet(_process, this, process);
22818
- _classPrivateFieldSet(_connection4, this, connection);
22946
+ _classPrivateFieldSet(_connection5, this, connection);
22819
22947
  _classPrivateFieldSet(_closeCallback, this, closeCallback || (() => {}));
22820
22948
  _classPrivateFieldSet(_targetFilterCallback2, this, targetFilterCallback || (() => {
22821
22949
  return true;
@@ -22823,13 +22951,13 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22823
22951
  _classPrivateFieldSet(_handleDevToolsAsPage, this, handleDevToolsAsPage);
22824
22952
  _assertClassBrand(_CdpBrowser_brand, this, _setIsPageTargetCallback).call(this, _isPageTargetCallback2);
22825
22953
  _classPrivateFieldSet(_targetManager3, this, new TargetManager(connection, _classPrivateFieldGet(_createTarget, this), _classPrivateFieldGet(_targetFilterCallback2, this), waitForInitiallyDiscoveredTargets));
22826
- _classPrivateFieldSet(_defaultContext, this, new CdpBrowserContext(_classPrivateFieldGet(_connection4, this), this));
22954
+ _classPrivateFieldSet(_defaultContext, this, new CdpBrowserContext(_classPrivateFieldGet(_connection5, this), this));
22827
22955
  for (const contextId of contextIds) {
22828
- _classPrivateFieldGet(_contexts, this).set(contextId, new CdpBrowserContext(_classPrivateFieldGet(_connection4, this), this, contextId));
22956
+ _classPrivateFieldGet(_contexts, this).set(contextId, new CdpBrowserContext(_classPrivateFieldGet(_connection5, this), this, contextId));
22829
22957
  }
22830
22958
  }
22831
22959
  async _attach(downloadBehavior) {
22832
- _classPrivateFieldGet(_connection4, this).on(exports.CDPSessionEvent.Disconnected, _classPrivateFieldGet(_emitDisconnected, this));
22960
+ _classPrivateFieldGet(_connection5, this).on(exports.CDPSessionEvent.Disconnected, _classPrivateFieldGet(_emitDisconnected, this));
22833
22961
  if (downloadBehavior) {
22834
22962
  await _classPrivateFieldGet(_defaultContext, this).setDownloadBehavior(downloadBehavior);
22835
22963
  }
@@ -22840,7 +22968,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22840
22968
  await _classPrivateFieldGet(_targetManager3, this).initialize();
22841
22969
  }
22842
22970
  _detach() {
22843
- _classPrivateFieldGet(_connection4, this).off(exports.CDPSessionEvent.Disconnected, _classPrivateFieldGet(_emitDisconnected, this));
22971
+ _classPrivateFieldGet(_connection5, this).off(exports.CDPSessionEvent.Disconnected, _classPrivateFieldGet(_emitDisconnected, this));
22844
22972
  _classPrivateFieldGet(_targetManager3, this).off("targetAvailable" /* TargetManagerEvent.TargetAvailable */, _classPrivateFieldGet(_onAttachedToTarget3, this));
22845
22973
  _classPrivateFieldGet(_targetManager3, this).off("targetGone" /* TargetManagerEvent.TargetGone */, _classPrivateFieldGet(_onDetachedFromTarget3, this));
22846
22974
  _classPrivateFieldGet(_targetManager3, this).off("targetChanged" /* TargetManagerEvent.TargetChanged */, _classPrivateFieldGet(_onTargetChanged, this));
@@ -22863,11 +22991,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22863
22991
  } = options;
22864
22992
  const {
22865
22993
  browserContextId
22866
- } = await _classPrivateFieldGet(_connection4, this).send('Target.createBrowserContext', {
22994
+ } = await _classPrivateFieldGet(_connection5, this).send('Target.createBrowserContext', {
22867
22995
  proxyServer,
22868
22996
  proxyBypassList: proxyBypassList && proxyBypassList.join(',')
22869
22997
  });
22870
- const context = new CdpBrowserContext(_classPrivateFieldGet(_connection4, this), this, browserContextId);
22998
+ const context = new CdpBrowserContext(_classPrivateFieldGet(_connection5, this), this, browserContextId);
22871
22999
  if (downloadBehavior) {
22872
23000
  await context.setDownloadBehavior(downloadBehavior);
22873
23001
  }
@@ -22884,27 +23012,34 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22884
23012
  if (!contextId) {
22885
23013
  return;
22886
23014
  }
22887
- await _classPrivateFieldGet(_connection4, this).send('Target.disposeBrowserContext', {
23015
+ await _classPrivateFieldGet(_connection5, this).send('Target.disposeBrowserContext', {
22888
23016
  browserContextId: contextId
22889
23017
  });
22890
23018
  _classPrivateFieldGet(_contexts, this).delete(contextId);
22891
23019
  }
22892
23020
  wsEndpoint() {
22893
- return _classPrivateFieldGet(_connection4, this).url();
23021
+ return _classPrivateFieldGet(_connection5, this).url();
22894
23022
  }
22895
- async newPage() {
22896
- return await _classPrivateFieldGet(_defaultContext, this).newPage();
23023
+ async newPage(options) {
23024
+ return await _classPrivateFieldGet(_defaultContext, this).newPage(options);
22897
23025
  }
22898
- // rebrowser-patches: expose browser CDP session
22899
- _connection() {
22900
- return _classPrivateFieldGet(_connection4, this);
22901
- }
22902
- async _createPageInContext(contextId) {
23026
+ async _createPageInContext(contextId, options) {
23027
+ const hasTargets = this.targets().filter(t => {
23028
+ return t.browserContext().id === contextId;
23029
+ }).length > 0;
23030
+ const windowBounds = options?.type === 'window' ? options.windowBounds : undefined;
22903
23031
  const {
22904
23032
  targetId
22905
- } = await _classPrivateFieldGet(_connection4, this).send('Target.createTarget', {
23033
+ } = await _classPrivateFieldGet(_connection5, this).send('Target.createTarget', {
22906
23034
  url: 'about:blank',
22907
- browserContextId: contextId || undefined
23035
+ browserContextId: contextId || undefined,
23036
+ left: windowBounds?.left,
23037
+ top: windowBounds?.top,
23038
+ width: windowBounds?.width,
23039
+ height: windowBounds?.height,
23040
+ windowState: windowBounds?.windowState,
23041
+ // Works around crbug.com/454825274.
23042
+ newWindow: hasTargets && options?.type === 'window' ? true : undefined
22908
23043
  });
22909
23044
  const target = await this.waitForTarget(t => {
22910
23045
  return t._targetId === targetId;
@@ -22922,19 +23057,70 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22922
23057
  }
22923
23058
  return page;
22924
23059
  }
23060
+ async _createDevToolsPage(pageTargetId) {
23061
+ const openDevToolsResponse = await _classPrivateFieldGet(_connection5, this).send('Target.openDevTools', {
23062
+ targetId: pageTargetId
23063
+ });
23064
+ const target = await this.waitForTarget(t => {
23065
+ return t._targetId === openDevToolsResponse.targetId;
23066
+ });
23067
+ if (!target) {
23068
+ throw new Error(`Missing target for DevTools page (id = ${pageTargetId})`);
23069
+ }
23070
+ const initialized = (await target._initializedDeferred.valueOrThrow()) === exports.InitializationStatus.SUCCESS;
23071
+ if (!initialized) {
23072
+ throw new Error(`Failed to create target for DevTools page (id = ${pageTargetId})`);
23073
+ }
23074
+ const page = await target.page();
23075
+ if (!page) {
23076
+ throw new Error(`Failed to create a DevTools Page for target (id = ${pageTargetId})`);
23077
+ }
23078
+ return page;
23079
+ }
22925
23080
  async installExtension(path) {
22926
23081
  const {
22927
23082
  id
22928
- } = await _classPrivateFieldGet(_connection4, this).send('Extensions.loadUnpacked', {
23083
+ } = await _classPrivateFieldGet(_connection5, this).send('Extensions.loadUnpacked', {
22929
23084
  path
22930
23085
  });
22931
23086
  return id;
22932
23087
  }
22933
23088
  uninstallExtension(id) {
22934
- return _classPrivateFieldGet(_connection4, this).send('Extensions.uninstall', {
23089
+ return _classPrivateFieldGet(_connection5, this).send('Extensions.uninstall', {
22935
23090
  id
22936
23091
  });
22937
23092
  }
23093
+ async screens() {
23094
+ const {
23095
+ screenInfos
23096
+ } = await _classPrivateFieldGet(_connection5, this).send('Emulation.getScreenInfos');
23097
+ return screenInfos;
23098
+ }
23099
+ async addScreen(params) {
23100
+ const {
23101
+ screenInfo
23102
+ } = await _classPrivateFieldGet(_connection5, this).send('Emulation.addScreen', params);
23103
+ return screenInfo;
23104
+ }
23105
+ async removeScreen(screenId) {
23106
+ return await _classPrivateFieldGet(_connection5, this).send('Emulation.removeScreen', {
23107
+ screenId
23108
+ });
23109
+ }
23110
+ async getWindowBounds(windowId) {
23111
+ const {
23112
+ bounds
23113
+ } = await _classPrivateFieldGet(_connection5, this).send('Browser.getWindowBounds', {
23114
+ windowId: Number(windowId)
23115
+ });
23116
+ return bounds;
23117
+ }
23118
+ async setWindowBounds(windowId, windowBounds) {
23119
+ await _classPrivateFieldGet(_connection5, this).send('Browser.setWindowBounds', {
23120
+ windowId: Number(windowId),
23121
+ bounds: windowBounds
23122
+ });
23123
+ }
22938
23124
  targets() {
22939
23125
  return Array.from(_classPrivateFieldGet(_targetManager3, this).getAvailableTargets().values()).filter(target => {
22940
23126
  return target._isTargetExposed() && target._initializedDeferred.value() === exports.InitializationStatus.SUCCESS;
@@ -22963,16 +23149,16 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22963
23149
  }
22964
23150
  disconnect() {
22965
23151
  _classPrivateFieldGet(_targetManager3, this).dispose();
22966
- _classPrivateFieldGet(_connection4, this).dispose();
23152
+ _classPrivateFieldGet(_connection5, this).dispose();
22967
23153
  this._detach();
22968
23154
  return Promise.resolve();
22969
23155
  }
22970
23156
  get connected() {
22971
- return !_classPrivateFieldGet(_connection4, this)._closed;
23157
+ return !_classPrivateFieldGet(_connection5, this)._closed;
22972
23158
  }
22973
23159
  get debugInfo() {
22974
23160
  return {
22975
- pendingProtocolErrors: _classPrivateFieldGet(_connection4, this).getPendingProtocolErrors()
23161
+ pendingProtocolErrors: _classPrivateFieldGet(_connection5, this).getPendingProtocolErrors()
22976
23162
  };
22977
23163
  }
22978
23164
  isNetworkEnabled() {
@@ -22993,11 +23179,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
22993
23179
  */
22994
23180
  function _setIsPageTargetCallback(isPageTargetCallback) {
22995
23181
  _classPrivateFieldSet(_isPageTargetCallback, this, isPageTargetCallback || (target => {
22996
- return target.type() === 'page' || target.type() === 'background_page' || target.type() === 'webview' || _classPrivateFieldGet(_handleDevToolsAsPage, this) && target.type() === 'other' && target.url().startsWith('devtools://');
23182
+ return target.type() === 'page' || target.type() === 'background_page' || target.type() === 'webview' || _classPrivateFieldGet(_handleDevToolsAsPage, this) && target.type() === 'other' && target.url().startsWith('devtools://devtools/bundled/devtools_app.html');
22997
23183
  }));
22998
23184
  }
22999
23185
  function _getVersion() {
23000
- return _classPrivateFieldGet(_connection4, this).send('Browser.getVersion');
23186
+ return _classPrivateFieldGet(_connection5, this).send('Browser.getVersion');
23001
23187
  }
23002
23188
  async function _connectToCdpBrowser(connectionTransport, url, options) {
23003
23189
  const {
@@ -23009,9 +23195,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
23009
23195
  _isPageTarget: isPageTarget,
23010
23196
  slowMo = 0,
23011
23197
  protocolTimeout,
23012
- handleDevToolsAsPage
23198
+ handleDevToolsAsPage,
23199
+ idGenerator = createIncrementalIdGenerator()
23013
23200
  } = options;
23014
- const connection = new Connection(url, connectionTransport, slowMo, protocolTimeout);
23201
+ const connection = new Connection(url, connectionTransport, slowMo, protocolTimeout, /* rawErrors */false, idGenerator);
23015
23202
  const {
23016
23203
  browserContextIds
23017
23204
  } = await connection.send('Target.getBrowserContexts');
@@ -23135,6 +23322,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
23135
23322
  if (parsed.sessionId === 'tabTargetSessionId') {
23136
23323
  _assertClassBrand(_ExtensionTransport_brand, this, _dispatchResponse).call(this, {
23137
23324
  method: 'Target.attachedToTarget',
23325
+ sessionId: 'tabTargetSessionId',
23138
23326
  params: {
23139
23327
  targetInfo: pageTargetInfo,
23140
23328
  sessionId: 'pageTargetSessionId'
@@ -23230,7 +23418,10 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
23230
23418
  * @public
23231
23419
  */
23232
23420
  function _dispatchResponse(message) {
23233
- this.onmessage?.(JSON.stringify(message));
23421
+ // Dispatch in a new task like other transports.
23422
+ setTimeout(() => {
23423
+ this.onmessage?.(JSON.stringify(message));
23424
+ }, 0);
23234
23425
  }
23235
23426
  const PredefinedNetworkConditions = Object.freeze({
23236
23427
  // Generally aligned with DevTools
@@ -24835,10 +25026,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
24835
25026
  const BiDi = await Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackIgnore: true */'./bidi/bidi.js')));
24836
25027
  const {
24837
25028
  slowMo = 0,
24838
- protocolTimeout
25029
+ protocolTimeout,
25030
+ idGenerator = createIncrementalIdGenerator()
24839
25031
  } = options;
24840
25032
  // Try pure BiDi first.
24841
- const pureBidiConnection = new BiDi.BidiConnection(url, connectionTransport, slowMo, protocolTimeout);
25033
+ const pureBidiConnection = new BiDi.BidiConnection(url, connectionTransport, idGenerator, slowMo, protocolTimeout);
24842
25034
  try {
24843
25035
  const result = await pureBidiConnection.send('session.status', {});
24844
25036
  if ('type' in result && result.type === 'success') {
@@ -24859,7 +25051,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
24859
25051
  // Unbind the connection to avoid memory leaks.
24860
25052
  pureBidiConnection.unbind();
24861
25053
  // Fall back to CDP over BiDi reusing the WS connection.
24862
- const cdpConnection = new Connection(url, connectionTransport, slowMo, protocolTimeout, /* rawErrors= */true);
25054
+ const cdpConnection = new Connection(url, connectionTransport, slowMo, protocolTimeout, /* rawErrors= */true, idGenerator);
24863
25055
  const version = await cdpConnection.send('Browser.getVersion');
24864
25056
  if (version.product.toLowerCase().includes('firefox')) {
24865
25057
  throw new UnsupportedOperation('Firefox is not supported in BiDi over CDP mode.');
@@ -24912,10 +25104,11 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
24912
25104
  const {
24913
25105
  browserWSEndpoint,
24914
25106
  browserURL,
25107
+ channel,
24915
25108
  transport,
24916
25109
  headers = {}
24917
25110
  } = options;
24918
- assert(Number(!!browserWSEndpoint) + Number(!!browserURL) + Number(!!transport) === 1, 'Exactly one of browserWSEndpoint, browserURL or transport must be passed to puppeteer.connect');
25111
+ assert(Number(!!browserWSEndpoint) + Number(!!browserURL) + Number(!!transport) + Number(!!channel) === 1, 'Exactly one of browserWSEndpoint, browserURL, transport or channel must be passed to puppeteer.connect');
24919
25112
  if (transport) {
24920
25113
  return {
24921
25114
  connectionTransport: transport,
@@ -24936,6 +25129,50 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
24936
25129
  connectionTransport: connectionTransport,
24937
25130
  endpointUrl: connectionURL
24938
25131
  };
25132
+ } else if (options.channel && isNode) {
25133
+ const {
25134
+ detectBrowserPlatform,
25135
+ resolveDefaultUserDataDir,
25136
+ Browser
25137
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require('@puppeteer/browsers')));
25138
+ const platform = detectBrowserPlatform();
25139
+ if (!platform) {
25140
+ throw new Error('Could not detect required browser platform');
25141
+ }
25142
+ const {
25143
+ convertPuppeteerChannelToBrowsersChannel
25144
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require('./node/LaunchOptions.js')));
25145
+ const {
25146
+ join
25147
+ } = await Promise.resolve().then(() => _interopRequireWildcard(require('node:path')));
25148
+ const userDataDir = resolveDefaultUserDataDir(Browser.CHROME, platform, convertPuppeteerChannelToBrowsersChannel(options.channel));
25149
+ const portPath = join(userDataDir, 'DevToolsActivePort');
25150
+ try {
25151
+ const fileContent = await environment.value.fs.promises.readFile(portPath, 'ascii');
25152
+ const [rawPort, rawPath] = fileContent.split('\n').map(line => {
25153
+ return line.trim();
25154
+ }).filter(line => {
25155
+ return !!line;
25156
+ });
25157
+ if (!rawPort || !rawPath) {
25158
+ throw new Error(`Invalid DevToolsActivePort '${fileContent}' found`);
25159
+ }
25160
+ const port = parseInt(rawPort, 10);
25161
+ if (isNaN(port) || port <= 0 || port > 65535) {
25162
+ throw new Error(`Invalid port '${rawPort}' found`);
25163
+ }
25164
+ const browserWSEndpoint = `ws://localhost:${port}${rawPath}`;
25165
+ const WebSocketClass = await getWebSocketTransportClass();
25166
+ const connectionTransport = await WebSocketClass.create(browserWSEndpoint, headers);
25167
+ return {
25168
+ connectionTransport: connectionTransport,
25169
+ endpointUrl: browserWSEndpoint
25170
+ };
25171
+ } catch (error) {
25172
+ throw new Error(`Could not find DevToolsActivePort for ${options.channel} at ${portPath}`, {
25173
+ cause: error
25174
+ });
25175
+ }
24939
25176
  }
24940
25177
  throw new Error('Invalid connection options');
24941
25178
  }
@@ -25089,9 +25326,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
25089
25326
  * @internal
25090
25327
  */
25091
25328
  const PUPPETEER_REVISIONS = Object.freeze({
25092
- chrome: '141.0.7390.122',
25093
- 'chrome-headless-shell': '141.0.7390.122',
25094
- firefox: 'stable_144.0'
25329
+ chrome: '143.0.7499.42',
25330
+ 'chrome-headless-shell': '143.0.7499.42',
25331
+ firefox: 'stable_146.0'
25095
25332
  });
25096
25333
 
25097
25334
  /**
@@ -25114,6 +25351,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
25114
25351
  exports.ARIAQueryHandler = ARIAQueryHandler;
25115
25352
  exports.Accessibility = Accessibility;
25116
25353
  exports.AsyncDisposableStack = AsyncDisposableStack;
25354
+ exports.AsyncDisposableStackPolyfill = AsyncDisposableStackPolyfill;
25117
25355
  exports.AsyncIterableUtil = AsyncIterableUtil;
25118
25356
  exports.Binding = Binding;
25119
25357
  exports.Browser = Browser;
@@ -25124,9 +25362,12 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
25124
25362
  exports.CSSCoverage = CSSCoverage;
25125
25363
  exports.Callback = Callback;
25126
25364
  exports.CallbackRegistry = CallbackRegistry;
25365
+ exports.CdpBluetoothEmulation = CdpBluetoothEmulation;
25127
25366
  exports.CdpBrowser = CdpBrowser;
25128
25367
  exports.CdpBrowserContext = CdpBrowserContext;
25129
25368
  exports.CdpCDPSession = CdpCDPSession;
25369
+ exports.CdpDeviceRequestPrompt = CdpDeviceRequestPrompt;
25370
+ exports.CdpDeviceRequestPromptManager = CdpDeviceRequestPromptManager;
25130
25371
  exports.CdpDialog = CdpDialog;
25131
25372
  exports.CdpElementHandle = CdpElementHandle;
25132
25373
  exports.CdpFrame = CdpFrame;
@@ -25152,10 +25393,9 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
25152
25393
  exports.DelegatedLocator = DelegatedLocator;
25153
25394
  exports.DevToolsTarget = DevToolsTarget;
25154
25395
  exports.DeviceRequestPrompt = DeviceRequestPrompt;
25155
- exports.DeviceRequestPromptDevice = DeviceRequestPromptDevice;
25156
- exports.DeviceRequestPromptManager = DeviceRequestPromptManager;
25157
25396
  exports.Dialog = Dialog;
25158
25397
  exports.DisposableStack = DisposableStack;
25398
+ exports.DisposableStackPolyfill = DisposableStackPolyfill;
25159
25399
  exports.ElementHandle = ElementHandle;
25160
25400
  exports.EmulatedState = EmulatedState;
25161
25401
  exports.EmulationManager = EmulationManager;
@@ -25236,6 +25476,7 @@ var Puppeteer = function (exports, _PuppeteerURL, _LazyArg, _ARIAQueryHandler, _
25236
25476
  exports.convertCookiesPartitionKeyFromPuppeteerToCdp = convertCookiesPartitionKeyFromPuppeteerToCdp;
25237
25477
  exports.createClientError = createClientError;
25238
25478
  exports.createEvaluationError = createEvaluationError;
25479
+ exports.createIncrementalIdGenerator = createIncrementalIdGenerator;
25239
25480
  exports.createProtocolErrorMessage = createProtocolErrorMessage;
25240
25481
  exports.customQueryHandlers = customQueryHandlers;
25241
25482
  exports.debug = debug;