easytouch-linux 1.0.7 → 1.0.18

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 (337) hide show
  1. package/LICENSE.txt +201 -0
  2. package/README.md +33 -314
  3. package/SKILL.md +366 -0
  4. package/bin/arm64/et +0 -0
  5. package/bin/et.js +60 -0
  6. package/bin/x64/et +0 -0
  7. package/package.json +19 -37
  8. package/.playwright/node/LICENSE +0 -2607
  9. package/.playwright/node/linux-x64/node +0 -0
  10. package/.playwright/package/README.md +0 -3
  11. package/.playwright/package/ThirdPartyNotices.txt +0 -1602
  12. package/.playwright/package/api.json +0 -1
  13. package/.playwright/package/bin/install_media_pack.ps1 +0 -5
  14. package/.playwright/package/bin/reinstall_chrome_beta_linux.sh +0 -42
  15. package/.playwright/package/bin/reinstall_chrome_beta_mac.sh +0 -13
  16. package/.playwright/package/bin/reinstall_chrome_beta_win.ps1 +0 -24
  17. package/.playwright/package/bin/reinstall_chrome_stable_linux.sh +0 -42
  18. package/.playwright/package/bin/reinstall_chrome_stable_mac.sh +0 -12
  19. package/.playwright/package/bin/reinstall_chrome_stable_win.ps1 +0 -24
  20. package/.playwright/package/bin/reinstall_msedge_beta_linux.sh +0 -48
  21. package/.playwright/package/bin/reinstall_msedge_beta_mac.sh +0 -11
  22. package/.playwright/package/bin/reinstall_msedge_beta_win.ps1 +0 -23
  23. package/.playwright/package/bin/reinstall_msedge_dev_linux.sh +0 -48
  24. package/.playwright/package/bin/reinstall_msedge_dev_mac.sh +0 -11
  25. package/.playwright/package/bin/reinstall_msedge_dev_win.ps1 +0 -23
  26. package/.playwright/package/bin/reinstall_msedge_stable_linux.sh +0 -48
  27. package/.playwright/package/bin/reinstall_msedge_stable_mac.sh +0 -11
  28. package/.playwright/package/bin/reinstall_msedge_stable_win.ps1 +0 -24
  29. package/.playwright/package/browsers.json +0 -66
  30. package/.playwright/package/cli.js +0 -18
  31. package/.playwright/package/index.d.ts +0 -17
  32. package/.playwright/package/index.js +0 -33
  33. package/.playwright/package/index.mjs +0 -28
  34. package/.playwright/package/lib/androidServerImpl.js +0 -69
  35. package/.playwright/package/lib/browserServerImpl.js +0 -92
  36. package/.playwright/package/lib/cli/driver.js +0 -95
  37. package/.playwright/package/lib/cli/program.js +0 -583
  38. package/.playwright/package/lib/cli/programWithTestStub.js +0 -67
  39. package/.playwright/package/lib/client/accessibility.js +0 -50
  40. package/.playwright/package/lib/client/android.js +0 -473
  41. package/.playwright/package/lib/client/api.js +0 -285
  42. package/.playwright/package/lib/client/artifact.js +0 -79
  43. package/.playwright/package/lib/client/browser.js +0 -145
  44. package/.playwright/package/lib/client/browserContext.js +0 -559
  45. package/.playwright/package/lib/client/browserType.js +0 -241
  46. package/.playwright/package/lib/client/cdpSession.js +0 -53
  47. package/.playwright/package/lib/client/channelOwner.js +0 -215
  48. package/.playwright/package/lib/client/clientHelper.js +0 -57
  49. package/.playwright/package/lib/client/clientInstrumentation.js +0 -52
  50. package/.playwright/package/lib/client/clock.js +0 -68
  51. package/.playwright/package/lib/client/connection.js +0 -333
  52. package/.playwright/package/lib/client/consoleMessage.js +0 -55
  53. package/.playwright/package/lib/client/coverage.js +0 -41
  54. package/.playwright/package/lib/client/dialog.js +0 -57
  55. package/.playwright/package/lib/client/download.js +0 -62
  56. package/.playwright/package/lib/client/electron.js +0 -135
  57. package/.playwright/package/lib/client/elementHandle.js +0 -321
  58. package/.playwright/package/lib/client/errors.js +0 -77
  59. package/.playwright/package/lib/client/eventEmitter.js +0 -314
  60. package/.playwright/package/lib/client/events.js +0 -94
  61. package/.playwright/package/lib/client/fetch.js +0 -391
  62. package/.playwright/package/lib/client/fileChooser.js +0 -45
  63. package/.playwright/package/lib/client/frame.js +0 -504
  64. package/.playwright/package/lib/client/harRouter.js +0 -99
  65. package/.playwright/package/lib/client/input.js +0 -111
  66. package/.playwright/package/lib/client/jsHandle.js +0 -121
  67. package/.playwright/package/lib/client/jsonPipe.js +0 -35
  68. package/.playwright/package/lib/client/localUtils.js +0 -36
  69. package/.playwright/package/lib/client/locator.js +0 -448
  70. package/.playwright/package/lib/client/network.js +0 -769
  71. package/.playwright/package/lib/client/page.js +0 -748
  72. package/.playwright/package/lib/client/playwright.js +0 -80
  73. package/.playwright/package/lib/client/selectors.js +0 -67
  74. package/.playwright/package/lib/client/stream.js +0 -54
  75. package/.playwright/package/lib/client/tracing.js +0 -147
  76. package/.playwright/package/lib/client/types.js +0 -24
  77. package/.playwright/package/lib/client/video.js +0 -51
  78. package/.playwright/package/lib/client/waiter.js +0 -162
  79. package/.playwright/package/lib/client/webError.js +0 -37
  80. package/.playwright/package/lib/client/worker.js +0 -71
  81. package/.playwright/package/lib/client/writableStream.js +0 -54
  82. package/.playwright/package/lib/common/socksProxy.js +0 -569
  83. package/.playwright/package/lib/common/timeoutSettings.js +0 -73
  84. package/.playwright/package/lib/common/types.js +0 -5
  85. package/.playwright/package/lib/generated/clockSource.js +0 -7
  86. package/.playwright/package/lib/generated/consoleApiSource.js +0 -7
  87. package/.playwright/package/lib/generated/injectedScriptSource.js +0 -7
  88. package/.playwright/package/lib/generated/pollingRecorderSource.js +0 -7
  89. package/.playwright/package/lib/generated/utilityScriptSource.js +0 -7
  90. package/.playwright/package/lib/generated/webSocketMockSource.js +0 -7
  91. package/.playwright/package/lib/image_tools/colorUtils.js +0 -98
  92. package/.playwright/package/lib/image_tools/compare.js +0 -108
  93. package/.playwright/package/lib/image_tools/imageChannel.js +0 -70
  94. package/.playwright/package/lib/image_tools/stats.js +0 -102
  95. package/.playwright/package/lib/inProcessFactory.js +0 -56
  96. package/.playwright/package/lib/inprocess.js +0 -20
  97. package/.playwright/package/lib/outofprocess.js +0 -67
  98. package/.playwright/package/lib/protocol/debug.js +0 -27
  99. package/.playwright/package/lib/protocol/serializers.js +0 -173
  100. package/.playwright/package/lib/protocol/transport.js +0 -82
  101. package/.playwright/package/lib/protocol/validator.js +0 -2780
  102. package/.playwright/package/lib/protocol/validatorPrimitives.js +0 -139
  103. package/.playwright/package/lib/remote/playwrightConnection.js +0 -275
  104. package/.playwright/package/lib/remote/playwrightServer.js +0 -111
  105. package/.playwright/package/lib/server/accessibility.js +0 -62
  106. package/.playwright/package/lib/server/android/android.js +0 -441
  107. package/.playwright/package/lib/server/android/backendAdb.js +0 -172
  108. package/.playwright/package/lib/server/artifact.js +0 -104
  109. package/.playwright/package/lib/server/bidi/bidiBrowser.js +0 -314
  110. package/.playwright/package/lib/server/bidi/bidiChromium.js +0 -124
  111. package/.playwright/package/lib/server/bidi/bidiConnection.js +0 -204
  112. package/.playwright/package/lib/server/bidi/bidiExecutionContext.js +0 -175
  113. package/.playwright/package/lib/server/bidi/bidiFirefox.js +0 -104
  114. package/.playwright/package/lib/server/bidi/bidiInput.js +0 -160
  115. package/.playwright/package/lib/server/bidi/bidiNetworkManager.js +0 -337
  116. package/.playwright/package/lib/server/bidi/bidiOverCdp.js +0 -103
  117. package/.playwright/package/lib/server/bidi/bidiPage.js +0 -518
  118. package/.playwright/package/lib/server/bidi/bidiPdf.js +0 -140
  119. package/.playwright/package/lib/server/bidi/third_party/bidiDeserializer.js +0 -93
  120. package/.playwright/package/lib/server/bidi/third_party/bidiKeyboard.js +0 -240
  121. package/.playwright/package/lib/server/bidi/third_party/bidiProtocol.js +0 -139
  122. package/.playwright/package/lib/server/bidi/third_party/bidiSerializer.js +0 -144
  123. package/.playwright/package/lib/server/bidi/third_party/firefoxPrefs.js +0 -221
  124. package/.playwright/package/lib/server/browser.js +0 -148
  125. package/.playwright/package/lib/server/browserContext.js +0 -675
  126. package/.playwright/package/lib/server/browserType.js +0 -338
  127. package/.playwright/package/lib/server/chromium/appIcon.png +0 -0
  128. package/.playwright/package/lib/server/chromium/chromium.js +0 -354
  129. package/.playwright/package/lib/server/chromium/chromiumSwitches.js +0 -46
  130. package/.playwright/package/lib/server/chromium/crAccessibility.js +0 -237
  131. package/.playwright/package/lib/server/chromium/crBrowser.js +0 -516
  132. package/.playwright/package/lib/server/chromium/crConnection.js +0 -228
  133. package/.playwright/package/lib/server/chromium/crCoverage.js +0 -246
  134. package/.playwright/package/lib/server/chromium/crDevTools.js +0 -104
  135. package/.playwright/package/lib/server/chromium/crDragDrop.js +0 -143
  136. package/.playwright/package/lib/server/chromium/crExecutionContext.js +0 -132
  137. package/.playwright/package/lib/server/chromium/crInput.js +0 -182
  138. package/.playwright/package/lib/server/chromium/crNetworkManager.js +0 -767
  139. package/.playwright/package/lib/server/chromium/crPage.js +0 -1122
  140. package/.playwright/package/lib/server/chromium/crPdf.js +0 -153
  141. package/.playwright/package/lib/server/chromium/crProtocolHelper.js +0 -133
  142. package/.playwright/package/lib/server/chromium/crServiceWorker.js +0 -112
  143. package/.playwright/package/lib/server/chromium/defaultFontFamilies.js +0 -145
  144. package/.playwright/package/lib/server/chromium/videoRecorder.js +0 -155
  145. package/.playwright/package/lib/server/clock.js +0 -125
  146. package/.playwright/package/lib/server/codegen/csharp.js +0 -304
  147. package/.playwright/package/lib/server/codegen/java.js +0 -243
  148. package/.playwright/package/lib/server/codegen/javascript.js +0 -253
  149. package/.playwright/package/lib/server/codegen/jsonl.js +0 -47
  150. package/.playwright/package/lib/server/codegen/language.js +0 -88
  151. package/.playwright/package/lib/server/codegen/languages.js +0 -30
  152. package/.playwright/package/lib/server/codegen/python.js +0 -262
  153. package/.playwright/package/lib/server/codegen/types.js +0 -5
  154. package/.playwright/package/lib/server/console.js +0 -57
  155. package/.playwright/package/lib/server/cookieStore.js +0 -185
  156. package/.playwright/package/lib/server/debugController.js +0 -212
  157. package/.playwright/package/lib/server/debugger.js +0 -132
  158. package/.playwright/package/lib/server/deviceDescriptors.js +0 -26
  159. package/.playwright/package/lib/server/deviceDescriptorsSource.json +0 -1669
  160. package/.playwright/package/lib/server/dialog.js +0 -71
  161. package/.playwright/package/lib/server/dispatchers/androidDispatcher.js +0 -204
  162. package/.playwright/package/lib/server/dispatchers/artifactDispatcher.js +0 -118
  163. package/.playwright/package/lib/server/dispatchers/browserContextDispatcher.js +0 -357
  164. package/.playwright/package/lib/server/dispatchers/browserDispatcher.js +0 -170
  165. package/.playwright/package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
  166. package/.playwright/package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -48
  167. package/.playwright/package/lib/server/dispatchers/debugControllerDispatcher.js +0 -105
  168. package/.playwright/package/lib/server/dispatchers/dialogDispatcher.js +0 -44
  169. package/.playwright/package/lib/server/dispatchers/dispatcher.js +0 -395
  170. package/.playwright/package/lib/server/dispatchers/electronDispatcher.js +0 -93
  171. package/.playwright/package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -228
  172. package/.playwright/package/lib/server/dispatchers/frameDispatcher.js +0 -294
  173. package/.playwright/package/lib/server/dispatchers/jsHandleDispatcher.js +0 -97
  174. package/.playwright/package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -59
  175. package/.playwright/package/lib/server/dispatchers/localUtilsDispatcher.js +0 -413
  176. package/.playwright/package/lib/server/dispatchers/networkDispatchers.js +0 -221
  177. package/.playwright/package/lib/server/dispatchers/pageDispatcher.js +0 -367
  178. package/.playwright/package/lib/server/dispatchers/playwrightDispatcher.js +0 -107
  179. package/.playwright/package/lib/server/dispatchers/selectorsDispatcher.js +0 -36
  180. package/.playwright/package/lib/server/dispatchers/streamDispatcher.js +0 -62
  181. package/.playwright/package/lib/server/dispatchers/tracingDispatcher.js +0 -64
  182. package/.playwright/package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -188
  183. package/.playwright/package/lib/server/dispatchers/writableStreamDispatcher.js +0 -58
  184. package/.playwright/package/lib/server/dom.js +0 -893
  185. package/.playwright/package/lib/server/download.js +0 -60
  186. package/.playwright/package/lib/server/electron/electron.js +0 -296
  187. package/.playwright/package/lib/server/electron/loader.js +0 -57
  188. package/.playwright/package/lib/server/errors.js +0 -68
  189. package/.playwright/package/lib/server/fetch.js +0 -663
  190. package/.playwright/package/lib/server/fileChooser.js +0 -42
  191. package/.playwright/package/lib/server/fileUploadUtils.js +0 -75
  192. package/.playwright/package/lib/server/firefox/ffAccessibility.js +0 -216
  193. package/.playwright/package/lib/server/firefox/ffBrowser.js +0 -462
  194. package/.playwright/package/lib/server/firefox/ffConnection.js +0 -168
  195. package/.playwright/package/lib/server/firefox/ffExecutionContext.js +0 -123
  196. package/.playwright/package/lib/server/firefox/ffInput.js +0 -161
  197. package/.playwright/package/lib/server/firefox/ffNetworkManager.js +0 -233
  198. package/.playwright/package/lib/server/firefox/ffPage.js +0 -544
  199. package/.playwright/package/lib/server/firefox/firefox.js +0 -99
  200. package/.playwright/package/lib/server/formData.js +0 -75
  201. package/.playwright/package/lib/server/frameSelectors.js +0 -171
  202. package/.playwright/package/lib/server/frames.js +0 -1663
  203. package/.playwright/package/lib/server/har/harRecorder.js +0 -139
  204. package/.playwright/package/lib/server/har/harTracer.js +0 -542
  205. package/.playwright/package/lib/server/helper.js +0 -103
  206. package/.playwright/package/lib/server/index.js +0 -108
  207. package/.playwright/package/lib/server/input.js +0 -309
  208. package/.playwright/package/lib/server/instrumentation.js +0 -70
  209. package/.playwright/package/lib/server/isomorphic/utilityScriptSerializers.js +0 -226
  210. package/.playwright/package/lib/server/javascript.js +0 -293
  211. package/.playwright/package/lib/server/launchApp.js +0 -91
  212. package/.playwright/package/lib/server/macEditingCommands.js +0 -139
  213. package/.playwright/package/lib/server/network.js +0 -617
  214. package/.playwright/package/lib/server/page.js +0 -863
  215. package/.playwright/package/lib/server/pipeTransport.js +0 -85
  216. package/.playwright/package/lib/server/playwright.js +0 -88
  217. package/.playwright/package/lib/server/progress.js +0 -99
  218. package/.playwright/package/lib/server/protocolError.js +0 -49
  219. package/.playwright/package/lib/server/recorder/chat.js +0 -177
  220. package/.playwright/package/lib/server/recorder/contextRecorder.js +0 -290
  221. package/.playwright/package/lib/server/recorder/recorderApp.js +0 -187
  222. package/.playwright/package/lib/server/recorder/recorderCollection.js +0 -104
  223. package/.playwright/package/lib/server/recorder/recorderFrontend.js +0 -5
  224. package/.playwright/package/lib/server/recorder/recorderRunner.js +0 -159
  225. package/.playwright/package/lib/server/recorder/recorderUtils.js +0 -89
  226. package/.playwright/package/lib/server/recorder/throttledFile.js +0 -46
  227. package/.playwright/package/lib/server/recorder.js +0 -367
  228. package/.playwright/package/lib/server/registry/browserFetcher.js +0 -168
  229. package/.playwright/package/lib/server/registry/dependencies.js +0 -322
  230. package/.playwright/package/lib/server/registry/index.js +0 -1165
  231. package/.playwright/package/lib/server/registry/nativeDeps.js +0 -496
  232. package/.playwright/package/lib/server/registry/oopDownloadBrowserMain.js +0 -138
  233. package/.playwright/package/lib/server/screenshotter.js +0 -348
  234. package/.playwright/package/lib/server/selectors.js +0 -73
  235. package/.playwright/package/lib/server/socksClientCertificatesInterceptor.js +0 -340
  236. package/.playwright/package/lib/server/socksInterceptor.js +0 -100
  237. package/.playwright/package/lib/server/trace/recorder/snapshotter.js +0 -161
  238. package/.playwright/package/lib/server/trace/recorder/snapshotterInjected.js +0 -518
  239. package/.playwright/package/lib/server/trace/recorder/tracing.js +0 -596
  240. package/.playwright/package/lib/server/trace/test/inMemorySnapshotter.js +0 -93
  241. package/.playwright/package/lib/server/trace/viewer/traceViewer.js +0 -219
  242. package/.playwright/package/lib/server/transport.js +0 -192
  243. package/.playwright/package/lib/server/types.js +0 -24
  244. package/.playwright/package/lib/server/usKeyboardLayout.js +0 -555
  245. package/.playwright/package/lib/server/webkit/webkit.js +0 -87
  246. package/.playwright/package/lib/server/webkit/wkAccessibility.js +0 -194
  247. package/.playwright/package/lib/server/webkit/wkBrowser.js +0 -329
  248. package/.playwright/package/lib/server/webkit/wkConnection.js +0 -173
  249. package/.playwright/package/lib/server/webkit/wkExecutionContext.js +0 -131
  250. package/.playwright/package/lib/server/webkit/wkInput.js +0 -179
  251. package/.playwright/package/lib/server/webkit/wkInterceptableRequest.js +0 -162
  252. package/.playwright/package/lib/server/webkit/wkPage.js +0 -1207
  253. package/.playwright/package/lib/server/webkit/wkProvisionalPage.js +0 -94
  254. package/.playwright/package/lib/server/webkit/wkWorkers.js +0 -104
  255. package/.playwright/package/lib/third_party/pixelmatch.js +0 -255
  256. package/.playwright/package/lib/utils/ascii.js +0 -31
  257. package/.playwright/package/lib/utils/comparators.js +0 -159
  258. package/.playwright/package/lib/utils/crypto.js +0 -171
  259. package/.playwright/package/lib/utils/debug.js +0 -46
  260. package/.playwright/package/lib/utils/debugLogger.js +0 -93
  261. package/.playwright/package/lib/utils/env.js +0 -49
  262. package/.playwright/package/lib/utils/eventsHelper.js +0 -38
  263. package/.playwright/package/lib/utils/expectUtils.js +0 -33
  264. package/.playwright/package/lib/utils/fileUtils.js +0 -205
  265. package/.playwright/package/lib/utils/happy-eyeballs.js +0 -194
  266. package/.playwright/package/lib/utils/headers.js +0 -52
  267. package/.playwright/package/lib/utils/hostPlatform.js +0 -145
  268. package/.playwright/package/lib/utils/httpServer.js +0 -233
  269. package/.playwright/package/lib/utils/index.js +0 -368
  270. package/.playwright/package/lib/utils/isomorphic/ariaSnapshot.js +0 -391
  271. package/.playwright/package/lib/utils/isomorphic/cssParser.js +0 -250
  272. package/.playwright/package/lib/utils/isomorphic/cssTokenizer.js +0 -979
  273. package/.playwright/package/lib/utils/isomorphic/locatorGenerators.js +0 -660
  274. package/.playwright/package/lib/utils/isomorphic/locatorParser.js +0 -185
  275. package/.playwright/package/lib/utils/isomorphic/locatorUtils.js +0 -62
  276. package/.playwright/package/lib/utils/isomorphic/mimeType.js +0 -29
  277. package/.playwright/package/lib/utils/isomorphic/selectorParser.js +0 -397
  278. package/.playwright/package/lib/utils/isomorphic/stringUtils.js +0 -169
  279. package/.playwright/package/lib/utils/isomorphic/traceUtils.js +0 -39
  280. package/.playwright/package/lib/utils/isomorphic/urlMatch.js +0 -122
  281. package/.playwright/package/lib/utils/linuxUtils.js +0 -78
  282. package/.playwright/package/lib/utils/manualPromise.js +0 -109
  283. package/.playwright/package/lib/utils/multimap.js +0 -75
  284. package/.playwright/package/lib/utils/network.js +0 -160
  285. package/.playwright/package/lib/utils/processLauncher.js +0 -248
  286. package/.playwright/package/lib/utils/profiler.js +0 -53
  287. package/.playwright/package/lib/utils/rtti.js +0 -44
  288. package/.playwright/package/lib/utils/semaphore.js +0 -51
  289. package/.playwright/package/lib/utils/sequence.js +0 -64
  290. package/.playwright/package/lib/utils/spawnAsync.js +0 -45
  291. package/.playwright/package/lib/utils/stackTrace.js +0 -134
  292. package/.playwright/package/lib/utils/task.js +0 -58
  293. package/.playwright/package/lib/utils/time.js +0 -37
  294. package/.playwright/package/lib/utils/timeoutRunner.js +0 -66
  295. package/.playwright/package/lib/utils/traceUtils.js +0 -44
  296. package/.playwright/package/lib/utils/userAgent.js +0 -105
  297. package/.playwright/package/lib/utils/wsServer.js +0 -128
  298. package/.playwright/package/lib/utils/zipFile.js +0 -75
  299. package/.playwright/package/lib/utils/zones.js +0 -69
  300. package/.playwright/package/lib/utilsBundle.js +0 -81
  301. package/.playwright/package/lib/utilsBundleImpl/index.js +0 -210
  302. package/.playwright/package/lib/utilsBundleImpl/xdg-open +0 -1066
  303. package/.playwright/package/lib/vite/htmlReport/index.html +0 -69
  304. package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
  305. package/.playwright/package/lib/vite/recorder/assets/codeMirrorModule-k-61wZCK.js +0 -24
  306. package/.playwright/package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
  307. package/.playwright/package/lib/vite/recorder/assets/index-B70BEW3b.js +0 -184
  308. package/.playwright/package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
  309. package/.playwright/package/lib/vite/recorder/index.html +0 -29
  310. package/.playwright/package/lib/vite/recorder/playwright-logo.svg +0 -9
  311. package/.playwright/package/lib/vite/traceViewer/assets/codeMirrorModule-CyuxU5C-.js +0 -24
  312. package/.playwright/package/lib/vite/traceViewer/assets/defaultSettingsView-5nVJRt0A.js +0 -243
  313. package/.playwright/package/lib/vite/traceViewer/assets/xtermModule-c-SNdYZy.js +0 -9
  314. package/.playwright/package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
  315. package/.playwright/package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
  316. package/.playwright/package/lib/vite/traceViewer/defaultSettingsView.2xeEXCXv.css +0 -1
  317. package/.playwright/package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
  318. package/.playwright/package/lib/vite/traceViewer/index.html +0 -43
  319. package/.playwright/package/lib/vite/traceViewer/index.qVn2ZnpC.js +0 -2
  320. package/.playwright/package/lib/vite/traceViewer/playwright-logo.svg +0 -9
  321. package/.playwright/package/lib/vite/traceViewer/snapshot.html +0 -21
  322. package/.playwright/package/lib/vite/traceViewer/sw.bundle.js +0 -3
  323. package/.playwright/package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
  324. package/.playwright/package/lib/vite/traceViewer/uiMode.html +0 -17
  325. package/.playwright/package/lib/vite/traceViewer/uiMode.m4IPRPOd.js +0 -5
  326. package/.playwright/package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
  327. package/.playwright/package/lib/zipBundle.js +0 -25
  328. package/.playwright/package/lib/zipBundleImpl.js +0 -5
  329. package/.playwright/package/package.json +0 -44
  330. package/.playwright/package/protocol.yml +0 -3758
  331. package/.playwright/package/types/protocol.d.ts +0 -21868
  332. package/.playwright/package/types/structs.d.ts +0 -45
  333. package/.playwright/package/types/types.d.ts +0 -22663
  334. package/et +0 -0
  335. package/install.js +0 -19
  336. package/playwright.ps1 +0 -7
  337. package/scripts/playwright-bridge.js +0 -560
