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,321 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var socksClientCertificatesInterceptor_exports = {};
|
|
30
|
-
__export(socksClientCertificatesInterceptor_exports, {
|
|
31
|
-
ClientCertificatesProxy: () => ClientCertificatesProxy,
|
|
32
|
-
getMatchingTLSOptionsForOrigin: () => getMatchingTLSOptionsForOrigin,
|
|
33
|
-
rewriteOpenSSLErrorIfNeeded: () => rewriteOpenSSLErrorIfNeeded
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(socksClientCertificatesInterceptor_exports);
|
|
36
|
-
var import_events = require("events");
|
|
37
|
-
var import_http2 = __toESM(require("http2"));
|
|
38
|
-
var import_net = __toESM(require("net"));
|
|
39
|
-
var import_stream = __toESM(require("stream"));
|
|
40
|
-
var import_tls = __toESM(require("tls"));
|
|
41
|
-
var import_socksProxy = require("./utils/socksProxy");
|
|
42
|
-
var import_utils = require("../utils");
|
|
43
|
-
var import_browserContext = require("./browserContext");
|
|
44
|
-
var import_network = require("./utils/network");
|
|
45
|
-
var import_debugLogger = require("./utils/debugLogger");
|
|
46
|
-
var import_happyEyeballs = require("./utils/happyEyeballs");
|
|
47
|
-
let dummyServerTlsOptions = void 0;
|
|
48
|
-
function loadDummyServerCertsIfNeeded() {
|
|
49
|
-
if (dummyServerTlsOptions)
|
|
50
|
-
return;
|
|
51
|
-
const { cert, key } = (0, import_utils.generateSelfSignedCertificate)();
|
|
52
|
-
dummyServerTlsOptions = { key, cert };
|
|
53
|
-
}
|
|
54
|
-
class ALPNCache {
|
|
55
|
-
constructor() {
|
|
56
|
-
this._cache = /* @__PURE__ */ new Map();
|
|
57
|
-
}
|
|
58
|
-
get(host, port, success) {
|
|
59
|
-
const cacheKey = `${host}:${port}`;
|
|
60
|
-
{
|
|
61
|
-
const result2 = this._cache.get(cacheKey);
|
|
62
|
-
if (result2) {
|
|
63
|
-
result2.then(success);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const result = new import_utils.ManualPromise();
|
|
68
|
-
this._cache.set(cacheKey, result);
|
|
69
|
-
result.then(success);
|
|
70
|
-
(0, import_happyEyeballs.createTLSSocket)({
|
|
71
|
-
host,
|
|
72
|
-
port,
|
|
73
|
-
servername: import_net.default.isIP(host) ? void 0 : host,
|
|
74
|
-
ALPNProtocols: ["h2", "http/1.1"],
|
|
75
|
-
rejectUnauthorized: false
|
|
76
|
-
}).then((socket) => {
|
|
77
|
-
result.resolve(socket.alpnProtocol || "http/1.1");
|
|
78
|
-
socket.end();
|
|
79
|
-
}).catch((error) => {
|
|
80
|
-
import_debugLogger.debugLogger.log("client-certificates", `ALPN error: ${error.message}`);
|
|
81
|
-
result.resolve("http/1.1");
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
class SocksProxyConnection {
|
|
86
|
-
constructor(socksProxy, uid, host, port) {
|
|
87
|
-
this.firstPackageReceived = false;
|
|
88
|
-
this._closed = false;
|
|
89
|
-
this.socksProxy = socksProxy;
|
|
90
|
-
this.uid = uid;
|
|
91
|
-
this.host = host;
|
|
92
|
-
this.port = port;
|
|
93
|
-
this._targetCloseEventListener = () => {
|
|
94
|
-
this.socksProxy._socksProxy.sendSocketEnd({ uid: this.uid });
|
|
95
|
-
this.internalTLS?.destroy();
|
|
96
|
-
this._dummyServer?.close();
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
async connect() {
|
|
100
|
-
if (this.socksProxy.proxyAgentFromOptions)
|
|
101
|
-
this.target = await this.socksProxy.proxyAgentFromOptions.callback(new import_events.EventEmitter(), { host: rewriteToLocalhostIfNeeded(this.host), port: this.port, secureEndpoint: false });
|
|
102
|
-
else
|
|
103
|
-
this.target = await (0, import_happyEyeballs.createSocket)(rewriteToLocalhostIfNeeded(this.host), this.port);
|
|
104
|
-
this.target.once("close", this._targetCloseEventListener);
|
|
105
|
-
this.target.once("error", (error) => this.socksProxy._socksProxy.sendSocketError({ uid: this.uid, error: error.message }));
|
|
106
|
-
if (this._closed) {
|
|
107
|
-
this.target.destroy();
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this.socksProxy._socksProxy.socketConnected({
|
|
111
|
-
uid: this.uid,
|
|
112
|
-
host: this.target.localAddress,
|
|
113
|
-
port: this.target.localPort
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
onClose() {
|
|
117
|
-
this.target.destroy();
|
|
118
|
-
this.internalTLS?.destroy();
|
|
119
|
-
this._dummyServer?.close();
|
|
120
|
-
this._closed = true;
|
|
121
|
-
}
|
|
122
|
-
onData(data) {
|
|
123
|
-
if (!this.firstPackageReceived) {
|
|
124
|
-
this.firstPackageReceived = true;
|
|
125
|
-
if (data[0] === 22)
|
|
126
|
-
this._attachTLSListeners();
|
|
127
|
-
else
|
|
128
|
-
this.target.on("data", (data2) => this.socksProxy._socksProxy.sendSocketData({ uid: this.uid, data: data2 }));
|
|
129
|
-
}
|
|
130
|
-
if (this.internal)
|
|
131
|
-
this.internal.push(data);
|
|
132
|
-
else
|
|
133
|
-
this.target.write(data);
|
|
134
|
-
}
|
|
135
|
-
_attachTLSListeners() {
|
|
136
|
-
this.internal = new import_stream.default.Duplex({
|
|
137
|
-
read: () => {
|
|
138
|
-
},
|
|
139
|
-
write: (data, encoding, callback) => {
|
|
140
|
-
this.socksProxy._socksProxy.sendSocketData({ uid: this.uid, data });
|
|
141
|
-
callback();
|
|
142
|
-
}
|
|
143
|
-
});
|
|
144
|
-
this.socksProxy.alpnCache.get(rewriteToLocalhostIfNeeded(this.host), this.port, (alpnProtocolChosenByServer) => {
|
|
145
|
-
import_debugLogger.debugLogger.log("client-certificates", `Proxy->Target ${this.host}:${this.port} chooses ALPN ${alpnProtocolChosenByServer}`);
|
|
146
|
-
if (this._closed)
|
|
147
|
-
return;
|
|
148
|
-
this._dummyServer = import_tls.default.createServer({
|
|
149
|
-
...dummyServerTlsOptions,
|
|
150
|
-
ALPNProtocols: alpnProtocolChosenByServer === "h2" ? ["h2", "http/1.1"] : ["http/1.1"]
|
|
151
|
-
});
|
|
152
|
-
this._dummyServer.emit("connection", this.internal);
|
|
153
|
-
this._dummyServer.once("secureConnection", (internalTLS) => {
|
|
154
|
-
this.internalTLS = internalTLS;
|
|
155
|
-
import_debugLogger.debugLogger.log("client-certificates", `Browser->Proxy ${this.host}:${this.port} chooses ALPN ${internalTLS.alpnProtocol}`);
|
|
156
|
-
let targetTLS = void 0;
|
|
157
|
-
const handleError = (error) => {
|
|
158
|
-
import_debugLogger.debugLogger.log("client-certificates", `error when connecting to target: ${error.message.replaceAll("\n", " ")}`);
|
|
159
|
-
const responseBody = (0, import_utils.escapeHTML)("Playwright client-certificate error: " + error.message).replaceAll("\n", " <br>");
|
|
160
|
-
if (internalTLS?.alpnProtocol === "h2") {
|
|
161
|
-
if ("performServerHandshake" in import_http2.default) {
|
|
162
|
-
this.target.removeListener("close", this._targetCloseEventListener);
|
|
163
|
-
const session = import_http2.default.performServerHandshake(internalTLS);
|
|
164
|
-
session.on("error", () => {
|
|
165
|
-
this.target.destroy();
|
|
166
|
-
this._targetCloseEventListener();
|
|
167
|
-
});
|
|
168
|
-
session.once("stream", (stream2) => {
|
|
169
|
-
stream2.respond({
|
|
170
|
-
"content-type": "text/html",
|
|
171
|
-
[import_http2.default.constants.HTTP2_HEADER_STATUS]: 503
|
|
172
|
-
});
|
|
173
|
-
const cleanup = () => {
|
|
174
|
-
session.close();
|
|
175
|
-
this.target.destroy();
|
|
176
|
-
this._targetCloseEventListener();
|
|
177
|
-
};
|
|
178
|
-
stream2.end(responseBody, cleanup);
|
|
179
|
-
stream2.once("error", cleanup);
|
|
180
|
-
});
|
|
181
|
-
} else {
|
|
182
|
-
this.target.destroy();
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
internalTLS.end([
|
|
186
|
-
"HTTP/1.1 503 Internal Server Error",
|
|
187
|
-
"Content-Type: text/html; charset=utf-8",
|
|
188
|
-
"Content-Length: " + Buffer.byteLength(responseBody),
|
|
189
|
-
"",
|
|
190
|
-
responseBody
|
|
191
|
-
].join("\r\n"));
|
|
192
|
-
this.target.destroy();
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
if (this._closed) {
|
|
196
|
-
internalTLS.destroy();
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
targetTLS = import_tls.default.connect({
|
|
200
|
-
socket: this.target,
|
|
201
|
-
host: this.host,
|
|
202
|
-
port: this.port,
|
|
203
|
-
rejectUnauthorized: !this.socksProxy.ignoreHTTPSErrors,
|
|
204
|
-
ALPNProtocols: [internalTLS.alpnProtocol || "http/1.1"],
|
|
205
|
-
servername: !import_net.default.isIP(this.host) ? this.host : void 0,
|
|
206
|
-
secureContext: this.socksProxy.secureContextMap.get(new URL(`https://${this.host}:${this.port}`).origin)
|
|
207
|
-
});
|
|
208
|
-
targetTLS.once("secureConnect", () => {
|
|
209
|
-
internalTLS.pipe(targetTLS);
|
|
210
|
-
targetTLS.pipe(internalTLS);
|
|
211
|
-
});
|
|
212
|
-
internalTLS.once("error", () => this.target.destroy());
|
|
213
|
-
targetTLS.once("error", handleError);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
class ClientCertificatesProxy {
|
|
219
|
-
constructor(contextOptions) {
|
|
220
|
-
this._connections = /* @__PURE__ */ new Map();
|
|
221
|
-
this.secureContextMap = /* @__PURE__ */ new Map();
|
|
222
|
-
(0, import_browserContext.verifyClientCertificates)(contextOptions.clientCertificates);
|
|
223
|
-
this.alpnCache = new ALPNCache();
|
|
224
|
-
this.ignoreHTTPSErrors = contextOptions.ignoreHTTPSErrors;
|
|
225
|
-
this.proxyAgentFromOptions = (0, import_network.createProxyAgent)(contextOptions.proxy);
|
|
226
|
-
this._initSecureContexts(contextOptions.clientCertificates);
|
|
227
|
-
this._socksProxy = new import_socksProxy.SocksProxy();
|
|
228
|
-
this._socksProxy.setPattern("*");
|
|
229
|
-
this._socksProxy.addListener(import_socksProxy.SocksProxy.Events.SocksRequested, async (payload) => {
|
|
230
|
-
try {
|
|
231
|
-
const connection = new SocksProxyConnection(this, payload.uid, payload.host, payload.port);
|
|
232
|
-
await connection.connect();
|
|
233
|
-
this._connections.set(payload.uid, connection);
|
|
234
|
-
} catch (error) {
|
|
235
|
-
this._socksProxy.socketFailed({ uid: payload.uid, errorCode: error.code });
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
this._socksProxy.addListener(import_socksProxy.SocksProxy.Events.SocksData, async (payload) => {
|
|
239
|
-
this._connections.get(payload.uid)?.onData(payload.data);
|
|
240
|
-
});
|
|
241
|
-
this._socksProxy.addListener(import_socksProxy.SocksProxy.Events.SocksClosed, (payload) => {
|
|
242
|
-
this._connections.get(payload.uid)?.onClose();
|
|
243
|
-
this._connections.delete(payload.uid);
|
|
244
|
-
});
|
|
245
|
-
loadDummyServerCertsIfNeeded();
|
|
246
|
-
}
|
|
247
|
-
_initSecureContexts(clientCertificates) {
|
|
248
|
-
const origin2certs = /* @__PURE__ */ new Map();
|
|
249
|
-
for (const cert of clientCertificates || []) {
|
|
250
|
-
const origin = normalizeOrigin(cert.origin);
|
|
251
|
-
const certs = origin2certs.get(origin) || [];
|
|
252
|
-
certs.push(cert);
|
|
253
|
-
origin2certs.set(origin, certs);
|
|
254
|
-
}
|
|
255
|
-
for (const [origin, certs] of origin2certs) {
|
|
256
|
-
try {
|
|
257
|
-
this.secureContextMap.set(origin, import_tls.default.createSecureContext(convertClientCertificatesToTLSOptions(certs)));
|
|
258
|
-
} catch (error) {
|
|
259
|
-
error = rewriteOpenSSLErrorIfNeeded(error);
|
|
260
|
-
throw (0, import_utils.rewriteErrorMessage)(error, `Failed to load client certificate: ${error.message}`);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
async listen() {
|
|
265
|
-
const port = await this._socksProxy.listen(0, "127.0.0.1");
|
|
266
|
-
return { server: `socks5://127.0.0.1:${port}` };
|
|
267
|
-
}
|
|
268
|
-
async close() {
|
|
269
|
-
await this._socksProxy.close();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
function normalizeOrigin(origin) {
|
|
273
|
-
try {
|
|
274
|
-
return new URL(origin).origin;
|
|
275
|
-
} catch (error) {
|
|
276
|
-
return origin;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
function convertClientCertificatesToTLSOptions(clientCertificates) {
|
|
280
|
-
if (!clientCertificates || !clientCertificates.length)
|
|
281
|
-
return;
|
|
282
|
-
const tlsOptions = {
|
|
283
|
-
pfx: [],
|
|
284
|
-
key: [],
|
|
285
|
-
cert: []
|
|
286
|
-
};
|
|
287
|
-
for (const cert of clientCertificates) {
|
|
288
|
-
if (cert.cert)
|
|
289
|
-
tlsOptions.cert.push(cert.cert);
|
|
290
|
-
if (cert.key)
|
|
291
|
-
tlsOptions.key.push({ pem: cert.key, passphrase: cert.passphrase });
|
|
292
|
-
if (cert.pfx)
|
|
293
|
-
tlsOptions.pfx.push({ buf: cert.pfx, passphrase: cert.passphrase });
|
|
294
|
-
}
|
|
295
|
-
return tlsOptions;
|
|
296
|
-
}
|
|
297
|
-
function getMatchingTLSOptionsForOrigin(clientCertificates, origin) {
|
|
298
|
-
const matchingCerts = clientCertificates?.filter(
|
|
299
|
-
(c) => normalizeOrigin(c.origin) === origin
|
|
300
|
-
);
|
|
301
|
-
return convertClientCertificatesToTLSOptions(matchingCerts);
|
|
302
|
-
}
|
|
303
|
-
function rewriteToLocalhostIfNeeded(host) {
|
|
304
|
-
return host === "local.playwright" ? "localhost" : host;
|
|
305
|
-
}
|
|
306
|
-
function rewriteOpenSSLErrorIfNeeded(error) {
|
|
307
|
-
if (error.message !== "unsupported" && error.code !== "ERR_CRYPTO_UNSUPPORTED_OPERATION")
|
|
308
|
-
return error;
|
|
309
|
-
return (0, import_utils.rewriteErrorMessage)(error, [
|
|
310
|
-
"Unsupported TLS certificate.",
|
|
311
|
-
"Most likely, the security algorithm of the given certificate was deprecated by OpenSSL.",
|
|
312
|
-
"For more details, see https://github.com/openssl/openssl/blob/master/README-PROVIDERS.md#the-legacy-provider",
|
|
313
|
-
"You could probably modernize the certificate by following the steps at https://github.com/nodejs/node/issues/40672#issuecomment-1243648223"
|
|
314
|
-
].join("\n"));
|
|
315
|
-
}
|
|
316
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
317
|
-
0 && (module.exports = {
|
|
318
|
-
ClientCertificatesProxy,
|
|
319
|
-
getMatchingTLSOptionsForOrigin,
|
|
320
|
-
rewriteOpenSSLErrorIfNeeded
|
|
321
|
-
});
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var socksInterceptor_exports = {};
|
|
30
|
-
__export(socksInterceptor_exports, {
|
|
31
|
-
SocksInterceptor: () => SocksInterceptor
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(socksInterceptor_exports);
|
|
34
|
-
var import_events = __toESM(require("events"));
|
|
35
|
-
var socks = __toESM(require("./utils/socksProxy"));
|
|
36
|
-
var import_validator = require("../protocol/validator");
|
|
37
|
-
var import_debug = require("./utils/debug");
|
|
38
|
-
class SocksInterceptor {
|
|
39
|
-
constructor(transport, pattern, redirectPortForTest) {
|
|
40
|
-
this._ids = /* @__PURE__ */ new Set();
|
|
41
|
-
this._handler = new socks.SocksProxyHandler(pattern, redirectPortForTest);
|
|
42
|
-
let lastId = -1;
|
|
43
|
-
this._channel = new Proxy(new import_events.default(), {
|
|
44
|
-
get: (obj, prop) => {
|
|
45
|
-
if (prop in obj || obj[prop] !== void 0 || typeof prop !== "string")
|
|
46
|
-
return obj[prop];
|
|
47
|
-
return (params) => {
|
|
48
|
-
try {
|
|
49
|
-
const id = --lastId;
|
|
50
|
-
this._ids.add(id);
|
|
51
|
-
const validator = (0, import_validator.findValidator)("SocksSupport", prop, "Params");
|
|
52
|
-
params = validator(params, "", { tChannelImpl: tChannelForSocks, binary: "toBase64", isUnderTest: import_debug.isUnderTest });
|
|
53
|
-
transport.send({ id, guid: this._socksSupportObjectGuid, method: prop, params, metadata: { stack: [], apiName: "", internal: true } });
|
|
54
|
-
} catch (e) {
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
this._handler.on(socks.SocksProxyHandler.Events.SocksConnected, (payload) => this._channel.socksConnected(payload));
|
|
60
|
-
this._handler.on(socks.SocksProxyHandler.Events.SocksData, (payload) => this._channel.socksData(payload));
|
|
61
|
-
this._handler.on(socks.SocksProxyHandler.Events.SocksError, (payload) => this._channel.socksError(payload));
|
|
62
|
-
this._handler.on(socks.SocksProxyHandler.Events.SocksFailed, (payload) => this._channel.socksFailed(payload));
|
|
63
|
-
this._handler.on(socks.SocksProxyHandler.Events.SocksEnd, (payload) => this._channel.socksEnd(payload));
|
|
64
|
-
this._channel.on("socksRequested", (payload) => this._handler.socketRequested(payload));
|
|
65
|
-
this._channel.on("socksClosed", (payload) => this._handler.socketClosed(payload));
|
|
66
|
-
this._channel.on("socksData", (payload) => this._handler.sendSocketData(payload));
|
|
67
|
-
}
|
|
68
|
-
cleanup() {
|
|
69
|
-
this._handler.cleanup();
|
|
70
|
-
}
|
|
71
|
-
interceptMessage(message) {
|
|
72
|
-
if (this._ids.has(message.id)) {
|
|
73
|
-
this._ids.delete(message.id);
|
|
74
|
-
return true;
|
|
75
|
-
}
|
|
76
|
-
if (message.method === "__create__" && message.params.type === "SocksSupport") {
|
|
77
|
-
this._socksSupportObjectGuid = message.params.guid;
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
if (this._socksSupportObjectGuid && message.guid === this._socksSupportObjectGuid) {
|
|
81
|
-
const validator = (0, import_validator.findValidator)("SocksSupport", message.method, "Event");
|
|
82
|
-
const params = validator(message.params, "", { tChannelImpl: tChannelForSocks, binary: "fromBase64", isUnderTest: import_debug.isUnderTest });
|
|
83
|
-
this._channel.emit(message.method, params);
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function tChannelForSocks(names, arg, path, context) {
|
|
90
|
-
throw new import_validator.ValidationError(`${path}: channels are not expected in SocksSupport`);
|
|
91
|
-
}
|
|
92
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
-
0 && (module.exports = {
|
|
94
|
-
SocksInterceptor
|
|
95
|
-
});
|
|
@@ -1,154 +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 storageScript_exports = {};
|
|
20
|
-
__export(storageScript_exports, {
|
|
21
|
-
collect: () => collect,
|
|
22
|
-
restore: () => restore
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(storageScript_exports);
|
|
25
|
-
async function collect(serializersSource, builtins, isFirefox, recordIndexedDB) {
|
|
26
|
-
const { serializeAsCallArgument } = serializersSource(builtins);
|
|
27
|
-
async function collectDB(dbInfo) {
|
|
28
|
-
if (!dbInfo.name)
|
|
29
|
-
throw new Error("Database name is empty");
|
|
30
|
-
if (!dbInfo.version)
|
|
31
|
-
throw new Error("Database version is unset");
|
|
32
|
-
function idbRequestToPromise(request) {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
request.addEventListener("success", () => resolve(request.result));
|
|
35
|
-
request.addEventListener("error", () => reject(request.error));
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
function isPlainObject(v) {
|
|
39
|
-
const ctor = v?.constructor;
|
|
40
|
-
if (isFirefox) {
|
|
41
|
-
const constructorImpl = ctor?.toString();
|
|
42
|
-
if (constructorImpl?.startsWith("function Object() {") && constructorImpl?.includes("[native code]"))
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
return ctor === Object;
|
|
46
|
-
}
|
|
47
|
-
function trySerialize(value) {
|
|
48
|
-
let trivial = true;
|
|
49
|
-
const encoded = serializeAsCallArgument(value, (v) => {
|
|
50
|
-
const isTrivial = isPlainObject(v) || Array.isArray(v) || typeof v === "string" || typeof v === "number" || typeof v === "boolean" || Object.is(v, null);
|
|
51
|
-
if (!isTrivial)
|
|
52
|
-
trivial = false;
|
|
53
|
-
return { fallThrough: v };
|
|
54
|
-
});
|
|
55
|
-
if (trivial)
|
|
56
|
-
return { trivial: value };
|
|
57
|
-
return { encoded };
|
|
58
|
-
}
|
|
59
|
-
const db = await idbRequestToPromise(indexedDB.open(dbInfo.name));
|
|
60
|
-
const transaction = db.transaction(db.objectStoreNames, "readonly");
|
|
61
|
-
const stores = await Promise.all([...db.objectStoreNames].map(async (storeName) => {
|
|
62
|
-
const objectStore = transaction.objectStore(storeName);
|
|
63
|
-
const keys = await idbRequestToPromise(objectStore.getAllKeys());
|
|
64
|
-
const records = await Promise.all(keys.map(async (key) => {
|
|
65
|
-
const record = {};
|
|
66
|
-
if (objectStore.keyPath === null) {
|
|
67
|
-
const { encoded: encoded2, trivial: trivial2 } = trySerialize(key);
|
|
68
|
-
if (trivial2)
|
|
69
|
-
record.key = trivial2;
|
|
70
|
-
else
|
|
71
|
-
record.keyEncoded = encoded2;
|
|
72
|
-
}
|
|
73
|
-
const value = await idbRequestToPromise(objectStore.get(key));
|
|
74
|
-
const { encoded, trivial } = trySerialize(value);
|
|
75
|
-
if (trivial)
|
|
76
|
-
record.value = trivial;
|
|
77
|
-
else
|
|
78
|
-
record.valueEncoded = encoded;
|
|
79
|
-
return record;
|
|
80
|
-
}));
|
|
81
|
-
const indexes = [...objectStore.indexNames].map((indexName) => {
|
|
82
|
-
const index = objectStore.index(indexName);
|
|
83
|
-
return {
|
|
84
|
-
name: index.name,
|
|
85
|
-
keyPath: typeof index.keyPath === "string" ? index.keyPath : void 0,
|
|
86
|
-
keyPathArray: Array.isArray(index.keyPath) ? index.keyPath : void 0,
|
|
87
|
-
multiEntry: index.multiEntry,
|
|
88
|
-
unique: index.unique
|
|
89
|
-
};
|
|
90
|
-
});
|
|
91
|
-
return {
|
|
92
|
-
name: storeName,
|
|
93
|
-
records,
|
|
94
|
-
indexes,
|
|
95
|
-
autoIncrement: objectStore.autoIncrement,
|
|
96
|
-
keyPath: typeof objectStore.keyPath === "string" ? objectStore.keyPath : void 0,
|
|
97
|
-
keyPathArray: Array.isArray(objectStore.keyPath) ? objectStore.keyPath : void 0
|
|
98
|
-
};
|
|
99
|
-
}));
|
|
100
|
-
return {
|
|
101
|
-
name: dbInfo.name,
|
|
102
|
-
version: dbInfo.version,
|
|
103
|
-
stores
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
return {
|
|
107
|
-
localStorage: Object.keys(localStorage).map((name) => ({ name, value: localStorage.getItem(name) })),
|
|
108
|
-
indexedDB: recordIndexedDB ? await Promise.all((await indexedDB.databases()).map(collectDB)).catch((e) => {
|
|
109
|
-
throw new Error("Unable to serialize IndexedDB: " + e.message);
|
|
110
|
-
}) : void 0
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
async function restore(serializersSource, builtins, originState) {
|
|
114
|
-
const { parseEvaluationResultValue } = serializersSource(builtins);
|
|
115
|
-
for (const { name, value } of originState.localStorage || [])
|
|
116
|
-
localStorage.setItem(name, value);
|
|
117
|
-
await Promise.all((originState.indexedDB ?? []).map(async (dbInfo) => {
|
|
118
|
-
const openRequest = indexedDB.open(dbInfo.name, dbInfo.version);
|
|
119
|
-
openRequest.addEventListener("upgradeneeded", () => {
|
|
120
|
-
const db2 = openRequest.result;
|
|
121
|
-
for (const store of dbInfo.stores) {
|
|
122
|
-
const objectStore = db2.createObjectStore(store.name, { autoIncrement: store.autoIncrement, keyPath: store.keyPathArray ?? store.keyPath });
|
|
123
|
-
for (const index of store.indexes)
|
|
124
|
-
objectStore.createIndex(index.name, index.keyPathArray ?? index.keyPath, { unique: index.unique, multiEntry: index.multiEntry });
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
function idbRequestToPromise(request) {
|
|
128
|
-
return new Promise((resolve, reject) => {
|
|
129
|
-
request.addEventListener("success", () => resolve(request.result));
|
|
130
|
-
request.addEventListener("error", () => reject(request.error));
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
const db = await idbRequestToPromise(openRequest);
|
|
134
|
-
const transaction = db.transaction(db.objectStoreNames, "readwrite");
|
|
135
|
-
await Promise.all(dbInfo.stores.map(async (store) => {
|
|
136
|
-
const objectStore = transaction.objectStore(store.name);
|
|
137
|
-
await Promise.all(store.records.map(async (record) => {
|
|
138
|
-
await idbRequestToPromise(
|
|
139
|
-
objectStore.add(
|
|
140
|
-
record.value ?? parseEvaluationResultValue(record.valueEncoded),
|
|
141
|
-
record.key ?? parseEvaluationResultValue(record.keyEncoded)
|
|
142
|
-
)
|
|
143
|
-
);
|
|
144
|
-
}));
|
|
145
|
-
}));
|
|
146
|
-
})).catch((e) => {
|
|
147
|
-
throw new Error("Unable to restore IndexedDB: " + e.message);
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
151
|
-
0 && (module.exports = {
|
|
152
|
-
collect,
|
|
153
|
-
restore
|
|
154
|
-
});
|
|
@@ -1,89 +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 timeoutSettings_exports = {};
|
|
20
|
-
__export(timeoutSettings_exports, {
|
|
21
|
-
DEFAULT_LAUNCH_TIMEOUT: () => DEFAULT_LAUNCH_TIMEOUT,
|
|
22
|
-
DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
|
|
23
|
-
TimeoutSettings: () => TimeoutSettings
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(timeoutSettings_exports);
|
|
26
|
-
var import_debug = require("./utils/debug");
|
|
27
|
-
const DEFAULT_TIMEOUT = 3e4;
|
|
28
|
-
const DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1e3;
|
|
29
|
-
class TimeoutSettings {
|
|
30
|
-
constructor(parent) {
|
|
31
|
-
this._parent = parent;
|
|
32
|
-
}
|
|
33
|
-
setDefaultTimeout(timeout) {
|
|
34
|
-
this._defaultTimeout = timeout;
|
|
35
|
-
}
|
|
36
|
-
setDefaultNavigationTimeout(timeout) {
|
|
37
|
-
this._defaultNavigationTimeout = timeout;
|
|
38
|
-
}
|
|
39
|
-
defaultNavigationTimeout() {
|
|
40
|
-
return this._defaultNavigationTimeout;
|
|
41
|
-
}
|
|
42
|
-
defaultTimeout() {
|
|
43
|
-
return this._defaultTimeout;
|
|
44
|
-
}
|
|
45
|
-
navigationTimeout(options) {
|
|
46
|
-
if (typeof options.timeout === "number")
|
|
47
|
-
return options.timeout;
|
|
48
|
-
if (this._defaultNavigationTimeout !== void 0)
|
|
49
|
-
return this._defaultNavigationTimeout;
|
|
50
|
-
if ((0, import_debug.debugMode)())
|
|
51
|
-
return 0;
|
|
52
|
-
if (this._defaultTimeout !== void 0)
|
|
53
|
-
return this._defaultTimeout;
|
|
54
|
-
if (this._parent)
|
|
55
|
-
return this._parent.navigationTimeout(options);
|
|
56
|
-
return DEFAULT_TIMEOUT;
|
|
57
|
-
}
|
|
58
|
-
timeout(options) {
|
|
59
|
-
if (typeof options.timeout === "number")
|
|
60
|
-
return options.timeout;
|
|
61
|
-
if ((0, import_debug.debugMode)())
|
|
62
|
-
return 0;
|
|
63
|
-
if (this._defaultTimeout !== void 0)
|
|
64
|
-
return this._defaultTimeout;
|
|
65
|
-
if (this._parent)
|
|
66
|
-
return this._parent.timeout(options);
|
|
67
|
-
return DEFAULT_TIMEOUT;
|
|
68
|
-
}
|
|
69
|
-
static timeout(options) {
|
|
70
|
-
if (typeof options.timeout === "number")
|
|
71
|
-
return options.timeout;
|
|
72
|
-
if ((0, import_debug.debugMode)())
|
|
73
|
-
return 0;
|
|
74
|
-
return DEFAULT_TIMEOUT;
|
|
75
|
-
}
|
|
76
|
-
static launchTimeout(options) {
|
|
77
|
-
if (typeof options.timeout === "number")
|
|
78
|
-
return options.timeout;
|
|
79
|
-
if ((0, import_debug.debugMode)())
|
|
80
|
-
return 0;
|
|
81
|
-
return DEFAULT_LAUNCH_TIMEOUT;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
-
0 && (module.exports = {
|
|
86
|
-
DEFAULT_LAUNCH_TIMEOUT,
|
|
87
|
-
DEFAULT_TIMEOUT,
|
|
88
|
-
TimeoutSettings
|
|
89
|
-
});
|