pokeedex 0.1.0 → 0.1.5

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 (560) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -5
  3. data/bin/pokeedex +1 -44
  4. data/lib/pokeedex/configuration.rb +0 -6
  5. data/lib/pokeedex/install_playwright.rb +62 -0
  6. data/lib/pokeedex/pokemon/scrapper/fetchers/base.rb +1 -1
  7. data/lib/pokeedex/version.rb +1 -1
  8. data/lib/pokeedex.rb +5 -2
  9. data/spec/pokeedex/configuration_spec.rb +0 -7
  10. data/spec/spec_helper.rb +1 -1
  11. metadata +2 -550
  12. data/node_modules/.bin/playwright +0 -1
  13. data/node_modules/.bin/playwright-core +0 -1
  14. data/node_modules/.yarn-integrity +0 -22
  15. data/node_modules/@playwright/test/LICENSE +0 -202
  16. data/node_modules/@playwright/test/NOTICE +0 -5
  17. data/node_modules/@playwright/test/README.md +0 -169
  18. data/node_modules/@playwright/test/cli.js +0 -19
  19. data/node_modules/@playwright/test/index.d.ts +0 -18
  20. data/node_modules/@playwright/test/index.js +0 -17
  21. data/node_modules/@playwright/test/index.mjs +0 -18
  22. data/node_modules/@playwright/test/node_modules/.bin/playwright +0 -1
  23. data/node_modules/@playwright/test/package.json +0 -35
  24. data/node_modules/@playwright/test/reporter.d.ts +0 -17
  25. data/node_modules/@playwright/test/reporter.js +0 -17
  26. data/node_modules/@playwright/test/reporter.mjs +0 -17
  27. data/node_modules/@types/node/LICENSE +0 -21
  28. data/node_modules/@types/node/README.md +0 -15
  29. data/node_modules/@types/node/assert/strict.d.ts +0 -8
  30. data/node_modules/@types/node/assert.d.ts +0 -1040
  31. data/node_modules/@types/node/async_hooks.d.ts +0 -541
  32. data/node_modules/@types/node/buffer.d.ts +0 -2300
  33. data/node_modules/@types/node/child_process.d.ts +0 -1544
  34. data/node_modules/@types/node/cluster.d.ts +0 -578
  35. data/node_modules/@types/node/console.d.ts +0 -452
  36. data/node_modules/@types/node/constants.d.ts +0 -19
  37. data/node_modules/@types/node/crypto.d.ts +0 -4451
  38. data/node_modules/@types/node/dgram.d.ts +0 -596
  39. data/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  40. data/node_modules/@types/node/dns/promises.d.ts +0 -476
  41. data/node_modules/@types/node/dns.d.ts +0 -865
  42. data/node_modules/@types/node/dom-events.d.ts +0 -124
  43. data/node_modules/@types/node/domain.d.ts +0 -170
  44. data/node_modules/@types/node/events.d.ts +0 -931
  45. data/node_modules/@types/node/fs/promises.d.ts +0 -1264
  46. data/node_modules/@types/node/fs.d.ts +0 -4390
  47. data/node_modules/@types/node/globals.d.ts +0 -611
  48. data/node_modules/@types/node/globals.global.d.ts +0 -1
  49. data/node_modules/@types/node/http.d.ts +0 -1921
  50. data/node_modules/@types/node/http2.d.ts +0 -2555
  51. data/node_modules/@types/node/https.d.ts +0 -544
  52. data/node_modules/@types/node/index.d.ts +0 -90
  53. data/node_modules/@types/node/inspector.d.ts +0 -3966
  54. data/node_modules/@types/node/module.d.ts +0 -301
  55. data/node_modules/@types/node/net.d.ts +0 -995
  56. data/node_modules/@types/node/os.d.ts +0 -495
  57. data/node_modules/@types/node/package.json +0 -217
  58. data/node_modules/@types/node/path.d.ts +0 -200
  59. data/node_modules/@types/node/perf_hooks.d.ts +0 -941
  60. data/node_modules/@types/node/process.d.ts +0 -1912
  61. data/node_modules/@types/node/punycode.d.ts +0 -117
  62. data/node_modules/@types/node/querystring.d.ts +0 -153
  63. data/node_modules/@types/node/readline/promises.d.ts +0 -150
  64. data/node_modules/@types/node/readline.d.ts +0 -540
  65. data/node_modules/@types/node/repl.d.ts +0 -430
  66. data/node_modules/@types/node/sea.d.ts +0 -153
  67. data/node_modules/@types/node/sqlite.d.ts +0 -213
  68. data/node_modules/@types/node/stream/consumers.d.ts +0 -12
  69. data/node_modules/@types/node/stream/promises.d.ts +0 -83
  70. data/node_modules/@types/node/stream/web.d.ts +0 -606
  71. data/node_modules/@types/node/stream.d.ts +0 -1726
  72. data/node_modules/@types/node/string_decoder.d.ts +0 -67
  73. data/node_modules/@types/node/test.d.ts +0 -2098
  74. data/node_modules/@types/node/timers/promises.d.ts +0 -97
  75. data/node_modules/@types/node/timers.d.ts +0 -240
  76. data/node_modules/@types/node/tls.d.ts +0 -1220
  77. data/node_modules/@types/node/trace_events.d.ts +0 -197
  78. data/node_modules/@types/node/tty.d.ts +0 -208
  79. data/node_modules/@types/node/url.d.ts +0 -969
  80. data/node_modules/@types/node/util.d.ts +0 -2301
  81. data/node_modules/@types/node/v8.d.ts +0 -808
  82. data/node_modules/@types/node/vm.d.ts +0 -922
  83. data/node_modules/@types/node/wasi.d.ts +0 -181
  84. data/node_modules/@types/node/worker_threads.d.ts +0 -712
  85. data/node_modules/@types/node/zlib.d.ts +0 -539
  86. data/node_modules/fsevents/LICENSE +0 -22
  87. data/node_modules/fsevents/README.md +0 -83
  88. data/node_modules/fsevents/fsevents.d.ts +0 -46
  89. data/node_modules/fsevents/fsevents.js +0 -82
  90. data/node_modules/fsevents/fsevents.node +0 -0
  91. data/node_modules/fsevents/package.json +0 -62
  92. data/node_modules/playwright/.eslintrc.js +0 -6
  93. data/node_modules/playwright/LICENSE +0 -202
  94. data/node_modules/playwright/NOTICE +0 -5
  95. data/node_modules/playwright/README.md +0 -169
  96. data/node_modules/playwright/ThirdPartyNotices.txt +0 -4356
  97. data/node_modules/playwright/cli.js +0 -19
  98. data/node_modules/playwright/index.d.ts +0 -17
  99. data/node_modules/playwright/index.js +0 -17
  100. data/node_modules/playwright/index.mjs +0 -18
  101. data/node_modules/playwright/jsx-runtime.js +0 -41
  102. data/node_modules/playwright/jsx-runtime.mjs +0 -21
  103. data/node_modules/playwright/lib/common/config.js +0 -256
  104. data/node_modules/playwright/lib/common/configLoader.js +0 -321
  105. data/node_modules/playwright/lib/common/esmLoaderHost.js +0 -93
  106. data/node_modules/playwright/lib/common/expectBundle.js +0 -27
  107. data/node_modules/playwright/lib/common/expectBundleImpl.js +0 -389
  108. data/node_modules/playwright/lib/common/fixtures.js +0 -323
  109. data/node_modules/playwright/lib/common/globals.js +0 -48
  110. data/node_modules/playwright/lib/common/ipc.js +0 -48
  111. data/node_modules/playwright/lib/common/poolBuilder.js +0 -79
  112. data/node_modules/playwright/lib/common/process.js +0 -140
  113. data/node_modules/playwright/lib/common/suiteUtils.js +0 -133
  114. data/node_modules/playwright/lib/common/test.js +0 -311
  115. data/node_modules/playwright/lib/common/testLoader.js +0 -102
  116. data/node_modules/playwright/lib/common/testType.js +0 -284
  117. data/node_modules/playwright/lib/fsWatcher.js +0 -69
  118. data/node_modules/playwright/lib/index.js +0 -888
  119. data/node_modules/playwright/lib/internalsForTest.js +0 -28
  120. data/node_modules/playwright/lib/isomorphic/events.js +0 -72
  121. data/node_modules/playwright/lib/isomorphic/folders.js +0 -25
  122. data/node_modules/playwright/lib/isomorphic/stringInternPool.js +0 -58
  123. data/node_modules/playwright/lib/isomorphic/teleReceiver.js +0 -504
  124. data/node_modules/playwright/lib/isomorphic/teleSuiteUpdater.js +0 -149
  125. data/node_modules/playwright/lib/isomorphic/testServerConnection.js +0 -210
  126. data/node_modules/playwright/lib/isomorphic/testServerInterface.js +0 -5
  127. data/node_modules/playwright/lib/isomorphic/testTree.js +0 -272
  128. data/node_modules/playwright/lib/loader/loaderMain.js +0 -58
  129. data/node_modules/playwright/lib/matchers/expect.js +0 -297
  130. data/node_modules/playwright/lib/matchers/matcherHint.js +0 -50
  131. data/node_modules/playwright/lib/matchers/matchers.js +0 -449
  132. data/node_modules/playwright/lib/matchers/toBeTruthy.js +0 -55
  133. data/node_modules/playwright/lib/matchers/toEqual.js +0 -57
  134. data/node_modules/playwright/lib/matchers/toMatchSnapshot.js +0 -383
  135. data/node_modules/playwright/lib/matchers/toMatchText.js +0 -76
  136. data/node_modules/playwright/lib/plugins/gitCommitInfoPlugin.js +0 -78
  137. data/node_modules/playwright/lib/plugins/index.js +0 -19
  138. data/node_modules/playwright/lib/plugins/webServerPlugin.js +0 -187
  139. data/node_modules/playwright/lib/program.js +0 -346
  140. data/node_modules/playwright/lib/reporters/base.js +0 -553
  141. data/node_modules/playwright/lib/reporters/blob.js +0 -133
  142. data/node_modules/playwright/lib/reporters/dot.js +0 -82
  143. data/node_modules/playwright/lib/reporters/empty.js +0 -42
  144. data/node_modules/playwright/lib/reporters/github.js +0 -115
  145. data/node_modules/playwright/lib/reporters/html.js +0 -623
  146. data/node_modules/playwright/lib/reporters/internalReporter.js +0 -123
  147. data/node_modules/playwright/lib/reporters/json.js +0 -243
  148. data/node_modules/playwright/lib/reporters/junit.js +0 -233
  149. data/node_modules/playwright/lib/reporters/line.js +0 -108
  150. data/node_modules/playwright/lib/reporters/list.js +0 -222
  151. data/node_modules/playwright/lib/reporters/markdown.js +0 -76
  152. data/node_modules/playwright/lib/reporters/merge.js +0 -477
  153. data/node_modules/playwright/lib/reporters/multiplexer.js +0 -90
  154. data/node_modules/playwright/lib/reporters/reporterV2.js +0 -118
  155. data/node_modules/playwright/lib/reporters/teleEmitter.js +0 -268
  156. data/node_modules/playwright/lib/reporters/versions/blobV1.js +0 -5
  157. data/node_modules/playwright/lib/runner/dispatcher.js +0 -532
  158. data/node_modules/playwright/lib/runner/failureTracker.js +0 -60
  159. data/node_modules/playwright/lib/runner/loadUtils.js +0 -308
  160. data/node_modules/playwright/lib/runner/loaderHost.js +0 -85
  161. data/node_modules/playwright/lib/runner/processHost.js +0 -175
  162. data/node_modules/playwright/lib/runner/projectUtils.js +0 -203
  163. data/node_modules/playwright/lib/runner/reporters.js +0 -151
  164. data/node_modules/playwright/lib/runner/runner.js +0 -179
  165. data/node_modules/playwright/lib/runner/sigIntWatcher.js +0 -100
  166. data/node_modules/playwright/lib/runner/taskRunner.js +0 -147
  167. data/node_modules/playwright/lib/runner/tasks.js +0 -407
  168. data/node_modules/playwright/lib/runner/testGroups.js +0 -136
  169. data/node_modules/playwright/lib/runner/testServer.js +0 -605
  170. data/node_modules/playwright/lib/runner/uiModeReporter.js +0 -31
  171. data/node_modules/playwright/lib/runner/vcs.js +0 -55
  172. data/node_modules/playwright/lib/runner/watchMode.js +0 -398
  173. data/node_modules/playwright/lib/runner/workerHost.js +0 -85
  174. data/node_modules/playwright/lib/third_party/tsconfig-loader.js +0 -134
  175. data/node_modules/playwright/lib/transform/babelBundle.js +0 -28
  176. data/node_modules/playwright/lib/transform/babelBundleImpl.js +0 -2032
  177. data/node_modules/playwright/lib/transform/compilationCache.js +0 -254
  178. data/node_modules/playwright/lib/transform/esmLoader.js +0 -117
  179. data/node_modules/playwright/lib/transform/esmUtils.js +0 -32
  180. data/node_modules/playwright/lib/transform/portTransport.js +0 -81
  181. data/node_modules/playwright/lib/transform/transform.js +0 -267
  182. data/node_modules/playwright/lib/util.js +0 -356
  183. data/node_modules/playwright/lib/utilsBundle.js +0 -28
  184. data/node_modules/playwright/lib/utilsBundleImpl.js +0 -102
  185. data/node_modules/playwright/lib/worker/fixtureRunner.js +0 -279
  186. data/node_modules/playwright/lib/worker/testInfo.js +0 -397
  187. data/node_modules/playwright/lib/worker/testTracing.js +0 -314
  188. data/node_modules/playwright/lib/worker/timeoutManager.js +0 -153
  189. data/node_modules/playwright/lib/worker/workerMain.js +0 -637
  190. data/node_modules/playwright/node_modules/.bin/playwright-core +0 -1
  191. data/node_modules/playwright/package.json +0 -66
  192. data/node_modules/playwright/test.d.ts +0 -18
  193. data/node_modules/playwright/test.js +0 -24
  194. data/node_modules/playwright/test.mjs +0 -33
  195. data/node_modules/playwright/types/test.d.ts +0 -8444
  196. data/node_modules/playwright/types/testReporter.d.ts +0 -749
  197. data/node_modules/playwright-core/LICENSE +0 -202
  198. data/node_modules/playwright-core/NOTICE +0 -5
  199. data/node_modules/playwright-core/README.md +0 -3
  200. data/node_modules/playwright-core/ThirdPartyNotices.txt +0 -1548
  201. data/node_modules/playwright-core/bin/PrintDeps.exe +0 -0
  202. data/node_modules/playwright-core/bin/README.md +0 -2
  203. data/node_modules/playwright-core/bin/install_media_pack.ps1 +0 -5
  204. data/node_modules/playwright-core/bin/reinstall_chrome_beta_linux.sh +0 -40
  205. data/node_modules/playwright-core/bin/reinstall_chrome_beta_mac.sh +0 -13
  206. data/node_modules/playwright-core/bin/reinstall_chrome_beta_win.ps1 +0 -24
  207. data/node_modules/playwright-core/bin/reinstall_chrome_stable_linux.sh +0 -40
  208. data/node_modules/playwright-core/bin/reinstall_chrome_stable_mac.sh +0 -12
  209. data/node_modules/playwright-core/bin/reinstall_chrome_stable_win.ps1 +0 -24
  210. data/node_modules/playwright-core/bin/reinstall_msedge_beta_linux.sh +0 -40
  211. data/node_modules/playwright-core/bin/reinstall_msedge_beta_mac.sh +0 -11
  212. data/node_modules/playwright-core/bin/reinstall_msedge_beta_win.ps1 +0 -23
  213. data/node_modules/playwright-core/bin/reinstall_msedge_dev_linux.sh +0 -40
  214. data/node_modules/playwright-core/bin/reinstall_msedge_dev_mac.sh +0 -11
  215. data/node_modules/playwright-core/bin/reinstall_msedge_dev_win.ps1 +0 -23
  216. data/node_modules/playwright-core/bin/reinstall_msedge_stable_linux.sh +0 -40
  217. data/node_modules/playwright-core/bin/reinstall_msedge_stable_mac.sh +0 -11
  218. data/node_modules/playwright-core/bin/reinstall_msedge_stable_win.ps1 +0 -24
  219. data/node_modules/playwright-core/browsers.json +0 -53
  220. data/node_modules/playwright-core/cli.js +0 -18
  221. data/node_modules/playwright-core/index.d.ts +0 -17
  222. data/node_modules/playwright-core/index.js +0 -33
  223. data/node_modules/playwright-core/index.mjs +0 -28
  224. data/node_modules/playwright-core/lib/androidServerImpl.js +0 -69
  225. data/node_modules/playwright-core/lib/browserServerImpl.js +0 -92
  226. data/node_modules/playwright-core/lib/cli/driver.js +0 -95
  227. data/node_modules/playwright-core/lib/cli/program.js +0 -577
  228. data/node_modules/playwright-core/lib/cli/programWithTestStub.js +0 -67
  229. data/node_modules/playwright-core/lib/client/accessibility.js +0 -50
  230. data/node_modules/playwright-core/lib/client/android.js +0 -473
  231. data/node_modules/playwright-core/lib/client/api.js +0 -279
  232. data/node_modules/playwright-core/lib/client/artifact.js +0 -79
  233. data/node_modules/playwright-core/lib/client/browser.js +0 -145
  234. data/node_modules/playwright-core/lib/client/browserContext.js +0 -541
  235. data/node_modules/playwright-core/lib/client/browserType.js +0 -241
  236. data/node_modules/playwright-core/lib/client/cdpSession.js +0 -53
  237. data/node_modules/playwright-core/lib/client/channelOwner.js +0 -231
  238. data/node_modules/playwright-core/lib/client/clientHelper.js +0 -57
  239. data/node_modules/playwright-core/lib/client/clientInstrumentation.js +0 -50
  240. data/node_modules/playwright-core/lib/client/clock.js +0 -68
  241. data/node_modules/playwright-core/lib/client/connection.js +0 -330
  242. data/node_modules/playwright-core/lib/client/consoleMessage.js +0 -55
  243. data/node_modules/playwright-core/lib/client/coverage.js +0 -41
  244. data/node_modules/playwright-core/lib/client/dialog.js +0 -57
  245. data/node_modules/playwright-core/lib/client/download.js +0 -62
  246. data/node_modules/playwright-core/lib/client/electron.js +0 -135
  247. data/node_modules/playwright-core/lib/client/elementHandle.js +0 -321
  248. data/node_modules/playwright-core/lib/client/errors.js +0 -77
  249. data/node_modules/playwright-core/lib/client/eventEmitter.js +0 -314
  250. data/node_modules/playwright-core/lib/client/events.js +0 -94
  251. data/node_modules/playwright-core/lib/client/fetch.js +0 -396
  252. data/node_modules/playwright-core/lib/client/fileChooser.js +0 -45
  253. data/node_modules/playwright-core/lib/client/frame.js +0 -504
  254. data/node_modules/playwright-core/lib/client/harRouter.js +0 -99
  255. data/node_modules/playwright-core/lib/client/input.js +0 -111
  256. data/node_modules/playwright-core/lib/client/jsHandle.js +0 -129
  257. data/node_modules/playwright-core/lib/client/jsonPipe.js +0 -35
  258. data/node_modules/playwright-core/lib/client/localUtils.js +0 -35
  259. data/node_modules/playwright-core/lib/client/locator.js +0 -441
  260. data/node_modules/playwright-core/lib/client/network.js +0 -604
  261. data/node_modules/playwright-core/lib/client/page.js +0 -725
  262. data/node_modules/playwright-core/lib/client/playwright.js +0 -77
  263. data/node_modules/playwright-core/lib/client/selectors.js +0 -67
  264. data/node_modules/playwright-core/lib/client/stream.js +0 -54
  265. data/node_modules/playwright-core/lib/client/tracing.js +0 -138
  266. data/node_modules/playwright-core/lib/client/types.js +0 -24
  267. data/node_modules/playwright-core/lib/client/video.js +0 -51
  268. data/node_modules/playwright-core/lib/client/waiter.js +0 -158
  269. data/node_modules/playwright-core/lib/client/webError.js +0 -37
  270. data/node_modules/playwright-core/lib/client/worker.js +0 -71
  271. data/node_modules/playwright-core/lib/client/writableStream.js +0 -54
  272. data/node_modules/playwright-core/lib/common/socksProxy.js +0 -569
  273. data/node_modules/playwright-core/lib/common/timeoutSettings.js +0 -73
  274. data/node_modules/playwright-core/lib/common/types.js +0 -5
  275. data/node_modules/playwright-core/lib/generated/clockSource.js +0 -7
  276. data/node_modules/playwright-core/lib/generated/consoleApiSource.js +0 -7
  277. data/node_modules/playwright-core/lib/generated/injectedScriptSource.js +0 -7
  278. data/node_modules/playwright-core/lib/generated/recorderSource.js +0 -7
  279. data/node_modules/playwright-core/lib/generated/utilityScriptSource.js +0 -7
  280. data/node_modules/playwright-core/lib/image_tools/colorUtils.js +0 -98
  281. data/node_modules/playwright-core/lib/image_tools/compare.js +0 -108
  282. data/node_modules/playwright-core/lib/image_tools/imageChannel.js +0 -70
  283. data/node_modules/playwright-core/lib/image_tools/stats.js +0 -102
  284. data/node_modules/playwright-core/lib/inProcessFactory.js +0 -54
  285. data/node_modules/playwright-core/lib/inprocess.js +0 -20
  286. data/node_modules/playwright-core/lib/outofprocess.js +0 -67
  287. data/node_modules/playwright-core/lib/protocol/debug.js +0 -27
  288. data/node_modules/playwright-core/lib/protocol/serializers.js +0 -173
  289. data/node_modules/playwright-core/lib/protocol/transport.js +0 -82
  290. data/node_modules/playwright-core/lib/protocol/validator.js +0 -2694
  291. data/node_modules/playwright-core/lib/protocol/validatorPrimitives.js +0 -139
  292. data/node_modules/playwright-core/lib/remote/playwrightConnection.js +0 -274
  293. data/node_modules/playwright-core/lib/remote/playwrightServer.js +0 -110
  294. data/node_modules/playwright-core/lib/server/accessibility.js +0 -62
  295. data/node_modules/playwright-core/lib/server/android/android.js +0 -441
  296. data/node_modules/playwright-core/lib/server/android/backendAdb.js +0 -172
  297. data/node_modules/playwright-core/lib/server/artifact.js +0 -104
  298. data/node_modules/playwright-core/lib/server/bidi/bidiBrowser.js +0 -296
  299. data/node_modules/playwright-core/lib/server/bidi/bidiConnection.js +0 -206
  300. data/node_modules/playwright-core/lib/server/bidi/bidiExecutionContext.js +0 -162
  301. data/node_modules/playwright-core/lib/server/bidi/bidiFirefox.js +0 -110
  302. data/node_modules/playwright-core/lib/server/bidi/bidiInput.js +0 -174
  303. data/node_modules/playwright-core/lib/server/bidi/bidiNetworkManager.js +0 -304
  304. data/node_modules/playwright-core/lib/server/bidi/bidiPage.js +0 -456
  305. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiDeserializer.js +0 -93
  306. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +0 -238
  307. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +0 -139
  308. data/node_modules/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +0 -144
  309. data/node_modules/playwright-core/lib/server/browser.js +0 -137
  310. data/node_modules/playwright-core/lib/server/browserContext.js +0 -684
  311. data/node_modules/playwright-core/lib/server/browserType.js +0 -307
  312. data/node_modules/playwright-core/lib/server/chromium/appIcon.png +0 -0
  313. data/node_modules/playwright-core/lib/server/chromium/chromium.js +0 -362
  314. data/node_modules/playwright-core/lib/server/chromium/chromiumSwitches.js +0 -44
  315. data/node_modules/playwright-core/lib/server/chromium/crAccessibility.js +0 -237
  316. data/node_modules/playwright-core/lib/server/chromium/crBrowser.js +0 -515
  317. data/node_modules/playwright-core/lib/server/chromium/crConnection.js +0 -228
  318. data/node_modules/playwright-core/lib/server/chromium/crCoverage.js +0 -246
  319. data/node_modules/playwright-core/lib/server/chromium/crDevTools.js +0 -104
  320. data/node_modules/playwright-core/lib/server/chromium/crDragDrop.js +0 -143
  321. data/node_modules/playwright-core/lib/server/chromium/crExecutionContext.js +0 -156
  322. data/node_modules/playwright-core/lib/server/chromium/crInput.js +0 -171
  323. data/node_modules/playwright-core/lib/server/chromium/crNetworkManager.js +0 -767
  324. data/node_modules/playwright-core/lib/server/chromium/crPage.js +0 -1128
  325. data/node_modules/playwright-core/lib/server/chromium/crPdf.js +0 -153
  326. data/node_modules/playwright-core/lib/server/chromium/crProtocolHelper.js +0 -133
  327. data/node_modules/playwright-core/lib/server/chromium/crServiceWorker.js +0 -112
  328. data/node_modules/playwright-core/lib/server/chromium/defaultFontFamilies.js +0 -145
  329. data/node_modules/playwright-core/lib/server/chromium/videoRecorder.js +0 -155
  330. data/node_modules/playwright-core/lib/server/clock.js +0 -125
  331. data/node_modules/playwright-core/lib/server/codegen/csharp.js +0 -299
  332. data/node_modules/playwright-core/lib/server/codegen/java.js +0 -235
  333. data/node_modules/playwright-core/lib/server/codegen/javascript.js +0 -223
  334. data/node_modules/playwright-core/lib/server/codegen/jsonl.js +0 -47
  335. data/node_modules/playwright-core/lib/server/codegen/language.js +0 -76
  336. data/node_modules/playwright-core/lib/server/codegen/languages.js +0 -30
  337. data/node_modules/playwright-core/lib/server/codegen/python.js +0 -265
  338. data/node_modules/playwright-core/lib/server/codegen/types.js +0 -5
  339. data/node_modules/playwright-core/lib/server/console.js +0 -57
  340. data/node_modules/playwright-core/lib/server/cookieStore.js +0 -112
  341. data/node_modules/playwright-core/lib/server/debugController.js +0 -234
  342. data/node_modules/playwright-core/lib/server/debugger.js +0 -132
  343. data/node_modules/playwright-core/lib/server/deviceDescriptors.js +0 -26
  344. data/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +0 -1669
  345. data/node_modules/playwright-core/lib/server/dialog.js +0 -70
  346. data/node_modules/playwright-core/lib/server/dispatchers/androidDispatcher.js +0 -193
  347. data/node_modules/playwright-core/lib/server/dispatchers/artifactDispatcher.js +0 -118
  348. data/node_modules/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +0 -351
  349. data/node_modules/playwright-core/lib/server/dispatchers/browserDispatcher.js +0 -170
  350. data/node_modules/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
  351. data/node_modules/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +0 -48
  352. data/node_modules/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +0 -103
  353. data/node_modules/playwright-core/lib/server/dispatchers/dialogDispatcher.js +0 -44
  354. data/node_modules/playwright-core/lib/server/dispatchers/dispatcher.js +0 -395
  355. data/node_modules/playwright-core/lib/server/dispatchers/electronDispatcher.js +0 -93
  356. data/node_modules/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +0 -228
  357. data/node_modules/playwright-core/lib/server/dispatchers/frameDispatcher.js +0 -286
  358. data/node_modules/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +0 -102
  359. data/node_modules/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +0 -59
  360. data/node_modules/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +0 -413
  361. data/node_modules/playwright-core/lib/server/dispatchers/networkDispatchers.js +0 -221
  362. data/node_modules/playwright-core/lib/server/dispatchers/pageDispatcher.js +0 -358
  363. data/node_modules/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +0 -106
  364. data/node_modules/playwright-core/lib/server/dispatchers/selectorsDispatcher.js +0 -36
  365. data/node_modules/playwright-core/lib/server/dispatchers/streamDispatcher.js +0 -62
  366. data/node_modules/playwright-core/lib/server/dispatchers/tracingDispatcher.js +0 -54
  367. data/node_modules/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +0 -58
  368. data/node_modules/playwright-core/lib/server/dom.js +0 -845
  369. data/node_modules/playwright-core/lib/server/download.js +0 -53
  370. data/node_modules/playwright-core/lib/server/electron/electron.js +0 -296
  371. data/node_modules/playwright-core/lib/server/electron/loader.js +0 -57
  372. data/node_modules/playwright-core/lib/server/errors.js +0 -68
  373. data/node_modules/playwright-core/lib/server/fetch.js +0 -660
  374. data/node_modules/playwright-core/lib/server/fileChooser.js +0 -42
  375. data/node_modules/playwright-core/lib/server/fileUploadUtils.js +0 -75
  376. data/node_modules/playwright-core/lib/server/firefox/ffAccessibility.js +0 -216
  377. data/node_modules/playwright-core/lib/server/firefox/ffBrowser.js +0 -458
  378. data/node_modules/playwright-core/lib/server/firefox/ffConnection.js +0 -168
  379. data/node_modules/playwright-core/lib/server/firefox/ffExecutionContext.js +0 -138
  380. data/node_modules/playwright-core/lib/server/firefox/ffInput.js +0 -150
  381. data/node_modules/playwright-core/lib/server/firefox/ffNetworkManager.js +0 -233
  382. data/node_modules/playwright-core/lib/server/firefox/ffPage.js +0 -556
  383. data/node_modules/playwright-core/lib/server/firefox/firefox.js +0 -110
  384. data/node_modules/playwright-core/lib/server/formData.js +0 -75
  385. data/node_modules/playwright-core/lib/server/frameSelectors.js +0 -171
  386. data/node_modules/playwright-core/lib/server/frames.js +0 -1654
  387. data/node_modules/playwright-core/lib/server/har/harRecorder.js +0 -139
  388. data/node_modules/playwright-core/lib/server/har/harTracer.js +0 -531
  389. data/node_modules/playwright-core/lib/server/helper.js +0 -103
  390. data/node_modules/playwright-core/lib/server/index.js +0 -114
  391. data/node_modules/playwright-core/lib/server/input.js +0 -311
  392. data/node_modules/playwright-core/lib/server/instrumentation.js +0 -70
  393. data/node_modules/playwright-core/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
  394. data/node_modules/playwright-core/lib/server/javascript.js +0 -306
  395. data/node_modules/playwright-core/lib/server/launchApp.js +0 -91
  396. data/node_modules/playwright-core/lib/server/macEditingCommands.js +0 -139
  397. data/node_modules/playwright-core/lib/server/network.js +0 -617
  398. data/node_modules/playwright-core/lib/server/page.js +0 -825
  399. data/node_modules/playwright-core/lib/server/pipeTransport.js +0 -85
  400. data/node_modules/playwright-core/lib/server/playwright.js +0 -85
  401. data/node_modules/playwright-core/lib/server/progress.js +0 -102
  402. data/node_modules/playwright-core/lib/server/protocolError.js +0 -49
  403. data/node_modules/playwright-core/lib/server/recorder/contextRecorder.js +0 -316
  404. data/node_modules/playwright-core/lib/server/recorder/recorderActions.js +0 -5
  405. data/node_modules/playwright-core/lib/server/recorder/recorderApp.js +0 -190
  406. data/node_modules/playwright-core/lib/server/recorder/recorderCollection.js +0 -127
  407. data/node_modules/playwright-core/lib/server/recorder/recorderRunner.js +0 -177
  408. data/node_modules/playwright-core/lib/server/recorder/recorderUtils.js +0 -71
  409. data/node_modules/playwright-core/lib/server/recorder/throttledFile.js +0 -46
  410. data/node_modules/playwright-core/lib/server/recorder.js +0 -324
  411. data/node_modules/playwright-core/lib/server/registry/browserFetcher.js +0 -168
  412. data/node_modules/playwright-core/lib/server/registry/dependencies.js +0 -322
  413. data/node_modules/playwright-core/lib/server/registry/index.js +0 -924
  414. data/node_modules/playwright-core/lib/server/registry/nativeDeps.js +0 -490
  415. data/node_modules/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +0 -138
  416. data/node_modules/playwright-core/lib/server/screenshotter.js +0 -348
  417. data/node_modules/playwright-core/lib/server/selectors.js +0 -73
  418. data/node_modules/playwright-core/lib/server/socksClientCertificatesInterceptor.js +0 -328
  419. data/node_modules/playwright-core/lib/server/socksInterceptor.js +0 -100
  420. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotter.js +0 -171
  421. data/node_modules/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +0 -493
  422. data/node_modules/playwright-core/lib/server/trace/recorder/tracing.js +0 -486
  423. data/node_modules/playwright-core/lib/server/trace/test/inMemorySnapshotter.js +0 -93
  424. data/node_modules/playwright-core/lib/server/trace/viewer/traceViewer.js +0 -216
  425. data/node_modules/playwright-core/lib/server/transport.js +0 -191
  426. data/node_modules/playwright-core/lib/server/types.js +0 -24
  427. data/node_modules/playwright-core/lib/server/usKeyboardLayout.js +0 -555
  428. data/node_modules/playwright-core/lib/server/webkit/webkit.js +0 -87
  429. data/node_modules/playwright-core/lib/server/webkit/wkAccessibility.js +0 -194
  430. data/node_modules/playwright-core/lib/server/webkit/wkBrowser.js +0 -328
  431. data/node_modules/playwright-core/lib/server/webkit/wkConnection.js +0 -173
  432. data/node_modules/playwright-core/lib/server/webkit/wkExecutionContext.js +0 -146
  433. data/node_modules/playwright-core/lib/server/webkit/wkInput.js +0 -169
  434. data/node_modules/playwright-core/lib/server/webkit/wkInterceptableRequest.js +0 -162
  435. data/node_modules/playwright-core/lib/server/webkit/wkPage.js +0 -1216
  436. data/node_modules/playwright-core/lib/server/webkit/wkProvisionalPage.js +0 -94
  437. data/node_modules/playwright-core/lib/server/webkit/wkWorkers.js +0 -104
  438. data/node_modules/playwright-core/lib/third_party/diff_match_patch.js +0 -2222
  439. data/node_modules/playwright-core/lib/third_party/pixelmatch.js +0 -255
  440. data/node_modules/playwright-core/lib/utils/ascii.js +0 -31
  441. data/node_modules/playwright-core/lib/utils/comparators.js +0 -171
  442. data/node_modules/playwright-core/lib/utils/crypto.js +0 -174
  443. data/node_modules/playwright-core/lib/utils/debug.js +0 -46
  444. data/node_modules/playwright-core/lib/utils/debugLogger.js +0 -91
  445. data/node_modules/playwright-core/lib/utils/env.js +0 -49
  446. data/node_modules/playwright-core/lib/utils/eventsHelper.js +0 -38
  447. data/node_modules/playwright-core/lib/utils/expectUtils.js +0 -33
  448. data/node_modules/playwright-core/lib/utils/fileUtils.js +0 -205
  449. data/node_modules/playwright-core/lib/utils/happy-eyeballs.js +0 -181
  450. data/node_modules/playwright-core/lib/utils/headers.js +0 -52
  451. data/node_modules/playwright-core/lib/utils/hostPlatform.js +0 -133
  452. data/node_modules/playwright-core/lib/utils/httpServer.js +0 -236
  453. data/node_modules/playwright-core/lib/utils/index.js +0 -368
  454. data/node_modules/playwright-core/lib/utils/isomorphic/cssParser.js +0 -250
  455. data/node_modules/playwright-core/lib/utils/isomorphic/cssTokenizer.js +0 -979
  456. data/node_modules/playwright-core/lib/utils/isomorphic/locatorGenerators.js +0 -651
  457. data/node_modules/playwright-core/lib/utils/isomorphic/locatorParser.js +0 -179
  458. data/node_modules/playwright-core/lib/utils/isomorphic/locatorUtils.js +0 -62
  459. data/node_modules/playwright-core/lib/utils/isomorphic/mimeType.js +0 -29
  460. data/node_modules/playwright-core/lib/utils/isomorphic/selectorParser.js +0 -397
  461. data/node_modules/playwright-core/lib/utils/isomorphic/stringUtils.js +0 -139
  462. data/node_modules/playwright-core/lib/utils/isomorphic/traceUtils.js +0 -39
  463. data/node_modules/playwright-core/lib/utils/isomorphic/urlMatch.js +0 -120
  464. data/node_modules/playwright-core/lib/utils/linuxUtils.js +0 -78
  465. data/node_modules/playwright-core/lib/utils/manualPromise.js +0 -109
  466. data/node_modules/playwright-core/lib/utils/multimap.js +0 -75
  467. data/node_modules/playwright-core/lib/utils/network.js +0 -160
  468. data/node_modules/playwright-core/lib/utils/processLauncher.js +0 -248
  469. data/node_modules/playwright-core/lib/utils/profiler.js +0 -53
  470. data/node_modules/playwright-core/lib/utils/rtti.js +0 -44
  471. data/node_modules/playwright-core/lib/utils/semaphore.js +0 -51
  472. data/node_modules/playwright-core/lib/utils/spawnAsync.js +0 -45
  473. data/node_modules/playwright-core/lib/utils/stackTrace.js +0 -121
  474. data/node_modules/playwright-core/lib/utils/task.js +0 -58
  475. data/node_modules/playwright-core/lib/utils/time.js +0 -37
  476. data/node_modules/playwright-core/lib/utils/timeoutRunner.js +0 -66
  477. data/node_modules/playwright-core/lib/utils/traceUtils.js +0 -44
  478. data/node_modules/playwright-core/lib/utils/userAgent.js +0 -105
  479. data/node_modules/playwright-core/lib/utils/wsServer.js +0 -127
  480. data/node_modules/playwright-core/lib/utils/zipFile.js +0 -75
  481. data/node_modules/playwright-core/lib/utils/zones.js +0 -62
  482. data/node_modules/playwright-core/lib/utilsBundle.js +0 -82
  483. data/node_modules/playwright-core/lib/utilsBundleImpl/index.js +0 -53
  484. data/node_modules/playwright-core/lib/utilsBundleImpl/xdg-open +0 -1066
  485. data/node_modules/playwright-core/lib/vite/htmlReport/index.html +0 -66
  486. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-aW6Vz3gf.js +0 -24
  487. data/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-ez37Vkbh.css +0 -1
  488. data/node_modules/playwright-core/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  489. data/node_modules/playwright-core/lib/vite/recorder/assets/index-B-MT5gKo.css +0 -1
  490. data/node_modules/playwright-core/lib/vite/recorder/assets/index-DCpXOVIh.js +0 -47
  491. data/node_modules/playwright-core/lib/vite/recorder/index.html +0 -29
  492. data/node_modules/playwright-core/lib/vite/recorder/playwright-logo.svg +0 -9
  493. data/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-eFKCUIu2.js +0 -24
  494. data/node_modules/playwright-core/lib/vite/traceViewer/assets/testServerConnection-DeE2kSzz.js +0 -1
  495. data/node_modules/playwright-core/lib/vite/traceViewer/assets/workbench-D0cirtfA.js +0 -72
  496. data/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-BeNbaIVa.js +0 -9
  497. data/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.ez37Vkbh.css +0 -1
  498. data/node_modules/playwright-core/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  499. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.BkuvsLJp.js +0 -2
  500. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.html +0 -16
  501. data/node_modules/playwright-core/lib/vite/traceViewer/embedded.w7WN2u1R.css +0 -1
  502. data/node_modules/playwright-core/lib/vite/traceViewer/index.C968kAiC.js +0 -2
  503. data/node_modules/playwright-core/lib/vite/traceViewer/index.CrbWWHbf.css +0 -1
  504. data/node_modules/playwright-core/lib/vite/traceViewer/index.html +0 -27
  505. data/node_modules/playwright-core/lib/vite/traceViewer/playwright-logo.svg +0 -9
  506. data/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +0 -21
  507. data/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +0 -3
  508. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BkFnr4V0.js +0 -10
  509. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D3cNFP6u.css +0 -1
  510. data/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +0 -18
  511. data/node_modules/playwright-core/lib/vite/traceViewer/workbench.DjbIuxix.css +0 -1
  512. data/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DSXBckUd.css +0 -32
  513. data/node_modules/playwright-core/lib/zipBundle.js +0 -25
  514. data/node_modules/playwright-core/lib/zipBundleImpl.js +0 -5
  515. data/node_modules/playwright-core/package.json +0 -44
  516. data/node_modules/playwright-core/types/protocol.d.ts +0 -21500
  517. data/node_modules/playwright-core/types/structs.d.ts +0 -45
  518. data/node_modules/playwright-core/types/types.d.ts +0 -21431
  519. data/node_modules/undici-types/LICENSE +0 -21
  520. data/node_modules/undici-types/README.md +0 -6
  521. data/node_modules/undici-types/agent.d.ts +0 -31
  522. data/node_modules/undici-types/api.d.ts +0 -43
  523. data/node_modules/undici-types/balanced-pool.d.ts +0 -29
  524. data/node_modules/undici-types/cache.d.ts +0 -36
  525. data/node_modules/undici-types/client.d.ts +0 -108
  526. data/node_modules/undici-types/connector.d.ts +0 -34
  527. data/node_modules/undici-types/content-type.d.ts +0 -21
  528. data/node_modules/undici-types/cookies.d.ts +0 -28
  529. data/node_modules/undici-types/diagnostics-channel.d.ts +0 -66
  530. data/node_modules/undici-types/dispatcher.d.ts +0 -255
  531. data/node_modules/undici-types/env-http-proxy-agent.d.ts +0 -21
  532. data/node_modules/undici-types/errors.d.ts +0 -149
  533. data/node_modules/undici-types/eventsource.d.ts +0 -63
  534. data/node_modules/undici-types/fetch.d.ts +0 -209
  535. data/node_modules/undici-types/file.d.ts +0 -39
  536. data/node_modules/undici-types/filereader.d.ts +0 -54
  537. data/node_modules/undici-types/formdata.d.ts +0 -108
  538. data/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  539. data/node_modules/undici-types/global-origin.d.ts +0 -7
  540. data/node_modules/undici-types/handlers.d.ts +0 -15
  541. data/node_modules/undici-types/header.d.ts +0 -4
  542. data/node_modules/undici-types/index.d.ts +0 -71
  543. data/node_modules/undici-types/interceptors.d.ts +0 -15
  544. data/node_modules/undici-types/mock-agent.d.ts +0 -50
  545. data/node_modules/undici-types/mock-client.d.ts +0 -25
  546. data/node_modules/undici-types/mock-errors.d.ts +0 -12
  547. data/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  548. data/node_modules/undici-types/mock-pool.d.ts +0 -25
  549. data/node_modules/undici-types/package.json +0 -55
  550. data/node_modules/undici-types/patch.d.ts +0 -71
  551. data/node_modules/undici-types/pool-stats.d.ts +0 -19
  552. data/node_modules/undici-types/pool.d.ts +0 -39
  553. data/node_modules/undici-types/proxy-agent.d.ts +0 -28
  554. data/node_modules/undici-types/readable.d.ts +0 -60
  555. data/node_modules/undici-types/retry-agent.d.ts +0 -8
  556. data/node_modules/undici-types/retry-handler.d.ts +0 -116
  557. data/node_modules/undici-types/util.d.ts +0 -18
  558. data/node_modules/undici-types/webidl.d.ts +0 -222
  559. data/node_modules/undici-types/websocket.d.ts +0 -152
  560. data/yarn.lock +0 -41