@@ -1,675 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BrowserContext = void 0;
7
- exports.assertBrowserContextIsNotOwned = assertBrowserContextIsNotOwned;
8
- exports.normalizeProxySettings = normalizeProxySettings;
9
- exports.validateBrowserContextOptions = validateBrowserContextOptions;
10
- exports.verifyClientCertificates = verifyClientCertificates;
11
- exports.verifyGeolocation = verifyGeolocation;
12
- var _timeoutSettings = require("../common/timeoutSettings");
13
- var _utils = require("../utils");
14
- var _fileUtils = require("../utils/fileUtils");
15
- var _helper = require("./helper");
16
- var network = _interopRequireWildcard(require("./network"));
17
- var _page6 = require("./page");
18
- var _path = _interopRequireDefault(require("path"));
19
- var _fs = _interopRequireDefault(require("fs"));
20
- var _instrumentation = require("./instrumentation");
21
- var _debugger = require("./debugger");
22
- var _tracing = require("./trace/recorder/tracing");
23
- var _harRecorder = require("./har/harRecorder");
24
- var _recorder = require("./recorder");
25
- var consoleApiSource = _interopRequireWildcard(require("../generated/consoleApiSource"));
26
- var _fetch = require("./fetch");
27
- var _clock = require("./clock");
28
- var _recorderApp = require("./recorder/recorderApp");
29
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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
- /**
33
- * Copyright 2017 Google Inc. All rights reserved.
34
- * Modifications copyright (c) Microsoft Corporation.
35
- *
36
- * Licensed under the Apache License, Version 2.0 (the "License");
37
- * you may not use this file except in compliance with the License.
38
- * You may obtain a copy of the License at
39
- *
40
- * http://www.apache.org/licenses/LICENSE-2.0
41
- *
42
- * Unless required by applicable law or agreed to in writing, software
43
- * distributed under the License is distributed on an "AS IS" BASIS,
44
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
45
- * See the License for the specific language governing permissions and
46
- * limitations under the License.
47
- */
48
-
49
- class BrowserContext extends _instrumentation.SdkObject {
50
- constructor(browser, options, browserContextId) {
51
- super(browser, 'browser-context');
52
- this._timeoutSettings = new _timeoutSettings.TimeoutSettings();
53
- this._pageBindings = new Map();
54
- this._activeProgressControllers = new Set();
55
- this._options = void 0;
56
- this._requestInterceptor = void 0;
57
- this._isPersistentContext = void 0;
58
- this._closedStatus = 'open';
59
- this._closePromise = void 0;
60
- this._closePromiseFulfill = void 0;
61
- this._permissions = new Map();
62
- this._downloads = new Set();
63
- this._browser = void 0;
64
- this._browserContextId = void 0;
65
- this._selectors = void 0;
66
- this._origins = new Set();
67
- this._harRecorders = new Map();
68
- this.tracing = void 0;
69
- this.fetchRequest = void 0;
70
- this._customCloseHandler = void 0;
71
- this._tempDirs = [];
72
- this._settingStorageState = false;
73
- this.initScripts = [];
74
- this._routesInFlight = new Set();
75
- this._debugger = void 0;
76
- this._closeReason = void 0;
77
- this.clock = void 0;
78
- this._clientCertificatesProxy = void 0;
79
- this.attribution.context = this;
80
- this._browser = browser;
81
- this._options = options;
82
- this._browserContextId = browserContextId;
83
- this._isPersistentContext = !browserContextId;
84
- this._closePromise = new Promise(fulfill => this._closePromiseFulfill = fulfill);
85
- this.fetchRequest = new _fetch.BrowserContextAPIRequestContext(this);
86
- if (this._options.recordHar) this._harRecorders.set('', new _harRecorder.HarRecorder(this, null, this._options.recordHar));
87
- this.tracing = new _tracing.Tracing(this, browser.options.tracesDir);
88
- this.clock = new _clock.Clock(this);
89
- }
90
- isPersistentContext() {
91
- return this._isPersistentContext;
92
- }
93
- setSelectors(selectors) {
94
- this._selectors = selectors;
95
- }
96
- selectors() {
97
- return this._selectors || this.attribution.playwright.selectors;
98
- }
99
- async _initialize() {
100
- if (this.attribution.playwright.options.isInternalPlaywright) return;
101
- // Debugger will pause execution upon page.pause in headed mode.
102
- this._debugger = new _debugger.Debugger(this);
103
-
104
- // When PWDEBUG=1, show inspector for each context.
105
- if ((0, _utils.debugMode)() === 'inspector') await _recorder.Recorder.show(this, _recorderApp.RecorderApp.factory(this), {
106
- pauseOnNextStatement: true
107
- });
108
-
109
- // When paused, show inspector.
110
- if (this._debugger.isPaused()) _recorder.Recorder.showInspectorNoReply(this, _recorderApp.RecorderApp.factory(this));
111
- this._debugger.on(_debugger.Debugger.Events.PausedStateChanged, () => {
112
- if (this._debugger.isPaused()) _recorder.Recorder.showInspectorNoReply(this, _recorderApp.RecorderApp.factory(this));
113
- });
114
- if ((0, _utils.debugMode)() === 'console') await this.extendInjectedScript(consoleApiSource.source);
115
- if (this._options.serviceWorkers === 'block') await this.addInitScript(`\nif (navigator.serviceWorker) navigator.serviceWorker.register = async () => { console.warn('Service Worker registration blocked by Playwright'); };\n`);
116
- if (this._options.permissions) await this.grantPermissions(this._options.permissions);
117
- }
118
- debugger() {
119
- return this._debugger;
120
- }
121
- async _ensureVideosPath() {
122
- if (this._options.recordVideo) await (0, _fileUtils.mkdirIfNeeded)(_path.default.join(this._options.recordVideo.dir, 'dummy'));
123
- }
124
- canResetForReuse() {
125
- if (this._closedStatus !== 'open') return false;
126
- return true;
127
- }
128
- async stopPendingOperations(reason) {
129
- // When using context reuse, stop pending operations to gracefully terminate all the actions
130
- // with a user-friendly error message containing operation log.
131
- for (const controller of this._activeProgressControllers) controller.abort(new Error(reason));
132
- // Let rejections in microtask generate events before returning.
133
- await new Promise(f => setTimeout(f, 0));
134
- }
135
- static reusableContextHash(params) {
136
- const paramsCopy = {
137
- ...params
138
- };
139
- for (const k of Object.keys(paramsCopy)) {
140
- const key = k;
141
- if (paramsCopy[key] === defaultNewContextParamValues[key]) delete paramsCopy[key];
142
- }
143
- for (const key of paramsThatAllowContextReuse) delete paramsCopy[key];
144
- return JSON.stringify(paramsCopy);
145
- }
146
- async resetForReuse(metadata, params) {
147
- var _page, _page2, _page3, _page4, _page5;
148
- this.setDefaultNavigationTimeout(undefined);
149
- this.setDefaultTimeout(undefined);
150
- this.tracing.resetForReuse();
151
- if (params) {
152
- for (const key of paramsThatAllowContextReuse) this._options[key] = params[key];
153
- }
154
- await this._cancelAllRoutesInFlight();
155
-
156
- // Close extra pages early.
157
- let page = this.pages()[0];
158
- const [, ...otherPages] = this.pages();
159
- for (const p of otherPages) await p.close(metadata);
160
- if (page && page.hasCrashed()) {
161
- await page.close(metadata);
162
- page = undefined;
163
- }
164
-
165
- // Unless dialogs are dismissed, setting extra http headers below does not respond.
166
- (_page = page) === null || _page === void 0 || _page._frameManager.setCloseAllOpeningDialogs(true);
167
- await ((_page2 = page) === null || _page2 === void 0 ? void 0 : _page2._frameManager.closeOpenDialogs());
168
- // Navigate to about:blank first to ensure no page scripts are running after this point.
169
- await ((_page3 = page) === null || _page3 === void 0 ? void 0 : _page3.mainFrame().goto(metadata, 'about:blank', {
170
- timeout: 0
171
- }));
172
- (_page4 = page) === null || _page4 === void 0 || _page4._frameManager.setCloseAllOpeningDialogs(false);
173
- await this._resetStorage();
174
- await this._removeExposedBindings();
175
- await this._removeInitScripts();
176
- this.clock.markAsUninstalled();
177
- // TODO: following can be optimized to not perform noops.
178
- if (this._options.permissions) await this.grantPermissions(this._options.permissions);else await this.clearPermissions();
179
- await this.setExtraHTTPHeaders(this._options.extraHTTPHeaders || []);
180
- await this.setGeolocation(this._options.geolocation);
181
- await this.setOffline(!!this._options.offline);
182
- await this.setUserAgent(this._options.userAgent);
183
- await this.clearCache();
184
- await this._resetCookies();
185
- await ((_page5 = page) === null || _page5 === void 0 ? void 0 : _page5.resetForReuse(metadata));
186
- }
187
- _browserClosed() {
188
- for (const page of this.pages()) page._didClose();
189
- this._didCloseInternal();
190
- }
191
- _didCloseInternal() {
192
- var _this$_clientCertific;
193
- if (this._closedStatus === 'closed') {
194
- // We can come here twice if we close browser context and browser
195
- // at the same time.
196
- return;
197
- }
198
- (_this$_clientCertific = this._clientCertificatesProxy) === null || _this$_clientCertific === void 0 || _this$_clientCertific.close().catch(() => {});
199
- this.tracing.abort();
200
- if (this._isPersistentContext) this.onClosePersistent();
201
- this._closePromiseFulfill(new Error('Context closed'));
202
- this.emit(BrowserContext.Events.Close);
203
- }
204
- pages() {
205
- return this.possiblyUninitializedPages().filter(page => page.initializedOrUndefined());
206
- }
207
-
208
- // BrowserContext methods.
209
-
210
- async cookies(urls = []) {
211
- if (urls && !Array.isArray(urls)) urls = [urls];
212
- return await this.doGetCookies(urls);
213
- }
214
- async clearCookies(options) {
215
- const currentCookies = await this.cookies();
216
- await this.doClearCookies();
217
- const matches = (cookie, prop, value) => {
218
- if (!value) return true;
219
- if (value instanceof RegExp) {
220
- value.lastIndex = 0;
221
- return value.test(cookie[prop]);
222
- }
223
- return cookie[prop] === value;
224
- };
225
- const cookiesToReadd = currentCookies.filter(cookie => {
226
- return !matches(cookie, 'name', options.name) || !matches(cookie, 'domain', options.domain) || !matches(cookie, 'path', options.path);
227
- });
228
- await this.addCookies(cookiesToReadd);
229
- }
230
- setHTTPCredentials(httpCredentials) {
231
- return this.doSetHTTPCredentials(httpCredentials);
232
- }
233
- hasBinding(name) {
234
- return this._pageBindings.has(name);
235
- }
236
- async exposeBinding(name, needsHandle, playwrightBinding) {
237
- if (this._pageBindings.has(name)) throw new Error(`Function "${name}" has been already registered`);
238
- for (const page of this.pages()) {
239
- if (page.getBinding(name)) throw new Error(`Function "${name}" has been already registered in one of the pages`);
240
- }
241
- const binding = new _page6.PageBinding(name, playwrightBinding, needsHandle);
242
- this._pageBindings.set(name, binding);
243
- await this.doAddInitScript(binding.initScript);
244
- const frames = this.pages().map(page => page.frames()).flat();
245
- await Promise.all(frames.map(frame => frame.evaluateExpression(binding.initScript.source).catch(e => {})));
246
- }
247
- async _removeExposedBindings() {
248
- for (const [key, binding] of this._pageBindings) {
249
- if (!binding.internal) this._pageBindings.delete(key);
250
- }
251
- }
252
- async grantPermissions(permissions, origin) {
253
- let resolvedOrigin = '*';
254
- if (origin) {
255
- const url = new URL(origin);
256
- resolvedOrigin = url.origin;
257
- }
258
- const existing = new Set(this._permissions.get(resolvedOrigin) || []);
259
- permissions.forEach(p => existing.add(p));
260
- const list = [...existing.values()];
261
- this._permissions.set(resolvedOrigin, list);
262
- await this.doGrantPermissions(resolvedOrigin, list);
263
- }
264
- async clearPermissions() {
265
- this._permissions.clear();
266
- await this.doClearPermissions();
267
- }
268
- setDefaultNavigationTimeout(timeout) {
269
- this._timeoutSettings.setDefaultNavigationTimeout(timeout);
270
- }
271
- setDefaultTimeout(timeout) {
272
- this._timeoutSettings.setDefaultTimeout(timeout);
273
- }
274
- async _loadDefaultContextAsIs(progress) {
275
- if (!this.possiblyUninitializedPages().length) {
276
- const waitForEvent = _helper.helper.waitForEvent(progress, this, BrowserContext.Events.Page);
277
- progress.cleanupWhenAborted(() => waitForEvent.dispose);
278
- // Race against BrowserContext.close
279
- await Promise.race([waitForEvent.promise, this._closePromise]);
280
- }
281
- const page = this.possiblyUninitializedPages()[0];
282
- if (!page) return;
283
- const pageOrError = await page.waitForInitializedOrError();
284
- if (pageOrError instanceof Error) throw pageOrError;
285
- await page.mainFrame()._waitForLoadState(progress, 'load');
286
- return page;
287
- }
288
- async _loadDefaultContext(progress) {
289
- const defaultPage = await this._loadDefaultContextAsIs(progress);
290
- if (!defaultPage) return;
291
- const browserName = this._browser.options.name;
292
- if (this._options.isMobile && browserName === 'chromium' || this._options.locale && browserName === 'webkit') {
293
- // Workaround for:
294
- // - chromium fails to change isMobile for existing page;
295
- // - webkit fails to change locale for existing page.
296
- await this.newPage(progress.metadata);
297
- await defaultPage.close(progress.metadata);
298
- }
299
- }
300
- _authenticateProxyViaHeader() {
301
- const proxy = this._options.proxy || this._browser.options.proxy || {
302
- username: undefined,
303
- password: undefined
304
- };
305
- const {
306
- username,
307
- password
308
- } = proxy;
309
- if (username) {
310
- this._options.httpCredentials = {
311
- username,
312
- password: password
313
- };
314
- const token = Buffer.from(`${username}:${password}`).toString('base64');
315
- this._options.extraHTTPHeaders = network.mergeHeaders([this._options.extraHTTPHeaders, network.singleHeader('Proxy-Authorization', `Basic ${token}`)]);
316
- }
317
- }
318
- _authenticateProxyViaCredentials() {
319
- const proxy = this._options.proxy || this._browser.options.proxy;
320
- if (!proxy) return;
321
- const {
322
- username,
323
- password
324
- } = proxy;
325
- if (username) this._options.httpCredentials = {
326
- username,
327
- password: password || ''
328
- };
329
- }
330
- async addInitScript(source, name) {
331
- const initScript = new _page6.InitScript(source, false /* internal */, name);
332
- this.initScripts.push(initScript);
333
- await this.doAddInitScript(initScript);
334
- }
335
- async _removeInitScripts() {
336
- this.initScripts = this.initScripts.filter(script => script.internal);
337
- await this.doRemoveNonInternalInitScripts();
338
- }
339
- async setRequestInterceptor(handler) {
340
- this._requestInterceptor = handler;
341
- await this.doUpdateRequestInterception();
342
- }
343
- isClosingOrClosed() {
344
- return this._closedStatus !== 'open';
345
- }
346
- async _deleteAllDownloads() {
347
- await Promise.all(Array.from(this._downloads).map(download => download.artifact.deleteOnContextClose()));
348
- }
349
- async _deleteAllTempDirs() {
350
- await Promise.all(this._tempDirs.map(async dir => await _fs.default.promises.unlink(dir).catch(e => {})));
351
- }
352
- setCustomCloseHandler(handler) {
353
- this._customCloseHandler = handler;
354
- }
355
- async close(options) {
356
- if (this._closedStatus === 'open') {
357
- if (options.reason) this._closeReason = options.reason;
358
- this.emit(BrowserContext.Events.BeforeClose);
359
- this._closedStatus = 'closing';
360
- for (const harRecorder of this._harRecorders.values()) await harRecorder.flush();
361
- await this.tracing.flush();
362
-
363
- // Cleanup.
364
- const promises = [];
365
- for (const {
366
- context,
367
- artifact
368
- } of this._browser._idToVideo.values()) {
369
- // Wait for the videos to finish.
370
- if (context === this) promises.push(artifact.finishedPromise());
371
- }
372
- if (this._customCloseHandler) {
373
- await this._customCloseHandler();
374
- } else {
375
- // Close the context.
376
- await this.doClose(options.reason);
377
- }
378
-
379
- // We delete downloads after context closure
380
- // so that browser does not write to the download file anymore.
381
- promises.push(this._deleteAllDownloads());
382
- promises.push(this._deleteAllTempDirs());
383
- await Promise.all(promises);
384
-
385
- // Custom handler should trigger didCloseInternal itself.
386
- if (!this._customCloseHandler) this._didCloseInternal();
387
- }
388
- await this._closePromise;
389
- }
390
- async newPage(metadata) {
391
- const page = await this.doCreateNewPage();
392
- if (metadata.isServerSide) page.markAsServerSideOnly();
393
- const pageOrError = await page.waitForInitializedOrError();
394
- if (pageOrError instanceof _page6.Page) {
395
- if (pageOrError.isClosed()) throw new Error('Page has been closed.');
396
- return pageOrError;
397
- }
398
- throw pageOrError;
399
- }
400
- addVisitedOrigin(origin) {
401
- this._origins.add(origin);
402
- }
403
- async storageState() {
404
- const result = {
405
- cookies: await this.cookies(),
406
- origins: []
407
- };
408
- const originsToSave = new Set(this._origins);
409
-
410
- // First try collecting storage stage from existing pages.
411
- for (const page of this.pages()) {
412
- const origin = page.mainFrame().origin();
413
- if (!origin || !originsToSave.has(origin)) continue;
414
- try {
415
- const storage = await page.mainFrame().nonStallingEvaluateInExistingContext(`({
416
- localStorage: Object.keys(localStorage).map(name => ({ name, value: localStorage.getItem(name) })),
417
- })`, 'utility');
418
- if (storage.localStorage.length) result.origins.push({
419
- origin,
420
- localStorage: storage.localStorage
421
- });
422
- originsToSave.delete(origin);
423
- } catch {
424
- // When failed on the live page, we'll retry on the blank page below.
425
- }
426
- }
427
-
428
- // If there are still origins to save, create a blank page to iterate over origins.
429
- if (originsToSave.size) {
430
- const internalMetadata = (0, _instrumentation.serverSideCallMetadata)();
431
- const page = await this.newPage(internalMetadata);
432
- await page._setServerRequestInterceptor(handler => {
433
- handler.fulfill({
434
- body: '<html></html>'
435
- }).catch(() => {});
436
- return true;
437
- });
438
- for (const origin of originsToSave) {
439
- const originStorage = {
440
- origin,
441
- localStorage: []
442
- };
443
- const frame = page.mainFrame();
444
- await frame.goto(internalMetadata, origin);
445
- const storage = await frame.evaluateExpression(`({
446
- localStorage: Object.keys(localStorage).map(name => ({ name, value: localStorage.getItem(name) })),
447
- })`, {
448
- world: 'utility'
449
- });
450
- originStorage.localStorage = storage.localStorage;
451
- if (storage.localStorage.length) result.origins.push(originStorage);
452
- }
453
- await page.close(internalMetadata);
454
- }
455
- return result;
456
- }
457
- async _resetStorage() {
458
- var _this$_options$storag;
459
- const oldOrigins = this._origins;
460
- const newOrigins = new Map(((_this$_options$storag = this._options.storageState) === null || _this$_options$storag === void 0 || (_this$_options$storag = _this$_options$storag.origins) === null || _this$_options$storag === void 0 ? void 0 : _this$_options$storag.map(p => [p.origin, p])) || []);
461
- if (!oldOrigins.size && !newOrigins.size) return;
462
- let page = this.pages()[0];
463
- const internalMetadata = (0, _instrumentation.serverSideCallMetadata)();
464
- page = page || (await this.newPage({
465
- ...internalMetadata,
466
- // Do not mark this page as internal, because we will leave it for later reuse
467
- // as a user-visible page.
468
- isServerSide: false
469
- }));
470
- await page._setServerRequestInterceptor(handler => {
471
- handler.fulfill({
472
- body: '<html></html>'
473
- }).catch(() => {});
474
- return true;
475
- });
476
- for (const origin of new Set([...oldOrigins, ...newOrigins.keys()])) {
477
- const frame = page.mainFrame();
478
- await frame.goto(internalMetadata, origin);
479
- await frame.resetStorageForCurrentOriginBestEffort(newOrigins.get(origin));
480
- }
481
- await page._setServerRequestInterceptor(undefined);
482
- this._origins = new Set([...newOrigins.keys()]);
483
- // It is safe to not restore the URL to about:blank since we are doing it in Page::resetForReuse.
484
- }
485
- async _resetCookies() {
486
- var _this$_options$storag2, _this$_options$storag3;
487
- await this.doClearCookies();
488
- if ((_this$_options$storag2 = this._options.storageState) !== null && _this$_options$storag2 !== void 0 && _this$_options$storag2.cookies) await this.addCookies((_this$_options$storag3 = this._options.storageState) === null || _this$_options$storag3 === void 0 ? void 0 : _this$_options$storag3.cookies);
489
- }
490
- isSettingStorageState() {
491
- return this._settingStorageState;
492
- }
493
- async setStorageState(metadata, state) {
494
- this._settingStorageState = true;
495
- try {
496
- if (state.cookies) await this.addCookies(state.cookies);
497
- if (state.origins && state.origins.length) {
498
- const internalMetadata = (0, _instrumentation.serverSideCallMetadata)();
499
- const page = await this.newPage(internalMetadata);
500
- await page._setServerRequestInterceptor(handler => {
501
- handler.fulfill({
502
- body: '<html></html>'
503
- }).catch(() => {});
504
- return true;
505
- });
506
- for (const originState of state.origins) {
507
- const frame = page.mainFrame();
508
- await frame.goto(metadata, originState.origin);
509
- await frame.evaluateExpression(`
510
- originState => {
511
- for (const { name, value } of (originState.localStorage || []))
512
- localStorage.setItem(name, value);
513
- }`, {
514
- isFunction: true,
515
- world: 'utility'
516
- }, originState);
517
- }
518
- await page.close(internalMetadata);
519
- }
520
- } finally {
521
- this._settingStorageState = false;
522
- }
523
- }
524
- async extendInjectedScript(source, arg) {
525
- const installInFrame = frame => frame.extendInjectedScript(source, arg).catch(() => {});
526
- const installInPage = page => {
527
- page.on(_page6.Page.Events.InternalFrameNavigatedToNewDocument, installInFrame);
528
- return Promise.all(page.frames().map(installInFrame));
529
- };
530
- this.on(BrowserContext.Events.Page, installInPage);
531
- return Promise.all(this.pages().map(installInPage));
532
- }
533
- async safeNonStallingEvaluateInAllFrames(expression, world, options = {}) {
534
- await Promise.all(this.pages().map(page => page.safeNonStallingEvaluateInAllFrames(expression, world, options)));
535
- }
536
- async _harStart(page, options) {
537
- const harId = (0, _utils.createGuid)();
538
- this._harRecorders.set(harId, new _harRecorder.HarRecorder(this, page, options));
539
- return harId;
540
- }
541
- async _harExport(harId) {
542
- const recorder = this._harRecorders.get(harId || '');
543
- return recorder.export();
544
- }
545
- addRouteInFlight(route) {
546
- this._routesInFlight.add(route);
547
- }
548
- removeRouteInFlight(route) {
549
- this._routesInFlight.delete(route);
550
- }
551
- async _cancelAllRoutesInFlight() {
552
- await Promise.all([...this._routesInFlight].map(r => r.abort())).catch(() => {});
553
- this._routesInFlight.clear();
554
- }
555
- }
556
- exports.BrowserContext = BrowserContext;
557
- BrowserContext.Events = {
558
- Console: 'console',
559
- Close: 'close',
560
- Dialog: 'dialog',
561
- Page: 'page',
562
- // Can't use just 'error' due to node.js special treatment of error events.
563
- // @see https://nodejs.org/api/events.html#events_error_events
564
- PageError: 'pageerror',
565
- Request: 'request',
566
- Response: 'response',
567
- RequestFailed: 'requestfailed',
568
- RequestFinished: 'requestfinished',
569
- RequestAborted: 'requestaborted',
570
- RequestFulfilled: 'requestfulfilled',
571
- RequestContinued: 'requestcontinued',
572
- BeforeClose: 'beforeclose',
573
- VideoStarted: 'videostarted'
574
- };
575
- function assertBrowserContextIsNotOwned(context) {
576
- for (const page of context.pages()) {
577
- if (page._ownedContext) throw new Error('Please use browser.newContext() for multi-page scripts that share the context.');
578
- }
579
- }
580
- function validateBrowserContextOptions(options, browserOptions) {
581
- if (options.noDefaultViewport && options.deviceScaleFactor !== undefined) throw new Error(`"deviceScaleFactor" option is not supported with null "viewport"`);
582
- if (options.noDefaultViewport && !!options.isMobile) throw new Error(`"isMobile" option is not supported with null "viewport"`);
583
- if (options.acceptDownloads === undefined && browserOptions.name !== 'electron') options.acceptDownloads = 'accept';
584
- // Electron requires explicit acceptDownloads: true since we wait for
585
- // https://github.com/electron/electron/pull/41718 to be widely shipped.
586
- // In 6-12 months, we can remove this check.
587
- else if (options.acceptDownloads === undefined && browserOptions.name === 'electron') options.acceptDownloads = 'internal-browser-default';
588
- if (!options.viewport && !options.noDefaultViewport) options.viewport = {
589
- width: 1280,
590
- height: 720
591
- };
592
- if (options.recordVideo) {
593
- if (!options.recordVideo.size) {
594
- if (options.noDefaultViewport) {
595
- options.recordVideo.size = {
596
- width: 800,
597
- height: 600
598
- };
599
- } else {
600
- const size = options.viewport;
601
- const scale = Math.min(1, 800 / Math.max(size.width, size.height));
602
- options.recordVideo.size = {
603
- width: Math.floor(size.width * scale),
604
- height: Math.floor(size.height * scale)
605
- };
606
- }
607
- }
608
- // Make sure both dimensions are odd, this is required for vp8
609
- options.recordVideo.size.width &= ~1;
610
- options.recordVideo.size.height &= ~1;
611
- }
612
- if (options.proxy) options.proxy = normalizeProxySettings(options.proxy);
613
- verifyGeolocation(options.geolocation);
614
- }
615
- function verifyGeolocation(geolocation) {
616
- if (!geolocation) return;
617
- geolocation.accuracy = geolocation.accuracy || 0;
618
- const {
619
- longitude,
620
- latitude,
621
- accuracy
622
- } = geolocation;
623
- if (longitude < -180 || longitude > 180) throw new Error(`geolocation.longitude: precondition -180 <= LONGITUDE <= 180 failed.`);
624
- if (latitude < -90 || latitude > 90) throw new Error(`geolocation.latitude: precondition -90 <= LATITUDE <= 90 failed.`);
625
- if (accuracy < 0) throw new Error(`geolocation.accuracy: precondition 0 <= ACCURACY failed.`);
626
- }
627
- function verifyClientCertificates(clientCertificates) {
628
- if (!clientCertificates) return;
629
- for (const cert of clientCertificates) {
630
- if (!cert.origin) throw new Error(`clientCertificates.origin is required`);
631
- if (!cert.cert && !cert.key && !cert.passphrase && !cert.pfx) throw new Error('None of cert, key, passphrase or pfx is specified');
632
- if (cert.cert && !cert.key) throw new Error('cert is specified without key');
633
- if (!cert.cert && cert.key) throw new Error('key is specified without cert');
634
- if (cert.pfx && (cert.cert || cert.key)) throw new Error('pfx is specified together with cert, key or passphrase');
635
- }
636
- }
637
- function normalizeProxySettings(proxy) {
638
- let {
639
- server,
640
- bypass
641
- } = proxy;
642
- let url;
643
- try {
644
- // new URL('127.0.0.1:8080') throws
645
- // new URL('localhost:8080') fails to parse host or protocol
646
- // In both of these cases, we need to try re-parse URL with `http://` prefix.
647
- url = new URL(server);
648
- if (!url.host || !url.protocol) url = new URL('http://' + server);
649
- } catch (e) {
650
- url = new URL('http://' + server);
651
- }
652
- if (url.protocol === 'socks4:' && (proxy.username || proxy.password)) throw new Error(`Socks4 proxy protocol does not support authentication`);
653
- if (url.protocol === 'socks5:' && (proxy.username || proxy.password)) throw new Error(`Browser does not support socks5 proxy authentication`);
654
- server = url.protocol + '//' + url.host;
655
- if (bypass) bypass = bypass.split(',').map(t => t.trim()).join(',');
656
- return {
657
- ...proxy,
658
- server,
659
- bypass
660
- };
661
- }
662
- const paramsThatAllowContextReuse = ['colorScheme', 'forcedColors', 'reducedMotion', 'screen', 'userAgent', 'viewport'];
663
- const defaultNewContextParamValues = {
664
- noDefaultViewport: false,
665
- ignoreHTTPSErrors: false,
666
- javaScriptEnabled: true,
667
- bypassCSP: false,
668
- offline: false,
669
- isMobile: false,
670
- hasTouch: false,
671
- acceptDownloads: 'accept',
672
- strictSelectors: false,
673
- serviceWorkers: 'allow',
674
- locale: 'en-US'
675
- };