@stablyai/internal-playwright-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +5 -0
- package/README.md +3 -0
- package/ThirdPartyNotices.txt +1134 -0
- package/bin/install_media_pack.ps1 +5 -0
- package/bin/install_webkit_wsl.ps1 +35 -0
- package/bin/reinstall_chrome_beta_linux.sh +42 -0
- package/bin/reinstall_chrome_beta_mac.sh +13 -0
- package/bin/reinstall_chrome_beta_win.ps1 +24 -0
- package/bin/reinstall_chrome_stable_linux.sh +42 -0
- package/bin/reinstall_chrome_stable_mac.sh +12 -0
- package/bin/reinstall_chrome_stable_win.ps1 +24 -0
- package/bin/reinstall_msedge_beta_linux.sh +48 -0
- package/bin/reinstall_msedge_beta_mac.sh +11 -0
- package/bin/reinstall_msedge_beta_win.ps1 +23 -0
- package/bin/reinstall_msedge_dev_linux.sh +48 -0
- package/bin/reinstall_msedge_dev_mac.sh +11 -0
- package/bin/reinstall_msedge_dev_win.ps1 +23 -0
- package/bin/reinstall_msedge_stable_linux.sh +48 -0
- package/bin/reinstall_msedge_stable_mac.sh +11 -0
- package/bin/reinstall_msedge_stable_win.ps1 +24 -0
- package/browsers.json +80 -0
- package/cli.js +18 -0
- package/index.d.ts +17 -0
- package/index.js +32 -0
- package/index.mjs +28 -0
- package/lib/androidServerImpl.js +65 -0
- package/lib/browserServerImpl.js +120 -0
- package/lib/cli/cli.js +58 -0
- package/lib/cli/driver.js +97 -0
- package/lib/cli/program.js +634 -0
- package/lib/cli/programWithTestStub.js +74 -0
- package/lib/client/accessibility.js +49 -0
- package/lib/client/android.js +361 -0
- package/lib/client/api.js +137 -0
- package/lib/client/artifact.js +79 -0
- package/lib/client/browser.js +163 -0
- package/lib/client/browserContext.js +529 -0
- package/lib/client/browserType.js +184 -0
- package/lib/client/cdpSession.js +51 -0
- package/lib/client/channelOwner.js +194 -0
- package/lib/client/clientHelper.js +64 -0
- package/lib/client/clientInstrumentation.js +55 -0
- package/lib/client/clientStackTrace.js +69 -0
- package/lib/client/clock.js +68 -0
- package/lib/client/connection.js +314 -0
- package/lib/client/consoleMessage.js +54 -0
- package/lib/client/coverage.js +44 -0
- package/lib/client/dialog.js +56 -0
- package/lib/client/download.js +62 -0
- package/lib/client/electron.js +138 -0
- package/lib/client/elementHandle.js +281 -0
- package/lib/client/errors.js +77 -0
- package/lib/client/eventEmitter.js +314 -0
- package/lib/client/events.js +99 -0
- package/lib/client/fetch.js +369 -0
- package/lib/client/fileChooser.js +46 -0
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +408 -0
- package/lib/client/harRouter.js +87 -0
- package/lib/client/input.js +84 -0
- package/lib/client/jsHandle.js +109 -0
- package/lib/client/jsonPipe.js +39 -0
- package/lib/client/localUtils.js +60 -0
- package/lib/client/locator.js +368 -0
- package/lib/client/network.js +747 -0
- package/lib/client/page.js +721 -0
- package/lib/client/platform.js +74 -0
- package/lib/client/playwright.js +71 -0
- package/lib/client/selectors.js +55 -0
- package/lib/client/stream.js +39 -0
- package/lib/client/timeoutSettings.js +79 -0
- package/lib/client/tracing.js +117 -0
- package/lib/client/types.js +28 -0
- package/lib/client/video.js +59 -0
- package/lib/client/waiter.js +142 -0
- package/lib/client/webError.js +39 -0
- package/lib/client/webSocket.js +93 -0
- package/lib/client/worker.js +63 -0
- package/lib/client/writableStream.js +39 -0
- package/lib/common/debugLogger.js +90 -0
- package/lib/common/socksProxy.js +569 -0
- package/lib/common/timeoutSettings.js +73 -0
- package/lib/common/types.js +5 -0
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +28 -0
- package/lib/generated/consoleApiSource.js +28 -0
- package/lib/generated/injectedScriptSource.js +28 -0
- package/lib/generated/pollingRecorderSource.js +28 -0
- package/lib/generated/recorderSource.js +28 -0
- package/lib/generated/storageScriptSource.js +28 -0
- package/lib/generated/utilityScriptSource.js +28 -0
- package/lib/generated/webSocketMockSource.js +336 -0
- package/lib/image_tools/colorUtils.js +98 -0
- package/lib/image_tools/compare.js +108 -0
- package/lib/image_tools/imageChannel.js +70 -0
- package/lib/image_tools/stats.js +102 -0
- package/lib/inProcessFactory.js +60 -0
- package/lib/index.js +19 -0
- package/lib/inprocess.js +3 -0
- package/lib/outofprocess.js +76 -0
- package/lib/protocol/debug.js +27 -0
- package/lib/protocol/serializers.js +192 -0
- package/lib/protocol/transport.js +82 -0
- package/lib/protocol/validator.js +2919 -0
- package/lib/protocol/validatorPrimitives.js +193 -0
- package/lib/remote/playwrightConnection.js +129 -0
- package/lib/remote/playwrightServer.js +335 -0
- package/lib/server/accessibility.js +69 -0
- package/lib/server/android/android.js +465 -0
- package/lib/server/android/backendAdb.js +177 -0
- package/lib/server/artifact.js +127 -0
- package/lib/server/bidi/bidiBrowser.js +490 -0
- package/lib/server/bidi/bidiChromium.js +153 -0
- package/lib/server/bidi/bidiConnection.js +212 -0
- package/lib/server/bidi/bidiExecutionContext.js +221 -0
- package/lib/server/bidi/bidiFirefox.js +130 -0
- package/lib/server/bidi/bidiInput.js +146 -0
- package/lib/server/bidi/bidiNetworkManager.js +383 -0
- package/lib/server/bidi/bidiOverCdp.js +102 -0
- package/lib/server/bidi/bidiPage.js +552 -0
- package/lib/server/bidi/bidiPdf.js +106 -0
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiDeserializer.js +98 -0
- package/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
- package/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/lib/server/bidi/third_party/bidiSerializer.js +148 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
- package/lib/server/browser.js +149 -0
- package/lib/server/browserContext.js +695 -0
- package/lib/server/browserType.js +328 -0
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/appIcon.png +0 -0
- package/lib/server/chromium/chromium.js +402 -0
- package/lib/server/chromium/chromiumSwitches.js +95 -0
- package/lib/server/chromium/crAccessibility.js +263 -0
- package/lib/server/chromium/crBrowser.js +501 -0
- package/lib/server/chromium/crConnection.js +202 -0
- package/lib/server/chromium/crCoverage.js +235 -0
- package/lib/server/chromium/crDevTools.js +113 -0
- package/lib/server/chromium/crDragDrop.js +131 -0
- package/lib/server/chromium/crExecutionContext.js +146 -0
- package/lib/server/chromium/crInput.js +187 -0
- package/lib/server/chromium/crNetworkManager.js +666 -0
- package/lib/server/chromium/crPage.js +1069 -0
- package/lib/server/chromium/crPdf.js +121 -0
- package/lib/server/chromium/crProtocolHelper.js +145 -0
- package/lib/server/chromium/crServiceWorker.js +123 -0
- package/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/chromium/videoRecorder.js +113 -0
- package/lib/server/clock.js +149 -0
- package/lib/server/codegen/csharp.js +327 -0
- package/lib/server/codegen/java.js +274 -0
- package/lib/server/codegen/javascript.js +270 -0
- package/lib/server/codegen/jsonl.js +52 -0
- package/lib/server/codegen/language.js +132 -0
- package/lib/server/codegen/languages.js +68 -0
- package/lib/server/codegen/python.js +279 -0
- package/lib/server/codegen/types.js +16 -0
- package/lib/server/console.js +53 -0
- package/lib/server/cookieStore.js +206 -0
- package/lib/server/debugController.js +191 -0
- package/lib/server/debugger.js +119 -0
- package/lib/server/deviceDescriptors.js +39 -0
- package/lib/server/deviceDescriptorsSource.json +1779 -0
- package/lib/server/dialog.js +116 -0
- package/lib/server/dispatchers/androidDispatcher.js +325 -0
- package/lib/server/dispatchers/artifactDispatcher.js +118 -0
- package/lib/server/dispatchers/browserContextDispatcher.js +364 -0
- package/lib/server/dispatchers/browserDispatcher.js +118 -0
- package/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
- package/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
- package/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
- package/lib/server/dispatchers/dialogDispatcher.js +47 -0
- package/lib/server/dispatchers/dispatcher.js +371 -0
- package/lib/server/dispatchers/electronDispatcher.js +89 -0
- package/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
- package/lib/server/dispatchers/frameDispatcher.js +227 -0
- package/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
- package/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
- package/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
- package/lib/server/dispatchers/networkDispatchers.js +213 -0
- package/lib/server/dispatchers/pageDispatcher.js +401 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +108 -0
- package/lib/server/dispatchers/selectorsDispatcher.js +36 -0
- package/lib/server/dispatchers/streamDispatcher.js +67 -0
- package/lib/server/dispatchers/tracingDispatcher.js +68 -0
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
- package/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
- package/lib/server/dom.js +806 -0
- package/lib/server/download.js +70 -0
- package/lib/server/electron/electron.js +270 -0
- package/lib/server/electron/loader.js +29 -0
- package/lib/server/errors.js +69 -0
- package/lib/server/fetch.js +621 -0
- package/lib/server/fileChooser.js +43 -0
- package/lib/server/fileUploadUtils.js +84 -0
- package/lib/server/firefox/ffAccessibility.js +238 -0
- package/lib/server/firefox/ffBrowser.js +428 -0
- package/lib/server/firefox/ffConnection.js +147 -0
- package/lib/server/firefox/ffExecutionContext.js +150 -0
- package/lib/server/firefox/ffInput.js +159 -0
- package/lib/server/firefox/ffNetworkManager.js +256 -0
- package/lib/server/firefox/ffPage.js +503 -0
- package/lib/server/firefox/firefox.js +116 -0
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +147 -0
- package/lib/server/frameSelectors.js +156 -0
- package/lib/server/frames.js +1502 -0
- package/lib/server/har/harRecorder.js +147 -0
- package/lib/server/har/harTracer.js +607 -0
- package/lib/server/harBackend.js +157 -0
- package/lib/server/helper.js +96 -0
- package/lib/server/index.js +58 -0
- package/lib/server/input.js +273 -0
- package/lib/server/instrumentation.js +69 -0
- package/lib/server/isomorphic/utilityScriptSerializers.js +212 -0
- package/lib/server/javascript.js +291 -0
- package/lib/server/launchApp.js +128 -0
- package/lib/server/localUtils.js +218 -0
- package/lib/server/macEditingCommands.js +143 -0
- package/lib/server/network.js +629 -0
- package/lib/server/page.js +871 -0
- package/lib/server/pipeTransport.js +89 -0
- package/lib/server/playwright.js +69 -0
- package/lib/server/progress.js +112 -0
- package/lib/server/protocolError.js +52 -0
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/codeGenerator.js +153 -0
- package/lib/server/recorder/csharp.js +310 -0
- package/lib/server/recorder/java.js +248 -0
- package/lib/server/recorder/javascript.js +229 -0
- package/lib/server/recorder/jsonl.js +47 -0
- package/lib/server/recorder/language.js +44 -0
- package/lib/server/recorder/python.js +276 -0
- package/lib/server/recorder/recorderActions.js +5 -0
- package/lib/server/recorder/recorderApp.js +387 -0
- package/lib/server/recorder/recorderRunner.js +138 -0
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +157 -0
- package/lib/server/recorder/throttledFile.js +57 -0
- package/lib/server/recorder/utils.js +45 -0
- package/lib/server/recorder.js +499 -0
- package/lib/server/registry/browserFetcher.js +175 -0
- package/lib/server/registry/dependencies.js +371 -0
- package/lib/server/registry/index.js +1331 -0
- package/lib/server/registry/nativeDeps.js +1280 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +120 -0
- package/lib/server/screenshotter.js +333 -0
- package/lib/server/selectors.js +112 -0
- package/lib/server/socksClientCertificatesInterceptor.js +383 -0
- package/lib/server/socksInterceptor.js +95 -0
- package/lib/server/stably/ai-tools/http-request.js +70 -0
- package/lib/server/stably/ai-tools/stablyApiCaller.js +137 -0
- package/lib/server/stably/autohealing/elementHandleFromCoordinates.js +64 -0
- package/lib/server/stably/autohealing/healingService.js +228 -0
- package/lib/server/stably/autohealing/screenshotFrame.js +41 -0
- package/lib/server/stably/constants.js +31 -0
- package/lib/server/trace/recorder/snapshotter.js +147 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +541 -0
- package/lib/server/trace/recorder/tracing.js +602 -0
- package/lib/server/trace/test/inMemorySnapshotter.js +87 -0
- package/lib/server/trace/viewer/traceViewer.js +240 -0
- package/lib/server/transport.js +181 -0
- package/lib/server/types.js +28 -0
- package/lib/server/usKeyboardLayout.js +145 -0
- package/lib/server/utils/ascii.js +44 -0
- package/lib/server/utils/comparators.js +161 -0
- package/lib/server/utils/crypto.js +216 -0
- package/lib/server/utils/debug.js +42 -0
- package/lib/server/utils/debugLogger.js +122 -0
- package/lib/server/utils/env.js +73 -0
- package/lib/server/utils/eventsHelper.js +39 -0
- package/lib/server/utils/expectUtils.js +38 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +111 -0
- package/lib/server/utils/httpServer.js +218 -0
- package/lib/server/utils/image_tools/colorUtils.js +89 -0
- package/lib/server/utils/image_tools/compare.js +109 -0
- package/lib/server/utils/image_tools/imageChannel.js +78 -0
- package/lib/server/utils/image_tools/stats.js +102 -0
- package/lib/server/utils/linuxUtils.js +71 -0
- package/lib/server/utils/network.js +233 -0
- package/lib/server/utils/nodePlatform.js +148 -0
- package/lib/server/utils/pipeTransport.js +84 -0
- package/lib/server/utils/processLauncher.js +241 -0
- package/lib/server/utils/profiler.js +65 -0
- package/lib/server/utils/socksProxy.js +511 -0
- package/lib/server/utils/spawnAsync.js +41 -0
- package/lib/server/utils/task.js +51 -0
- package/lib/server/utils/userAgent.js +98 -0
- package/lib/server/utils/wsServer.js +121 -0
- package/lib/server/utils/zipFile.js +74 -0
- package/lib/server/utils/zones.js +57 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +119 -0
- package/lib/server/webkit/wkAccessibility.js +237 -0
- package/lib/server/webkit/wkBrowser.js +339 -0
- package/lib/server/webkit/wkConnection.js +149 -0
- package/lib/server/webkit/wkExecutionContext.js +154 -0
- package/lib/server/webkit/wkInput.js +181 -0
- package/lib/server/webkit/wkInterceptableRequest.js +169 -0
- package/lib/server/webkit/wkPage.js +1134 -0
- package/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/lib/server/webkit/wkWorkers.js +104 -0
- package/lib/server/webkit/wsl/webkit-wsl-transport-client.js +74 -0
- package/lib/server/webkit/wsl/webkit-wsl-transport-server.js +113 -0
- package/lib/third_party/diff_match_patch.js +2222 -0
- package/lib/third_party/pixelmatch.js +255 -0
- package/lib/utils/ascii.js +31 -0
- package/lib/utils/comparators.js +171 -0
- package/lib/utils/crypto.js +33 -0
- package/lib/utils/debug.js +46 -0
- package/lib/utils/debugLogger.js +89 -0
- package/lib/utils/env.js +49 -0
- package/lib/utils/eventsHelper.js +38 -0
- package/lib/utils/fileUtils.js +205 -0
- package/lib/utils/glob.js +83 -0
- package/lib/utils/happy-eyeballs.js +160 -0
- package/lib/utils/headers.js +52 -0
- package/lib/utils/hostPlatform.js +128 -0
- package/lib/utils/httpServer.js +236 -0
- package/lib/utils/index.js +346 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +392 -0
- package/lib/utils/isomorphic/assert.js +31 -0
- package/lib/utils/isomorphic/colors.js +72 -0
- package/lib/utils/isomorphic/cssParser.js +245 -0
- package/lib/utils/isomorphic/cssTokenizer.js +1051 -0
- package/lib/utils/isomorphic/headers.js +53 -0
- package/lib/utils/isomorphic/locatorGenerators.js +673 -0
- package/lib/utils/isomorphic/locatorParser.js +176 -0
- package/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/lib/utils/isomorphic/manualPromise.js +114 -0
- package/lib/utils/isomorphic/mimeType.js +459 -0
- package/lib/utils/isomorphic/multimap.js +80 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +321 -0
- package/lib/utils/isomorphic/rtti.js +43 -0
- package/lib/utils/isomorphic/selectorParser.js +386 -0
- package/lib/utils/isomorphic/semaphore.js +54 -0
- package/lib/utils/isomorphic/stackTrace.js +158 -0
- package/lib/utils/isomorphic/stringUtils.js +155 -0
- package/lib/utils/isomorphic/time.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/traceUtils.js +58 -0
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +176 -0
- package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/lib/utils/linuxUtils.js +78 -0
- package/lib/utils/manualPromise.js +109 -0
- package/lib/utils/mimeType.js +29 -0
- package/lib/utils/multimap.js +75 -0
- package/lib/utils/network.js +188 -0
- package/lib/utils/processLauncher.js +248 -0
- package/lib/utils/profiler.js +53 -0
- package/lib/utils/rtti.js +44 -0
- package/lib/utils/semaphore.js +51 -0
- package/lib/utils/spawnAsync.js +45 -0
- package/lib/utils/stackTrace.js +121 -0
- package/lib/utils/task.js +58 -0
- package/lib/utils/time.js +37 -0
- package/lib/utils/timeoutRunner.js +66 -0
- package/lib/utils/traceUtils.js +44 -0
- package/lib/utils/userAgent.js +105 -0
- package/lib/utils/wsServer.js +127 -0
- package/lib/utils/zipFile.js +75 -0
- package/lib/utils/zones.js +62 -0
- package/lib/utils.js +107 -0
- package/lib/utilsBundle.js +109 -0
- package/lib/utilsBundleImpl/index.js +218 -0
- package/lib/utilsBundleImpl/xdg-open +1066 -0
- package/lib/vite/htmlReport/index.html +84 -0
- package/lib/vite/recorder/assets/codeMirrorModule-C3UTv-Ge.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-RJCXzfmE.js +24 -0
- package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/recorder/assets/index-Ri0uHF7I.css +1 -0
- package/lib/vite/recorder/assets/index-Y-X2TGJv.js +193 -0
- package/lib/vite/recorder/index.html +29 -0
- package/lib/vite/recorder/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-Bhnc5o2x.js +24 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-ClwvkA2N.js +265 -0
- package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/lib/vite/traceViewer/codeMirrorModule.C3UTv-Ge.css +1 -0
- package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/lib/vite/traceViewer/defaultSettingsView.TQ8_7ybu.css +1 -0
- package/lib/vite/traceViewer/index.DFO9NNF5.js +2 -0
- package/lib/vite/traceViewer/index.I8N9v4jT.css +1 -0
- package/lib/vite/traceViewer/index.html +43 -0
- package/lib/vite/traceViewer/playwright-logo.svg +9 -0
- package/lib/vite/traceViewer/snapshot.html +21 -0
- package/lib/vite/traceViewer/sw.bundle.js +3 -0
- package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/lib/vite/traceViewer/uiMode.Shu3QS-1.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +17 -0
- package/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +32 -0
- package/lib/zipBundle.js +34 -0
- package/lib/zipBundleImpl.js +5 -0
- package/package.json +43 -0
- package/types/protocol.d.ts +23130 -0
- package/types/structs.d.ts +45 -0
- package/types/types.d.ts +22857 -0
@@ -0,0 +1,227 @@
|
|
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 frameDispatcher_exports = {};
|
20
|
+
__export(frameDispatcher_exports, {
|
21
|
+
FrameDispatcher: () => FrameDispatcher
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(frameDispatcher_exports);
|
24
|
+
var import_frames = require("../frames");
|
25
|
+
var import_dispatcher = require("./dispatcher");
|
26
|
+
var import_elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
27
|
+
var import_jsHandleDispatcher = require("./jsHandleDispatcher");
|
28
|
+
var import_networkDispatchers = require("./networkDispatchers");
|
29
|
+
var import_networkDispatchers2 = require("./networkDispatchers");
|
30
|
+
var import_ariaSnapshot = require("../../utils/isomorphic/ariaSnapshot");
|
31
|
+
var import_utilsBundle = require("../../utilsBundle");
|
32
|
+
class FrameDispatcher extends import_dispatcher.Dispatcher {
|
33
|
+
constructor(scope, frame) {
|
34
|
+
const gcBucket = frame._page.mainFrame() === frame ? "MainFrame" : "Frame";
|
35
|
+
const pageDispatcher = scope.connection.existingDispatcher(frame._page);
|
36
|
+
super(pageDispatcher || scope, frame, "Frame", {
|
37
|
+
url: frame.url(),
|
38
|
+
name: frame.name(),
|
39
|
+
parentFrame: FrameDispatcher.fromNullable(scope, frame.parentFrame()),
|
40
|
+
loadStates: Array.from(frame._firedLifecycleEvents)
|
41
|
+
}, gcBucket);
|
42
|
+
this._type_Frame = true;
|
43
|
+
this._browserContextDispatcher = scope;
|
44
|
+
this._frame = frame;
|
45
|
+
this.addObjectListener(import_frames.Frame.Events.AddLifecycle, (lifecycleEvent) => {
|
46
|
+
this._dispatchEvent("loadstate", { add: lifecycleEvent });
|
47
|
+
});
|
48
|
+
this.addObjectListener(import_frames.Frame.Events.RemoveLifecycle, (lifecycleEvent) => {
|
49
|
+
this._dispatchEvent("loadstate", { remove: lifecycleEvent });
|
50
|
+
});
|
51
|
+
this.addObjectListener(import_frames.Frame.Events.InternalNavigation, (event) => {
|
52
|
+
if (!event.isPublic)
|
53
|
+
return;
|
54
|
+
const params = { url: event.url, name: event.name, error: event.error ? event.error.message : void 0 };
|
55
|
+
if (event.newDocument)
|
56
|
+
params.newDocument = { request: import_networkDispatchers2.RequestDispatcher.fromNullable(this._browserContextDispatcher, event.newDocument.request || null) };
|
57
|
+
this._dispatchEvent("navigated", params);
|
58
|
+
});
|
59
|
+
}
|
60
|
+
static from(scope, frame) {
|
61
|
+
const result = scope.connection.existingDispatcher(frame);
|
62
|
+
return result || new FrameDispatcher(scope, frame);
|
63
|
+
}
|
64
|
+
static fromNullable(scope, frame) {
|
65
|
+
if (!frame)
|
66
|
+
return;
|
67
|
+
return FrameDispatcher.from(scope, frame);
|
68
|
+
}
|
69
|
+
async goto(params, progress) {
|
70
|
+
return { response: import_networkDispatchers.ResponseDispatcher.fromNullable(this._browserContextDispatcher, await this._frame.goto(progress, params.url, params)) };
|
71
|
+
}
|
72
|
+
async frameElement(params, progress) {
|
73
|
+
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, await progress.race(this._frame.frameElement())) };
|
74
|
+
}
|
75
|
+
async evaluateExpression(params, progress) {
|
76
|
+
return { value: (0, import_jsHandleDispatcher.serializeResult)(await progress.race(this._frame.evaluateExpression(params.expression, { isFunction: params.isFunction }, (0, import_jsHandleDispatcher.parseArgument)(params.arg)))) };
|
77
|
+
}
|
78
|
+
async evaluateExpressionHandle(params, progress) {
|
79
|
+
return { handle: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this, await progress.race(this._frame.evaluateExpressionHandle(params.expression, { isFunction: params.isFunction }, (0, import_jsHandleDispatcher.parseArgument)(params.arg)))) };
|
80
|
+
}
|
81
|
+
async waitForSelector(params, progress) {
|
82
|
+
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.fromNullable(this, await this._frame.waitForSelector(progress, params.selector, true, params)) };
|
83
|
+
}
|
84
|
+
async dispatchEvent(params, progress) {
|
85
|
+
return this._frame.dispatchEvent(progress, params.selector, params.type, (0, import_jsHandleDispatcher.parseArgument)(params.eventInit), params);
|
86
|
+
}
|
87
|
+
async evalOnSelector(params, progress) {
|
88
|
+
return { value: (0, import_jsHandleDispatcher.serializeResult)(await progress.race(this._frame.evalOnSelector(params.selector, !!params.strict, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg)))) };
|
89
|
+
}
|
90
|
+
async evalOnSelectorAll(params, progress) {
|
91
|
+
return { value: (0, import_jsHandleDispatcher.serializeResult)(await progress.race(this._frame.evalOnSelectorAll(params.selector, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg)))) };
|
92
|
+
}
|
93
|
+
async querySelector(params, progress) {
|
94
|
+
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.fromNullable(this, await progress.race(this._frame.querySelector(params.selector, params))) };
|
95
|
+
}
|
96
|
+
async querySelectorAll(params, progress) {
|
97
|
+
const elements = await progress.race(this._frame.querySelectorAll(params.selector));
|
98
|
+
return { elements: elements.map((e) => import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, e)) };
|
99
|
+
}
|
100
|
+
async queryCount(params, progress) {
|
101
|
+
return { value: await progress.race(this._frame.queryCount(params.selector, params)) };
|
102
|
+
}
|
103
|
+
async content(params, progress) {
|
104
|
+
return { value: await progress.race(this._frame.content()) };
|
105
|
+
}
|
106
|
+
async setContent(params, progress) {
|
107
|
+
return await this._frame.setContent(progress, params.html, params);
|
108
|
+
}
|
109
|
+
async addScriptTag(params, progress) {
|
110
|
+
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, await progress.race(this._frame.addScriptTag(params))) };
|
111
|
+
}
|
112
|
+
async addStyleTag(params, progress) {
|
113
|
+
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, await progress.race(this._frame.addStyleTag(params))) };
|
114
|
+
}
|
115
|
+
async click(params, progress) {
|
116
|
+
progress.metadata.potentiallyClosesScope = true;
|
117
|
+
return await this._frame.click(progress, params.selector, params);
|
118
|
+
}
|
119
|
+
async dblclick(params, progress) {
|
120
|
+
return await this._frame.dblclick(progress, params.selector, params);
|
121
|
+
}
|
122
|
+
async dragAndDrop(params, progress) {
|
123
|
+
return await this._frame.dragAndDrop(progress, params.source, params.target, params);
|
124
|
+
}
|
125
|
+
async tap(params, progress) {
|
126
|
+
return await this._frame.tap(progress, params.selector, params);
|
127
|
+
}
|
128
|
+
async fill(params, progress) {
|
129
|
+
return await this._frame.fill(progress, params.selector, params.value, params);
|
130
|
+
}
|
131
|
+
async focus(params, progress) {
|
132
|
+
await this._frame.focus(progress, params.selector, params);
|
133
|
+
}
|
134
|
+
async blur(params, progress) {
|
135
|
+
await this._frame.blur(progress, params.selector, params);
|
136
|
+
}
|
137
|
+
async textContent(params, progress) {
|
138
|
+
const value = await this._frame.textContent(progress, params.selector, params);
|
139
|
+
return { value: value === null ? void 0 : value };
|
140
|
+
}
|
141
|
+
async innerText(params, progress) {
|
142
|
+
return { value: await this._frame.innerText(progress, params.selector, params) };
|
143
|
+
}
|
144
|
+
async innerHTML(params, progress) {
|
145
|
+
return { value: await this._frame.innerHTML(progress, params.selector, params) };
|
146
|
+
}
|
147
|
+
async resolveSelector(params, progress) {
|
148
|
+
return await this._frame.resolveSelector(progress, params.selector);
|
149
|
+
}
|
150
|
+
async getAttribute(params, progress) {
|
151
|
+
const value = await this._frame.getAttribute(progress, params.selector, params.name, params);
|
152
|
+
return { value: value === null ? void 0 : value };
|
153
|
+
}
|
154
|
+
async inputValue(params, progress) {
|
155
|
+
const value = await this._frame.inputValue(progress, params.selector, params);
|
156
|
+
return { value };
|
157
|
+
}
|
158
|
+
async isChecked(params, progress) {
|
159
|
+
return { value: await this._frame.isChecked(progress, params.selector, params) };
|
160
|
+
}
|
161
|
+
async isDisabled(params, progress) {
|
162
|
+
return { value: await this._frame.isDisabled(progress, params.selector, params) };
|
163
|
+
}
|
164
|
+
async isEditable(params, progress) {
|
165
|
+
return { value: await this._frame.isEditable(progress, params.selector, params) };
|
166
|
+
}
|
167
|
+
async isEnabled(params, progress) {
|
168
|
+
return { value: await this._frame.isEnabled(progress, params.selector, params) };
|
169
|
+
}
|
170
|
+
async isHidden(params, progress) {
|
171
|
+
return { value: await this._frame.isHidden(progress, params.selector, params) };
|
172
|
+
}
|
173
|
+
async isVisible(params, progress) {
|
174
|
+
return { value: await this._frame.isVisible(progress, params.selector, params) };
|
175
|
+
}
|
176
|
+
async hover(params, progress) {
|
177
|
+
return await this._frame.hover(progress, params.selector, params);
|
178
|
+
}
|
179
|
+
async selectOption(params, progress) {
|
180
|
+
const elements = (params.elements || []).map((e) => e._elementHandle);
|
181
|
+
return { values: await this._frame.selectOption(progress, params.selector, elements, params.options || [], params) };
|
182
|
+
}
|
183
|
+
async setInputFiles(params, progress) {
|
184
|
+
return await this._frame.setInputFiles(progress, params.selector, params);
|
185
|
+
}
|
186
|
+
async type(params, progress) {
|
187
|
+
return await this._frame.type(progress, params.selector, params.text, params);
|
188
|
+
}
|
189
|
+
async press(params, progress) {
|
190
|
+
return await this._frame.press(progress, params.selector, params.key, params);
|
191
|
+
}
|
192
|
+
async check(params, progress) {
|
193
|
+
return await this._frame.check(progress, params.selector, params);
|
194
|
+
}
|
195
|
+
async uncheck(params, progress) {
|
196
|
+
return await this._frame.uncheck(progress, params.selector, params);
|
197
|
+
}
|
198
|
+
async waitForTimeout(params, progress) {
|
199
|
+
return await this._frame.waitForTimeout(progress, params.waitTimeout);
|
200
|
+
}
|
201
|
+
async waitForFunction(params, progress) {
|
202
|
+
return { handle: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this, await this._frame.waitForFunctionExpression(progress, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg), params)) };
|
203
|
+
}
|
204
|
+
async title(params, progress) {
|
205
|
+
return { value: await progress.race(this._frame.title()) };
|
206
|
+
}
|
207
|
+
async highlight(params, progress) {
|
208
|
+
return await this._frame.highlight(progress, params.selector);
|
209
|
+
}
|
210
|
+
async expect(params, progress) {
|
211
|
+
progress.metadata.potentiallyClosesScope = true;
|
212
|
+
let expectedValue = params.expectedValue ? (0, import_jsHandleDispatcher.parseArgument)(params.expectedValue) : void 0;
|
213
|
+
if (params.expression === "to.match.aria" && expectedValue)
|
214
|
+
expectedValue = (0, import_ariaSnapshot.parseAriaSnapshotUnsafe)(import_utilsBundle.yaml, expectedValue);
|
215
|
+
const result = await this._frame.expect(progress, params.selector, { ...params, expectedValue }, params.timeout);
|
216
|
+
if (result.received !== void 0)
|
217
|
+
result.received = (0, import_jsHandleDispatcher.serializeResult)(result.received);
|
218
|
+
return result;
|
219
|
+
}
|
220
|
+
async ariaSnapshot(params, progress) {
|
221
|
+
return { snapshot: await this._frame.ariaSnapshot(progress, params.selector) };
|
222
|
+
}
|
223
|
+
}
|
224
|
+
// Annotate the CommonJS export names for ESM import in node:
|
225
|
+
0 && (module.exports = {
|
226
|
+
FrameDispatcher
|
227
|
+
});
|
@@ -0,0 +1,85 @@
|
|
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 jsHandleDispatcher_exports = {};
|
20
|
+
__export(jsHandleDispatcher_exports, {
|
21
|
+
JSHandleDispatcher: () => JSHandleDispatcher,
|
22
|
+
parseArgument: () => parseArgument,
|
23
|
+
parseValue: () => parseValue,
|
24
|
+
serializeResult: () => serializeResult
|
25
|
+
});
|
26
|
+
module.exports = __toCommonJS(jsHandleDispatcher_exports);
|
27
|
+
var import_dispatcher = require("./dispatcher");
|
28
|
+
var import_elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
29
|
+
var import_serializers = require("../../protocol/serializers");
|
30
|
+
class JSHandleDispatcher extends import_dispatcher.Dispatcher {
|
31
|
+
constructor(scope, jsHandle) {
|
32
|
+
super(scope, jsHandle, jsHandle.asElement() ? "ElementHandle" : "JSHandle", {
|
33
|
+
preview: jsHandle.toString()
|
34
|
+
});
|
35
|
+
this._type_JSHandle = true;
|
36
|
+
jsHandle._setPreviewCallback((preview) => this._dispatchEvent("previewUpdated", { preview }));
|
37
|
+
}
|
38
|
+
static fromJSHandle(scope, handle) {
|
39
|
+
return scope.connection.existingDispatcher(handle) || new JSHandleDispatcher(scope, handle);
|
40
|
+
}
|
41
|
+
async evaluateExpression(params, progress) {
|
42
|
+
const jsHandle = await progress.race(this._object.evaluateExpression(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg)));
|
43
|
+
return { value: serializeResult(jsHandle) };
|
44
|
+
}
|
45
|
+
async evaluateExpressionHandle(params, progress) {
|
46
|
+
const jsHandle = await progress.race(this._object.evaluateExpressionHandle(params.expression, { isFunction: params.isFunction }, parseArgument(params.arg)));
|
47
|
+
return { handle: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this.parentScope(), jsHandle) };
|
48
|
+
}
|
49
|
+
async getProperty(params, progress) {
|
50
|
+
const jsHandle = await progress.race(this._object.getProperty(params.name));
|
51
|
+
return { handle: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this.parentScope(), jsHandle) };
|
52
|
+
}
|
53
|
+
async getPropertyList(params, progress) {
|
54
|
+
const map = await progress.race(this._object.getProperties());
|
55
|
+
const properties = [];
|
56
|
+
for (const [name, value] of map) {
|
57
|
+
properties.push({ name, value: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this.parentScope(), value) });
|
58
|
+
}
|
59
|
+
return { properties };
|
60
|
+
}
|
61
|
+
async jsonValue(params, progress) {
|
62
|
+
return { value: serializeResult(await progress.race(this._object.jsonValue())) };
|
63
|
+
}
|
64
|
+
async dispose(_, progress) {
|
65
|
+
progress.metadata.potentiallyClosesScope = true;
|
66
|
+
this._object.dispose();
|
67
|
+
this._dispose();
|
68
|
+
}
|
69
|
+
}
|
70
|
+
function parseArgument(arg) {
|
71
|
+
return (0, import_serializers.parseSerializedValue)(arg.value, arg.handles.map((a) => a._object));
|
72
|
+
}
|
73
|
+
function parseValue(v) {
|
74
|
+
return (0, import_serializers.parseSerializedValue)(v, []);
|
75
|
+
}
|
76
|
+
function serializeResult(arg) {
|
77
|
+
return (0, import_serializers.serializeValue)(arg, (value) => ({ fallThrough: value }));
|
78
|
+
}
|
79
|
+
// Annotate the CommonJS export names for ESM import in node:
|
80
|
+
0 && (module.exports = {
|
81
|
+
JSHandleDispatcher,
|
82
|
+
parseArgument,
|
83
|
+
parseValue,
|
84
|
+
serializeResult
|
85
|
+
});
|
@@ -0,0 +1,58 @@
|
|
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 jsonPipeDispatcher_exports = {};
|
20
|
+
__export(jsonPipeDispatcher_exports, {
|
21
|
+
JsonPipeDispatcher: () => JsonPipeDispatcher
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(jsonPipeDispatcher_exports);
|
24
|
+
var import_dispatcher = require("./dispatcher");
|
25
|
+
var import_instrumentation = require("../instrumentation");
|
26
|
+
class JsonPipeDispatcher extends import_dispatcher.Dispatcher {
|
27
|
+
constructor(scope) {
|
28
|
+
super(scope, new import_instrumentation.SdkObject(scope._object, "jsonPipe"), "JsonPipe", {});
|
29
|
+
this._type_JsonPipe = true;
|
30
|
+
}
|
31
|
+
async send(params, progress) {
|
32
|
+
this.emit("message", params.message);
|
33
|
+
}
|
34
|
+
async close(params, progress) {
|
35
|
+
this.emit("close");
|
36
|
+
if (!this._disposed) {
|
37
|
+
this._dispatchEvent("closed", {});
|
38
|
+
this._dispose();
|
39
|
+
}
|
40
|
+
}
|
41
|
+
dispatch(message) {
|
42
|
+
if (!this._disposed)
|
43
|
+
this._dispatchEvent("message", { message });
|
44
|
+
}
|
45
|
+
wasClosed(reason) {
|
46
|
+
if (!this._disposed) {
|
47
|
+
this._dispatchEvent("closed", { reason });
|
48
|
+
this._dispose();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
dispose() {
|
52
|
+
this._dispose();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
56
|
+
0 && (module.exports = {
|
57
|
+
JsonPipeDispatcher
|
58
|
+
});
|
@@ -0,0 +1,149 @@
|
|
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 localUtilsDispatcher_exports = {};
|
30
|
+
__export(localUtilsDispatcher_exports, {
|
31
|
+
LocalUtilsDispatcher: () => LocalUtilsDispatcher
|
32
|
+
});
|
33
|
+
module.exports = __toCommonJS(localUtilsDispatcher_exports);
|
34
|
+
var import_dispatcher = require("./dispatcher");
|
35
|
+
var import_instrumentation = require("../../server/instrumentation");
|
36
|
+
var localUtils = __toESM(require("../localUtils"));
|
37
|
+
var import_userAgent = require("../utils/userAgent");
|
38
|
+
var import_deviceDescriptors = require("../deviceDescriptors");
|
39
|
+
var import_jsonPipeDispatcher = require("../dispatchers/jsonPipeDispatcher");
|
40
|
+
var import_socksInterceptor = require("../socksInterceptor");
|
41
|
+
var import_transport = require("../transport");
|
42
|
+
var import_network = require("../utils/network");
|
43
|
+
var import_urlMatch = require("../../utils/isomorphic/urlMatch");
|
44
|
+
class LocalUtilsDispatcher extends import_dispatcher.Dispatcher {
|
45
|
+
constructor(scope, playwright) {
|
46
|
+
const localUtils2 = new import_instrumentation.SdkObject(playwright, "localUtils", "localUtils");
|
47
|
+
localUtils2.logName = "browser";
|
48
|
+
const deviceDescriptors = Object.entries(import_deviceDescriptors.deviceDescriptors).map(([name, descriptor]) => ({ name, descriptor }));
|
49
|
+
super(scope, localUtils2, "LocalUtils", {
|
50
|
+
deviceDescriptors
|
51
|
+
});
|
52
|
+
this._harBackends = /* @__PURE__ */ new Map();
|
53
|
+
this._stackSessions = /* @__PURE__ */ new Map();
|
54
|
+
this._type_LocalUtils = true;
|
55
|
+
}
|
56
|
+
async zip(params, progress) {
|
57
|
+
return await localUtils.zip(progress, this._stackSessions, params);
|
58
|
+
}
|
59
|
+
async harOpen(params, progress) {
|
60
|
+
return await localUtils.harOpen(progress, this._harBackends, params);
|
61
|
+
}
|
62
|
+
async harLookup(params, progress) {
|
63
|
+
return await localUtils.harLookup(progress, this._harBackends, params);
|
64
|
+
}
|
65
|
+
async harClose(params, progress) {
|
66
|
+
localUtils.harClose(this._harBackends, params);
|
67
|
+
}
|
68
|
+
async harUnzip(params, progress) {
|
69
|
+
return await localUtils.harUnzip(progress, params);
|
70
|
+
}
|
71
|
+
async tracingStarted(params, progress) {
|
72
|
+
return await localUtils.tracingStarted(progress, this._stackSessions, params);
|
73
|
+
}
|
74
|
+
async traceDiscarded(params, progress) {
|
75
|
+
return await localUtils.traceDiscarded(progress, this._stackSessions, params);
|
76
|
+
}
|
77
|
+
async addStackToTracingNoReply(params, progress) {
|
78
|
+
localUtils.addStackToTracingNoReply(this._stackSessions, params);
|
79
|
+
}
|
80
|
+
async connect(params, progress) {
|
81
|
+
const wsHeaders = {
|
82
|
+
"User-Agent": (0, import_userAgent.getUserAgent)(),
|
83
|
+
"x-playwright-proxy": params.exposeNetwork ?? "",
|
84
|
+
...params.headers
|
85
|
+
};
|
86
|
+
const wsEndpoint = await urlToWSEndpoint(progress, params.wsEndpoint);
|
87
|
+
const transport = await import_transport.WebSocketTransport.connect(progress, wsEndpoint, { headers: wsHeaders, followRedirects: true, debugLogHeader: "x-playwright-debug-log" });
|
88
|
+
const socksInterceptor = new import_socksInterceptor.SocksInterceptor(transport, params.exposeNetwork, params.socksProxyRedirectPortForTest);
|
89
|
+
const pipe = new import_jsonPipeDispatcher.JsonPipeDispatcher(this);
|
90
|
+
transport.onmessage = (json) => {
|
91
|
+
if (socksInterceptor.interceptMessage(json))
|
92
|
+
return;
|
93
|
+
const cb = () => {
|
94
|
+
try {
|
95
|
+
pipe.dispatch(json);
|
96
|
+
} catch (e) {
|
97
|
+
transport.close();
|
98
|
+
}
|
99
|
+
};
|
100
|
+
if (params.slowMo)
|
101
|
+
setTimeout(cb, params.slowMo);
|
102
|
+
else
|
103
|
+
cb();
|
104
|
+
};
|
105
|
+
pipe.on("message", (message) => {
|
106
|
+
transport.send(message);
|
107
|
+
});
|
108
|
+
transport.onclose = (reason) => {
|
109
|
+
socksInterceptor?.cleanup();
|
110
|
+
pipe.wasClosed(reason);
|
111
|
+
};
|
112
|
+
pipe.on("close", () => transport.close());
|
113
|
+
return { pipe, headers: transport.headers };
|
114
|
+
}
|
115
|
+
async globToRegex(params, progress) {
|
116
|
+
const regex = (0, import_urlMatch.resolveGlobToRegexPattern)(params.baseURL, params.glob, params.webSocketUrl);
|
117
|
+
return { regex };
|
118
|
+
}
|
119
|
+
}
|
120
|
+
async function urlToWSEndpoint(progress, endpointURL) {
|
121
|
+
if (endpointURL.startsWith("ws"))
|
122
|
+
return endpointURL;
|
123
|
+
progress.log(`<ws preparing> retrieving websocket url from ${endpointURL}`);
|
124
|
+
const fetchUrl = new URL(endpointURL);
|
125
|
+
if (!fetchUrl.pathname.endsWith("/"))
|
126
|
+
fetchUrl.pathname += "/";
|
127
|
+
fetchUrl.pathname += "json";
|
128
|
+
const json = await (0, import_network.fetchData)(progress, {
|
129
|
+
url: fetchUrl.toString(),
|
130
|
+
method: "GET",
|
131
|
+
headers: { "User-Agent": (0, import_userAgent.getUserAgent)() }
|
132
|
+
}, async (params, response) => {
|
133
|
+
return new Error(`Unexpected status ${response.statusCode} when connecting to ${fetchUrl.toString()}.
|
134
|
+
This does not look like a Playwright server, try connecting via ws://.`);
|
135
|
+
});
|
136
|
+
const wsUrl = new URL(endpointURL);
|
137
|
+
let wsEndpointPath = JSON.parse(json).wsEndpointPath;
|
138
|
+
if (wsEndpointPath.startsWith("/"))
|
139
|
+
wsEndpointPath = wsEndpointPath.substring(1);
|
140
|
+
if (!wsUrl.pathname.endsWith("/"))
|
141
|
+
wsUrl.pathname += "/";
|
142
|
+
wsUrl.pathname += wsEndpointPath;
|
143
|
+
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
144
|
+
return wsUrl.toString();
|
145
|
+
}
|
146
|
+
// Annotate the CommonJS export names for ESM import in node:
|
147
|
+
0 && (module.exports = {
|
148
|
+
LocalUtilsDispatcher
|
149
|
+
});
|