rebrowser-playwright-core 1.52.0 → 1.64.1
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.
- package/ThirdPartyNotices.txt +7 -1554
- package/bin/install_webkit_wsl.ps1 +33 -0
- package/bin/reinstall_chrome_beta_linux.sh +1 -1
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_linux.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_linux.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_linux.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_linux.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +16 -44
- package/cli.js +5 -1
- package/index.js +2 -17
- package/lib/bootstrap.js +149 -0
- package/lib/coreBundle.js +78218 -0
- package/lib/entry/cliDaemon.js +5 -0
- package/lib/entry/dashboardApp.js +3 -0
- package/lib/entry/mcp.js +10 -0
- package/lib/entry/oopBrowserDownload.js +3 -0
- package/lib/{server/deviceDescriptors.js → package.js} +18 -7
- package/lib/server/electron/loader.js +108 -14
- package/lib/serverRegistry.js +1939 -0
- package/lib/serverRegistry.js.LICENSE +65 -0
- package/lib/tools/cli-client/channelSessions.js +141 -0
- package/lib/tools/cli-client/cli.js +7 -0
- package/lib/tools/cli-client/help.json +808 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/output.js +352 -0
- package/lib/tools/cli-client/program.js +422 -0
- package/lib/tools/cli-client/registry.js +180 -0
- package/lib/tools/cli-client/session.js +261 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/skills/playwright-cli/SKILL.md +493 -0
- package/lib/tools/skills/playwright-cli/references/element-attributes.md +23 -0
- package/lib/tools/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/lib/tools/skills/playwright-cli/references/pr-attachments.md +60 -0
- package/lib/tools/skills/playwright-cli/references/request-mocking.md +87 -0
- package/lib/tools/skills/playwright-cli/references/running-code.md +245 -0
- package/lib/tools/skills/playwright-cli/references/session-management.md +227 -0
- package/lib/tools/skills/playwright-cli/references/storage-state.md +275 -0
- package/lib/tools/skills/playwright-cli/references/test-generation.md +433 -0
- package/lib/tools/skills/playwright-cli/references/tracing.md +139 -0
- package/lib/tools/skills/playwright-cli/references/video-recording.md +216 -0
- package/lib/tools/skills/playwright-component-testing/SKILL.md +136 -0
- package/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
- package/lib/tools/skills/playwright-component-testing/references/migration.md +89 -0
- package/lib/tools/skills/playwright-component-testing/references/react.md +69 -0
- package/lib/tools/skills/playwright-component-testing/references/typing.md +173 -0
- package/lib/tools/skills/playwright-component-testing/references/vue.md +77 -0
- package/lib/tools/skills/playwright-trace/SKILL.md +174 -0
- package/lib/tools/utils/extension.js +112 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utilsBundle.js +86038 -66
- package/lib/utilsBundle.js.LICENSE +1890 -0
- package/lib/vite/dashboard/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/dashboard/assets/codeMirrorModule-CQ8RZGBm.js +32 -0
- package/lib/vite/dashboard/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/dashboard/assets/firefox-1bWoP6pv.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-beta-k3eOH_eK.svg +1 -0
- package/lib/vite/dashboard/assets/firefox-nightly-Cp5nfeDT.svg +1 -0
- package/lib/vite/dashboard/assets/index-AwgwcYie.css +1 -0
- package/lib/vite/dashboard/assets/index-hRvO4yU2.js +12 -0
- package/lib/vite/dashboard/assets/safari-na3_-uQk.svg +1 -0
- package/lib/vite/dashboard/index.html +29 -0
- package/lib/vite/dashboard/playwright-logo.svg +24 -0
- package/lib/vite/htmlReport/index.html +2 -61
- package/lib/vite/htmlReport/report.css +2 -0
- package/lib/vite/htmlReport/report.js +32 -0
- package/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DK72OMRi.js +32 -0
- package/lib/vite/recorder/assets/index-BZpYJZ-P.css +1 -0
- package/lib/vite/recorder/assets/index-Cn0mmDuv.js +129 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/codeMirrorModule-BEB2e8M3.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-D-g2vrvf.js +184 -0
- package/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
- package/lib/vite/traceViewer/assets/xtermModule-B794rD2Z.js +7 -0
- package/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
- package/lib/vite/traceViewer/defaultSettingsView.C8BeHuxd.css +1 -0
- package/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
- package/lib/vite/traceViewer/index.html +9 -8
- package/lib/vite/traceViewer/index.oNry3Hjv.js +1 -0
- package/lib/vite/traceViewer/manifest.webmanifest +16 -0
- package/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
- package/lib/vite/traceViewer/snapshot.html +4 -15
- package/lib/vite/traceViewer/sw.bundle.js +4 -3
- package/lib/vite/traceViewer/uiMode.CYwC_gH1.js +5 -0
- package/lib/vite/traceViewer/uiMode.CyMfwkXJ.css +1 -0
- package/lib/vite/traceViewer/uiMode.html +6 -5
- package/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
- package/lib/webp_codec.LICENSE +173 -0
- package/lib/webp_codec.wasm +0 -0
- package/lib/{utilsBundleImpl/xdg-open → xdg-open} +338 -137
- package/package.json +6 -16
- package/types/protocol.d.ts +10495 -8030
- package/types/structs.d.ts +8 -1
- package/types/types.d.ts +9256 -4825
- package/lib/androidServerImpl.js +0 -63
- package/lib/browserServerImpl.js +0 -88
- package/lib/cli/driver.js +0 -97
- package/lib/cli/program.js +0 -567
- package/lib/cli/programWithTestStub.js +0 -74
- package/lib/client/accessibility.js +0 -49
- package/lib/client/android.js +0 -365
- package/lib/client/api.js +0 -137
- package/lib/client/artifact.js +0 -79
- package/lib/client/browser.js +0 -136
- package/lib/client/browserContext.js +0 -539
- package/lib/client/browserType.js +0 -193
- package/lib/client/cdpSession.js +0 -51
- package/lib/client/channelOwner.js +0 -205
- package/lib/client/clientHelper.js +0 -64
- package/lib/client/clientInstrumentation.js +0 -55
- package/lib/client/clientStackTrace.js +0 -69
- package/lib/client/clock.js +0 -68
- package/lib/client/connection.js +0 -318
- package/lib/client/consoleMessage.js +0 -55
- package/lib/client/coverage.js +0 -44
- package/lib/client/dialog.js +0 -56
- package/lib/client/download.js +0 -62
- package/lib/client/electron.js +0 -133
- package/lib/client/elementHandle.js +0 -284
- package/lib/client/errors.js +0 -77
- package/lib/client/eventEmitter.js +0 -314
- package/lib/client/events.js +0 -98
- package/lib/client/fetch.js +0 -367
- package/lib/client/fileChooser.js +0 -46
- package/lib/client/fileUtils.js +0 -34
- package/lib/client/frame.js +0 -386
- package/lib/client/harRouter.js +0 -87
- package/lib/client/input.js +0 -82
- package/lib/client/jsHandle.js +0 -105
- package/lib/client/jsonPipe.js +0 -39
- package/lib/client/localUtils.js +0 -61
- package/lib/client/locator.js +0 -362
- package/lib/client/network.js +0 -751
- package/lib/client/page.js +0 -709
- package/lib/client/platform.js +0 -74
- package/lib/client/playwright.js +0 -85
- package/lib/client/selectors.js +0 -75
- package/lib/client/stream.js +0 -39
- package/lib/client/timeoutSettings.js +0 -75
- package/lib/client/tracing.js +0 -114
- package/lib/client/types.js +0 -28
- package/lib/client/video.js +0 -59
- package/lib/client/waiter.js +0 -142
- package/lib/client/webError.js +0 -39
- package/lib/client/webSocket.js +0 -111
- package/lib/client/worker.js +0 -63
- package/lib/client/writableStream.js +0 -39
- package/lib/generated/clockSource.js +0 -28
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/generated/injectedScriptSource.js +0 -28
- package/lib/generated/pollingRecorderSource.js +0 -28
- package/lib/generated/utilityScriptSource.js +0 -28
- package/lib/generated/webSocketMockSource.js +0 -378
- package/lib/inProcessFactory.js +0 -59
- package/lib/inprocess.js +0 -3
- package/lib/outofprocess.js +0 -78
- package/lib/protocol/debug.js +0 -211
- package/lib/protocol/serializers.js +0 -192
- package/lib/protocol/validator.js +0 -2825
- package/lib/protocol/validatorPrimitives.js +0 -179
- package/lib/remote/playwrightConnection.js +0 -266
- package/lib/remote/playwrightServer.js +0 -139
- package/lib/server/accessibility.js +0 -69
- package/lib/server/android/android.js +0 -451
- package/lib/server/android/backendAdb.js +0 -179
- package/lib/server/artifact.js +0 -127
- package/lib/server/bidi/bidiBrowser.js +0 -380
- package/lib/server/bidi/bidiChromium.js +0 -152
- package/lib/server/bidi/bidiConnection.js +0 -187
- package/lib/server/bidi/bidiExecutionContext.js +0 -220
- package/lib/server/bidi/bidiFirefox.js +0 -112
- package/lib/server/bidi/bidiInput.js +0 -146
- package/lib/server/bidi/bidiNetworkManager.js +0 -320
- package/lib/server/bidi/bidiOverCdp.js +0 -102
- package/lib/server/bidi/bidiPage.js +0 -530
- package/lib/server/bidi/bidiPdf.js +0 -106
- package/lib/server/bidi/third_party/bidiCommands.d.js +0 -22
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/bidi/third_party/bidiKeyboard.js +0 -256
- package/lib/server/bidi/third_party/bidiProtocol.js +0 -152
- package/lib/server/bidi/third_party/bidiSerializer.js +0 -148
- package/lib/server/bidi/third_party/firefoxPrefs.js +0 -259
- package/lib/server/browser.js +0 -140
- package/lib/server/browserContext.js +0 -650
- package/lib/server/browserType.js +0 -326
- package/lib/server/callLog.js +0 -82
- package/lib/server/chromium/chromium.js +0 -376
- package/lib/server/chromium/chromiumSwitches.js +0 -101
- package/lib/server/chromium/crAccessibility.js +0 -263
- package/lib/server/chromium/crBrowser.js +0 -498
- package/lib/server/chromium/crConnection.js +0 -324
- package/lib/server/chromium/crCoverage.js +0 -232
- package/lib/server/chromium/crDevTools.js +0 -117
- package/lib/server/chromium/crDragDrop.js +0 -126
- package/lib/server/chromium/crExecutionContext.js +0 -145
- package/lib/server/chromium/crInput.js +0 -184
- package/lib/server/chromium/crNetworkManager.js +0 -666
- package/lib/server/chromium/crPage.js +0 -1055
- package/lib/server/chromium/crPdf.js +0 -121
- package/lib/server/chromium/crProtocolHelper.js +0 -145
- package/lib/server/chromium/crServiceWorker.js +0 -130
- package/lib/server/chromium/defaultFontFamilies.js +0 -162
- package/lib/server/chromium/protocol.d.js +0 -16
- package/lib/server/chromium/videoRecorder.js +0 -121
- package/lib/server/clock.js +0 -137
- package/lib/server/codegen/csharp.js +0 -329
- package/lib/server/codegen/java.js +0 -270
- package/lib/server/codegen/javascript.js +0 -268
- package/lib/server/codegen/jsonl.js +0 -51
- package/lib/server/codegen/language.js +0 -111
- package/lib/server/codegen/languages.js +0 -68
- package/lib/server/codegen/python.js +0 -277
- package/lib/server/codegen/types.js +0 -16
- package/lib/server/console.js +0 -53
- package/lib/server/cookieStore.js +0 -204
- package/lib/server/debugController.js +0 -185
- package/lib/server/debugger.js +0 -136
- package/lib/server/deviceDescriptorsSource.json +0 -1669
- package/lib/server/dialog.js +0 -72
- package/lib/server/dispatchers/androidDispatcher.js +0 -293
- package/lib/server/dispatchers/artifactDispatcher.js +0 -118
- package/lib/server/dispatchers/browserContextDispatcher.js +0 -328
- package/lib/server/dispatchers/browserDispatcher.js +0 -151
- package/lib/server/dispatchers/browserTypeDispatcher.js +0 -55
- package/lib/server/dispatchers/cdpSessionDispatcher.js +0 -44
- package/lib/server/dispatchers/debugControllerDispatcher.js +0 -87
- package/lib/server/dispatchers/dialogDispatcher.js +0 -47
- package/lib/server/dispatchers/dispatcher.js +0 -346
- package/lib/server/dispatchers/electronDispatcher.js +0 -90
- package/lib/server/dispatchers/elementHandlerDispatcher.js +0 -191
- package/lib/server/dispatchers/frameDispatcher.js +0 -224
- package/lib/server/dispatchers/jsHandleDispatcher.js +0 -80
- package/lib/server/dispatchers/jsonPipeDispatcher.js +0 -58
- package/lib/server/dispatchers/localUtilsDispatcher.js +0 -155
- package/lib/server/dispatchers/networkDispatchers.js +0 -204
- package/lib/server/dispatchers/pageDispatcher.js +0 -328
- package/lib/server/dispatchers/playwrightDispatcher.js +0 -100
- package/lib/server/dispatchers/selectorsDispatcher.js +0 -40
- package/lib/server/dispatchers/streamDispatcher.js +0 -60
- package/lib/server/dispatchers/tracingDispatcher.js +0 -59
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +0 -154
- package/lib/server/dispatchers/writableStreamDispatcher.js +0 -73
- package/lib/server/dom.js +0 -869
- package/lib/server/download.js +0 -70
- package/lib/server/electron/electron.js +0 -277
- package/lib/server/errors.js +0 -69
- package/lib/server/fetch.js +0 -640
- package/lib/server/fileChooser.js +0 -43
- package/lib/server/fileUploadUtils.js +0 -84
- package/lib/server/firefox/ffAccessibility.js +0 -238
- package/lib/server/firefox/ffBrowser.js +0 -404
- package/lib/server/firefox/ffConnection.js +0 -147
- package/lib/server/firefox/ffExecutionContext.js +0 -149
- package/lib/server/firefox/ffInput.js +0 -159
- package/lib/server/firefox/ffNetworkManager.js +0 -254
- package/lib/server/firefox/ffPage.js +0 -501
- package/lib/server/firefox/firefox.js +0 -106
- package/lib/server/firefox/protocol.d.js +0 -16
- package/lib/server/formData.js +0 -147
- package/lib/server/frameSelectors.js +0 -137
- package/lib/server/frames.js +0 -1555
- package/lib/server/har/harRecorder.js +0 -147
- package/lib/server/har/harTracer.js +0 -606
- package/lib/server/harBackend.js +0 -157
- package/lib/server/helper.js +0 -100
- package/lib/server/index.js +0 -61
- package/lib/server/input.js +0 -280
- package/lib/server/instrumentation.js +0 -75
- package/lib/server/javascript.js +0 -299
- package/lib/server/launchApp.js +0 -110
- package/lib/server/localUtils.js +0 -211
- package/lib/server/macEditingCommands.js +0 -143
- package/lib/server/network.js +0 -583
- package/lib/server/page.js +0 -790
- package/lib/server/pageBinding.js +0 -88
- package/lib/server/pipeTransport.js +0 -89
- package/lib/server/playwright.js +0 -81
- package/lib/server/progress.js +0 -104
- package/lib/server/protocolError.js +0 -52
- package/lib/server/recorder/chat.js +0 -161
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderApp.js +0 -184
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/recorder/recorderRunner.js +0 -135
- package/lib/server/recorder/recorderUtils.js +0 -100
- package/lib/server/recorder/throttledFile.js +0 -57
- package/lib/server/recorder.js +0 -360
- package/lib/server/registry/browserFetcher.js +0 -175
- package/lib/server/registry/dependencies.js +0 -371
- package/lib/server/registry/index.js +0 -1271
- package/lib/server/registry/nativeDeps.js +0 -1105
- package/lib/server/registry/oopDownloadBrowserMain.js +0 -120
- package/lib/server/screenshotter.js +0 -332
- package/lib/server/selectors.js +0 -112
- package/lib/server/socksClientCertificatesInterceptor.js +0 -321
- package/lib/server/socksInterceptor.js +0 -95
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/server/trace/recorder/snapshotter.js +0 -143
- package/lib/server/trace/recorder/snapshotterInjected.js +0 -539
- package/lib/server/trace/recorder/tracing.js +0 -593
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/server/trace/viewer/traceViewer.js +0 -249
- package/lib/server/transport.js +0 -183
- package/lib/server/types.js +0 -28
- package/lib/server/usKeyboardLayout.js +0 -145
- package/lib/server/utils/ascii.js +0 -44
- package/lib/server/utils/comparators.js +0 -161
- package/lib/server/utils/crypto.js +0 -216
- package/lib/server/utils/debug.js +0 -47
- package/lib/server/utils/debugLogger.js +0 -114
- package/lib/server/utils/env.js +0 -68
- package/lib/server/utils/eventsHelper.js +0 -39
- package/lib/server/utils/expectUtils.js +0 -38
- package/lib/server/utils/fileUtils.js +0 -191
- package/lib/server/utils/happyEyeballs.js +0 -207
- package/lib/server/utils/hostPlatform.js +0 -109
- package/lib/server/utils/httpServer.js +0 -218
- package/lib/server/utils/image_tools/colorUtils.js +0 -89
- package/lib/server/utils/image_tools/compare.js +0 -109
- package/lib/server/utils/image_tools/imageChannel.js +0 -78
- package/lib/server/utils/image_tools/stats.js +0 -102
- package/lib/server/utils/linuxUtils.js +0 -71
- package/lib/server/utils/network.js +0 -217
- package/lib/server/utils/nodePlatform.js +0 -148
- package/lib/server/utils/pipeTransport.js +0 -84
- package/lib/server/utils/processLauncher.js +0 -238
- package/lib/server/utils/profiler.js +0 -65
- package/lib/server/utils/socksProxy.js +0 -511
- package/lib/server/utils/spawnAsync.js +0 -41
- package/lib/server/utils/task.js +0 -51
- package/lib/server/utils/userAgent.js +0 -98
- package/lib/server/utils/wsServer.js +0 -132
- package/lib/server/utils/zipFile.js +0 -74
- package/lib/server/utils/zones.js +0 -57
- package/lib/server/webkit/protocol.d.js +0 -16
- package/lib/server/webkit/webkit.js +0 -100
- package/lib/server/webkit/wkAccessibility.js +0 -237
- package/lib/server/webkit/wkBrowser.js +0 -312
- package/lib/server/webkit/wkConnection.js +0 -149
- package/lib/server/webkit/wkExecutionContext.js +0 -153
- package/lib/server/webkit/wkInput.js +0 -181
- package/lib/server/webkit/wkInterceptableRequest.js +0 -169
- package/lib/server/webkit/wkPage.js +0 -1114
- package/lib/server/webkit/wkProvisionalPage.js +0 -83
- package/lib/server/webkit/wkWorkers.js +0 -104
- package/lib/third_party/pixelmatch.js +0 -255
- package/lib/utils/isomorphic/ariaSnapshot.js +0 -384
- package/lib/utils/isomorphic/assert.js +0 -31
- package/lib/utils/isomorphic/builtins.js +0 -90
- package/lib/utils/isomorphic/colors.js +0 -72
- package/lib/utils/isomorphic/cssParser.js +0 -246
- package/lib/utils/isomorphic/cssTokenizer.js +0 -1051
- package/lib/utils/isomorphic/headers.js +0 -53
- package/lib/utils/isomorphic/locatorGenerators.js +0 -655
- package/lib/utils/isomorphic/locatorParser.js +0 -176
- package/lib/utils/isomorphic/locatorUtils.js +0 -81
- package/lib/utils/isomorphic/manualPromise.js +0 -115
- package/lib/utils/isomorphic/mimeType.js +0 -460
- package/lib/utils/isomorphic/multimap.js +0 -81
- package/lib/utils/isomorphic/rtti.js +0 -43
- package/lib/utils/isomorphic/selectorParser.js +0 -387
- package/lib/utils/isomorphic/semaphore.js +0 -54
- package/lib/utils/isomorphic/stackTrace.js +0 -158
- package/lib/utils/isomorphic/stringUtils.js +0 -176
- package/lib/utils/isomorphic/time.js +0 -44
- package/lib/utils/isomorphic/timeoutRunner.js +0 -67
- package/lib/utils/isomorphic/traceUtils.js +0 -59
- package/lib/utils/isomorphic/types.js +0 -16
- package/lib/utils/isomorphic/urlMatch.js +0 -167
- package/lib/utils/isomorphic/utilityScriptSerializers.js +0 -248
- package/lib/utils.js +0 -101
- package/lib/utilsBundleImpl/index.js +0 -208
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +0 -1
- package/lib/vite/recorder/assets/codeMirrorModule-DVQi6prl.js +0 -24
- package/lib/vite/recorder/assets/index-97EUAAbk.js +0 -184
- package/lib/vite/recorder/assets/index-eHBmevrY.css +0 -1
- package/lib/vite/traceViewer/assets/codeMirrorModule-DwAiTpyC.js +0 -24
- package/lib/vite/traceViewer/assets/defaultSettingsView-DkkRvn5X.js +0 -265
- package/lib/vite/traceViewer/assets/xtermModule-BoAIEibi.js +0 -9
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +0 -1
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.DvtSwn6E.js +0 -2
- package/lib/vite/traceViewer/uiMode.BatfzHMG.css +0 -1
- package/lib/vite/traceViewer/uiMode.Sdytl9wc.js +0 -5
- package/lib/vite/traceViewer/xtermModule.Beg8tuEN.css +0 -32
- package/lib/zipBundle.js +0 -34
- package/lib/zipBundleImpl.js +0 -5
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var validatorPrimitives_exports = {};
|
|
20
|
-
__export(validatorPrimitives_exports, {
|
|
21
|
-
ValidationError: () => ValidationError,
|
|
22
|
-
createMetadataValidator: () => createMetadataValidator,
|
|
23
|
-
findValidator: () => findValidator,
|
|
24
|
-
maybeFindValidator: () => maybeFindValidator,
|
|
25
|
-
scheme: () => scheme,
|
|
26
|
-
tAny: () => tAny,
|
|
27
|
-
tArray: () => tArray,
|
|
28
|
-
tBinary: () => tBinary,
|
|
29
|
-
tBoolean: () => tBoolean,
|
|
30
|
-
tChannel: () => tChannel,
|
|
31
|
-
tEnum: () => tEnum,
|
|
32
|
-
tNumber: () => tNumber,
|
|
33
|
-
tObject: () => tObject,
|
|
34
|
-
tOptional: () => tOptional,
|
|
35
|
-
tString: () => tString,
|
|
36
|
-
tType: () => tType,
|
|
37
|
-
tUndefined: () => tUndefined
|
|
38
|
-
});
|
|
39
|
-
module.exports = __toCommonJS(validatorPrimitives_exports);
|
|
40
|
-
class ValidationError extends Error {
|
|
41
|
-
}
|
|
42
|
-
const scheme = {};
|
|
43
|
-
function findValidator(type, method, kind) {
|
|
44
|
-
const validator = maybeFindValidator(type, method, kind);
|
|
45
|
-
if (!validator)
|
|
46
|
-
throw new ValidationError(`Unknown scheme for ${kind}: ${type}.${method}`);
|
|
47
|
-
return validator;
|
|
48
|
-
}
|
|
49
|
-
function maybeFindValidator(type, method, kind) {
|
|
50
|
-
const schemeName = type + (kind === "Initializer" ? "" : method[0].toUpperCase() + method.substring(1)) + kind;
|
|
51
|
-
return scheme[schemeName];
|
|
52
|
-
}
|
|
53
|
-
function createMetadataValidator() {
|
|
54
|
-
return tOptional(scheme["Metadata"]);
|
|
55
|
-
}
|
|
56
|
-
const tNumber = (arg, path, context) => {
|
|
57
|
-
if (arg instanceof Number)
|
|
58
|
-
return arg.valueOf();
|
|
59
|
-
if (typeof arg === "number")
|
|
60
|
-
return arg;
|
|
61
|
-
throw new ValidationError(`${path}: expected number, got ${typeof arg}`);
|
|
62
|
-
};
|
|
63
|
-
const tBoolean = (arg, path, context) => {
|
|
64
|
-
if (arg instanceof Boolean)
|
|
65
|
-
return arg.valueOf();
|
|
66
|
-
if (typeof arg === "boolean")
|
|
67
|
-
return arg;
|
|
68
|
-
throw new ValidationError(`${path}: expected boolean, got ${typeof arg}`);
|
|
69
|
-
};
|
|
70
|
-
const tString = (arg, path, context) => {
|
|
71
|
-
if (arg instanceof String)
|
|
72
|
-
return arg.valueOf();
|
|
73
|
-
if (typeof arg === "string")
|
|
74
|
-
return arg;
|
|
75
|
-
throw new ValidationError(`${path}: expected string, got ${typeof arg}`);
|
|
76
|
-
};
|
|
77
|
-
const tBinary = (arg, path, context) => {
|
|
78
|
-
if (context.binary === "fromBase64") {
|
|
79
|
-
if (arg instanceof String)
|
|
80
|
-
return Buffer.from(arg.valueOf(), "base64");
|
|
81
|
-
if (typeof arg === "string")
|
|
82
|
-
return Buffer.from(arg, "base64");
|
|
83
|
-
throw new ValidationError(`${path}: expected base64-encoded buffer, got ${typeof arg}`);
|
|
84
|
-
}
|
|
85
|
-
if (context.binary === "toBase64") {
|
|
86
|
-
if (!(arg instanceof Buffer))
|
|
87
|
-
throw new ValidationError(`${path}: expected Buffer, got ${typeof arg}`);
|
|
88
|
-
return arg.toString("base64");
|
|
89
|
-
}
|
|
90
|
-
if (context.binary === "buffer") {
|
|
91
|
-
if (!(arg instanceof Buffer))
|
|
92
|
-
throw new ValidationError(`${path}: expected Buffer, got ${typeof arg}`);
|
|
93
|
-
return arg;
|
|
94
|
-
}
|
|
95
|
-
throw new ValidationError(`Unsupported binary behavior "${context.binary}"`);
|
|
96
|
-
};
|
|
97
|
-
const tUndefined = (arg, path, context) => {
|
|
98
|
-
if (Object.is(arg, void 0))
|
|
99
|
-
return arg;
|
|
100
|
-
throw new ValidationError(`${path}: expected undefined, got ${typeof arg}`);
|
|
101
|
-
};
|
|
102
|
-
const tAny = (arg, path, context) => {
|
|
103
|
-
return arg;
|
|
104
|
-
};
|
|
105
|
-
const tOptional = (v) => {
|
|
106
|
-
return (arg, path, context) => {
|
|
107
|
-
if (Object.is(arg, void 0))
|
|
108
|
-
return arg;
|
|
109
|
-
return v(arg, path, context);
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
const tArray = (v) => {
|
|
113
|
-
return (arg, path, context) => {
|
|
114
|
-
if (!Array.isArray(arg))
|
|
115
|
-
throw new ValidationError(`${path}: expected array, got ${typeof arg}`);
|
|
116
|
-
return arg.map((x, index) => v(x, path + "[" + index + "]", context));
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
const tObject = (s) => {
|
|
120
|
-
return (arg, path, context) => {
|
|
121
|
-
if (Object.is(arg, null))
|
|
122
|
-
throw new ValidationError(`${path}: expected object, got null`);
|
|
123
|
-
if (typeof arg !== "object")
|
|
124
|
-
throw new ValidationError(`${path}: expected object, got ${typeof arg}`);
|
|
125
|
-
const result = {};
|
|
126
|
-
for (const [key, v] of Object.entries(s)) {
|
|
127
|
-
const value = v(arg[key], path ? path + "." + key : key, context);
|
|
128
|
-
if (!Object.is(value, void 0))
|
|
129
|
-
result[key] = value;
|
|
130
|
-
}
|
|
131
|
-
if (context.isUnderTest()) {
|
|
132
|
-
for (const [key, value] of Object.entries(arg)) {
|
|
133
|
-
if (key.startsWith("__testHook"))
|
|
134
|
-
result[key] = value;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return result;
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
const tEnum = (e) => {
|
|
141
|
-
return (arg, path, context) => {
|
|
142
|
-
if (!e.includes(arg))
|
|
143
|
-
throw new ValidationError(`${path}: expected one of (${e.join("|")})`);
|
|
144
|
-
return arg;
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
const tChannel = (names) => {
|
|
148
|
-
return (arg, path, context) => {
|
|
149
|
-
return context.tChannelImpl(names, arg, path, context);
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
const tType = (name) => {
|
|
153
|
-
return (arg, path, context) => {
|
|
154
|
-
const v = scheme[name];
|
|
155
|
-
if (!v)
|
|
156
|
-
throw new ValidationError(path + ': unknown type "' + name + '"');
|
|
157
|
-
return v(arg, path, context);
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
161
|
-
0 && (module.exports = {
|
|
162
|
-
ValidationError,
|
|
163
|
-
createMetadataValidator,
|
|
164
|
-
findValidator,
|
|
165
|
-
maybeFindValidator,
|
|
166
|
-
scheme,
|
|
167
|
-
tAny,
|
|
168
|
-
tArray,
|
|
169
|
-
tBinary,
|
|
170
|
-
tBoolean,
|
|
171
|
-
tChannel,
|
|
172
|
-
tEnum,
|
|
173
|
-
tNumber,
|
|
174
|
-
tObject,
|
|
175
|
-
tOptional,
|
|
176
|
-
tString,
|
|
177
|
-
tType,
|
|
178
|
-
tUndefined
|
|
179
|
-
});
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var playwrightConnection_exports = {};
|
|
20
|
-
__export(playwrightConnection_exports, {
|
|
21
|
-
PlaywrightConnection: () => PlaywrightConnection
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(playwrightConnection_exports);
|
|
24
|
-
var import_socksProxy = require("../server/utils/socksProxy");
|
|
25
|
-
var import_server = require("../server");
|
|
26
|
-
var import_android = require("../server/android/android");
|
|
27
|
-
var import_browser = require("../server/browser");
|
|
28
|
-
var import_debugControllerDispatcher = require("../server/dispatchers/debugControllerDispatcher");
|
|
29
|
-
var import_instrumentation = require("../server/instrumentation");
|
|
30
|
-
var import_assert = require("../utils/isomorphic/assert");
|
|
31
|
-
var import_debug = require("../server/utils/debug");
|
|
32
|
-
var import_profiler = require("../server/utils/profiler");
|
|
33
|
-
var import_utils = require("../utils");
|
|
34
|
-
var import_debugLogger = require("../server/utils/debugLogger");
|
|
35
|
-
class PlaywrightConnection {
|
|
36
|
-
constructor(lock, clientType, ws, options, preLaunched, id, onClose) {
|
|
37
|
-
this._cleanups = [];
|
|
38
|
-
this._disconnected = false;
|
|
39
|
-
this._ws = ws;
|
|
40
|
-
this._preLaunched = preLaunched;
|
|
41
|
-
this._options = options;
|
|
42
|
-
options.launchOptions = filterLaunchOptions(options.launchOptions, options.allowFSPaths);
|
|
43
|
-
if (clientType === "reuse-browser" || clientType === "pre-launched-browser-or-android")
|
|
44
|
-
(0, import_assert.assert)(preLaunched.playwright);
|
|
45
|
-
if (clientType === "pre-launched-browser-or-android")
|
|
46
|
-
(0, import_assert.assert)(preLaunched.browser || preLaunched.androidDevice);
|
|
47
|
-
this._onClose = onClose;
|
|
48
|
-
this._id = id;
|
|
49
|
-
this._profileName = `${(/* @__PURE__ */ new Date()).toISOString()}-${clientType}`;
|
|
50
|
-
this._dispatcherConnection = new import_server.DispatcherConnection();
|
|
51
|
-
this._dispatcherConnection.onmessage = async (message) => {
|
|
52
|
-
await lock;
|
|
53
|
-
if (ws.readyState !== ws.CLOSING) {
|
|
54
|
-
const messageString = JSON.stringify(message);
|
|
55
|
-
if (import_debugLogger.debugLogger.isEnabled("server:channel"))
|
|
56
|
-
import_debugLogger.debugLogger.log("server:channel", `[${this._id}] ${(0, import_utils.monotonicTime)() * 1e3} SEND \u25BA ${messageString}`);
|
|
57
|
-
if (import_debugLogger.debugLogger.isEnabled("server:metadata"))
|
|
58
|
-
this.logServerMetadata(message, messageString, "SEND");
|
|
59
|
-
ws.send(messageString);
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
ws.on("message", async (message) => {
|
|
63
|
-
await lock;
|
|
64
|
-
const messageString = Buffer.from(message).toString();
|
|
65
|
-
const jsonMessage = JSON.parse(messageString);
|
|
66
|
-
if (import_debugLogger.debugLogger.isEnabled("server:channel"))
|
|
67
|
-
import_debugLogger.debugLogger.log("server:channel", `[${this._id}] ${(0, import_utils.monotonicTime)() * 1e3} \u25C0 RECV ${messageString}`);
|
|
68
|
-
if (import_debugLogger.debugLogger.isEnabled("server:metadata"))
|
|
69
|
-
this.logServerMetadata(jsonMessage, messageString, "RECV");
|
|
70
|
-
this._dispatcherConnection.dispatch(jsonMessage);
|
|
71
|
-
});
|
|
72
|
-
ws.on("close", () => this._onDisconnect());
|
|
73
|
-
ws.on("error", (error) => this._onDisconnect(error));
|
|
74
|
-
if (clientType === "controller") {
|
|
75
|
-
this._root = this._initDebugControllerMode();
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
this._root = new import_server.RootDispatcher(this._dispatcherConnection, async (scope, options2) => {
|
|
79
|
-
await (0, import_profiler.startProfiling)();
|
|
80
|
-
if (clientType === "reuse-browser")
|
|
81
|
-
return await this._initReuseBrowsersMode(scope);
|
|
82
|
-
if (clientType === "pre-launched-browser-or-android")
|
|
83
|
-
return this._preLaunched.browser ? await this._initPreLaunchedBrowserMode(scope) : await this._initPreLaunchedAndroidMode(scope);
|
|
84
|
-
if (clientType === "launch-browser")
|
|
85
|
-
return await this._initLaunchBrowserMode(scope, options2);
|
|
86
|
-
throw new Error("Unsupported client type: " + clientType);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
async _initLaunchBrowserMode(scope, options) {
|
|
90
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] engaged launch mode for "${this._options.browserName}"`);
|
|
91
|
-
const playwright = (0, import_server.createPlaywright)({ sdkLanguage: options.sdkLanguage, isServer: true });
|
|
92
|
-
const ownedSocksProxy = await this._createOwnedSocksProxy(playwright);
|
|
93
|
-
let browserName = this._options.browserName;
|
|
94
|
-
if ("bidi" === browserName) {
|
|
95
|
-
if (this._options.launchOptions?.channel?.toLocaleLowerCase().includes("firefox"))
|
|
96
|
-
browserName = "bidiFirefox";
|
|
97
|
-
else
|
|
98
|
-
browserName = "bidiChromium";
|
|
99
|
-
}
|
|
100
|
-
const browser = await playwright[browserName].launch((0, import_instrumentation.serverSideCallMetadata)(), this._options.launchOptions);
|
|
101
|
-
this._cleanups.push(async () => {
|
|
102
|
-
for (const browser2 of playwright.allBrowsers())
|
|
103
|
-
await browser2.close({ reason: "Connection terminated" });
|
|
104
|
-
});
|
|
105
|
-
browser.on(import_browser.Browser.Events.Disconnected, () => {
|
|
106
|
-
this.close({ code: 1001, reason: "Browser closed" });
|
|
107
|
-
});
|
|
108
|
-
return new import_server.PlaywrightDispatcher(scope, playwright, ownedSocksProxy, browser);
|
|
109
|
-
}
|
|
110
|
-
async _initPreLaunchedBrowserMode(scope) {
|
|
111
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] engaged pre-launched (browser) mode`);
|
|
112
|
-
const playwright = this._preLaunched.playwright;
|
|
113
|
-
this._preLaunched.socksProxy?.setPattern(this._options.socksProxyPattern);
|
|
114
|
-
const browser = this._preLaunched.browser;
|
|
115
|
-
browser.on(import_browser.Browser.Events.Disconnected, () => {
|
|
116
|
-
this.close({ code: 1001, reason: "Browser closed" });
|
|
117
|
-
});
|
|
118
|
-
const playwrightDispatcher = new import_server.PlaywrightDispatcher(scope, playwright, this._preLaunched.socksProxy, browser);
|
|
119
|
-
for (const b of playwright.allBrowsers()) {
|
|
120
|
-
if (b !== browser)
|
|
121
|
-
await b.close({ reason: "Connection terminated" });
|
|
122
|
-
}
|
|
123
|
-
this._cleanups.push(() => playwrightDispatcher.cleanup());
|
|
124
|
-
return playwrightDispatcher;
|
|
125
|
-
}
|
|
126
|
-
async _initPreLaunchedAndroidMode(scope) {
|
|
127
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] engaged pre-launched (Android) mode`);
|
|
128
|
-
const playwright = this._preLaunched.playwright;
|
|
129
|
-
const androidDevice = this._preLaunched.androidDevice;
|
|
130
|
-
androidDevice.on(import_android.AndroidDevice.Events.Close, () => {
|
|
131
|
-
this.close({ code: 1001, reason: "Android device disconnected" });
|
|
132
|
-
});
|
|
133
|
-
const playwrightDispatcher = new import_server.PlaywrightDispatcher(scope, playwright, void 0, void 0, androidDevice);
|
|
134
|
-
this._cleanups.push(() => playwrightDispatcher.cleanup());
|
|
135
|
-
return playwrightDispatcher;
|
|
136
|
-
}
|
|
137
|
-
_initDebugControllerMode() {
|
|
138
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] engaged reuse controller mode`);
|
|
139
|
-
const playwright = this._preLaunched.playwright;
|
|
140
|
-
return new import_debugControllerDispatcher.DebugControllerDispatcher(this._dispatcherConnection, playwright.debugController);
|
|
141
|
-
}
|
|
142
|
-
async _initReuseBrowsersMode(scope) {
|
|
143
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] engaged reuse browsers mode for ${this._options.browserName}`);
|
|
144
|
-
const playwright = this._preLaunched.playwright;
|
|
145
|
-
const requestedOptions = launchOptionsHash(this._options.launchOptions);
|
|
146
|
-
let browser = playwright.allBrowsers().find((b) => {
|
|
147
|
-
if (b.options.name !== this._options.browserName)
|
|
148
|
-
return false;
|
|
149
|
-
const existingOptions = launchOptionsHash(b.options.originalLaunchOptions);
|
|
150
|
-
return existingOptions === requestedOptions;
|
|
151
|
-
});
|
|
152
|
-
for (const b of playwright.allBrowsers()) {
|
|
153
|
-
if (b === browser)
|
|
154
|
-
continue;
|
|
155
|
-
if (b.options.name === this._options.browserName && b.options.channel === this._options.launchOptions.channel)
|
|
156
|
-
await b.close({ reason: "Connection terminated" });
|
|
157
|
-
}
|
|
158
|
-
if (!browser) {
|
|
159
|
-
browser = await playwright[this._options.browserName || "chromium"].launch((0, import_instrumentation.serverSideCallMetadata)(), {
|
|
160
|
-
...this._options.launchOptions,
|
|
161
|
-
headless: !!process.env.PW_DEBUG_CONTROLLER_HEADLESS
|
|
162
|
-
});
|
|
163
|
-
browser.on(import_browser.Browser.Events.Disconnected, () => {
|
|
164
|
-
this.close({ code: 1001, reason: "Browser closed" });
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
this._cleanups.push(async () => {
|
|
168
|
-
for (const browser2 of playwright.allBrowsers()) {
|
|
169
|
-
for (const context of browser2.contexts()) {
|
|
170
|
-
if (!context.pages().length)
|
|
171
|
-
await context.close({ reason: "Connection terminated" });
|
|
172
|
-
else
|
|
173
|
-
await context.stopPendingOperations("Connection closed");
|
|
174
|
-
}
|
|
175
|
-
if (!browser2.contexts())
|
|
176
|
-
await browser2.close({ reason: "Connection terminated" });
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
const playwrightDispatcher = new import_server.PlaywrightDispatcher(scope, playwright, void 0, browser);
|
|
180
|
-
return playwrightDispatcher;
|
|
181
|
-
}
|
|
182
|
-
async _createOwnedSocksProxy(playwright) {
|
|
183
|
-
if (!this._options.socksProxyPattern)
|
|
184
|
-
return;
|
|
185
|
-
const socksProxy = new import_socksProxy.SocksProxy();
|
|
186
|
-
socksProxy.setPattern(this._options.socksProxyPattern);
|
|
187
|
-
playwright.options.socksProxyPort = await socksProxy.listen(0);
|
|
188
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] started socks proxy on port ${playwright.options.socksProxyPort}`);
|
|
189
|
-
this._cleanups.push(() => socksProxy.close());
|
|
190
|
-
return socksProxy;
|
|
191
|
-
}
|
|
192
|
-
async _onDisconnect(error) {
|
|
193
|
-
this._disconnected = true;
|
|
194
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] disconnected. error: ${error}`);
|
|
195
|
-
this._root._dispose();
|
|
196
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] starting cleanup`);
|
|
197
|
-
for (const cleanup of this._cleanups)
|
|
198
|
-
await cleanup().catch(() => {
|
|
199
|
-
});
|
|
200
|
-
await (0, import_profiler.stopProfiling)(this._profileName);
|
|
201
|
-
this._onClose();
|
|
202
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] finished cleanup`);
|
|
203
|
-
}
|
|
204
|
-
logServerMetadata(message, messageString, direction) {
|
|
205
|
-
const serverLogMetadata = {
|
|
206
|
-
wallTime: Date.now(),
|
|
207
|
-
id: message.id,
|
|
208
|
-
guid: message.guid,
|
|
209
|
-
method: message.method,
|
|
210
|
-
payloadSizeInBytes: Buffer.byteLength(messageString, "utf-8")
|
|
211
|
-
};
|
|
212
|
-
import_debugLogger.debugLogger.log("server:metadata", (direction === "SEND" ? "SEND \u25BA " : "\u25C0 RECV ") + JSON.stringify(serverLogMetadata));
|
|
213
|
-
}
|
|
214
|
-
async close(reason) {
|
|
215
|
-
if (this._disconnected)
|
|
216
|
-
return;
|
|
217
|
-
import_debugLogger.debugLogger.log("server", `[${this._id}] force closing connection: ${reason?.reason || ""} (${reason?.code || 0})`);
|
|
218
|
-
try {
|
|
219
|
-
this._ws.close(reason?.code, reason?.reason);
|
|
220
|
-
} catch (e) {
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
function launchOptionsHash(options) {
|
|
225
|
-
const copy = { ...options };
|
|
226
|
-
for (const k of Object.keys(copy)) {
|
|
227
|
-
const key = k;
|
|
228
|
-
if (copy[key] === defaultLaunchOptions[key])
|
|
229
|
-
delete copy[key];
|
|
230
|
-
}
|
|
231
|
-
for (const key of optionsThatAllowBrowserReuse)
|
|
232
|
-
delete copy[key];
|
|
233
|
-
return JSON.stringify(copy);
|
|
234
|
-
}
|
|
235
|
-
function filterLaunchOptions(options, allowFSPaths) {
|
|
236
|
-
return {
|
|
237
|
-
channel: options.channel,
|
|
238
|
-
args: options.args,
|
|
239
|
-
ignoreAllDefaultArgs: options.ignoreAllDefaultArgs,
|
|
240
|
-
ignoreDefaultArgs: options.ignoreDefaultArgs,
|
|
241
|
-
timeout: options.timeout,
|
|
242
|
-
headless: options.headless,
|
|
243
|
-
proxy: options.proxy,
|
|
244
|
-
chromiumSandbox: options.chromiumSandbox,
|
|
245
|
-
firefoxUserPrefs: options.firefoxUserPrefs,
|
|
246
|
-
slowMo: options.slowMo,
|
|
247
|
-
executablePath: (0, import_debug.isUnderTest)() || allowFSPaths ? options.executablePath : void 0,
|
|
248
|
-
downloadsPath: allowFSPaths ? options.downloadsPath : void 0
|
|
249
|
-
};
|
|
250
|
-
}
|
|
251
|
-
const defaultLaunchOptions = {
|
|
252
|
-
ignoreAllDefaultArgs: false,
|
|
253
|
-
handleSIGINT: false,
|
|
254
|
-
handleSIGTERM: false,
|
|
255
|
-
handleSIGHUP: false,
|
|
256
|
-
headless: true,
|
|
257
|
-
devtools: false
|
|
258
|
-
};
|
|
259
|
-
const optionsThatAllowBrowserReuse = [
|
|
260
|
-
"headless",
|
|
261
|
-
"tracesDir"
|
|
262
|
-
];
|
|
263
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
264
|
-
0 && (module.exports = {
|
|
265
|
-
PlaywrightConnection
|
|
266
|
-
});
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var playwrightServer_exports = {};
|
|
20
|
-
__export(playwrightServer_exports, {
|
|
21
|
-
PlaywrightServer: () => PlaywrightServer
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(playwrightServer_exports);
|
|
24
|
-
var import_playwrightConnection = require("./playwrightConnection");
|
|
25
|
-
var import_playwright = require("../server/playwright");
|
|
26
|
-
var import_debugLogger = require("../server/utils/debugLogger");
|
|
27
|
-
var import_semaphore = require("../utils/isomorphic/semaphore");
|
|
28
|
-
var import_wsServer = require("../server/utils/wsServer");
|
|
29
|
-
var import_ascii = require("../server/utils/ascii");
|
|
30
|
-
var import_userAgent = require("../server/utils/userAgent");
|
|
31
|
-
class PlaywrightServer {
|
|
32
|
-
constructor(options) {
|
|
33
|
-
this._options = options;
|
|
34
|
-
if (options.preLaunchedBrowser)
|
|
35
|
-
this._preLaunchedPlaywright = options.preLaunchedBrowser.attribution.playwright;
|
|
36
|
-
if (options.preLaunchedAndroidDevice)
|
|
37
|
-
this._preLaunchedPlaywright = options.preLaunchedAndroidDevice._android.attribution.playwright;
|
|
38
|
-
const browserSemaphore = new import_semaphore.Semaphore(this._options.maxConnections);
|
|
39
|
-
const controllerSemaphore = new import_semaphore.Semaphore(1);
|
|
40
|
-
const reuseBrowserSemaphore = new import_semaphore.Semaphore(1);
|
|
41
|
-
this._wsServer = new import_wsServer.WSServer({
|
|
42
|
-
onUpgrade: (request, socket) => {
|
|
43
|
-
const uaError = userAgentVersionMatchesErrorMessage(request.headers["user-agent"] || "");
|
|
44
|
-
if (uaError)
|
|
45
|
-
return { error: `HTTP/${request.httpVersion} 428 Precondition Required\r
|
|
46
|
-
\r
|
|
47
|
-
${uaError}` };
|
|
48
|
-
},
|
|
49
|
-
onHeaders: (headers) => {
|
|
50
|
-
if (process.env.PWTEST_SERVER_WS_HEADERS)
|
|
51
|
-
headers.push(process.env.PWTEST_SERVER_WS_HEADERS);
|
|
52
|
-
},
|
|
53
|
-
onConnection: (request, url, ws, id) => {
|
|
54
|
-
const browserHeader = request.headers["x-playwright-browser"];
|
|
55
|
-
const browserName = url.searchParams.get("browser") || (Array.isArray(browserHeader) ? browserHeader[0] : browserHeader) || null;
|
|
56
|
-
const proxyHeader = request.headers["x-playwright-proxy"];
|
|
57
|
-
const proxyValue = url.searchParams.get("proxy") || (Array.isArray(proxyHeader) ? proxyHeader[0] : proxyHeader);
|
|
58
|
-
const launchOptionsHeader = request.headers["x-playwright-launch-options"] || "";
|
|
59
|
-
const launchOptionsHeaderValue = Array.isArray(launchOptionsHeader) ? launchOptionsHeader[0] : launchOptionsHeader;
|
|
60
|
-
const launchOptionsParam = url.searchParams.get("launch-options");
|
|
61
|
-
let launchOptions = {};
|
|
62
|
-
try {
|
|
63
|
-
launchOptions = JSON.parse(launchOptionsParam || launchOptionsHeaderValue);
|
|
64
|
-
} catch (e) {
|
|
65
|
-
}
|
|
66
|
-
const isExtension = this._options.mode === "extension";
|
|
67
|
-
if (isExtension) {
|
|
68
|
-
if (!this._preLaunchedPlaywright)
|
|
69
|
-
this._preLaunchedPlaywright = (0, import_playwright.createPlaywright)({ sdkLanguage: "javascript", isServer: true });
|
|
70
|
-
}
|
|
71
|
-
let clientType = "launch-browser";
|
|
72
|
-
let semaphore = browserSemaphore;
|
|
73
|
-
if (isExtension && url.searchParams.has("debug-controller")) {
|
|
74
|
-
clientType = "controller";
|
|
75
|
-
semaphore = controllerSemaphore;
|
|
76
|
-
} else if (isExtension) {
|
|
77
|
-
clientType = "reuse-browser";
|
|
78
|
-
semaphore = reuseBrowserSemaphore;
|
|
79
|
-
} else if (this._options.mode === "launchServer") {
|
|
80
|
-
clientType = "pre-launched-browser-or-android";
|
|
81
|
-
semaphore = browserSemaphore;
|
|
82
|
-
}
|
|
83
|
-
return new import_playwrightConnection.PlaywrightConnection(
|
|
84
|
-
semaphore.acquire(),
|
|
85
|
-
clientType,
|
|
86
|
-
ws,
|
|
87
|
-
{ socksProxyPattern: proxyValue, browserName, launchOptions, allowFSPaths: this._options.mode === "extension" },
|
|
88
|
-
{
|
|
89
|
-
playwright: this._preLaunchedPlaywright,
|
|
90
|
-
browser: this._options.preLaunchedBrowser,
|
|
91
|
-
androidDevice: this._options.preLaunchedAndroidDevice,
|
|
92
|
-
socksProxy: this._options.preLaunchedSocksProxy
|
|
93
|
-
},
|
|
94
|
-
id,
|
|
95
|
-
() => semaphore.release()
|
|
96
|
-
);
|
|
97
|
-
},
|
|
98
|
-
onClose: async () => {
|
|
99
|
-
import_debugLogger.debugLogger.log("server", "closing browsers");
|
|
100
|
-
if (this._preLaunchedPlaywright)
|
|
101
|
-
await Promise.all(this._preLaunchedPlaywright.allBrowsers().map((browser) => browser.close({ reason: "Playwright Server stopped" })));
|
|
102
|
-
import_debugLogger.debugLogger.log("server", "closed browsers");
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
async listen(port = 0, hostname) {
|
|
107
|
-
return this._wsServer.listen(port, hostname, this._options.path);
|
|
108
|
-
}
|
|
109
|
-
async close() {
|
|
110
|
-
await this._wsServer.close();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
function userAgentVersionMatchesErrorMessage(userAgent) {
|
|
114
|
-
const match = userAgent.match(/^Playwright\/(\d+\.\d+\.\d+)/);
|
|
115
|
-
if (!match) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
const received = match[1].split(".").slice(0, 2).join(".");
|
|
119
|
-
const expected = (0, import_userAgent.getPlaywrightVersion)(true);
|
|
120
|
-
if (received !== expected) {
|
|
121
|
-
return (0, import_ascii.wrapInASCIIBox)([
|
|
122
|
-
`Playwright version mismatch:`,
|
|
123
|
-
` - server version: v${expected}`,
|
|
124
|
-
` - client version: v${received}`,
|
|
125
|
-
``,
|
|
126
|
-
`If you are using VSCode extension, restart VSCode.`,
|
|
127
|
-
``,
|
|
128
|
-
`If you are connecting to a remote service,`,
|
|
129
|
-
`keep your local Playwright version in sync`,
|
|
130
|
-
`with the remote service version.`,
|
|
131
|
-
``,
|
|
132
|
-
`<3 Playwright Team`
|
|
133
|
-
].join("\n"), 1);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
137
|
-
0 && (module.exports = {
|
|
138
|
-
PlaywrightServer
|
|
139
|
-
});
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var accessibility_exports = {};
|
|
20
|
-
__export(accessibility_exports, {
|
|
21
|
-
Accessibility: () => Accessibility
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(accessibility_exports);
|
|
24
|
-
class Accessibility {
|
|
25
|
-
constructor(getAXTree) {
|
|
26
|
-
this._getAXTree = getAXTree;
|
|
27
|
-
}
|
|
28
|
-
async snapshot(options = {}) {
|
|
29
|
-
const {
|
|
30
|
-
interestingOnly = true,
|
|
31
|
-
root = null
|
|
32
|
-
} = options;
|
|
33
|
-
const { tree, needle } = await this._getAXTree(root || void 0);
|
|
34
|
-
if (!interestingOnly) {
|
|
35
|
-
if (root)
|
|
36
|
-
return needle && serializeTree(needle)[0];
|
|
37
|
-
return serializeTree(tree)[0];
|
|
38
|
-
}
|
|
39
|
-
const interestingNodes = /* @__PURE__ */ new Set();
|
|
40
|
-
collectInterestingNodes(interestingNodes, tree, false);
|
|
41
|
-
if (root && (!needle || !interestingNodes.has(needle)))
|
|
42
|
-
return null;
|
|
43
|
-
return serializeTree(needle || tree, interestingNodes)[0];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function collectInterestingNodes(collection, node, insideControl) {
|
|
47
|
-
if (node.isInteresting(insideControl))
|
|
48
|
-
collection.add(node);
|
|
49
|
-
if (node.isLeafNode())
|
|
50
|
-
return;
|
|
51
|
-
insideControl = insideControl || node.isControl();
|
|
52
|
-
for (const child of node.children())
|
|
53
|
-
collectInterestingNodes(collection, child, insideControl);
|
|
54
|
-
}
|
|
55
|
-
function serializeTree(node, whitelistedNodes) {
|
|
56
|
-
const children = [];
|
|
57
|
-
for (const child of node.children())
|
|
58
|
-
children.push(...serializeTree(child, whitelistedNodes));
|
|
59
|
-
if (whitelistedNodes && !whitelistedNodes.has(node))
|
|
60
|
-
return children;
|
|
61
|
-
const serializedNode = node.serialize();
|
|
62
|
-
if (children.length)
|
|
63
|
-
serializedNode.children = children;
|
|
64
|
-
return [serializedNode];
|
|
65
|
-
}
|
|
66
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
-
0 && (module.exports = {
|
|
68
|
-
Accessibility
|
|
69
|
-
});
|