patchright-core 1.57.0 → 1.59.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/ThirdPartyNotices.txt +2688 -297
- package/browsers.json +23 -22
- package/lib/bootstrap.js +77 -0
- package/lib/cli/browserActions.js +308 -0
- package/lib/cli/driver.js +3 -2
- package/lib/cli/installActions.js +171 -0
- package/lib/cli/program.js +48 -413
- package/lib/client/android.js +4 -4
- package/lib/client/api.js +3 -0
- package/lib/client/browser.js +11 -5
- package/lib/client/browserContext.js +20 -23
- package/lib/client/browserType.js +23 -54
- package/lib/client/cdpSession.js +6 -2
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/clientHelper.js +2 -1
- package/lib/client/clock.js +0 -1
- package/lib/client/{webSocket.js → connect.js} +57 -7
- package/lib/client/connection.js +8 -0
- package/lib/client/consoleMessage.js +3 -0
- package/lib/client/debugger.js +57 -0
- package/lib/client/dialog.js +8 -1
- package/lib/client/disposable.js +76 -0
- package/lib/client/electron.js +1 -0
- package/lib/client/elementHandle.js +1 -1
- package/lib/client/events.js +3 -0
- package/lib/client/fetch.js +2 -4
- package/lib/client/frame.js +9 -13
- package/lib/client/harRouter.js +13 -1
- package/lib/client/jsHandle.js +4 -8
- package/lib/client/locator.js +13 -36
- package/lib/client/network.js +14 -11
- package/lib/client/page.js +44 -50
- package/lib/client/screencast.js +88 -0
- package/lib/client/selectors.js +3 -1
- package/lib/client/tracing.js +11 -5
- package/lib/client/video.js +13 -20
- package/lib/client/worker.js +6 -6
- package/lib/generated/bindingsControllerSource.js +1 -1
- package/lib/generated/clockSource.js +1 -1
- package/lib/generated/injectedScriptSource.js +1 -1
- package/lib/generated/pollingRecorderSource.js +1 -1
- package/lib/generated/storageScriptSource.js +1 -1
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/mcpBundle.js +78 -0
- package/lib/mcpBundleImpl.js +91 -0
- package/lib/protocol/serializers.js +5 -0
- package/lib/protocol/validator.js +228 -58
- package/lib/protocol/validatorPrimitives.js +1 -1
- package/lib/remote/playwrightConnection.js +10 -8
- package/lib/remote/playwrightPipeServer.js +100 -0
- package/lib/remote/playwrightServer.js +14 -10
- package/lib/remote/playwrightWebSocketServer.js +73 -0
- package/lib/remote/serverTransport.js +96 -0
- package/lib/server/android/android.js +2 -2
- package/lib/server/artifact.js +1 -1
- package/lib/server/bidi/bidiBrowser.js +80 -14
- package/lib/server/bidi/bidiChromium.js +23 -14
- package/lib/server/bidi/bidiConnection.js +1 -0
- package/lib/server/bidi/bidiDeserializer.js +116 -0
- package/lib/server/bidi/bidiExecutionContext.js +75 -29
- package/lib/server/bidi/bidiFirefox.js +6 -8
- package/lib/server/bidi/bidiNetworkManager.js +40 -12
- package/lib/server/bidi/bidiPage.js +67 -40
- package/lib/server/bidi/third_party/bidiProtocolCore.js +1 -0
- package/lib/server/bidi/third_party/firefoxPrefs.js +3 -1
- package/lib/server/browser.js +84 -21
- package/lib/server/browserContext.js +137 -77
- package/lib/server/browserType.js +26 -16
- package/lib/server/chromium/chromium.js +28 -31
- package/lib/server/chromium/chromiumSwitches.js +16 -4
- package/lib/server/chromium/crBrowser.js +40 -27
- package/lib/server/chromium/crConnection.js +0 -5
- package/lib/server/chromium/crDevTools.js +1 -2
- package/lib/server/chromium/crNetworkManager.js +54 -229
- package/lib/server/chromium/crPage.js +74 -260
- package/lib/server/chromium/crServiceWorker.js +7 -14
- package/lib/server/clock.js +33 -41
- package/lib/server/codegen/javascript.js +6 -29
- package/lib/server/console.js +5 -1
- package/lib/server/debugController.js +12 -6
- package/lib/server/debugger.js +40 -47
- package/lib/server/deviceDescriptorsSource.json +137 -137
- package/lib/server/dispatchers/browserContextDispatcher.js +30 -30
- package/lib/server/dispatchers/browserDispatcher.js +11 -5
- package/lib/server/dispatchers/browserTypeDispatcher.js +7 -0
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -1
- package/lib/server/dispatchers/debuggerDispatcher.js +84 -0
- package/lib/server/dispatchers/dispatcher.js +7 -14
- package/lib/server/dispatchers/disposableDispatcher.js +39 -0
- package/lib/server/dispatchers/electronDispatcher.js +2 -1
- package/lib/server/dispatchers/frameDispatcher.js +7 -7
- package/lib/server/dispatchers/localUtilsDispatcher.js +37 -1
- package/lib/server/dispatchers/networkDispatchers.js +6 -5
- package/lib/server/dispatchers/pageDispatcher.js +101 -34
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +4 -5
- package/lib/server/disposable.js +41 -0
- package/lib/server/dom.js +56 -29
- package/lib/server/download.js +3 -2
- package/lib/server/electron/electron.js +17 -9
- package/lib/server/firefox/ffBrowser.js +9 -29
- package/lib/server/firefox/ffConnection.js +0 -5
- package/lib/server/firefox/ffInput.js +21 -5
- package/lib/server/firefox/ffNetworkManager.js +4 -4
- package/lib/server/firefox/ffPage.js +27 -33
- package/lib/server/firefox/firefox.js +6 -8
- package/lib/server/frameSelectors.js +14 -169
- package/lib/server/frames.js +263 -551
- package/lib/server/har/harRecorder.js +2 -2
- package/lib/server/har/harTracer.js +5 -4
- package/lib/server/input.js +49 -4
- package/lib/server/instrumentation.js +8 -0
- package/lib/server/javascript.js +6 -22
- package/lib/server/launchApp.js +0 -1
- package/lib/server/localUtils.js +6 -6
- package/lib/server/network.js +59 -20
- package/lib/server/overlay.js +138 -0
- package/lib/server/page.js +179 -157
- package/lib/server/progress.js +32 -6
- package/lib/server/recorder/recorderApp.js +84 -104
- package/lib/server/recorder.js +76 -40
- package/lib/server/registry/browserFetcher.js +6 -4
- package/lib/server/registry/index.js +222 -226
- package/lib/server/registry/nativeDeps.js +1 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +3 -0
- package/lib/server/screencast.js +137 -0
- package/lib/server/trace/recorder/snapshotter.js +2 -2
- package/lib/server/trace/recorder/snapshotterInjected.js +21 -1
- package/lib/server/trace/recorder/tracing.js +98 -47
- package/lib/server/trace/viewer/traceViewer.js +24 -21
- package/lib/server/usKeyboardLayout.js +7 -0
- package/lib/server/utils/comparators.js +1 -1
- package/lib/server/utils/disposable.js +32 -0
- package/lib/server/utils/eventsHelper.js +3 -1
- package/lib/server/utils/expectUtils.js +87 -2
- package/lib/server/utils/fileUtils.js +16 -2
- package/lib/server/utils/happyEyeballs.js +15 -12
- package/lib/server/utils/httpServer.js +10 -23
- package/lib/server/utils/network.js +39 -29
- package/lib/server/utils/processLauncher.js +8 -6
- package/lib/server/utils/zipFile.js +2 -2
- package/lib/server/videoRecorder.js +194 -0
- package/lib/server/webkit/webkit.js +4 -6
- package/lib/server/webkit/wkBrowser.js +1 -10
- package/lib/server/webkit/wkConnection.js +1 -6
- package/lib/server/webkit/wkInterceptableRequest.js +29 -1
- package/lib/server/webkit/wkPage.js +88 -57
- package/lib/server/webkit/wkWorkers.js +2 -1
- package/lib/serverRegistry.js +156 -0
- package/lib/tools/backend/browserBackend.js +79 -0
- package/lib/tools/backend/common.js +63 -0
- package/lib/tools/backend/config.js +41 -0
- package/lib/tools/backend/console.js +66 -0
- package/lib/tools/backend/context.js +296 -0
- package/lib/tools/backend/cookies.js +152 -0
- package/lib/tools/backend/devtools.js +69 -0
- package/lib/tools/backend/dialogs.js +59 -0
- package/lib/tools/backend/evaluate.js +64 -0
- package/lib/tools/backend/files.js +60 -0
- package/lib/tools/backend/form.js +64 -0
- package/lib/tools/backend/keyboard.js +155 -0
- package/lib/tools/backend/logFile.js +95 -0
- package/lib/tools/backend/mouse.js +168 -0
- package/lib/tools/backend/navigate.js +106 -0
- package/lib/tools/backend/network.js +135 -0
- package/lib/tools/backend/pdf.js +48 -0
- package/lib/tools/backend/response.js +305 -0
- package/lib/tools/backend/route.js +140 -0
- package/lib/tools/backend/runCode.js +77 -0
- package/lib/tools/backend/screenshot.js +88 -0
- package/lib/tools/backend/sessionLog.js +74 -0
- package/lib/tools/backend/snapshot.js +208 -0
- package/lib/tools/backend/storage.js +68 -0
- package/lib/tools/backend/tab.js +445 -0
- package/lib/tools/backend/tabs.js +67 -0
- package/lib/tools/backend/tool.js +47 -0
- package/lib/tools/backend/tools.js +102 -0
- package/lib/tools/backend/tracing.js +78 -0
- package/lib/tools/backend/utils.js +83 -0
- package/lib/tools/backend/verify.js +151 -0
- package/lib/tools/backend/video.js +98 -0
- package/lib/tools/backend/wait.js +63 -0
- package/lib/tools/backend/webstorage.js +223 -0
- package/lib/tools/cli-client/cli.js +6 -0
- package/lib/tools/cli-client/help.json +399 -0
- package/lib/tools/cli-client/minimist.js +128 -0
- package/lib/tools/cli-client/program.js +350 -0
- package/lib/tools/cli-client/registry.js +176 -0
- package/lib/tools/cli-client/session.js +289 -0
- package/lib/tools/cli-client/skill/SKILL.md +328 -0
- package/lib/tools/cli-client/skill/references/element-attributes.md +23 -0
- package/lib/tools/cli-client/skill/references/playwright-tests.md +39 -0
- package/lib/tools/cli-client/skill/references/request-mocking.md +87 -0
- package/lib/tools/cli-client/skill/references/running-code.md +231 -0
- package/lib/tools/cli-client/skill/references/session-management.md +169 -0
- package/lib/tools/cli-client/skill/references/storage-state.md +275 -0
- package/lib/tools/cli-client/skill/references/test-generation.md +88 -0
- package/lib/tools/cli-client/skill/references/tracing.md +139 -0
- package/lib/tools/cli-client/skill/references/video-recording.md +143 -0
- package/lib/tools/cli-daemon/command.js +73 -0
- package/lib/tools/cli-daemon/commands.js +956 -0
- package/lib/tools/cli-daemon/daemon.js +157 -0
- package/lib/tools/cli-daemon/helpGenerator.js +177 -0
- package/lib/tools/cli-daemon/program.js +129 -0
- package/lib/tools/dashboard/appIcon.png +0 -0
- package/lib/tools/dashboard/dashboardApp.js +284 -0
- package/lib/tools/dashboard/dashboardController.js +296 -0
- package/lib/tools/exports.js +60 -0
- package/lib/tools/mcp/browserFactory.js +233 -0
- package/lib/tools/mcp/cdpRelay.js +352 -0
- package/lib/tools/mcp/cli-stub.js +7 -0
- package/lib/tools/mcp/config.d.js +16 -0
- package/lib/tools/mcp/config.js +446 -0
- package/lib/tools/mcp/configIni.js +189 -0
- package/lib/tools/mcp/extensionContextFactory.js +55 -0
- package/lib/tools/mcp/index.js +62 -0
- package/lib/tools/mcp/log.js +35 -0
- package/lib/tools/mcp/program.js +107 -0
- package/lib/tools/mcp/protocol.js +28 -0
- package/lib/tools/mcp/watchdog.js +44 -0
- package/lib/tools/trace/SKILL.md +171 -0
- package/lib/tools/trace/installSkill.js +48 -0
- package/lib/tools/trace/traceActions.js +142 -0
- package/lib/tools/trace/traceAttachments.js +69 -0
- package/lib/tools/trace/traceCli.js +87 -0
- package/lib/tools/trace/traceConsole.js +97 -0
- package/lib/tools/trace/traceErrors.js +55 -0
- package/lib/tools/trace/traceOpen.js +69 -0
- package/lib/tools/trace/traceParser.js +96 -0
- package/lib/tools/trace/traceRequests.js +182 -0
- package/lib/tools/trace/traceScreenshot.js +68 -0
- package/lib/tools/trace/traceSnapshot.js +149 -0
- package/lib/tools/trace/traceUtils.js +153 -0
- package/lib/tools/utils/connect.js +32 -0
- package/lib/tools/utils/mcp/http.js +152 -0
- package/lib/tools/utils/mcp/server.js +230 -0
- package/lib/tools/utils/mcp/tool.js +47 -0
- package/lib/tools/utils/socketConnection.js +108 -0
- package/lib/utils/isomorphic/ariaSnapshot.js +60 -2
- package/lib/utils/isomorphic/formatUtils.js +64 -0
- package/lib/utils/isomorphic/jsonSchema.js +89 -0
- package/lib/utils/isomorphic/lruCache.js +51 -0
- package/lib/utils/isomorphic/mimeType.js +7 -2
- package/lib/utils/isomorphic/protocolFormatter.js +2 -2
- package/lib/utils/isomorphic/protocolMetainfo.js +127 -98
- package/lib/utils/isomorphic/stringUtils.js +49 -0
- package/lib/utils/isomorphic/timeoutRunner.js +3 -3
- package/lib/utils/isomorphic/trace/entries.js +16 -0
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +492 -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 +132 -0
- package/lib/utils/isomorphic/trace/traceModel.js +366 -0
- package/lib/utils/isomorphic/trace/traceModernizer.js +401 -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/urlMatch.js +54 -1
- package/lib/utils/isomorphic/utilityScriptSerializers.js +11 -0
- package/lib/utils/isomorphic/yaml.js +84 -0
- package/lib/utils.js +8 -2
- package/lib/utilsBundle.js +5 -26
- package/lib/utilsBundleImpl/index.js +172 -173
- package/lib/vite/dashboard/assets/index-BAOybkp8.js +50 -0
- package/lib/vite/dashboard/assets/index-CZAYOG76.css +1 -0
- package/lib/vite/dashboard/index.html +28 -0
- package/lib/vite/htmlReport/index.html +2 -70
- package/lib/vite/htmlReport/report.css +1 -0
- package/lib/vite/htmlReport/report.js +72 -0
- package/lib/vite/recorder/assets/codeMirrorModule-C8KMvO9L.js +32 -0
- package/lib/vite/recorder/assets/{codeMirrorModule-C3UTv-Ge.css → codeMirrorModule-DYBRYzYX.css} +1 -1
- package/lib/vite/recorder/assets/{index-Ri0uHF7I.css → index-BSjZa4pk.css} +1 -1
- package/lib/vite/recorder/assets/index-CqAYX1I3.js +193 -0
- package/lib/vite/recorder/index.html +2 -2
- package/lib/vite/traceViewer/assets/codeMirrorModule-DS0FLvoc.js +32 -0
- package/lib/vite/traceViewer/assets/defaultSettingsView-GTWI-W_B.js +262 -0
- package/lib/vite/traceViewer/{codeMirrorModule.C3UTv-Ge.css → codeMirrorModule.DYBRYzYX.css} +1 -1
- package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
- package/lib/vite/traceViewer/index.CzXZzn5A.css +1 -0
- package/lib/vite/traceViewer/index.Dtstcb7U.js +2 -0
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +5 -3
- package/lib/vite/traceViewer/uiMode.Vipi55dB.js +6 -0
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/lib/zipBundleImpl.js +2 -2
- package/lib/zodBundle.js +39 -0
- package/lib/zodBundleImpl.js +40 -0
- package/package.json +7 -1
- package/types/protocol.d.ts +1696 -221
- package/types/types.d.ts +879 -112
- package/lib/server/bidi/third_party/bidiDeserializer.js +0 -98
- package/lib/server/chromium/videoRecorder.js +0 -115
- package/lib/server/pageBinding.js +0 -87
- package/lib/server/trace/test/inMemorySnapshotter.js +0 -87
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +0 -248
- package/lib/vite/recorder/assets/codeMirrorModule-CBbSe-ZI.js +0 -25
- package/lib/vite/recorder/assets/index-CpZVd2nA.js +0 -193
- package/lib/vite/traceViewer/assets/codeMirrorModule-DHz0wP2C.js +0 -25
- package/lib/vite/traceViewer/assets/defaultSettingsView-WsZP88O6.js +0 -266
- package/lib/vite/traceViewer/defaultSettingsView.ConWv5KN.css +0 -1
- package/lib/vite/traceViewer/index.C4Y3Aw8n.css +0 -1
- package/lib/vite/traceViewer/index.C8xAeo93.js +0 -2
- package/lib/vite/traceViewer/uiMode.BltraIJB.js +0 -5
- /package/lib/{server/utils → utils/isomorphic}/imageUtils.js +0 -0
- /package/lib/utils/isomorphic/{traceUtils.js → trace/traceUtils.js} +0 -0
|
@@ -36,6 +36,7 @@ var import_path = __toESM(require("path"));
|
|
|
36
36
|
var import_browserContext = require("../browserContext");
|
|
37
37
|
var import_artifactDispatcher = require("./artifactDispatcher");
|
|
38
38
|
var import_cdpSessionDispatcher = require("./cdpSessionDispatcher");
|
|
39
|
+
var import_debuggerDispatcher = require("./debuggerDispatcher");
|
|
39
40
|
var import_dialogDispatcher = require("./dialogDispatcher");
|
|
40
41
|
var import_dispatcher = require("./dispatcher");
|
|
41
42
|
var import_frameDispatcher = require("./frameDispatcher");
|
|
@@ -43,6 +44,7 @@ var import_networkDispatchers = require("./networkDispatchers");
|
|
|
43
44
|
var import_pageDispatcher = require("./pageDispatcher");
|
|
44
45
|
var import_crBrowser = require("../chromium/crBrowser");
|
|
45
46
|
var import_errors = require("../errors");
|
|
47
|
+
var import_disposableDispatcher = require("./disposableDispatcher");
|
|
46
48
|
var import_tracingDispatcher = require("./tracingDispatcher");
|
|
47
49
|
var import_webSocketRouteDispatcher = require("./webSocketRouteDispatcher");
|
|
48
50
|
var import_writableStreamDispatcher = require("./writableStreamDispatcher");
|
|
@@ -52,12 +54,14 @@ var import_recorder = require("../recorder");
|
|
|
52
54
|
var import_recorderApp = require("../recorder/recorderApp");
|
|
53
55
|
var import_elementHandlerDispatcher = require("./elementHandlerDispatcher");
|
|
54
56
|
var import_jsHandleDispatcher = require("./jsHandleDispatcher");
|
|
57
|
+
var import_disposable = require("../disposable");
|
|
55
58
|
class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
56
59
|
constructor(parentScope, context) {
|
|
60
|
+
const debugger_ = import_debuggerDispatcher.DebuggerDispatcher.from(parentScope, context.debugger());
|
|
57
61
|
const requestContext = import_networkDispatchers.APIRequestContextDispatcher.from(parentScope, context.fetchRequest);
|
|
58
62
|
const tracing = import_tracingDispatcher.TracingDispatcher.from(parentScope, context.tracing);
|
|
59
63
|
super(parentScope, context, "BrowserContext", {
|
|
60
|
-
|
|
64
|
+
debugger: debugger_,
|
|
61
65
|
requestContext,
|
|
62
66
|
tracing,
|
|
63
67
|
options: context._options
|
|
@@ -66,10 +70,10 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
66
70
|
this._type_BrowserContext = true;
|
|
67
71
|
this._subscriptions = /* @__PURE__ */ new Set();
|
|
68
72
|
this._webSocketInterceptionPatterns = [];
|
|
69
|
-
this.
|
|
70
|
-
this._initScripts = [];
|
|
73
|
+
this._disposables = [];
|
|
71
74
|
this._clockPaused = false;
|
|
72
75
|
this._interceptionUrlMatchers = [];
|
|
76
|
+
this.adopt(debugger_);
|
|
73
77
|
this.adopt(requestContext);
|
|
74
78
|
this.adopt(tracing);
|
|
75
79
|
this._requestInterceptor = (route, request) => {
|
|
@@ -83,15 +87,6 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
83
87
|
this._dispatchEvent("route", { route: new import_networkDispatchers.RouteDispatcher(import_networkDispatchers.RequestDispatcher.from(this, request), route) });
|
|
84
88
|
};
|
|
85
89
|
this._context = context;
|
|
86
|
-
const onVideo = (artifact) => {
|
|
87
|
-
const artifactDispatcher = import_artifactDispatcher.ArtifactDispatcher.from(parentScope, artifact);
|
|
88
|
-
this._dispatchEvent("video", { artifact: artifactDispatcher });
|
|
89
|
-
};
|
|
90
|
-
this.addObjectListener(import_browserContext.BrowserContext.Events.VideoStarted, onVideo);
|
|
91
|
-
for (const video of context._browser._idToVideo.values()) {
|
|
92
|
-
if (video.context === context)
|
|
93
|
-
onVideo(video.artifact);
|
|
94
|
-
}
|
|
95
90
|
for (const page of context.pages())
|
|
96
91
|
this._dispatchEvent("page", { page: import_pageDispatcher.PageDispatcher.from(this, page) });
|
|
97
92
|
this.addObjectListener(import_browserContext.BrowserContext.Events.Page, (page) => {
|
|
@@ -197,7 +192,8 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
197
192
|
return import_elementHandlerDispatcher.ElementHandleDispatcher.from(import_frameDispatcher.FrameDispatcher.from(this, elementHandle._frame), elementHandle);
|
|
198
193
|
return import_jsHandleDispatcher.JSHandleDispatcher.fromJSHandle(jsScope, a);
|
|
199
194
|
}),
|
|
200
|
-
location: message.location()
|
|
195
|
+
location: message.location(),
|
|
196
|
+
timestamp: message.timestamp()
|
|
201
197
|
};
|
|
202
198
|
}
|
|
203
199
|
async createTempFiles(params, progress) {
|
|
@@ -224,7 +220,8 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
224
220
|
this._dispatchEvent("bindingCall", { binding: binding2 });
|
|
225
221
|
return binding2.promise();
|
|
226
222
|
});
|
|
227
|
-
this.
|
|
223
|
+
this._disposables.push(binding);
|
|
224
|
+
return { disposable: new import_disposableDispatcher.DisposableDispatcher(this, binding) };
|
|
228
225
|
}
|
|
229
226
|
async newPage(params, progress) {
|
|
230
227
|
return { page: import_pageDispatcher.PageDispatcher.from(this, await this._context.newPage(progress)) };
|
|
@@ -264,7 +261,9 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
264
261
|
await progress.race(this._context.setHTTPCredentials(params.httpCredentials));
|
|
265
262
|
}
|
|
266
263
|
async addInitScript(params, progress) {
|
|
267
|
-
|
|
264
|
+
const initScript = await this._context.addInitScript(params.source);
|
|
265
|
+
this._disposables.push(initScript);
|
|
266
|
+
return { disposable: new import_disposableDispatcher.DisposableDispatcher(this, initScript) };
|
|
268
267
|
}
|
|
269
268
|
async setNetworkInterceptionPatterns(params, progress) {
|
|
270
269
|
const hadMatchers = this._interceptionUrlMatchers.length > 0;
|
|
@@ -273,7 +272,7 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
273
272
|
await this._context.removeRequestInterceptor(this._requestInterceptor);
|
|
274
273
|
this._interceptionUrlMatchers = [];
|
|
275
274
|
} else {
|
|
276
|
-
this._interceptionUrlMatchers = params.patterns.map(
|
|
275
|
+
this._interceptionUrlMatchers = params.patterns.map(import_urlMatch.deserializeURLMatch);
|
|
277
276
|
if (!hadMatchers)
|
|
278
277
|
await this._context.addRequestInterceptor(progress, this._requestInterceptor);
|
|
279
278
|
}
|
|
@@ -286,6 +285,9 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
286
285
|
async storageState(params, progress) {
|
|
287
286
|
return await progress.race(this._context.storageState(progress, params.indexedDB));
|
|
288
287
|
}
|
|
288
|
+
async setStorageState(params, progress) {
|
|
289
|
+
await this._context.setStorageState(progress, params.storageState, "api");
|
|
290
|
+
}
|
|
289
291
|
async close(params, progress) {
|
|
290
292
|
progress.metadata.potentiallyClosesScope = true;
|
|
291
293
|
await this._context.close(params);
|
|
@@ -295,13 +297,15 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
295
297
|
}
|
|
296
298
|
async disableRecorder(params, progress) {
|
|
297
299
|
const recorder = await import_recorder.Recorder.existingForContext(this._context);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
await recorder?.setMode("none");
|
|
301
|
+
}
|
|
302
|
+
async exposeConsoleApi(params, progress) {
|
|
303
|
+
await this._context.exposeConsoleApi();
|
|
300
304
|
}
|
|
301
305
|
async pause(params, progress) {
|
|
302
306
|
}
|
|
303
307
|
async newCDPSession(params, progress) {
|
|
304
|
-
if (
|
|
308
|
+
if (this._object._browser.options.browserType !== "chromium")
|
|
305
309
|
throw new Error(`CDP session is only available in Chromium`);
|
|
306
310
|
if (!params.page && !params.frame || params.page && params.frame)
|
|
307
311
|
throw new Error(`CDP session must be initiated with either Page or Frame, not none or both`);
|
|
@@ -319,13 +323,13 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
319
323
|
return { artifact: import_artifactDispatcher.ArtifactDispatcher.from(this, artifact) };
|
|
320
324
|
}
|
|
321
325
|
async clockFastForward(params, progress) {
|
|
322
|
-
await this._context.clock.fastForward(
|
|
326
|
+
await this._context.clock.fastForward(params.ticksString ?? params.ticksNumber ?? 0);
|
|
323
327
|
}
|
|
324
328
|
async clockInstall(params, progress) {
|
|
325
|
-
await this._context.clock.install(
|
|
329
|
+
await this._context.clock.install(params.timeString ?? params.timeNumber ?? void 0);
|
|
326
330
|
}
|
|
327
331
|
async clockPauseAt(params, progress) {
|
|
328
|
-
await this._context.clock.pauseAt(
|
|
332
|
+
await this._context.clock.pauseAt(params.timeString ?? params.timeNumber ?? 0);
|
|
329
333
|
this._clockPaused = true;
|
|
330
334
|
}
|
|
331
335
|
async clockResume(params, progress) {
|
|
@@ -333,13 +337,13 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
333
337
|
this._clockPaused = false;
|
|
334
338
|
}
|
|
335
339
|
async clockRunFor(params, progress) {
|
|
336
|
-
await this._context.clock.runFor(
|
|
340
|
+
await this._context.clock.runFor(params.ticksString ?? params.ticksNumber ?? 0);
|
|
337
341
|
}
|
|
338
342
|
async clockSetFixedTime(params, progress) {
|
|
339
|
-
await this._context.clock.setFixedTime(
|
|
343
|
+
await this._context.clock.setFixedTime(params.timeString ?? params.timeNumber ?? 0);
|
|
340
344
|
}
|
|
341
345
|
async clockSetSystemTime(params, progress) {
|
|
342
|
-
await this._context.clock.setSystemTime(
|
|
346
|
+
await this._context.clock.setSystemTime(params.timeString ?? params.timeNumber ?? 0);
|
|
343
347
|
}
|
|
344
348
|
async updateSubscription(params, progress) {
|
|
345
349
|
if (params.enabled)
|
|
@@ -360,12 +364,8 @@ class BrowserContextDispatcher extends import_dispatcher.Dispatcher {
|
|
|
360
364
|
this._interceptionUrlMatchers = [];
|
|
361
365
|
this._context.removeRequestInterceptor(this._requestInterceptor).catch(() => {
|
|
362
366
|
});
|
|
363
|
-
|
|
364
|
-
});
|
|
365
|
-
this._bindings = [];
|
|
366
|
-
this._context.removeInitScripts(this._initScripts).catch(() => {
|
|
367
|
+
(0, import_disposable.disposeAll)(this._disposables).catch(() => {
|
|
367
368
|
});
|
|
368
|
-
this._initScripts = [];
|
|
369
369
|
if (this._routeWebSocketInitScript)
|
|
370
370
|
import_webSocketRouteDispatcher.WebSocketRouteDispatcher.uninstall(this.connection, this._context, this._routeWebSocketInitScript).catch(() => {
|
|
371
371
|
});
|
|
@@ -29,7 +29,7 @@ var import_browserContext = require("../browserContext");
|
|
|
29
29
|
var import_artifactDispatcher = require("./artifactDispatcher");
|
|
30
30
|
class BrowserDispatcher extends import_dispatcher.Dispatcher {
|
|
31
31
|
constructor(scope, browser, options = {}) {
|
|
32
|
-
super(scope, browser, "Browser", { version: browser.version(), name: browser.options.name });
|
|
32
|
+
super(scope, browser, "Browser", { version: browser.version(), name: browser.options.name, browserName: browser.options.browserType });
|
|
33
33
|
this._type_Browser = true;
|
|
34
34
|
this._isolatedContexts = /* @__PURE__ */ new Set();
|
|
35
35
|
this._options = options;
|
|
@@ -48,7 +48,7 @@ class BrowserDispatcher extends import_dispatcher.Dispatcher {
|
|
|
48
48
|
}
|
|
49
49
|
async newContext(params, progress) {
|
|
50
50
|
if (params.recordVideo && this._object.attribution.playwright.options.isServer)
|
|
51
|
-
params.recordVideo.dir =
|
|
51
|
+
params.recordVideo.dir = void 0;
|
|
52
52
|
if (!this._options.isolateContexts) {
|
|
53
53
|
const context2 = await this._object.newContext(progress, params);
|
|
54
54
|
const contextDispatcher2 = import_browserContextDispatcher.BrowserContextDispatcher.from(this, context2);
|
|
@@ -91,23 +91,29 @@ class BrowserDispatcher extends import_dispatcher.Dispatcher {
|
|
|
91
91
|
return { userAgent: this._object.userAgent() };
|
|
92
92
|
}
|
|
93
93
|
async newBrowserCDPSession(params, progress) {
|
|
94
|
-
if (
|
|
94
|
+
if (this._object.options.browserType !== "chromium")
|
|
95
95
|
throw new Error(`CDP session is only available in Chromium`);
|
|
96
96
|
const crBrowser = this._object;
|
|
97
97
|
return { session: new import_cdpSessionDispatcher.CDPSessionDispatcher(this, await crBrowser.newBrowserCDPSession()) };
|
|
98
98
|
}
|
|
99
99
|
async startTracing(params, progress) {
|
|
100
|
-
if (
|
|
100
|
+
if (this._object.options.browserType !== "chromium")
|
|
101
101
|
throw new Error(`Tracing is only available in Chromium`);
|
|
102
102
|
const crBrowser = this._object;
|
|
103
103
|
await crBrowser.startTracing(params.page ? params.page._object : void 0, params);
|
|
104
104
|
}
|
|
105
105
|
async stopTracing(params, progress) {
|
|
106
|
-
if (
|
|
106
|
+
if (this._object.options.browserType !== "chromium")
|
|
107
107
|
throw new Error(`Tracing is only available in Chromium`);
|
|
108
108
|
const crBrowser = this._object;
|
|
109
109
|
return { artifact: import_artifactDispatcher.ArtifactDispatcher.from(this, await crBrowser.stopTracing()) };
|
|
110
110
|
}
|
|
111
|
+
async startServer(params, progress) {
|
|
112
|
+
return await this._object.startServer(params.title, params);
|
|
113
|
+
}
|
|
114
|
+
async stopServer(params, progress) {
|
|
115
|
+
await this._object.stopServer();
|
|
116
|
+
}
|
|
111
117
|
async cleanupContexts() {
|
|
112
118
|
await Promise.all(Array.from(this._isolatedContexts).map((context) => context.close({ reason: "Global context cleanup (connection terminated)" })));
|
|
113
119
|
}
|
|
@@ -57,6 +57,13 @@ class BrowserTypeDispatcher extends import_dispatcher.Dispatcher {
|
|
|
57
57
|
defaultContext: browser._defaultContext ? import_browserContextDispatcher.BrowserContextDispatcher.from(browserDispatcher, browser._defaultContext) : void 0
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
async connectOverCDPTransport(params, progress) {
|
|
61
|
+
if (this._denyLaunch)
|
|
62
|
+
throw new Error(`Launching more browsers is not allowed.`);
|
|
63
|
+
const browser = await this._object.connectOverCDPTransport(progress, params.transport);
|
|
64
|
+
const browserDispatcher = new import_browserDispatcher.BrowserDispatcher(this, browser);
|
|
65
|
+
return { browser: browserDispatcher, defaultContext: browser._defaultContext ? import_browserContextDispatcher.BrowserContextDispatcher.from(browserDispatcher, browser._defaultContext) : void 0 };
|
|
66
|
+
}
|
|
60
67
|
}
|
|
61
68
|
// Annotate the CommonJS export names for ESM import in node:
|
|
62
69
|
0 && (module.exports = {
|
|
@@ -28,7 +28,10 @@ class CDPSessionDispatcher extends import_dispatcher.Dispatcher {
|
|
|
28
28
|
super(scope, cdpSession, "CDPSession", {});
|
|
29
29
|
this._type_CDPSession = true;
|
|
30
30
|
this.addObjectListener(import_crConnection.CDPSession.Events.Event, ({ method, params }) => this._dispatchEvent("event", { method, params }));
|
|
31
|
-
this.addObjectListener(import_crConnection.CDPSession.Events.Closed, () =>
|
|
31
|
+
this.addObjectListener(import_crConnection.CDPSession.Events.Closed, () => {
|
|
32
|
+
this._dispatchEvent("close");
|
|
33
|
+
this._dispose();
|
|
34
|
+
});
|
|
32
35
|
}
|
|
33
36
|
async send(params, progress) {
|
|
34
37
|
return { result: await progress.race(this._object.send(params.method, params.params)) };
|
|
@@ -0,0 +1,84 @@
|
|
|
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 debuggerDispatcher_exports = {};
|
|
20
|
+
__export(debuggerDispatcher_exports, {
|
|
21
|
+
DebuggerDispatcher: () => DebuggerDispatcher
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(debuggerDispatcher_exports);
|
|
24
|
+
var import_dispatcher = require("./dispatcher");
|
|
25
|
+
var import_debugger = require("../debugger");
|
|
26
|
+
var import_protocolFormatter = require("../../utils/isomorphic/protocolFormatter");
|
|
27
|
+
class DebuggerDispatcher extends import_dispatcher.Dispatcher {
|
|
28
|
+
constructor(scope, debugger_) {
|
|
29
|
+
super(scope, debugger_, "Debugger", {});
|
|
30
|
+
this._type_EventTarget = true;
|
|
31
|
+
this._type_Debugger = true;
|
|
32
|
+
this.addObjectListener(import_debugger.Debugger.Events.PausedStateChanged, () => {
|
|
33
|
+
this._dispatchEvent("pausedStateChanged", { pausedDetails: this._serializePausedDetails() });
|
|
34
|
+
});
|
|
35
|
+
this._dispatchEvent("pausedStateChanged", { pausedDetails: this._serializePausedDetails() });
|
|
36
|
+
}
|
|
37
|
+
static from(scope, debugger_) {
|
|
38
|
+
const result = scope.connection.existingDispatcher(debugger_);
|
|
39
|
+
return result || new DebuggerDispatcher(scope, debugger_);
|
|
40
|
+
}
|
|
41
|
+
_serializePausedDetails() {
|
|
42
|
+
const details = this._object.pausedDetails();
|
|
43
|
+
if (!details)
|
|
44
|
+
return void 0;
|
|
45
|
+
const { metadata } = details;
|
|
46
|
+
return {
|
|
47
|
+
location: {
|
|
48
|
+
file: metadata.location?.file ?? "<unknown>",
|
|
49
|
+
line: metadata.location?.line,
|
|
50
|
+
column: metadata.location?.column
|
|
51
|
+
},
|
|
52
|
+
title: (0, import_protocolFormatter.renderTitleForCall)(metadata)
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
async requestPause(params, progress) {
|
|
56
|
+
if (this._object.isPaused())
|
|
57
|
+
throw new Error("Debugger is already paused");
|
|
58
|
+
this._object.setPauseBeforeWaitingActions();
|
|
59
|
+
this._object.setPauseAt({ next: true });
|
|
60
|
+
}
|
|
61
|
+
async resume(params, progress) {
|
|
62
|
+
if (!this._object.isPaused())
|
|
63
|
+
throw new Error("Debugger is not paused");
|
|
64
|
+
this._object.resume();
|
|
65
|
+
}
|
|
66
|
+
async next(params, progress) {
|
|
67
|
+
if (!this._object.isPaused())
|
|
68
|
+
throw new Error("Debugger is not paused");
|
|
69
|
+
this._object.setPauseBeforeWaitingActions();
|
|
70
|
+
this._object.setPauseAt({ next: true });
|
|
71
|
+
this._object.resume();
|
|
72
|
+
}
|
|
73
|
+
async runTo(params, progress) {
|
|
74
|
+
if (!this._object.isPaused())
|
|
75
|
+
throw new Error("Debugger is not paused");
|
|
76
|
+
this._object.setPauseBeforeWaitingActions();
|
|
77
|
+
this._object.setPauseAt({ location: params.location });
|
|
78
|
+
this._object.resume();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
82
|
+
0 && (module.exports = {
|
|
83
|
+
DebuggerDispatcher
|
|
84
|
+
});
|
|
@@ -85,11 +85,7 @@ class Dispatcher extends import_events.EventEmitter {
|
|
|
85
85
|
this.connection.sendAdopt(this, child);
|
|
86
86
|
}
|
|
87
87
|
async _runCommand(callMetadata, method, validParams) {
|
|
88
|
-
const controller =
|
|
89
|
-
const logName = this._object.logName || "api";
|
|
90
|
-
import_utils.debugLogger.log(logName, message);
|
|
91
|
-
this._object.instrumentation.onCallLog(this._object, callMetadata, logName, message);
|
|
92
|
-
});
|
|
88
|
+
const controller = import_progress.ProgressController.createForSdkObject(this._object, callMetadata);
|
|
93
89
|
this._activeProgressControllers.add(controller);
|
|
94
90
|
try {
|
|
95
91
|
return await controller.run((progress) => this[method](validParams, progress), validParams?.timeout);
|
|
@@ -106,7 +102,7 @@ class Dispatcher extends import_events.EventEmitter {
|
|
|
106
102
|
this.connection.sendEvent(this, method, params);
|
|
107
103
|
}
|
|
108
104
|
_dispose(reason) {
|
|
109
|
-
this._disposeRecursively(new import_errors.TargetClosedError());
|
|
105
|
+
this._disposeRecursively(new import_errors.TargetClosedError(this._object.closeReason()));
|
|
110
106
|
this.connection.sendDispose(this, reason);
|
|
111
107
|
}
|
|
112
108
|
_onDispose() {
|
|
@@ -257,7 +253,7 @@ class DispatcherConnection {
|
|
|
257
253
|
const { id, guid, method, params, metadata } = message;
|
|
258
254
|
const dispatcher = this._dispatcherByGuid.get(guid);
|
|
259
255
|
if (!dispatcher) {
|
|
260
|
-
this.onmessage({ id, error: (0, import_errors.serializeError)(new import_errors.TargetClosedError()) });
|
|
256
|
+
this.onmessage({ id, error: (0, import_errors.serializeError)(new import_errors.TargetClosedError(void 0)) });
|
|
261
257
|
return;
|
|
262
258
|
}
|
|
263
259
|
let validParams;
|
|
@@ -273,7 +269,7 @@ class DispatcherConnection {
|
|
|
273
269
|
this.onmessage({ id, error: (0, import_errors.serializeError)(e) });
|
|
274
270
|
return;
|
|
275
271
|
}
|
|
276
|
-
const metainfo = import_protocolMetainfo.
|
|
272
|
+
const metainfo = (0, import_protocolMetainfo.getMetainfo)({ type: dispatcher._type, method });
|
|
277
273
|
if (metainfo?.internal) {
|
|
278
274
|
validMetadata.internal = true;
|
|
279
275
|
}
|
|
@@ -325,19 +321,19 @@ class DispatcherConnection {
|
|
|
325
321
|
const response = { id };
|
|
326
322
|
try {
|
|
327
323
|
if (this._dispatcherByGuid.get(guid) !== dispatcher)
|
|
328
|
-
throw new import_errors.TargetClosedError(closeReason(
|
|
324
|
+
throw new import_errors.TargetClosedError(sdkObject.closeReason());
|
|
329
325
|
const result = await dispatcher._runCommand(callMetadata, method, validParams);
|
|
330
326
|
const validator = (0, import_validator.findValidator)(dispatcher._type, method, "Result");
|
|
331
327
|
response.result = validator(result, "", this._validatorToWireContext());
|
|
332
328
|
callMetadata.result = result;
|
|
333
329
|
} catch (e) {
|
|
334
330
|
if ((0, import_errors.isTargetClosedError)(e)) {
|
|
335
|
-
const reason = closeReason(
|
|
331
|
+
const reason = sdkObject.closeReason();
|
|
336
332
|
if (reason)
|
|
337
333
|
(0, import_utils.rewriteErrorMessage)(e, reason);
|
|
338
334
|
} else if ((0, import_protocolError.isProtocolError)(e)) {
|
|
339
335
|
if (e.type === "closed")
|
|
340
|
-
e = new import_errors.TargetClosedError(closeReason(
|
|
336
|
+
e = new import_errors.TargetClosedError(sdkObject.closeReason(), e.browserLogMessage());
|
|
341
337
|
else if (e.type === "crashed")
|
|
342
338
|
(0, import_utils.rewriteErrorMessage)(e, "Target crashed " + e.browserLogMessage());
|
|
343
339
|
}
|
|
@@ -359,9 +355,6 @@ class DispatcherConnection {
|
|
|
359
355
|
await new Promise((f) => setTimeout(f, slowMo));
|
|
360
356
|
}
|
|
361
357
|
}
|
|
362
|
-
function closeReason(sdkObject) {
|
|
363
|
-
return sdkObject.attribution.page?.closeReason || sdkObject.attribution.context?._closeReason || sdkObject.attribution.browser?._closeReason;
|
|
364
|
-
}
|
|
365
358
|
// Annotate the CommonJS export names for ESM import in node:
|
|
366
359
|
0 && (module.exports = {
|
|
367
360
|
Dispatcher,
|
|
@@ -0,0 +1,39 @@
|
|
|
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 disposableDispatcher_exports = {};
|
|
20
|
+
__export(disposableDispatcher_exports, {
|
|
21
|
+
DisposableDispatcher: () => DisposableDispatcher
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(disposableDispatcher_exports);
|
|
24
|
+
var import_dispatcher = require("./dispatcher");
|
|
25
|
+
class DisposableDispatcher extends import_dispatcher.Dispatcher {
|
|
26
|
+
constructor(scope, disposable) {
|
|
27
|
+
super(scope, disposable, "Disposable", {});
|
|
28
|
+
this._type_Disposable = true;
|
|
29
|
+
}
|
|
30
|
+
async dispose(_, progress) {
|
|
31
|
+
progress.metadata.potentiallyClosesScope = true;
|
|
32
|
+
await this._object.dispose();
|
|
33
|
+
this._dispose();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
DisposableDispatcher
|
|
39
|
+
});
|
|
@@ -58,7 +58,8 @@ class ElectronApplicationDispatcher extends import_dispatcher.Dispatcher {
|
|
|
58
58
|
type: message.type(),
|
|
59
59
|
text: message.text(),
|
|
60
60
|
args: message.args().map((a) => import_jsHandleDispatcher.JSHandleDispatcher.fromJSHandle(this, a)),
|
|
61
|
-
location: message.location()
|
|
61
|
+
location: message.location(),
|
|
62
|
+
timestamp: message.timestamp()
|
|
62
63
|
});
|
|
63
64
|
});
|
|
64
65
|
}
|
|
@@ -73,10 +73,10 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
73
73
|
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, await progress.race(this._frame.frameElement())) };
|
|
74
74
|
}
|
|
75
75
|
async evaluateExpression(params, progress) {
|
|
76
|
-
return { value: (0, import_jsHandleDispatcher.serializeResult)(await progress.race(this._frame.evaluateExpression(params.expression, { isFunction: params.isFunction
|
|
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
77
|
}
|
|
78
78
|
async evaluateExpressionHandle(params, progress) {
|
|
79
|
-
return { handle: import_elementHandlerDispatcher.ElementHandleDispatcher.fromJSOrElementHandle(this, await progress.race(this._frame.evaluateExpressionHandle(params.expression, { isFunction: params.isFunction
|
|
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
80
|
}
|
|
81
81
|
async waitForSelector(params, progress) {
|
|
82
82
|
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.fromNullable(this, await this._frame.waitForSelector(progress, params.selector, true, params)) };
|
|
@@ -88,7 +88,7 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
88
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
89
|
}
|
|
90
90
|
async evalOnSelectorAll(params, progress) {
|
|
91
|
-
return { value: (0, import_jsHandleDispatcher.serializeResult)(await this._frame.evalOnSelectorAll(params.selector, params.expression, params.isFunction, (0, import_jsHandleDispatcher.parseArgument)(params.arg)
|
|
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
92
|
}
|
|
93
93
|
async querySelector(params, progress) {
|
|
94
94
|
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.fromNullable(this, await progress.race(this._frame.querySelector(params.selector, params))) };
|
|
@@ -112,6 +112,9 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
112
112
|
async addStyleTag(params, progress) {
|
|
113
113
|
return { element: import_elementHandlerDispatcher.ElementHandleDispatcher.from(this, await progress.race(this._frame.addStyleTag(params))) };
|
|
114
114
|
}
|
|
115
|
+
async ariaSnapshot(params, progress) {
|
|
116
|
+
return await this._frame.ariaSnapshot(progress, params);
|
|
117
|
+
}
|
|
115
118
|
async click(params, progress) {
|
|
116
119
|
progress.metadata.potentiallyClosesScope = true;
|
|
117
120
|
return await this._frame.click(progress, params.selector, params);
|
|
@@ -212,14 +215,11 @@ class FrameDispatcher extends import_dispatcher.Dispatcher {
|
|
|
212
215
|
let expectedValue = params.expectedValue ? (0, import_jsHandleDispatcher.parseArgument)(params.expectedValue) : void 0;
|
|
213
216
|
if (params.expression === "to.match.aria" && expectedValue)
|
|
214
217
|
expectedValue = (0, import_ariaSnapshot.parseAriaSnapshotUnsafe)(import_utilsBundle.yaml, expectedValue);
|
|
215
|
-
const result = await this._frame.expect(progress, params.selector, { ...params, expectedValue
|
|
218
|
+
const result = await this._frame.expect(progress, params.selector, { ...params, expectedValue, timeoutForLogs: params.timeout });
|
|
216
219
|
if (result.received !== void 0)
|
|
217
220
|
result.received = (0, import_jsHandleDispatcher.serializeResult)(result.received);
|
|
218
221
|
return result;
|
|
219
222
|
}
|
|
220
|
-
async ariaSnapshot(params, progress) {
|
|
221
|
-
return { snapshot: await this._frame.ariaSnapshot(progress, params.selector) };
|
|
222
|
-
}
|
|
223
223
|
}
|
|
224
224
|
// Annotate the CommonJS export names for ESM import in node:
|
|
225
225
|
0 && (module.exports = {
|
|
@@ -31,12 +31,14 @@ __export(localUtilsDispatcher_exports, {
|
|
|
31
31
|
LocalUtilsDispatcher: () => LocalUtilsDispatcher
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(localUtilsDispatcher_exports);
|
|
34
|
+
var import_net = __toESM(require("net"));
|
|
34
35
|
var import_dispatcher = require("./dispatcher");
|
|
35
36
|
var import_instrumentation = require("../../server/instrumentation");
|
|
36
37
|
var localUtils = __toESM(require("../localUtils"));
|
|
37
38
|
var import_userAgent = require("../utils/userAgent");
|
|
38
39
|
var import_deviceDescriptors = require("../deviceDescriptors");
|
|
39
40
|
var import_jsonPipeDispatcher = require("../dispatchers/jsonPipeDispatcher");
|
|
41
|
+
var import_pipeTransport = require("../pipeTransport");
|
|
40
42
|
var import_socksInterceptor = require("../socksInterceptor");
|
|
41
43
|
var import_transport = require("../transport");
|
|
42
44
|
var import_network = require("../utils/network");
|
|
@@ -78,12 +80,17 @@ class LocalUtilsDispatcher extends import_dispatcher.Dispatcher {
|
|
|
78
80
|
localUtils.addStackToTracingNoReply(this._stackSessions, params);
|
|
79
81
|
}
|
|
80
82
|
async connect(params, progress) {
|
|
83
|
+
if (URL.canParse(params.endpoint))
|
|
84
|
+
return await this._connectOverWebSocket(params, progress);
|
|
85
|
+
return await this._connectOverPipe(params, progress);
|
|
86
|
+
}
|
|
87
|
+
async _connectOverWebSocket(params, progress) {
|
|
81
88
|
const wsHeaders = {
|
|
82
89
|
"User-Agent": (0, import_userAgent.getUserAgent)(),
|
|
83
90
|
"x-playwright-proxy": params.exposeNetwork ?? "",
|
|
84
91
|
...params.headers
|
|
85
92
|
};
|
|
86
|
-
const wsEndpoint = await urlToWSEndpoint(progress, params.
|
|
93
|
+
const wsEndpoint = await urlToWSEndpoint(progress, params.endpoint);
|
|
87
94
|
const transport = await import_transport.WebSocketTransport.connect(progress, wsEndpoint, { headers: wsHeaders, followRedirects: true, debugLogHeader: "x-playwright-debug-log" });
|
|
88
95
|
const socksInterceptor = new import_socksInterceptor.SocksInterceptor(transport, params.exposeNetwork, params.socksProxyRedirectPortForTest);
|
|
89
96
|
const pipe = new import_jsonPipeDispatcher.JsonPipeDispatcher(this);
|
|
@@ -112,6 +119,35 @@ class LocalUtilsDispatcher extends import_dispatcher.Dispatcher {
|
|
|
112
119
|
pipe.on("close", () => transport.close());
|
|
113
120
|
return { pipe, headers: transport.headers };
|
|
114
121
|
}
|
|
122
|
+
async _connectOverPipe(params, progress) {
|
|
123
|
+
const socket = await new Promise((resolve, reject) => {
|
|
124
|
+
const conn = import_net.default.connect(params.endpoint, () => resolve(conn));
|
|
125
|
+
conn.on("error", reject);
|
|
126
|
+
});
|
|
127
|
+
const transport = new import_pipeTransport.PipeTransport(socket, socket);
|
|
128
|
+
const pipe = new import_jsonPipeDispatcher.JsonPipeDispatcher(this);
|
|
129
|
+
transport.onmessage = (json) => {
|
|
130
|
+
const cb = () => {
|
|
131
|
+
try {
|
|
132
|
+
pipe.dispatch(json);
|
|
133
|
+
} catch (e) {
|
|
134
|
+
transport.close();
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
if (params.slowMo)
|
|
138
|
+
setTimeout(cb, params.slowMo);
|
|
139
|
+
else
|
|
140
|
+
cb();
|
|
141
|
+
};
|
|
142
|
+
pipe.on("message", (message) => {
|
|
143
|
+
transport.send(message);
|
|
144
|
+
});
|
|
145
|
+
transport.onclose = (reason) => {
|
|
146
|
+
pipe.wasClosed(reason);
|
|
147
|
+
};
|
|
148
|
+
pipe.on("close", () => socket.end());
|
|
149
|
+
return { pipe, headers: [] };
|
|
150
|
+
}
|
|
115
151
|
async globToRegex(params, progress) {
|
|
116
152
|
const regex = (0, import_urlMatch.resolveGlobToRegexPattern)(params.baseURL, params.glob, params.webSocketUrl);
|
|
117
153
|
return { regex };
|
|
@@ -30,7 +30,6 @@ var import_dispatcher = require("./dispatcher");
|
|
|
30
30
|
var import_frameDispatcher = require("./frameDispatcher");
|
|
31
31
|
var import_pageDispatcher = require("./pageDispatcher");
|
|
32
32
|
var import_tracingDispatcher = require("./tracingDispatcher");
|
|
33
|
-
var import_network2 = require("../network");
|
|
34
33
|
class RequestDispatcher extends import_dispatcher.Dispatcher {
|
|
35
34
|
static from(scope, request) {
|
|
36
35
|
const result = scope.connection.existingDispatcher(request);
|
|
@@ -54,12 +53,11 @@ class RequestDispatcher extends import_dispatcher.Dispatcher {
|
|
|
54
53
|
postData: postData === null ? void 0 : postData,
|
|
55
54
|
headers: request.headers(),
|
|
56
55
|
isNavigationRequest: request.isNavigationRequest(),
|
|
57
|
-
redirectedFrom: RequestDispatcher.fromNullable(scope, request.redirectedFrom())
|
|
58
|
-
hasResponse: !!request._existingResponse()
|
|
56
|
+
redirectedFrom: RequestDispatcher.fromNullable(scope, request.redirectedFrom())
|
|
59
57
|
});
|
|
60
58
|
this._type_Request = true;
|
|
61
59
|
this._browserContextDispatcher = scope;
|
|
62
|
-
|
|
60
|
+
ResponseDispatcher.fromNullable(scope, request._existingResponse());
|
|
63
61
|
}
|
|
64
62
|
async rawRequestHeaders(params, progress) {
|
|
65
63
|
return { headers: await progress.race(this._object.rawRequestHeaders()) };
|
|
@@ -83,8 +81,8 @@ class ResponseDispatcher extends import_dispatcher.Dispatcher {
|
|
|
83
81
|
this._type_Response = true;
|
|
84
82
|
}
|
|
85
83
|
static from(scope, response) {
|
|
86
|
-
const result = scope.connection.existingDispatcher(response);
|
|
87
84
|
const requestDispatcher = RequestDispatcher.from(scope, response.request());
|
|
85
|
+
const result = scope.connection.existingDispatcher(response);
|
|
88
86
|
return result || new ResponseDispatcher(requestDispatcher, response);
|
|
89
87
|
}
|
|
90
88
|
static fromNullable(scope, response) {
|
|
@@ -102,6 +100,9 @@ class ResponseDispatcher extends import_dispatcher.Dispatcher {
|
|
|
102
100
|
async rawResponseHeaders(params, progress) {
|
|
103
101
|
return { headers: await progress.race(this._object.rawResponseHeaders()) };
|
|
104
102
|
}
|
|
103
|
+
async httpVersion(params, progress) {
|
|
104
|
+
return { value: await progress.race(this._object.httpVersion()) };
|
|
105
|
+
}
|
|
105
106
|
async sizes(params, progress) {
|
|
106
107
|
return { sizes: await progress.race(this._object.sizes()) };
|
|
107
108
|
}
|