@pedropaulovc/playwright-core 1.59.0-next
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/README.md +3 -0
- package/ThirdPartyNotices.txt +4076 -0
- package/bin/install_media_pack.ps1 +5 -0
- package/bin/install_webkit_wsl.ps1 +33 -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 +79 -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/driver.js +97 -0
- package/lib/cli/program.js +603 -0
- package/lib/cli/programWithTestStub.js +74 -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 +161 -0
- package/lib/client/browserContext.js +582 -0
- package/lib/client/browserType.js +185 -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 +318 -0
- package/lib/client/consoleMessage.js +58 -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 +284 -0
- package/lib/client/errors.js +77 -0
- package/lib/client/eventEmitter.js +314 -0
- package/lib/client/events.js +103 -0
- package/lib/client/fetch.js +368 -0
- package/lib/client/fileChooser.js +46 -0
- package/lib/client/fileUtils.js +34 -0
- package/lib/client/frame.js +409 -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 +369 -0
- package/lib/client/network.js +747 -0
- package/lib/client/page.js +745 -0
- package/lib/client/pageAgent.js +64 -0
- package/lib/client/platform.js +77 -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 +119 -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 +85 -0
- package/lib/client/writableStream.js +39 -0
- package/lib/generated/bindingsControllerSource.js +28 -0
- package/lib/generated/clockSource.js +28 -0
- package/lib/generated/injectedScriptSource.js +28 -0
- package/lib/generated/pollingRecorderSource.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/inProcessFactory.js +60 -0
- package/lib/inprocess.js +3 -0
- package/lib/mcpBundle.js +84 -0
- package/lib/mcpBundleImpl/index.js +147 -0
- package/lib/outofprocess.js +76 -0
- package/lib/protocol/serializers.js +197 -0
- package/lib/protocol/validator.js +2969 -0
- package/lib/protocol/validatorPrimitives.js +193 -0
- package/lib/remote/playwrightConnection.js +129 -0
- package/lib/remote/playwrightServer.js +334 -0
- package/lib/server/agent/actionRunner.js +335 -0
- package/lib/server/agent/actions.js +128 -0
- package/lib/server/agent/codegen.js +111 -0
- package/lib/server/agent/context.js +150 -0
- package/lib/server/agent/expectTools.js +156 -0
- package/lib/server/agent/pageAgent.js +204 -0
- package/lib/server/agent/performTools.js +262 -0
- package/lib/server/agent/tool.js +109 -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 +549 -0
- package/lib/server/bidi/bidiChromium.js +148 -0
- package/lib/server/bidi/bidiConnection.js +213 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +267 -0
- package/lib/server/bidi/bidiFirefox.js +128 -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 +583 -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/bidiKeyboard.js +256 -0
- package/lib/server/bidi/third_party/bidiProtocol.js +24 -0
- package/lib/server/bidi/third_party/bidiProtocolCore.js +180 -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 +702 -0
- package/lib/server/browserType.js +336 -0
- package/lib/server/callLog.js +82 -0
- package/lib/server/chromium/appIcon.png +0 -0
- package/lib/server/chromium/chromium.js +395 -0
- package/lib/server/chromium/chromiumSwitches.js +104 -0
- package/lib/server/chromium/crBrowser.js +511 -0
- package/lib/server/chromium/crConnection.js +197 -0
- package/lib/server/chromium/crCoverage.js +235 -0
- package/lib/server/chromium/crDevTools.js +111 -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 +707 -0
- package/lib/server/chromium/crPage.js +1001 -0
- package/lib/server/chromium/crPdf.js +121 -0
- package/lib/server/chromium/crProtocolHelper.js +145 -0
- package/lib/server/chromium/crServiceWorker.js +136 -0
- package/lib/server/chromium/defaultFontFamilies.js +162 -0
- package/lib/server/chromium/protocol.d.js +16 -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 +247 -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 +57 -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 +384 -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 +364 -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/pageAgentDispatcher.js +96 -0
- package/lib/server/dispatchers/pageDispatcher.js +393 -0
- package/lib/server/dispatchers/playwrightDispatcher.js +108 -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 +815 -0
- package/lib/server/download.js +70 -0
- package/lib/server/electron/electron.js +273 -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/ffBrowser.js +418 -0
- package/lib/server/firefox/ffConnection.js +142 -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 +497 -0
- package/lib/server/firefox/firefox.js +114 -0
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/formData.js +147 -0
- package/lib/server/frameSelectors.js +160 -0
- package/lib/server/frames.js +1471 -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 +277 -0
- package/lib/server/instrumentation.js +72 -0
- package/lib/server/javascript.js +291 -0
- package/lib/server/launchApp.js +128 -0
- package/lib/server/localUtils.js +214 -0
- package/lib/server/macEditingCommands.js +143 -0
- package/lib/server/network.js +667 -0
- package/lib/server/page.js +830 -0
- package/lib/server/pipeTransport.js +89 -0
- package/lib/server/playwright.js +69 -0
- package/lib/server/progress.js +132 -0
- package/lib/server/protocolError.js +52 -0
- package/lib/server/recorder/chat.js +161 -0
- package/lib/server/recorder/recorderApp.js +366 -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.js +499 -0
- package/lib/server/registry/browserFetcher.js +177 -0
- package/lib/server/registry/dependencies.js +371 -0
- package/lib/server/registry/index.js +1422 -0
- package/lib/server/registry/nativeDeps.js +1280 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +127 -0
- package/lib/server/screencast.js +190 -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/trace/recorder/snapshotter.js +147 -0
- package/lib/server/trace/recorder/snapshotterInjected.js +561 -0
- package/lib/server/trace/recorder/tracing.js +604 -0
- package/lib/server/trace/viewer/traceExporter.js +679 -0
- package/lib/server/trace/viewer/traceParser.js +72 -0
- package/lib/server/trace/viewer/traceViewer.js +245 -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 +139 -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 +123 -0
- package/lib/server/utils/fileUtils.js +191 -0
- package/lib/server/utils/happyEyeballs.js +207 -0
- package/lib/server/utils/hostPlatform.js +123 -0
- package/lib/server/utils/httpServer.js +203 -0
- package/lib/server/utils/imageUtils.js +141 -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 +242 -0
- package/lib/server/utils/nodePlatform.js +154 -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/videoRecorder.js +124 -0
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/server/webkit/webkit.js +108 -0
- package/lib/server/webkit/wkBrowser.js +335 -0
- package/lib/server/webkit/wkConnection.js +144 -0
- package/lib/server/webkit/wkExecutionContext.js +154 -0
- package/lib/server/webkit/wkInput.js +181 -0
- package/lib/server/webkit/wkInterceptableRequest.js +197 -0
- package/lib/server/webkit/wkPage.js +1158 -0
- package/lib/server/webkit/wkProvisionalPage.js +83 -0
- package/lib/server/webkit/wkWorkers.js +105 -0
- package/lib/third_party/pixelmatch.js +255 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +455 -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 +689 -0
- package/lib/utils/isomorphic/locatorParser.js +176 -0
- package/lib/utils/isomorphic/locatorUtils.js +81 -0
- package/lib/utils/isomorphic/lruCache.js +51 -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 +81 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +330 -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 +204 -0
- package/lib/utils/isomorphic/time.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +66 -0
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
- package/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
- package/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
- package/lib/utils/isomorphic/trace/traceLoader.js +131 -0
- package/lib/utils/isomorphic/trace/traceModel.js +365 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
- package/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
- package/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
- package/lib/utils/isomorphic/traceUtils.js +58 -0
- package/lib/utils/isomorphic/types.js +16 -0
- package/lib/utils/isomorphic/urlMatch.js +190 -0
- package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +111 -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-DYBRYzYX.css +1 -0
- package/lib/vite/recorder/assets/codeMirrorModule-DadYNm1I.js +32 -0
- package/lib/vite/recorder/assets/codicon-DCmgc-ay.ttf +0 -0
- package/lib/vite/recorder/assets/index-BSjZa4pk.css +1 -0
- package/lib/vite/recorder/assets/index-BhTWtUlo.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-DwzBH9eL.js +32 -0
- package/lib/vite/traceViewer/assets/codeMirrorModule-a5XoALAZ.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js +266 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-CdCX8877.js +266 -0
- package/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +9 -0
- package/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +1 -0
- package/lib/vite/traceViewer/codicon.DCmgc-ay.ttf +0 -0
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +1 -0
- package/lib/vite/traceViewer/index.BVu7tZDe.css +1 -0
- package/lib/vite/traceViewer/index.Dd9jebqr.js +2 -0
- package/lib/vite/traceViewer/index.f4OcrOqs.js +2 -0
- package/lib/vite/traceViewer/index.html +43 -0
- package/lib/vite/traceViewer/manifest.webmanifest +16 -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 +5 -0
- package/lib/vite/traceViewer/uiMode.Btcz36p_.css +1 -0
- package/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +17 -0
- package/lib/vite/traceViewer/uiMode.qcahlSup.js +5 -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 +23824 -0
- package/types/structs.d.ts +45 -0
- package/types/types.d.ts +22843 -0
|
@@ -0,0 +1,121 @@
|
|
|
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 wsServer_exports = {};
|
|
20
|
+
__export(wsServer_exports, {
|
|
21
|
+
WSServer: () => WSServer,
|
|
22
|
+
perMessageDeflate: () => perMessageDeflate
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(wsServer_exports);
|
|
25
|
+
var import_network = require("./network");
|
|
26
|
+
var import_utilsBundle = require("../../utilsBundle");
|
|
27
|
+
var import_debugLogger = require("./debugLogger");
|
|
28
|
+
let lastConnectionId = 0;
|
|
29
|
+
const kConnectionSymbol = Symbol("kConnection");
|
|
30
|
+
const perMessageDeflate = {
|
|
31
|
+
serverNoContextTakeover: true,
|
|
32
|
+
zlibDeflateOptions: {
|
|
33
|
+
level: 3
|
|
34
|
+
},
|
|
35
|
+
zlibInflateOptions: {
|
|
36
|
+
chunkSize: 10 * 1024
|
|
37
|
+
},
|
|
38
|
+
threshold: 10 * 1024
|
|
39
|
+
};
|
|
40
|
+
class WSServer {
|
|
41
|
+
constructor(delegate) {
|
|
42
|
+
this._delegate = delegate;
|
|
43
|
+
}
|
|
44
|
+
async listen(port = 0, hostname, path) {
|
|
45
|
+
import_debugLogger.debugLogger.log("server", `Server started at ${/* @__PURE__ */ new Date()}`);
|
|
46
|
+
const server = (0, import_network.createHttpServer)(this._delegate.onRequest);
|
|
47
|
+
server.on("error", (error) => import_debugLogger.debugLogger.log("server", String(error)));
|
|
48
|
+
this.server = server;
|
|
49
|
+
const wsEndpoint = await new Promise((resolve, reject) => {
|
|
50
|
+
server.listen(port, hostname, () => {
|
|
51
|
+
const address = server.address();
|
|
52
|
+
if (!address) {
|
|
53
|
+
reject(new Error("Could not bind server socket"));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const wsEndpoint2 = typeof address === "string" ? `${address}${path}` : `ws://${hostname || "localhost"}:${address.port}${path}`;
|
|
57
|
+
resolve(wsEndpoint2);
|
|
58
|
+
}).on("error", reject);
|
|
59
|
+
});
|
|
60
|
+
import_debugLogger.debugLogger.log("server", "Listening at " + wsEndpoint);
|
|
61
|
+
this._wsServer = new import_utilsBundle.wsServer({
|
|
62
|
+
noServer: true,
|
|
63
|
+
perMessageDeflate
|
|
64
|
+
});
|
|
65
|
+
this._wsServer.on("headers", (headers) => this._delegate.onHeaders(headers));
|
|
66
|
+
server.on("upgrade", (request, socket, head) => {
|
|
67
|
+
const pathname = new URL("http://localhost" + request.url).pathname;
|
|
68
|
+
if (pathname !== path) {
|
|
69
|
+
socket.write(`HTTP/${request.httpVersion} 400 Bad Request\r
|
|
70
|
+
\r
|
|
71
|
+
`);
|
|
72
|
+
socket.destroy();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const upgradeResult = this._delegate.onUpgrade(request, socket);
|
|
76
|
+
if (upgradeResult) {
|
|
77
|
+
socket.write(upgradeResult.error);
|
|
78
|
+
socket.destroy();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
this._wsServer.handleUpgrade(request, socket, head, (ws) => this._wsServer.emit("connection", ws, request));
|
|
82
|
+
});
|
|
83
|
+
this._wsServer.on("connection", (ws, request) => {
|
|
84
|
+
import_debugLogger.debugLogger.log("server", "Connected client ws.extension=" + ws.extensions);
|
|
85
|
+
const url = new URL("http://localhost" + (request.url || ""));
|
|
86
|
+
const id = String(++lastConnectionId);
|
|
87
|
+
import_debugLogger.debugLogger.log("server", `[${id}] serving connection: ${request.url}`);
|
|
88
|
+
const connection = this._delegate.onConnection(request, url, ws, id);
|
|
89
|
+
ws[kConnectionSymbol] = connection;
|
|
90
|
+
});
|
|
91
|
+
return wsEndpoint;
|
|
92
|
+
}
|
|
93
|
+
async close() {
|
|
94
|
+
const server = this._wsServer;
|
|
95
|
+
if (!server)
|
|
96
|
+
return;
|
|
97
|
+
import_debugLogger.debugLogger.log("server", "closing websocket server");
|
|
98
|
+
const waitForClose = new Promise((f) => server.close(f));
|
|
99
|
+
await Promise.all(Array.from(server.clients).map(async (ws) => {
|
|
100
|
+
const connection = ws[kConnectionSymbol];
|
|
101
|
+
if (connection)
|
|
102
|
+
await connection.close();
|
|
103
|
+
try {
|
|
104
|
+
ws.terminate();
|
|
105
|
+
} catch (e) {
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
await waitForClose;
|
|
109
|
+
import_debugLogger.debugLogger.log("server", "closing http server");
|
|
110
|
+
if (this.server)
|
|
111
|
+
await new Promise((f) => this.server.close(f));
|
|
112
|
+
this._wsServer = void 0;
|
|
113
|
+
this.server = void 0;
|
|
114
|
+
import_debugLogger.debugLogger.log("server", "closed server");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
WSServer,
|
|
120
|
+
perMessageDeflate
|
|
121
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
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 zipFile_exports = {};
|
|
20
|
+
__export(zipFile_exports, {
|
|
21
|
+
ZipFile: () => ZipFile
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(zipFile_exports);
|
|
24
|
+
var import_zipBundle = require("../../zipBundle");
|
|
25
|
+
class ZipFile {
|
|
26
|
+
constructor(fileName) {
|
|
27
|
+
this._entries = /* @__PURE__ */ new Map();
|
|
28
|
+
this._fileName = fileName;
|
|
29
|
+
this._openedPromise = this._open();
|
|
30
|
+
}
|
|
31
|
+
async _open() {
|
|
32
|
+
await new Promise((fulfill, reject) => {
|
|
33
|
+
import_zipBundle.yauzl.open(this._fileName, { autoClose: false }, (e, z) => {
|
|
34
|
+
if (e) {
|
|
35
|
+
reject(e);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this._zipFile = z;
|
|
39
|
+
this._zipFile.on("entry", (entry) => {
|
|
40
|
+
this._entries.set(entry.fileName, entry);
|
|
41
|
+
});
|
|
42
|
+
this._zipFile.on("end", fulfill);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async entries() {
|
|
47
|
+
await this._openedPromise;
|
|
48
|
+
return [...this._entries.keys()];
|
|
49
|
+
}
|
|
50
|
+
async read(entryPath) {
|
|
51
|
+
await this._openedPromise;
|
|
52
|
+
const entry = this._entries.get(entryPath);
|
|
53
|
+
if (!entry)
|
|
54
|
+
throw new Error(`${entryPath} not found in file ${this._fileName}`);
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
this._zipFile.openReadStream(entry, (error, readStream) => {
|
|
57
|
+
if (error || !readStream) {
|
|
58
|
+
reject(error || "Entry not found");
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const buffers = [];
|
|
62
|
+
readStream.on("data", (data) => buffers.push(data));
|
|
63
|
+
readStream.on("end", () => resolve(Buffer.concat(buffers)));
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
close() {
|
|
68
|
+
this._zipFile?.close();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
72
|
+
0 && (module.exports = {
|
|
73
|
+
ZipFile
|
|
74
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
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 zones_exports = {};
|
|
20
|
+
__export(zones_exports, {
|
|
21
|
+
Zone: () => Zone,
|
|
22
|
+
currentZone: () => currentZone,
|
|
23
|
+
emptyZone: () => emptyZone
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(zones_exports);
|
|
26
|
+
var import_async_hooks = require("async_hooks");
|
|
27
|
+
const asyncLocalStorage = new import_async_hooks.AsyncLocalStorage();
|
|
28
|
+
class Zone {
|
|
29
|
+
constructor(asyncLocalStorage2, store) {
|
|
30
|
+
this._asyncLocalStorage = asyncLocalStorage2;
|
|
31
|
+
this._data = store;
|
|
32
|
+
}
|
|
33
|
+
with(type, data) {
|
|
34
|
+
return new Zone(this._asyncLocalStorage, new Map(this._data).set(type, data));
|
|
35
|
+
}
|
|
36
|
+
without(type) {
|
|
37
|
+
const data = type ? new Map(this._data) : /* @__PURE__ */ new Map();
|
|
38
|
+
data.delete(type);
|
|
39
|
+
return new Zone(this._asyncLocalStorage, data);
|
|
40
|
+
}
|
|
41
|
+
run(func) {
|
|
42
|
+
return this._asyncLocalStorage.run(this, func);
|
|
43
|
+
}
|
|
44
|
+
data(type) {
|
|
45
|
+
return this._data.get(type);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const emptyZone = new Zone(asyncLocalStorage, /* @__PURE__ */ new Map());
|
|
49
|
+
function currentZone() {
|
|
50
|
+
return asyncLocalStorage.getStore() ?? emptyZone;
|
|
51
|
+
}
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
Zone,
|
|
55
|
+
currentZone,
|
|
56
|
+
emptyZone
|
|
57
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
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 videoRecorder_exports = {};
|
|
20
|
+
__export(videoRecorder_exports, {
|
|
21
|
+
VideoRecorder: () => VideoRecorder
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(videoRecorder_exports);
|
|
24
|
+
var import_utils = require("../utils");
|
|
25
|
+
var import_processLauncher = require("./utils/processLauncher");
|
|
26
|
+
const fps = 25;
|
|
27
|
+
class VideoRecorder {
|
|
28
|
+
constructor(ffmpegPath, options) {
|
|
29
|
+
this._process = null;
|
|
30
|
+
this._gracefullyClose = null;
|
|
31
|
+
this._lastWritePromise = Promise.resolve();
|
|
32
|
+
this._firstFrameTimestamp = 0;
|
|
33
|
+
this._lastFrame = null;
|
|
34
|
+
this._lastWriteNodeTime = 0;
|
|
35
|
+
this._frameQueue = [];
|
|
36
|
+
this._isStopped = false;
|
|
37
|
+
this._ffmpegPath = ffmpegPath;
|
|
38
|
+
if (!options.outputFile.endsWith(".webm"))
|
|
39
|
+
throw new Error("File must have .webm extension");
|
|
40
|
+
this._launchPromise = this._launch(options).catch((e) => e);
|
|
41
|
+
}
|
|
42
|
+
async _launch(options) {
|
|
43
|
+
await (0, import_utils.mkdirIfNeeded)(options.outputFile);
|
|
44
|
+
const w = options.width;
|
|
45
|
+
const h = options.height;
|
|
46
|
+
const args = `-loglevel error -f image2pipe -avioflags direct -fpsprobesize 0 -probesize 32 -analyzeduration 0 -c:v mjpeg -i pipe:0 -y -an -r ${fps} -c:v vp8 -qmin 0 -qmax 50 -crf 8 -deadline realtime -speed 8 -b:v 1M -threads 1 -vf pad=${w}:${h}:0:0:gray,crop=${w}:${h}:0:0`.split(" ");
|
|
47
|
+
args.push(options.outputFile);
|
|
48
|
+
const { launchedProcess, gracefullyClose } = await (0, import_processLauncher.launchProcess)({
|
|
49
|
+
command: this._ffmpegPath,
|
|
50
|
+
args,
|
|
51
|
+
stdio: "stdin",
|
|
52
|
+
log: (message) => import_utils.debugLogger.log("browser", message),
|
|
53
|
+
tempDirectories: [],
|
|
54
|
+
attemptToGracefullyClose: async () => {
|
|
55
|
+
import_utils.debugLogger.log("browser", "Closing stdin...");
|
|
56
|
+
launchedProcess.stdin.end();
|
|
57
|
+
},
|
|
58
|
+
onExit: (exitCode, signal) => {
|
|
59
|
+
import_utils.debugLogger.log("browser", `ffmpeg onkill exitCode=${exitCode} signal=${signal}`);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
launchedProcess.stdin.on("finish", () => {
|
|
63
|
+
import_utils.debugLogger.log("browser", "ffmpeg finished input.");
|
|
64
|
+
});
|
|
65
|
+
launchedProcess.stdin.on("error", () => {
|
|
66
|
+
import_utils.debugLogger.log("browser", "ffmpeg error.");
|
|
67
|
+
});
|
|
68
|
+
this._process = launchedProcess;
|
|
69
|
+
this._gracefullyClose = gracefullyClose;
|
|
70
|
+
}
|
|
71
|
+
writeFrame(frame, timestamp) {
|
|
72
|
+
this._launchPromise.then((error) => {
|
|
73
|
+
if (error)
|
|
74
|
+
return;
|
|
75
|
+
this._writeFrame(frame, timestamp);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
_writeFrame(frame, timestamp) {
|
|
79
|
+
(0, import_utils.assert)(this._process);
|
|
80
|
+
if (this._isStopped)
|
|
81
|
+
return;
|
|
82
|
+
if (!this._firstFrameTimestamp)
|
|
83
|
+
this._firstFrameTimestamp = timestamp;
|
|
84
|
+
const frameNumber = Math.floor((timestamp - this._firstFrameTimestamp) * fps);
|
|
85
|
+
if (this._lastFrame) {
|
|
86
|
+
const repeatCount = frameNumber - this._lastFrame.frameNumber;
|
|
87
|
+
for (let i = 0; i < repeatCount; ++i)
|
|
88
|
+
this._frameQueue.push(this._lastFrame.buffer);
|
|
89
|
+
this._lastWritePromise = this._lastWritePromise.then(() => this._sendFrames());
|
|
90
|
+
}
|
|
91
|
+
this._lastFrame = { buffer: frame, timestamp, frameNumber };
|
|
92
|
+
this._lastWriteNodeTime = (0, import_utils.monotonicTime)();
|
|
93
|
+
}
|
|
94
|
+
async _sendFrames() {
|
|
95
|
+
while (this._frameQueue.length)
|
|
96
|
+
await this._sendFrame(this._frameQueue.shift());
|
|
97
|
+
}
|
|
98
|
+
async _sendFrame(frame) {
|
|
99
|
+
return new Promise((f) => this._process.stdin.write(frame, f)).then((error) => {
|
|
100
|
+
if (error)
|
|
101
|
+
import_utils.debugLogger.log("browser", `ffmpeg failed to write: ${String(error)}`);
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async stop() {
|
|
105
|
+
const error = await this._launchPromise;
|
|
106
|
+
if (error)
|
|
107
|
+
throw error;
|
|
108
|
+
if (this._isStopped || !this._lastFrame)
|
|
109
|
+
return;
|
|
110
|
+
const addTime = Math.max(((0, import_utils.monotonicTime)() - this._lastWriteNodeTime) / 1e3, 1);
|
|
111
|
+
this._writeFrame(Buffer.from([]), this._lastFrame.timestamp + addTime);
|
|
112
|
+
this._isStopped = true;
|
|
113
|
+
try {
|
|
114
|
+
await this._lastWritePromise;
|
|
115
|
+
await this._gracefullyClose();
|
|
116
|
+
} catch (e) {
|
|
117
|
+
import_utils.debugLogger.log("error", `ffmpeg failed to stop: ${String(e)}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
122
|
+
0 && (module.exports = {
|
|
123
|
+
VideoRecorder
|
|
124
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var protocol_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(protocol_d_exports);
|
|
@@ -0,0 +1,108 @@
|
|
|
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 webkit_exports = {};
|
|
30
|
+
__export(webkit_exports, {
|
|
31
|
+
WebKit: () => WebKit,
|
|
32
|
+
translatePathToWSL: () => translatePathToWSL
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(webkit_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_wkConnection = require("./wkConnection");
|
|
37
|
+
var import_ascii = require("../utils/ascii");
|
|
38
|
+
var import_browserType = require("../browserType");
|
|
39
|
+
var import_wkBrowser = require("../webkit/wkBrowser");
|
|
40
|
+
var import_spawnAsync = require("../utils/spawnAsync");
|
|
41
|
+
class WebKit extends import_browserType.BrowserType {
|
|
42
|
+
constructor(parent) {
|
|
43
|
+
super(parent, "webkit");
|
|
44
|
+
}
|
|
45
|
+
connectToTransport(transport, options) {
|
|
46
|
+
return import_wkBrowser.WKBrowser.connect(this.attribution.playwright, transport, options);
|
|
47
|
+
}
|
|
48
|
+
amendEnvironment(env, userDataDir, isPersistent, options) {
|
|
49
|
+
return {
|
|
50
|
+
...env,
|
|
51
|
+
CURL_COOKIE_JAR_PATH: process.platform === "win32" && isPersistent ? import_path.default.join(userDataDir, "cookiejar.db") : void 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
doRewriteStartupLog(logs) {
|
|
55
|
+
if (logs.includes("Failed to open display") || logs.includes("cannot open display"))
|
|
56
|
+
logs = "\n" + (0, import_ascii.wrapInASCIIBox)(import_browserType.kNoXServerRunningError, 1);
|
|
57
|
+
return logs;
|
|
58
|
+
}
|
|
59
|
+
attemptToGracefullyCloseBrowser(transport) {
|
|
60
|
+
transport.send({ method: "Playwright.close", params: {}, id: import_wkConnection.kBrowserCloseMessageId });
|
|
61
|
+
}
|
|
62
|
+
async defaultArgs(options, isPersistent, userDataDir) {
|
|
63
|
+
const { args = [], headless } = options;
|
|
64
|
+
const userDataDirArg = args.find((arg) => arg.startsWith("--user-data-dir"));
|
|
65
|
+
if (userDataDirArg)
|
|
66
|
+
throw this._createUserDataDirArgMisuseError("--user-data-dir");
|
|
67
|
+
if (args.find((arg) => !arg.startsWith("-")))
|
|
68
|
+
throw new Error("Arguments can not specify page to be opened");
|
|
69
|
+
const webkitArguments = ["--inspector-pipe"];
|
|
70
|
+
if (process.platform === "win32" && options.channel !== "webkit-wsl")
|
|
71
|
+
webkitArguments.push("--disable-accelerated-compositing");
|
|
72
|
+
if (headless)
|
|
73
|
+
webkitArguments.push("--headless");
|
|
74
|
+
if (isPersistent)
|
|
75
|
+
webkitArguments.push(`--user-data-dir=${options.channel === "webkit-wsl" ? await translatePathToWSL(userDataDir) : userDataDir}`);
|
|
76
|
+
else
|
|
77
|
+
webkitArguments.push(`--no-startup-window`);
|
|
78
|
+
const proxy = options.proxyOverride || options.proxy;
|
|
79
|
+
if (proxy) {
|
|
80
|
+
if (process.platform === "darwin") {
|
|
81
|
+
webkitArguments.push(`--proxy=${proxy.server}`);
|
|
82
|
+
if (proxy.bypass)
|
|
83
|
+
webkitArguments.push(`--proxy-bypass-list=${proxy.bypass}`);
|
|
84
|
+
} else if (process.platform === "linux" || process.platform === "win32" && options.channel === "webkit-wsl") {
|
|
85
|
+
webkitArguments.push(`--proxy=${proxy.server}`);
|
|
86
|
+
if (proxy.bypass)
|
|
87
|
+
webkitArguments.push(...proxy.bypass.split(",").map((t) => `--ignore-host=${t}`));
|
|
88
|
+
} else if (process.platform === "win32") {
|
|
89
|
+
webkitArguments.push(`--curl-proxy=${proxy.server.replace(/^socks5:\/\//, "socks5h://")}`);
|
|
90
|
+
if (proxy.bypass)
|
|
91
|
+
webkitArguments.push(`--curl-noproxy=${proxy.bypass}`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
webkitArguments.push(...args);
|
|
95
|
+
if (isPersistent)
|
|
96
|
+
webkitArguments.push("about:blank");
|
|
97
|
+
return webkitArguments;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
async function translatePathToWSL(path2) {
|
|
101
|
+
const { stdout } = await (0, import_spawnAsync.spawnAsync)("wsl.exe", ["-d", "playwright", "--cd", "/home/pwuser", "wslpath", path2.replace(/\\/g, "\\\\")]);
|
|
102
|
+
return stdout.toString().trim();
|
|
103
|
+
}
|
|
104
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
105
|
+
0 && (module.exports = {
|
|
106
|
+
WebKit,
|
|
107
|
+
translatePathToWSL
|
|
108
|
+
});
|