@@ -1,1216 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.WKPage = void 0;
7
- var _path = _interopRequireDefault(require("path"));
8
- var _os = _interopRequireDefault(require("os"));
9
- var _utilsBundle = require("../../utilsBundle");
10
- var _stackTrace = require("../../utils/stackTrace");
11
- var _utils = require("../../utils");
12
- var _hostPlatform = require("../../utils/hostPlatform");
13
- var dialog = _interopRequireWildcard(require("../dialog"));
14
- var dom = _interopRequireWildcard(require("../dom"));
15
- var _eventsHelper = require("../../utils/eventsHelper");
16
- var _helper = require("../helper");
17
- var network = _interopRequireWildcard(require("../network"));
18
- var _page = require("../page");
19
- var _wkAccessibility = require("./wkAccessibility");
20
- var _wkConnection = require("./wkConnection");
21
- var _wkExecutionContext = require("./wkExecutionContext");
22
- var _wkInput = require("./wkInput");
23
- var _wkInterceptableRequest = require("./wkInterceptableRequest");
24
- var _wkProvisionalPage = require("./wkProvisionalPage");
25
- var _wkWorkers = require("./wkWorkers");
26
- var _debugLogger = require("../../utils/debugLogger");
27
- var _manualPromise = require("../../utils/manualPromise");
28
- var _browserContext = require("../browserContext");
29
- var _errors = require("../errors");
30
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
31
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
32
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
- /**
34
- * Copyright 2017 Google Inc. All rights reserved.
35
- * Modifications copyright (c) Microsoft Corporation.
36
- *
37
- * Licensed under the Apache License, Version 2.0 (the "License");
38
- * you may not use this file except in compliance with the License.
39
- * You may obtain a copy of the License at
40
- *
41
- * http://www.apache.org/licenses/LICENSE-2.0
42
- *
43
- * Unless required by applicable law or agreed to in writing, software
44
- * distributed under the License is distributed on an "AS IS" BASIS,
45
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46
- * See the License for the specific language governing permissions and
47
- * limitations under the License.
48
- */
49
-
50
- const UTILITY_WORLD_NAME = '__playwright_utility_world__';
51
- class WKPage {
52
- constructor(browserContext, pageProxySession, opener) {
53
- this.rawMouse = void 0;
54
- this.rawKeyboard = void 0;
55
- this.rawTouchscreen = void 0;
56
- this._session = void 0;
57
- this._provisionalPage = null;
58
- this._page = void 0;
59
- this._pagePromise = new _manualPromise.ManualPromise();
60
- this._pageProxySession = void 0;
61
- this._opener = void 0;
62
- this._requestIdToRequest = new Map();
63
- this._requestIdToRequestWillBeSentEvent = new Map();
64
- this._workers = void 0;
65
- this._contextIdToContext = void 0;
66
- this._sessionListeners = [];
67
- this._eventListeners = void 0;
68
- this._browserContext = void 0;
69
- this._initializedPage = null;
70
- this._firstNonInitialNavigationCommittedPromise = void 0;
71
- this._firstNonInitialNavigationCommittedFulfill = () => {};
72
- this._firstNonInitialNavigationCommittedReject = e => {};
73
- this._lastConsoleMessage = null;
74
- this._requestIdToResponseReceivedPayloadEvent = new Map();
75
- // Holds window features for the next popup being opened via window.open,
76
- // until the popup page proxy arrives.
77
- this._nextWindowOpenPopupFeatures = void 0;
78
- this._recordingVideoFile = null;
79
- this._screencastGeneration = 0;
80
- this._pageProxySession = pageProxySession;
81
- this._opener = opener;
82
- this.rawKeyboard = new _wkInput.RawKeyboardImpl(pageProxySession);
83
- this.rawMouse = new _wkInput.RawMouseImpl(pageProxySession);
84
- this.rawTouchscreen = new _wkInput.RawTouchscreenImpl(pageProxySession);
85
- this._contextIdToContext = new Map();
86
- this._page = new _page.Page(this, browserContext);
87
- this.rawMouse.setPage(this._page);
88
- this._workers = new _wkWorkers.WKWorkers(this._page);
89
- this._session = undefined;
90
- this._browserContext = browserContext;
91
- this._page.on(_page.Page.Events.FrameDetached, frame => this._removeContextsForFrame(frame, false));
92
- this._eventListeners = [_eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Target.targetCreated', this._onTargetCreated.bind(this)), _eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Target.targetDestroyed', this._onTargetDestroyed.bind(this)), _eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Target.dispatchMessageFromTarget', this._onDispatchMessageFromTarget.bind(this)), _eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Target.didCommitProvisionalTarget', this._onDidCommitProvisionalTarget.bind(this)), _eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Screencast.screencastFrame', this._onScreencastFrame.bind(this))];
93
- this._firstNonInitialNavigationCommittedPromise = new Promise((f, r) => {
94
- this._firstNonInitialNavigationCommittedFulfill = f;
95
- this._firstNonInitialNavigationCommittedReject = r;
96
- });
97
- if (opener && !browserContext._options.noDefaultViewport && opener._nextWindowOpenPopupFeatures) {
98
- const viewportSize = _helper.helper.getViewportSizeFromWindowFeatures(opener._nextWindowOpenPopupFeatures);
99
- opener._nextWindowOpenPopupFeatures = undefined;
100
- if (viewportSize) this._page._emulatedSize = {
101
- viewport: viewportSize,
102
- screen: viewportSize
103
- };
104
- }
105
- }
106
- potentiallyUninitializedPage() {
107
- return this._page;
108
- }
109
- async _initializePageProxySession() {
110
- if (this._page._browserContext.isSettingStorageState()) return;
111
- const promises = [this._pageProxySession.send('Dialog.enable'), this._pageProxySession.send('Emulation.setActiveAndFocused', {
112
- active: true
113
- })];
114
- const contextOptions = this._browserContext._options;
115
- if (contextOptions.javaScriptEnabled === false) promises.push(this._pageProxySession.send('Emulation.setJavaScriptEnabled', {
116
- enabled: false
117
- }));
118
- promises.push(this._updateViewport());
119
- promises.push(this.updateHttpCredentials());
120
- if (this._browserContext._permissions.size) {
121
- for (const [key, value] of this._browserContext._permissions) promises.push(this._grantPermissions(key, value));
122
- }
123
- if (this._browserContext._options.recordVideo) {
124
- const outputFile = _path.default.join(this._browserContext._options.recordVideo.dir, (0, _utils.createGuid)() + '.webm');
125
- promises.push(this._browserContext._ensureVideosPath().then(() => {
126
- return this._startVideo({
127
- // validateBrowserContextOptions ensures correct video size.
128
- ...this._browserContext._options.recordVideo.size,
129
- outputFile
130
- });
131
- }));
132
- }
133
- await Promise.all(promises);
134
- }
135
- _setSession(session) {
136
- _eventsHelper.eventsHelper.removeEventListeners(this._sessionListeners);
137
- this._session = session;
138
- this.rawKeyboard.setSession(session);
139
- this.rawMouse.setSession(session);
140
- this._addSessionListeners();
141
- this._workers.setSession(session);
142
- }
143
-
144
- // This method is called for provisional targets as well. The session passed as the parameter
145
- // may be different from the current session and may be destroyed without becoming current.
146
- async _initializeSession(session, provisional, resourceTreeHandler) {
147
- await this._initializeSessionMayThrow(session, resourceTreeHandler).catch(e => {
148
- // Provisional session can be disposed at any time, for example due to new navigation initiating
149
- // a new provisional page.
150
- if (provisional && session.isDisposed()) return;
151
- // Swallow initialization errors due to newer target swap in,
152
- // since we will reinitialize again.
153
- if (this._session === session) throw e;
154
- });
155
- }
156
- async _initializeSessionMayThrow(session, resourceTreeHandler) {
157
- const [, frameTree] = await Promise.all([
158
- // Page agent must be enabled before Runtime.
159
- session.send('Page.enable'), session.send('Page.getResourceTree')]);
160
- resourceTreeHandler(frameTree);
161
- const promises = [
162
- // Resource tree should be received before first execution context.
163
- session.send('Runtime.enable'), session.send('Runtime.addBinding', {
164
- name: _page.PageBinding.kPlaywrightBinding
165
- }), session.send('Page.createUserWorld', {
166
- name: UTILITY_WORLD_NAME
167
- }).catch(_ => {}),
168
- // Worlds are per-process
169
- session.send('Console.enable'), session.send('Network.enable'), this._workers.initializeSession(session)];
170
- if (this._page.needsRequestInterception()) {
171
- promises.push(session.send('Network.setInterceptionEnabled', {
172
- enabled: true
173
- }));
174
- promises.push(session.send('Network.setResourceCachingDisabled', {
175
- disabled: true
176
- }));
177
- promises.push(session.send('Network.addInterception', {
178
- url: '.*',
179
- stage: 'request',
180
- isRegex: true
181
- }));
182
- }
183
- if (this._page._browserContext.isSettingStorageState()) {
184
- await Promise.all(promises);
185
- return;
186
- }
187
- const contextOptions = this._browserContext._options;
188
- if (contextOptions.userAgent) promises.push(this.updateUserAgent());
189
- const emulatedMedia = this._page.emulatedMedia();
190
- if (emulatedMedia.media || emulatedMedia.colorScheme || emulatedMedia.reducedMotion || emulatedMedia.forcedColors) promises.push(WKPage._setEmulateMedia(session, emulatedMedia.media, emulatedMedia.colorScheme, emulatedMedia.reducedMotion, emulatedMedia.forcedColors));
191
- const bootstrapScript = this._calculateBootstrapScript();
192
- if (bootstrapScript.length) promises.push(session.send('Page.setBootstrapScript', {
193
- source: bootstrapScript
194
- }));
195
- this._page.frames().map(frame => frame.evaluateExpression(bootstrapScript).catch(e => {}));
196
- if (contextOptions.bypassCSP) promises.push(session.send('Page.setBypassCSP', {
197
- enabled: true
198
- }));
199
- const emulatedSize = this._page.emulatedSize();
200
- if (emulatedSize) {
201
- promises.push(session.send('Page.setScreenSizeOverride', {
202
- width: emulatedSize.screen.width,
203
- height: emulatedSize.screen.height
204
- }));
205
- }
206
- promises.push(this.updateEmulateMedia());
207
- promises.push(session.send('Network.setExtraHTTPHeaders', {
208
- headers: (0, _utils.headersArrayToObject)(this._calculateExtraHTTPHeaders(), false /* lowerCase */)
209
- }));
210
- if (contextOptions.offline) promises.push(session.send('Network.setEmulateOfflineState', {
211
- offline: true
212
- }));
213
- promises.push(session.send('Page.setTouchEmulationEnabled', {
214
- enabled: !!contextOptions.hasTouch
215
- }));
216
- if (contextOptions.timezoneId) {
217
- promises.push(session.send('Page.setTimeZone', {
218
- timeZone: contextOptions.timezoneId
219
- }).catch(e => {
220
- throw new Error(`Invalid timezone ID: ${contextOptions.timezoneId}`);
221
- }));
222
- }
223
- if (this._page.fileChooserIntercepted()) promises.push(session.send('Page.setInterceptFileChooserDialog', {
224
- enabled: true
225
- }));
226
- promises.push(session.send('Page.overrideSetting', {
227
- setting: 'DeviceOrientationEventEnabled',
228
- value: contextOptions.isMobile
229
- }));
230
- promises.push(session.send('Page.overrideSetting', {
231
- setting: 'FullScreenEnabled',
232
- value: !contextOptions.isMobile
233
- }));
234
- promises.push(session.send('Page.overrideSetting', {
235
- setting: 'NotificationsEnabled',
236
- value: !contextOptions.isMobile
237
- }));
238
- promises.push(session.send('Page.overrideSetting', {
239
- setting: 'PointerLockEnabled',
240
- value: !contextOptions.isMobile
241
- }));
242
- promises.push(session.send('Page.overrideSetting', {
243
- setting: 'InputTypeMonthEnabled',
244
- value: contextOptions.isMobile
245
- }));
246
- promises.push(session.send('Page.overrideSetting', {
247
- setting: 'InputTypeWeekEnabled',
248
- value: contextOptions.isMobile
249
- }));
250
- await Promise.all(promises);
251
- }
252
- _onDidCommitProvisionalTarget(event) {
253
- const {
254
- oldTargetId,
255
- newTargetId
256
- } = event;
257
- (0, _utils.assert)(this._provisionalPage);
258
- (0, _utils.assert)(this._provisionalPage._session.sessionId === newTargetId, 'Unknown new target: ' + newTargetId);
259
- (0, _utils.assert)(this._session.sessionId === oldTargetId, 'Unknown old target: ' + oldTargetId);
260
- const newSession = this._provisionalPage._session;
261
- this._provisionalPage.commit();
262
- this._provisionalPage.dispose();
263
- this._provisionalPage = null;
264
- this._setSession(newSession);
265
- }
266
- _onTargetDestroyed(event) {
267
- const {
268
- targetId,
269
- crashed
270
- } = event;
271
- if (this._provisionalPage && this._provisionalPage._session.sessionId === targetId) {
272
- this._maybeCancelCoopNavigationRequest(this._provisionalPage);
273
- this._provisionalPage._session.dispose();
274
- this._provisionalPage.dispose();
275
- this._provisionalPage = null;
276
- } else if (this._session.sessionId === targetId) {
277
- this._session.dispose();
278
- _eventsHelper.eventsHelper.removeEventListeners(this._sessionListeners);
279
- if (crashed) {
280
- this._session.markAsCrashed();
281
- this._page._didCrash();
282
- }
283
- }
284
- }
285
- didClose() {
286
- this._pageProxySession.dispose();
287
- _eventsHelper.eventsHelper.removeEventListeners(this._sessionListeners);
288
- _eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
289
- if (this._session) this._session.dispose();
290
- if (this._provisionalPage) {
291
- this._provisionalPage._session.dispose();
292
- this._provisionalPage.dispose();
293
- this._provisionalPage = null;
294
- }
295
- this._firstNonInitialNavigationCommittedReject(new _errors.TargetClosedError());
296
- this._page._didClose();
297
- }
298
- dispatchMessageToSession(message) {
299
- this._pageProxySession.dispatchMessage(message);
300
- }
301
- handleProvisionalLoadFailed(event) {
302
- if (!this._initializedPage) {
303
- this._firstNonInitialNavigationCommittedReject(new Error('Initial load failed'));
304
- return;
305
- }
306
- if (!this._provisionalPage) return;
307
- let errorText = event.error;
308
- if (errorText.includes('cancelled')) errorText += '; maybe frame was detached?';
309
- this._page._frameManager.frameAbortedNavigation(this._page.mainFrame()._id, errorText, event.loaderId);
310
- }
311
- handleWindowOpen(event) {
312
- (0, _utils.debugAssert)(!this._nextWindowOpenPopupFeatures);
313
- this._nextWindowOpenPopupFeatures = event.windowFeatures;
314
- }
315
- async pageOrError() {
316
- return this._pagePromise;
317
- }
318
- async _onTargetCreated(event) {
319
- const {
320
- targetInfo
321
- } = event;
322
- const session = new _wkConnection.WKSession(this._pageProxySession.connection, targetInfo.targetId, message => {
323
- this._pageProxySession.send('Target.sendMessageToTarget', {
324
- message: JSON.stringify(message),
325
- targetId: targetInfo.targetId
326
- }).catch(e => {
327
- session.dispatchMessage({
328
- id: message.id,
329
- error: {
330
- message: e.message
331
- }
332
- });
333
- });
334
- });
335
- (0, _utils.assert)(targetInfo.type === 'page', 'Only page targets are expected in WebKit, received: ' + targetInfo.type);
336
- if (!targetInfo.isProvisional) {
337
- (0, _utils.assert)(!this._initializedPage);
338
- let pageOrError;
339
- try {
340
- this._setSession(session);
341
- await Promise.all([this._initializePageProxySession(), this._initializeSession(session, false, ({
342
- frameTree
343
- }) => this._handleFrameTree(frameTree))]);
344
- pageOrError = this._page;
345
- } catch (e) {
346
- pageOrError = e;
347
- }
348
- if (targetInfo.isPaused) this._pageProxySession.sendMayFail('Target.resume', {
349
- targetId: targetInfo.targetId
350
- });
351
- if (pageOrError instanceof _page.Page && this._page.mainFrame().url() === '') {
352
- try {
353
- // Initial empty page has an empty url. We should wait until the first real url has been loaded,
354
- // even if that url is about:blank. This is especially important for popups, where we need the
355
- // actual url before interacting with it.
356
- await this._firstNonInitialNavigationCommittedPromise;
357
- } catch (e) {
358
- pageOrError = e;
359
- }
360
- } else {
361
- // Avoid rejection on disconnect.
362
- this._firstNonInitialNavigationCommittedPromise.catch(() => {});
363
- }
364
- await this._page.initOpener(this._opener);
365
- // Note: it is important to call |reportAsNew| before resolving pageOrError promise,
366
- // so that anyone who awaits pageOrError got a ready and reported page.
367
- this._initializedPage = pageOrError instanceof _page.Page ? pageOrError : null;
368
- this._page.reportAsNew(pageOrError instanceof _page.Page ? undefined : pageOrError);
369
- this._pagePromise.resolve(pageOrError);
370
- } else {
371
- (0, _utils.assert)(targetInfo.isProvisional);
372
- (0, _utils.assert)(!this._provisionalPage);
373
- this._provisionalPage = new _wkProvisionalPage.WKProvisionalPage(session, this);
374
- if (targetInfo.isPaused) {
375
- this._provisionalPage.initializationPromise.then(() => {
376
- this._pageProxySession.sendMayFail('Target.resume', {
377
- targetId: targetInfo.targetId
378
- });
379
- });
380
- }
381
- }
382
- }
383
- _onDispatchMessageFromTarget(event) {
384
- const {
385
- targetId,
386
- message
387
- } = event;
388
- if (this._provisionalPage && this._provisionalPage._session.sessionId === targetId) this._provisionalPage._session.dispatchMessage(JSON.parse(message));else if (this._session.sessionId === targetId) this._session.dispatchMessage(JSON.parse(message));else throw new Error('Unknown target: ' + targetId);
389
- }
390
- _addSessionListeners() {
391
- this._sessionListeners = [_eventsHelper.eventsHelper.addEventListener(this._session, 'Page.frameNavigated', event => this._onFrameNavigated(event.frame, false)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.navigatedWithinDocument', event => this._onFrameNavigatedWithinDocument(event.frameId, event.url)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.frameAttached', event => this._onFrameAttached(event.frameId, event.parentFrameId)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.frameDetached', event => this._onFrameDetached(event.frameId)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.willCheckNavigationPolicy', event => this._onWillCheckNavigationPolicy(event.frameId)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.didCheckNavigationPolicy', event => this._onDidCheckNavigationPolicy(event.frameId, event.cancel)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.frameScheduledNavigation', event => this._onFrameScheduledNavigation(event.frameId, event.delay, event.targetIsCurrentFrame)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.loadEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'load')), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.domContentEventFired', event => this._page._frameManager.frameLifecycleEvent(event.frameId, 'domcontentloaded')), _eventsHelper.eventsHelper.addEventListener(this._session, 'Runtime.executionContextCreated', event => this._onExecutionContextCreated(event.context)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Runtime.bindingCalled', event => this._onBindingCalled(event.contextId, event.argument)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Console.messageAdded', event => this._onConsoleMessage(event)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Console.messageRepeatCountUpdated', event => this._onConsoleRepeatCountUpdated(event)), _eventsHelper.eventsHelper.addEventListener(this._pageProxySession, 'Dialog.javascriptDialogOpening', event => this._onDialog(event)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Page.fileChooserOpened', event => this._onFileChooserOpened(event)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.requestWillBeSent', e => this._onRequestWillBeSent(this._session, e)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.requestIntercepted', e => this._onRequestIntercepted(this._session, e)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.responseReceived', e => this._onResponseReceived(this._session, e)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.loadingFinished', e => this._onLoadingFinished(e)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.loadingFailed', e => this._onLoadingFailed(this._session, e)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketCreated', e => this._page._frameManager.onWebSocketCreated(e.requestId, e.url)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketWillSendHandshakeRequest', e => this._page._frameManager.onWebSocketRequest(e.requestId)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketHandshakeResponseReceived', e => this._page._frameManager.onWebSocketResponse(e.requestId, e.response.status, e.response.statusText)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketFrameSent', e => e.response.payloadData && this._page._frameManager.onWebSocketFrameSent(e.requestId, e.response.opcode, e.response.payloadData)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketFrameReceived', e => e.response.payloadData && this._page._frameManager.webSocketFrameReceived(e.requestId, e.response.opcode, e.response.payloadData)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketClosed', e => this._page._frameManager.webSocketClosed(e.requestId)), _eventsHelper.eventsHelper.addEventListener(this._session, 'Network.webSocketFrameError', e => this._page._frameManager.webSocketError(e.requestId, e.errorMessage))];
392
- }
393
- async _updateState(method, params) {
394
- await this._forAllSessions(session => session.send(method, params).then());
395
- }
396
- async _forAllSessions(callback) {
397
- const sessions = [this._session];
398
- // If the state changes during provisional load, push it to the provisional page
399
- // as well to always be in sync with the backend.
400
- if (this._provisionalPage) sessions.push(this._provisionalPage._session);
401
- await Promise.all(sessions.map(session => callback(session).catch(e => {})));
402
- }
403
- _onWillCheckNavigationPolicy(frameId) {
404
- // It may happen that new policy check occurs while there is an ongoing
405
- // provisional load, in this case it should be safe to ignore it as it will
406
- // either:
407
- // - end up canceled, e.g. ctrl+click opening link in new tab, having no effect
408
- // on this page
409
- // - start new provisional load which we will miss in our signal trackers but
410
- // we certainly won't hang waiting for it to finish and there is high chance
411
- // that the current provisional page will commit navigation canceling the new
412
- // one.
413
- if (this._provisionalPage) return;
414
- this._page._frameManager.frameRequestedNavigation(frameId);
415
- }
416
- _onDidCheckNavigationPolicy(frameId, cancel) {
417
- if (!cancel) return;
418
- // This is a cross-process navigation that is canceled in the original page and continues in
419
- // the provisional page. Bail out as we are tracking it.
420
- if (this._provisionalPage) return;
421
- this._page._frameManager.frameAbortedNavigation(frameId, 'Navigation canceled by policy check');
422
- }
423
- _onFrameScheduledNavigation(frameId, delay, targetIsCurrentFrame) {
424
- if (targetIsCurrentFrame) this._page._frameManager.frameRequestedNavigation(frameId);
425
- }
426
- _handleFrameTree(frameTree) {
427
- this._onFrameAttached(frameTree.frame.id, frameTree.frame.parentId || null);
428
- this._onFrameNavigated(frameTree.frame, true);
429
- this._page._frameManager.frameLifecycleEvent(frameTree.frame.id, 'domcontentloaded');
430
- this._page._frameManager.frameLifecycleEvent(frameTree.frame.id, 'load');
431
- if (!frameTree.childFrames) return;
432
- for (const child of frameTree.childFrames) this._handleFrameTree(child);
433
- }
434
- _onFrameAttached(frameId, parentFrameId) {
435
- return this._page._frameManager.frameAttached(frameId, parentFrameId);
436
- }
437
- _onFrameNavigated(framePayload, initial) {
438
- const frame = this._page._frameManager.frame(framePayload.id);
439
- (0, _utils.assert)(frame);
440
- this._removeContextsForFrame(frame, true);
441
- if (!framePayload.parentId) this._workers.clear();
442
- this._page._frameManager.frameCommittedNewDocumentNavigation(framePayload.id, framePayload.url, framePayload.name || '', framePayload.loaderId, initial);
443
- if (!initial) this._firstNonInitialNavigationCommittedFulfill();
444
- }
445
- _onFrameNavigatedWithinDocument(frameId, url) {
446
- this._page._frameManager.frameCommittedSameDocumentNavigation(frameId, url);
447
- }
448
- _onFrameDetached(frameId) {
449
- this._page._frameManager.frameDetached(frameId);
450
- }
451
- _removeContextsForFrame(frame, notifyFrame) {
452
- for (const [contextId, context] of this._contextIdToContext) {
453
- if (context.frame === frame) {
454
- this._contextIdToContext.delete(contextId);
455
- if (notifyFrame) frame._contextDestroyed(context);
456
- }
457
- }
458
- }
459
- _onExecutionContextCreated(contextPayload) {
460
- if (this._contextIdToContext.has(contextPayload.id)) return;
461
- const frame = this._page._frameManager.frame(contextPayload.frameId);
462
- if (!frame) return;
463
- const delegate = new _wkExecutionContext.WKExecutionContext(this._session, contextPayload.id);
464
- let worldName;
465
- if (contextPayload.type === 'normal') worldName = 'main';else if (contextPayload.type === 'user' && contextPayload.name === UTILITY_WORLD_NAME) worldName = 'utility';else return;
466
- const context = new dom.FrameExecutionContext(delegate, frame, worldName);
467
- context[contextDelegateSymbol] = delegate;
468
- frame._contextCreated(worldName, context);
469
- this._contextIdToContext.set(contextPayload.id, context);
470
- }
471
- async _onBindingCalled(contextId, argument) {
472
- const pageOrError = await this.pageOrError();
473
- if (!(pageOrError instanceof Error)) {
474
- const context = this._contextIdToContext.get(contextId);
475
- if (context) await this._page._onBindingCalled(argument, context);
476
- }
477
- }
478
- async navigateFrame(frame, url, referrer) {
479
- if (this._pageProxySession.isDisposed()) throw new _errors.TargetClosedError();
480
- const pageProxyId = this._pageProxySession.sessionId;
481
- const result = await this._pageProxySession.connection.browserSession.send('Playwright.navigate', {
482
- url,
483
- pageProxyId,
484
- frameId: frame._id,
485
- referrer
486
- });
487
- return {
488
- newDocumentId: result.loaderId
489
- };
490
- }
491
- _onConsoleMessage(event) {
492
- // Note: do no introduce await in this function, otherwise we lose the ordering.
493
- // For example, frame.setContent relies on this.
494
- const {
495
- type,
496
- level,
497
- text,
498
- parameters,
499
- url,
500
- line: lineNumber,
501
- column: columnNumber,
502
- source
503
- } = event.message;
504
- if (level === 'error' && source === 'javascript') {
505
- const {
506
- name,
507
- message
508
- } = (0, _stackTrace.splitErrorMessage)(text);
509
- let stack;
510
- if (event.message.stackTrace) {
511
- stack = text + '\n' + event.message.stackTrace.callFrames.map(callFrame => {
512
- return ` at ${callFrame.functionName || 'unknown'} (${callFrame.url}:${callFrame.lineNumber}:${callFrame.columnNumber})`;
513
- }).join('\n');
514
- } else {
515
- stack = '';
516
- }
517
- this._lastConsoleMessage = null;
518
- const error = new Error(message);
519
- error.stack = stack;
520
- error.name = name;
521
- this._page.emitOnContextOnceInitialized(_browserContext.BrowserContext.Events.PageError, error, this._page);
522
- return;
523
- }
524
- let derivedType = type || '';
525
- if (type === 'log') derivedType = level;else if (type === 'timing') derivedType = 'timeEnd';
526
- const handles = [];
527
- for (const p of parameters || []) {
528
- let context;
529
- if (p.objectId) {
530
- const objectId = JSON.parse(p.objectId);
531
- context = this._contextIdToContext.get(objectId.injectedScriptId);
532
- } else {
533
- // Pick any context if the parameter is a value.
534
- context = [...this._contextIdToContext.values()].find(c => c.frame === this._page.mainFrame());
535
- }
536
- if (!context) return;
537
- handles.push(context.createHandle(p));
538
- }
539
- this._lastConsoleMessage = {
540
- derivedType,
541
- text,
542
- handles,
543
- count: 0,
544
- location: {
545
- url: url || '',
546
- lineNumber: (lineNumber || 1) - 1,
547
- columnNumber: (columnNumber || 1) - 1
548
- }
549
- };
550
- this._onConsoleRepeatCountUpdated({
551
- count: 1
552
- });
553
- }
554
- _onConsoleRepeatCountUpdated(event) {
555
- if (this._lastConsoleMessage) {
556
- const {
557
- derivedType,
558
- text,
559
- handles,
560
- count,
561
- location
562
- } = this._lastConsoleMessage;
563
- for (let i = count; i < event.count; ++i) this._page._addConsoleMessage(derivedType, handles, location, handles.length ? undefined : text);
564
- this._lastConsoleMessage.count = event.count;
565
- }
566
- }
567
- _onDialog(event) {
568
- this._page.emitOnContext(_browserContext.BrowserContext.Events.Dialog, new dialog.Dialog(this._page, event.type, event.message, async (accept, promptText) => {
569
- await this._pageProxySession.send('Dialog.handleJavaScriptDialog', {
570
- accept,
571
- promptText
572
- });
573
- }, event.defaultPrompt));
574
- }
575
- async _onFileChooserOpened(event) {
576
- let handle;
577
- try {
578
- const context = await this._page._frameManager.frame(event.frameId)._mainContext();
579
- handle = context.createHandle(event.element).asElement();
580
- } catch (e) {
581
- // During async processing, frame/context may go away. We should not throw.
582
- return;
583
- }
584
- await this._page._onFileChooserOpened(handle);
585
- }
586
- static async _setEmulateMedia(session, mediaType, colorScheme, reducedMotion, forcedColors) {
587
- const promises = [];
588
- promises.push(session.send('Page.setEmulatedMedia', {
589
- media: mediaType === 'no-override' ? '' : mediaType
590
- }));
591
- let appearance = undefined;
592
- switch (colorScheme) {
593
- case 'light':
594
- appearance = 'Light';
595
- break;
596
- case 'dark':
597
- appearance = 'Dark';
598
- break;
599
- case 'no-override':
600
- appearance = undefined;
601
- break;
602
- }
603
- promises.push(session.send('Page.overrideUserPreference', {
604
- name: 'PrefersColorScheme',
605
- value: appearance
606
- }));
607
- let reducedMotionWk = undefined;
608
- switch (reducedMotion) {
609
- case 'reduce':
610
- reducedMotionWk = 'Reduce';
611
- break;
612
- case 'no-preference':
613
- reducedMotionWk = 'NoPreference';
614
- break;
615
- case 'no-override':
616
- reducedMotionWk = undefined;
617
- break;
618
- }
619
- promises.push(session.send('Page.overrideUserPreference', {
620
- name: 'PrefersReducedMotion',
621
- value: reducedMotionWk
622
- }));
623
- let forcedColorsWk = undefined;
624
- switch (forcedColors) {
625
- case 'active':
626
- forcedColorsWk = 'Active';
627
- break;
628
- case 'none':
629
- forcedColorsWk = 'None';
630
- break;
631
- case 'no-override':
632
- forcedColorsWk = undefined;
633
- break;
634
- }
635
- promises.push(session.send('Page.setForcedColors', {
636
- forcedColors: forcedColorsWk
637
- }));
638
- await Promise.all(promises);
639
- }
640
- async updateExtraHTTPHeaders() {
641
- await this._updateState('Network.setExtraHTTPHeaders', {
642
- headers: (0, _utils.headersArrayToObject)(this._calculateExtraHTTPHeaders(), false /* lowerCase */)
643
- });
644
- }
645
- _calculateExtraHTTPHeaders() {
646
- const locale = this._browserContext._options.locale;
647
- const headers = network.mergeHeaders([this._browserContext._options.extraHTTPHeaders, this._page.extraHTTPHeaders(), locale ? network.singleHeader('Accept-Language', locale) : undefined]);
648
- return headers;
649
- }
650
- async updateEmulateMedia() {
651
- const emulatedMedia = this._page.emulatedMedia();
652
- const colorScheme = emulatedMedia.colorScheme;
653
- const reducedMotion = emulatedMedia.reducedMotion;
654
- const forcedColors = emulatedMedia.forcedColors;
655
- await this._forAllSessions(session => WKPage._setEmulateMedia(session, emulatedMedia.media, colorScheme, reducedMotion, forcedColors));
656
- }
657
- async updateEmulatedViewportSize() {
658
- this._browserContext._validateEmulatedViewport(this._page.viewportSize());
659
- await this._updateViewport();
660
- }
661
- async updateUserAgent() {
662
- const contextOptions = this._browserContext._options;
663
- this._updateState('Page.overrideUserAgent', {
664
- value: contextOptions.userAgent
665
- });
666
- }
667
- async bringToFront() {
668
- this._pageProxySession.send('Target.activate', {
669
- targetId: this._session.sessionId
670
- });
671
- }
672
- async _updateViewport() {
673
- const options = this._browserContext._options;
674
- const deviceSize = this._page.emulatedSize();
675
- if (deviceSize === null) return;
676
- const viewportSize = deviceSize.viewport;
677
- const screenSize = deviceSize.screen;
678
- const promises = [this._pageProxySession.send('Emulation.setDeviceMetricsOverride', {
679
- width: viewportSize.width,
680
- height: viewportSize.height,
681
- fixedLayout: !!options.isMobile,
682
- deviceScaleFactor: options.deviceScaleFactor || 1
683
- }), this._session.send('Page.setScreenSizeOverride', {
684
- width: screenSize.width,
685
- height: screenSize.height
686
- })];
687
- if (options.isMobile) {
688
- const angle = viewportSize.width > viewportSize.height ? 90 : 0;
689
- // Special handling for macOS 12.
690
- const useLegacySetOrientationOverrideMethod = _os.default.platform() === 'darwin' && parseInt(_os.default.release().split('.')[0], 10) <= 21;
691
- if (useLegacySetOrientationOverrideMethod) promises.push(this._session.send('Page.setOrientationOverride', {
692
- angle
693
- }));else promises.push(this._pageProxySession.send('Emulation.setOrientationOverride', {
694
- angle
695
- }));
696
- }
697
- await Promise.all(promises);
698
- }
699
- async updateRequestInterception() {
700
- const enabled = this._page.needsRequestInterception();
701
- await Promise.all([this._updateState('Network.setInterceptionEnabled', {
702
- enabled
703
- }), this._updateState('Network.setResourceCachingDisabled', {
704
- disabled: enabled
705
- }), this._updateState('Network.addInterception', {
706
- url: '.*',
707
- stage: 'request',
708
- isRegex: true
709
- })]);
710
- }
711
- async updateOffline() {
712
- await this._updateState('Network.setEmulateOfflineState', {
713
- offline: !!this._browserContext._options.offline
714
- });
715
- }
716
- async updateHttpCredentials() {
717
- const credentials = this._browserContext._options.httpCredentials || {
718
- username: '',
719
- password: '',
720
- origin: ''
721
- };
722
- await this._pageProxySession.send('Emulation.setAuthCredentials', {
723
- username: credentials.username,
724
- password: credentials.password,
725
- origin: credentials.origin
726
- });
727
- }
728
- async updateFileChooserInterception() {
729
- const enabled = this._page.fileChooserIntercepted();
730
- await this._session.send('Page.setInterceptFileChooserDialog', {
731
- enabled
732
- }).catch(() => {}); // target can be closed.
733
- }
734
- async reload() {
735
- await this._session.send('Page.reload');
736
- }
737
- goBack() {
738
- return this._session.send('Page.goBack').then(() => true).catch(error => {
739
- if (error instanceof Error && error.message.includes(`Protocol error (Page.goBack): Failed to go`)) return false;
740
- throw error;
741
- });
742
- }
743
- goForward() {
744
- return this._session.send('Page.goForward').then(() => true).catch(error => {
745
- if (error instanceof Error && error.message.includes(`Protocol error (Page.goForward): Failed to go`)) return false;
746
- throw error;
747
- });
748
- }
749
- async addInitScript(initScript) {
750
- await this._updateBootstrapScript();
751
- }
752
- async removeNonInternalInitScripts() {
753
- await this._updateBootstrapScript();
754
- }
755
- _calculateBootstrapScript() {
756
- const scripts = [];
757
- if (!this._page.context()._options.isMobile) {
758
- scripts.push('delete window.orientation');
759
- scripts.push('delete window.ondevicemotion');
760
- scripts.push('delete window.ondeviceorientation');
761
- }
762
- scripts.push('if (!window.safari) window.safari = { pushNotification: { toString() { return "[object SafariRemoteNotification]"; } } };');
763
- scripts.push('if (!window.GestureEvent) window.GestureEvent = function GestureEvent() {};');
764
- scripts.push(...this._page.allInitScripts().map(script => script.source));
765
- return scripts.join(';\n');
766
- }
767
- async _updateBootstrapScript() {
768
- await this._updateState('Page.setBootstrapScript', {
769
- source: this._calculateBootstrapScript()
770
- });
771
- }
772
- async closePage(runBeforeUnload) {
773
- await this._stopVideo();
774
- await this._pageProxySession.sendMayFail('Target.close', {
775
- targetId: this._session.sessionId,
776
- runBeforeUnload
777
- });
778
- }
779
- async setBackgroundColor(color) {
780
- await this._session.send('Page.setDefaultBackgroundColorOverride', {
781
- color
782
- });
783
- }
784
- _toolbarHeight() {
785
- var _this$_page$_browserC;
786
- if ((_this$_page$_browserC = this._page._browserContext._browser) !== null && _this$_page$_browserC !== void 0 && _this$_page$_browserC.options.headful) return _hostPlatform.hostPlatform === 'mac10.15' ? 55 : 59;
787
- return 0;
788
- }
789
- async _startVideo(options) {
790
- (0, _utils.assert)(!this._recordingVideoFile);
791
- const {
792
- screencastId
793
- } = await this._pageProxySession.send('Screencast.startVideo', {
794
- file: options.outputFile,
795
- width: options.width,
796
- height: options.height,
797
- toolbarHeight: this._toolbarHeight()
798
- });
799
- this._recordingVideoFile = options.outputFile;
800
- this._browserContext._browser._videoStarted(this._browserContext, screencastId, options.outputFile, this.pageOrError());
801
- }
802
- async _stopVideo() {
803
- if (!this._recordingVideoFile) return;
804
- await this._pageProxySession.sendMayFail('Screencast.stopVideo');
805
- this._recordingVideoFile = null;
806
- }
807
- validateScreenshotDimension(side, omitDeviceScaleFactor) {
808
- // Cairo based implementations (Linux and Windows) have hard limit of 32767
809
- // (see https://github.com/microsoft/playwright/issues/16727).
810
- if (process.platform === 'darwin') return;
811
- if (!omitDeviceScaleFactor && this._page._browserContext._options.deviceScaleFactor) side = Math.ceil(side * this._page._browserContext._options.deviceScaleFactor);
812
- if (side > 32767) throw new Error('Cannot take screenshot larger than 32767 pixels on any dimension');
813
- }
814
- async takeScreenshot(progress, format, documentRect, viewportRect, quality, fitsViewport, scale) {
815
- const rect = documentRect || viewportRect;
816
- const omitDeviceScaleFactor = scale === 'css';
817
- this.validateScreenshotDimension(rect.width, omitDeviceScaleFactor);
818
- this.validateScreenshotDimension(rect.height, omitDeviceScaleFactor);
819
- const result = await this._session.send('Page.snapshotRect', {
820
- ...rect,
821
- coordinateSystem: documentRect ? 'Page' : 'Viewport',
822
- omitDeviceScaleFactor
823
- });
824
- const prefix = 'data:image/png;base64,';
825
- let buffer = Buffer.from(result.dataURL.substr(prefix.length), 'base64');
826
- if (format === 'jpeg') buffer = _utilsBundle.jpegjs.encode(_utilsBundle.PNG.sync.read(buffer), quality).data;
827
- return buffer;
828
- }
829
- async getContentFrame(handle) {
830
- const nodeInfo = await this._session.send('DOM.describeNode', {
831
- objectId: handle._objectId
832
- });
833
- if (!nodeInfo.contentFrameId) return null;
834
- return this._page._frameManager.frame(nodeInfo.contentFrameId);
835
- }
836
- async getOwnerFrame(handle) {
837
- if (!handle._objectId) return null;
838
- const nodeInfo = await this._session.send('DOM.describeNode', {
839
- objectId: handle._objectId
840
- });
841
- return nodeInfo.ownerFrameId || null;
842
- }
843
- isElementHandle(remoteObject) {
844
- return remoteObject.subtype === 'node';
845
- }
846
- async getBoundingBox(handle) {
847
- const quads = await this.getContentQuads(handle);
848
- if (!quads || !quads.length) return null;
849
- let minX = Infinity;
850
- let maxX = -Infinity;
851
- let minY = Infinity;
852
- let maxY = -Infinity;
853
- for (const quad of quads) {
854
- for (const point of quad) {
855
- minX = Math.min(minX, point.x);
856
- maxX = Math.max(maxX, point.x);
857
- minY = Math.min(minY, point.y);
858
- maxY = Math.max(maxY, point.y);
859
- }
860
- }
861
- return {
862
- x: minX,
863
- y: minY,
864
- width: maxX - minX,
865
- height: maxY - minY
866
- };
867
- }
868
- async scrollRectIntoViewIfNeeded(handle, rect) {
869
- return await this._session.send('DOM.scrollIntoViewIfNeeded', {
870
- objectId: handle._objectId,
871
- rect
872
- }).then(() => 'done').catch(e => {
873
- if (e instanceof Error && e.message.includes('Node does not have a layout object')) return 'error:notvisible';
874
- if (e instanceof Error && e.message.includes('Node is detached from document')) return 'error:notconnected';
875
- throw e;
876
- });
877
- }
878
- async setScreencastOptions(options) {
879
- if (options) {
880
- const so = {
881
- ...options,
882
- toolbarHeight: this._toolbarHeight()
883
- };
884
- const {
885
- generation
886
- } = await this._pageProxySession.send('Screencast.startScreencast', so);
887
- this._screencastGeneration = generation;
888
- } else {
889
- await this._pageProxySession.send('Screencast.stopScreencast');
890
- }
891
- }
892
- _onScreencastFrame(event) {
893
- const generation = this._screencastGeneration;
894
- this._page.throttleScreencastFrameAck(() => {
895
- this._pageProxySession.send('Screencast.screencastFrameAck', {
896
- generation
897
- }).catch(e => _debugLogger.debugLogger.log('error', e));
898
- });
899
- const buffer = Buffer.from(event.data, 'base64');
900
- this._page.emit(_page.Page.Events.ScreencastFrame, {
901
- buffer,
902
- width: event.deviceWidth,
903
- height: event.deviceHeight
904
- });
905
- }
906
- rafCountForStablePosition() {
907
- return process.platform === 'win32' ? 5 : 1;
908
- }
909
- async getContentQuads(handle) {
910
- const result = await this._session.sendMayFail('DOM.getContentQuads', {
911
- objectId: handle._objectId
912
- });
913
- if (!result) return null;
914
- return result.quads.map(quad => [{
915
- x: quad[0],
916
- y: quad[1]
917
- }, {
918
- x: quad[2],
919
- y: quad[3]
920
- }, {
921
- x: quad[4],
922
- y: quad[5]
923
- }, {
924
- x: quad[6],
925
- y: quad[7]
926
- }]);
927
- }
928
- async setInputFiles(handle, files) {
929
- const objectId = handle._objectId;
930
- const protocolFiles = files.map(file => ({
931
- name: file.name,
932
- type: file.mimeType,
933
- data: file.buffer
934
- }));
935
- await this._session.send('DOM.setInputFiles', {
936
- objectId,
937
- files: protocolFiles
938
- });
939
- }
940
- async setInputFilePaths(handle, paths) {
941
- const pageProxyId = this._pageProxySession.sessionId;
942
- const objectId = handle._objectId;
943
- await Promise.all([this._pageProxySession.connection.browserSession.send('Playwright.grantFileReadAccess', {
944
- pageProxyId,
945
- paths
946
- }), this._session.send('DOM.setInputFiles', {
947
- objectId,
948
- paths
949
- })]);
950
- }
951
- async adoptElementHandle(handle, to) {
952
- const result = await this._session.sendMayFail('DOM.resolveNode', {
953
- objectId: handle._objectId,
954
- executionContextId: to[contextDelegateSymbol]._contextId
955
- });
956
- if (!result || result.object.subtype === 'null') throw new Error(dom.kUnableToAdoptErrorMessage);
957
- return to.createHandle(result.object);
958
- }
959
- async getAccessibilityTree(needle) {
960
- return (0, _wkAccessibility.getAccessibilityTree)(this._session, needle);
961
- }
962
- async inputActionEpilogue() {}
963
- async resetForReuse() {}
964
- async getFrameElement(frame) {
965
- const parent = frame.parentFrame();
966
- if (!parent) throw new Error('Frame has been detached.');
967
- const context = await parent._mainContext();
968
- const result = await this._session.send('DOM.resolveNode', {
969
- frameId: frame._id,
970
- executionContextId: context[contextDelegateSymbol]._contextId
971
- });
972
- if (!result || result.object.subtype === 'null') throw new Error('Frame has been detached.');
973
- return context.createHandle(result.object);
974
- }
975
- _maybeCancelCoopNavigationRequest(provisionalPage) {
976
- const navigationRequest = provisionalPage.coopNavigationRequest();
977
- for (const [requestId, request] of this._requestIdToRequest) {
978
- if (request.request === navigationRequest) {
979
- // Make sure the request completes if the provisional navigation is canceled.
980
- this._onLoadingFailed(provisionalPage._session, {
981
- requestId: requestId,
982
- errorText: 'Provisiolal navigation canceled.',
983
- timestamp: request._timestamp,
984
- canceled: true
985
- });
986
- return;
987
- }
988
- }
989
- }
990
- _adoptRequestFromNewProcess(navigationRequest, newSession, newRequestId) {
991
- for (const [requestId, request] of this._requestIdToRequest) {
992
- if (request.request === navigationRequest) {
993
- this._requestIdToRequest.delete(requestId);
994
- request.adoptRequestFromNewProcess(newSession, newRequestId);
995
- this._requestIdToRequest.set(newRequestId, request);
996
- return;
997
- }
998
- }
999
- }
1000
- _onRequestWillBeSent(session, event) {
1001
- if (event.request.url.startsWith('data:')) return;
1002
-
1003
- // We do not support intercepting redirects.
1004
- if (this._page.needsRequestInterception() && !event.redirectResponse) this._requestIdToRequestWillBeSentEvent.set(event.requestId, event);else this._onRequest(session, event, false);
1005
- }
1006
- _onRequest(session, event, intercepted) {
1007
- let redirectedFrom = null;
1008
- if (event.redirectResponse) {
1009
- const request = this._requestIdToRequest.get(event.requestId);
1010
- // If we connect late to the target, we could have missed the requestWillBeSent event.
1011
- if (request) {
1012
- this._handleRequestRedirect(request, event.requestId, event.redirectResponse, event.timestamp);
1013
- redirectedFrom = request;
1014
- }
1015
- }
1016
- const frame = redirectedFrom ? redirectedFrom.request.frame() : this._page._frameManager.frame(event.frameId);
1017
- // sometimes we get stray network events for detached frames
1018
- // TODO(einbinder) why?
1019
- if (!frame) return;
1020
-
1021
- // TODO(einbinder) this will fail if we are an XHR document request
1022
- const isNavigationRequest = event.type === 'Document';
1023
- const documentId = isNavigationRequest ? event.loaderId : undefined;
1024
- const request = new _wkInterceptableRequest.WKInterceptableRequest(session, frame, event, redirectedFrom, documentId);
1025
- let route;
1026
- if (intercepted) {
1027
- route = new _wkInterceptableRequest.WKRouteImpl(session, event.requestId);
1028
- // There is no point in waiting for the raw headers in Network.responseReceived when intercepting.
1029
- // Use provisional headers as raw headers, so that client can call allHeaders() from the route handler.
1030
- request.request.setRawRequestHeaders(null);
1031
- }
1032
- this._requestIdToRequest.set(event.requestId, request);
1033
- this._page._frameManager.requestStarted(request.request, route);
1034
- }
1035
- _handleRequestRedirect(request, requestId, responsePayload, timestamp) {
1036
- const response = request.createResponse(responsePayload);
1037
- response._securityDetailsFinished();
1038
- response._serverAddrFinished();
1039
- response.setResponseHeadersSize(null);
1040
- response.setEncodedBodySize(null);
1041
- response._requestFinished(responsePayload.timing ? _helper.helper.secondsToRoundishMillis(timestamp - request._timestamp) : -1);
1042
- this._requestIdToRequest.delete(requestId);
1043
- this._page._frameManager.requestReceivedResponse(response);
1044
- this._page._frameManager.reportRequestFinished(request.request, response);
1045
- }
1046
- _onRequestIntercepted(session, event) {
1047
- const requestWillBeSentEvent = this._requestIdToRequestWillBeSentEvent.get(event.requestId);
1048
- if (!requestWillBeSentEvent) {
1049
- // Intercepted, although we do not intend to allow interception.
1050
- // Just continue.
1051
- session.sendMayFail('Network.interceptWithRequest', {
1052
- requestId: event.requestId
1053
- });
1054
- return;
1055
- }
1056
- this._requestIdToRequestWillBeSentEvent.delete(event.requestId);
1057
- this._onRequest(session, requestWillBeSentEvent, true);
1058
- }
1059
- _onResponseReceived(session, event) {
1060
- const requestWillBeSentEvent = this._requestIdToRequestWillBeSentEvent.get(event.requestId);
1061
- if (requestWillBeSentEvent) {
1062
- this._requestIdToRequestWillBeSentEvent.delete(event.requestId);
1063
- // We received a response, so the request won't be intercepted (e.g. it was handled by a
1064
- // service worker and we don't intercept service workers).
1065
- this._onRequest(session, requestWillBeSentEvent, false);
1066
- }
1067
- const request = this._requestIdToRequest.get(event.requestId);
1068
- // FileUpload sends a response without a matching request.
1069
- if (!request) return;
1070
- this._requestIdToResponseReceivedPayloadEvent.set(event.requestId, event);
1071
- const response = request.createResponse(event.response);
1072
- this._page._frameManager.requestReceivedResponse(response);
1073
- if (response.status() === 204) {
1074
- this._onLoadingFailed(session, {
1075
- requestId: event.requestId,
1076
- errorText: 'Aborted: 204 No Content',
1077
- timestamp: event.timestamp
1078
- });
1079
- }
1080
- }
1081
- _onLoadingFinished(event) {
1082
- const request = this._requestIdToRequest.get(event.requestId);
1083
- // For certain requestIds we never receive requestWillBeSent event.
1084
- // @see https://crbug.com/750469
1085
- if (!request) return;
1086
-
1087
- // Under certain conditions we never get the Network.responseReceived
1088
- // event from protocol. @see https://crbug.com/883475
1089
- const response = request.request._existingResponse();
1090
- if (response) {
1091
- var _event$metrics, _event$metrics2, _responseReceivedPayl, _responseReceivedPayl2, _responseReceivedPayl3, _event$metrics3, _event$metrics$respon, _event$metrics4, _event$metrics$respon2, _event$metrics5;
1092
- const responseReceivedPayload = this._requestIdToResponseReceivedPayloadEvent.get(event.requestId);
1093
- response._serverAddrFinished(parseRemoteAddress(event === null || event === void 0 || (_event$metrics = event.metrics) === null || _event$metrics === void 0 ? void 0 : _event$metrics.remoteAddress));
1094
- response._securityDetailsFinished({
1095
- protocol: isLoadedSecurely(response.url(), response.timing()) ? (_event$metrics2 = event.metrics) === null || _event$metrics2 === void 0 || (_event$metrics2 = _event$metrics2.securityConnection) === null || _event$metrics2 === void 0 ? void 0 : _event$metrics2.protocol : undefined,
1096
- subjectName: responseReceivedPayload === null || responseReceivedPayload === void 0 || (_responseReceivedPayl = responseReceivedPayload.response.security) === null || _responseReceivedPayl === void 0 || (_responseReceivedPayl = _responseReceivedPayl.certificate) === null || _responseReceivedPayl === void 0 ? void 0 : _responseReceivedPayl.subject,
1097
- validFrom: responseReceivedPayload === null || responseReceivedPayload === void 0 || (_responseReceivedPayl2 = responseReceivedPayload.response.security) === null || _responseReceivedPayl2 === void 0 || (_responseReceivedPayl2 = _responseReceivedPayl2.certificate) === null || _responseReceivedPayl2 === void 0 ? void 0 : _responseReceivedPayl2.validFrom,
1098
- validTo: responseReceivedPayload === null || responseReceivedPayload === void 0 || (_responseReceivedPayl3 = responseReceivedPayload.response.security) === null || _responseReceivedPayl3 === void 0 || (_responseReceivedPayl3 = _responseReceivedPayl3.certificate) === null || _responseReceivedPayl3 === void 0 ? void 0 : _responseReceivedPayl3.validUntil
1099
- });
1100
- if ((_event$metrics3 = event.metrics) !== null && _event$metrics3 !== void 0 && _event$metrics3.protocol) response._setHttpVersion(event.metrics.protocol);
1101
- response.setEncodedBodySize((_event$metrics$respon = (_event$metrics4 = event.metrics) === null || _event$metrics4 === void 0 ? void 0 : _event$metrics4.responseBodyBytesReceived) !== null && _event$metrics$respon !== void 0 ? _event$metrics$respon : null);
1102
- response.setResponseHeadersSize((_event$metrics$respon2 = (_event$metrics5 = event.metrics) === null || _event$metrics5 === void 0 ? void 0 : _event$metrics5.responseHeaderBytesReceived) !== null && _event$metrics$respon2 !== void 0 ? _event$metrics$respon2 : null);
1103
- response._requestFinished(_helper.helper.secondsToRoundishMillis(event.timestamp - request._timestamp));
1104
- } else {
1105
- // Use provisional headers if we didn't have the response with raw headers.
1106
- request.request.setRawRequestHeaders(null);
1107
- }
1108
- this._requestIdToResponseReceivedPayloadEvent.delete(event.requestId);
1109
- this._requestIdToRequest.delete(event.requestId);
1110
- this._page._frameManager.reportRequestFinished(request.request, response);
1111
- }
1112
- _onLoadingFailed(session, event) {
1113
- const requestWillBeSentEvent = this._requestIdToRequestWillBeSentEvent.get(event.requestId);
1114
- if (requestWillBeSentEvent) {
1115
- this._requestIdToRequestWillBeSentEvent.delete(event.requestId);
1116
- // If loading failed, the request won't be intercepted (e.g. it was handled by a
1117
- // service worker and we don't intercept service workers).
1118
- this._onRequest(session, requestWillBeSentEvent, false);
1119
- }
1120
- const request = this._requestIdToRequest.get(event.requestId);
1121
- // For certain requestIds we never receive requestWillBeSent event.
1122
- // @see https://crbug.com/750469
1123
- if (!request) return;
1124
- const response = request.request._existingResponse();
1125
- if (response) {
1126
- response._serverAddrFinished();
1127
- response._securityDetailsFinished();
1128
- response.setResponseHeadersSize(null);
1129
- response.setEncodedBodySize(null);
1130
- response._requestFinished(_helper.helper.secondsToRoundishMillis(event.timestamp - request._timestamp));
1131
- } else {
1132
- // Use provisional headers if we didn't have the response with raw headers.
1133
- request.request.setRawRequestHeaders(null);
1134
- }
1135
- this._requestIdToRequest.delete(event.requestId);
1136
- request.request._setFailureText(event.errorText);
1137
- this._page._frameManager.requestFailed(request.request, event.errorText.includes('cancelled'));
1138
- }
1139
- async _grantPermissions(origin, permissions) {
1140
- const webPermissionToProtocol = new Map([['geolocation', 'geolocation'], ['notifications', 'notifications'], ['clipboard-read', 'clipboard-read']]);
1141
- const filtered = permissions.map(permission => {
1142
- const protocolPermission = webPermissionToProtocol.get(permission);
1143
- if (!protocolPermission) throw new Error('Unknown permission: ' + permission);
1144
- return protocolPermission;
1145
- });
1146
- await this._pageProxySession.send('Emulation.grantPermissions', {
1147
- origin,
1148
- permissions: filtered
1149
- });
1150
- }
1151
- async _clearPermissions() {
1152
- await this._pageProxySession.send('Emulation.resetPermissions', {});
1153
- }
1154
- shouldToggleStyleSheetToSyncAnimations() {
1155
- return true;
1156
- }
1157
- }
1158
-
1159
- /**
1160
- * WebKit Remote Addresses look like:
1161
- *
1162
- * macOS:
1163
- * ::1.8911
1164
- * 2606:2800:220:1:248:1893:25c8:1946.443
1165
- * 127.0.0.1:8000
1166
- *
1167
- * ubuntu:
1168
- * ::1:8907
1169
- * 127.0.0.1:8000
1170
- *
1171
- * NB: They look IPv4 and IPv6's with ports but use an alternative notation.
1172
- */
1173
- exports.WKPage = WKPage;
1174
- function parseRemoteAddress(value) {
1175
- if (!value) return;
1176
- try {
1177
- const colon = value.lastIndexOf(':');
1178
- const dot = value.lastIndexOf('.');
1179
- if (dot < 0) {
1180
- // IPv6ish:port
1181
- return {
1182
- ipAddress: `[${value.slice(0, colon)}]`,
1183
- port: +value.slice(colon + 1)
1184
- };
1185
- }
1186
- if (colon > dot) {
1187
- // IPv4:port
1188
- const [address, port] = value.split(':');
1189
- return {
1190
- ipAddress: address,
1191
- port: +port
1192
- };
1193
- } else {
1194
- // IPv6ish.port
1195
- const [address, port] = value.split('.');
1196
- return {
1197
- ipAddress: `[${address}]`,
1198
- port: +port
1199
- };
1200
- }
1201
- } catch (_) {}
1202
- }
1203
-
1204
- /**
1205
- * Adapted from Source/WebInspectorUI/UserInterface/Models/Resource.js in
1206
- * WebKit codebase.
1207
- */
1208
- function isLoadedSecurely(url, timing) {
1209
- try {
1210
- const u = new URL(url);
1211
- if (u.protocol !== 'https:' && u.protocol !== 'wss:' && u.protocol !== 'sftp:') return false;
1212
- if (timing.secureConnectionStart === -1 && timing.connectStart !== -1) return false;
1213
- return true;
1214
- } catch (_) {}
1215
- }
1216
- const contextDelegateSymbol = Symbol('delegate');