patchright-bun-core 1.58.2 → 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 +126 -650
- package/browsers.json +16 -14
- 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 +47 -411
- package/lib/client/android.js +4 -4
- package/lib/client/api.js +3 -3
- package/lib/client/browser.js +8 -0
- package/lib/client/browserContext.js +18 -37
- package/lib/client/browserType.js +19 -51
- package/lib/client/cdpSession.js +6 -2
- package/lib/client/channelOwner.js +1 -1
- package/lib/client/{webSocket.js → connect.js} +57 -7
- package/lib/client/connection.js +8 -4
- 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 -4
- package/lib/client/events.js +3 -3
- package/lib/client/fetch.js +0 -1
- package/lib/client/frame.js +0 -5
- package/lib/client/harRouter.js +13 -1
- package/lib/client/jsHandle.js +0 -4
- package/lib/client/locator.js +5 -7
- package/lib/client/network.js +14 -11
- package/lib/client/page.js +34 -48
- package/lib/client/platform.js +0 -3
- package/lib/client/screencast.js +88 -0
- package/lib/client/selectors.js +3 -1
- package/lib/client/tracing.js +11 -4
- package/lib/client/video.js +13 -20
- 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 +0 -6
- package/lib/mcpBundleImpl.js +91 -0
- package/lib/protocol/validator.js +216 -118
- 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 +13 -8
- 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/bidi/bidiBrowser.js +30 -8
- package/lib/server/bidi/bidiChromium.js +18 -5
- package/lib/server/bidi/bidiNetworkManager.js +39 -11
- package/lib/server/bidi/bidiPage.js +31 -15
- package/lib/server/bidi/third_party/firefoxPrefs.js +3 -1
- package/lib/server/browser.js +84 -21
- package/lib/server/browserContext.js +97 -58
- package/lib/server/browserType.js +14 -12
- package/lib/server/chromium/chromium.js +15 -13
- package/lib/server/chromium/crBrowser.js +18 -10
- package/lib/server/chromium/crNetworkManager.js +4 -4
- package/lib/server/chromium/crPage.js +26 -64
- package/lib/server/chromium/crServiceWorker.js +5 -4
- package/lib/server/clock.js +33 -33
- 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 +27 -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 +1 -1
- package/lib/server/dispatchers/disposableDispatcher.js +39 -0
- package/lib/server/dispatchers/electronDispatcher.js +2 -1
- package/lib/server/dispatchers/frameDispatcher.js +3 -3
- package/lib/server/dispatchers/localUtilsDispatcher.js +37 -1
- package/lib/server/dispatchers/networkDispatchers.js +6 -5
- package/lib/server/dispatchers/pageDispatcher.js +101 -38
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +4 -5
- package/lib/server/disposable.js +41 -0
- package/lib/server/dom.js +44 -26
- package/lib/server/download.js +3 -2
- package/lib/server/electron/electron.js +12 -7
- package/lib/server/firefox/ffBrowser.js +9 -19
- package/lib/server/firefox/ffInput.js +21 -5
- package/lib/server/firefox/ffNetworkManager.js +2 -2
- package/lib/server/firefox/ffPage.js +24 -27
- package/lib/server/frames.js +40 -11
- 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 +5 -0
- package/lib/server/launchApp.js +0 -1
- package/lib/server/localUtils.js +6 -6
- package/lib/server/network.js +9 -8
- package/lib/server/overlay.js +138 -0
- package/lib/server/page.js +111 -51
- package/lib/server/progress.js +6 -0
- package/lib/server/recorder/recorderApp.js +9 -8
- package/lib/server/recorder.js +76 -40
- package/lib/server/registry/index.js +54 -81
- package/lib/server/registry/nativeDeps.js +1 -0
- package/lib/server/screencast.js +90 -143
- package/lib/server/trace/recorder/snapshotter.js +2 -2
- package/lib/server/trace/recorder/tracing.js +87 -36
- package/lib/server/trace/viewer/traceViewer.js +3 -4
- 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/fileUtils.js +16 -2
- package/lib/server/utils/happyEyeballs.js +15 -12
- package/lib/server/utils/hostPlatform.js +0 -15
- package/lib/server/utils/httpServer.js +5 -3
- package/lib/server/utils/network.js +2 -1
- package/lib/server/utils/nodePlatform.js +0 -6
- package/lib/server/utils/processLauncher.js +8 -6
- package/lib/server/utils/zipFile.js +2 -2
- package/lib/server/videoRecorder.js +82 -12
- package/lib/server/webkit/wkBrowser.js +1 -6
- package/lib/server/webkit/wkPage.js +27 -25
- 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/{server/trace/viewer/traceParser.js → tools/trace/installSkill.js} +15 -39
- 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/formatUtils.js +64 -0
- package/lib/utils/isomorphic/jsonSchema.js +89 -0
- package/lib/utils/isomorphic/mimeType.js +7 -2
- package/lib/utils/isomorphic/protocolFormatter.js +2 -2
- package/lib/utils/isomorphic/protocolMetainfo.js +127 -106
- package/lib/utils/isomorphic/stringUtils.js +3 -3
- package/lib/utils/isomorphic/timeoutRunner.js +3 -3
- package/lib/utils/isomorphic/trace/snapshotRenderer.js +35 -42
- package/lib/utils/isomorphic/trace/traceLoader.js +15 -14
- package/lib/utils/isomorphic/trace/traceModel.js +3 -2
- package/lib/utils/isomorphic/trace/traceModernizer.js +1 -0
- package/lib/utils/isomorphic/urlMatch.js +54 -1
- package/lib/utils/isomorphic/utilityScriptSerializers.js +11 -0
- package/lib/utils.js +6 -2
- package/lib/utilsBundle.js +3 -21
- package/lib/utilsBundleImpl/index.js +132 -133
- 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-DadYNm1I.js → codeMirrorModule-C8KMvO9L.js} +20 -20
- package/lib/vite/recorder/assets/index-CqAYX1I3.js +193 -0
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/assets/{codeMirrorModule-a5XoALAZ.js → codeMirrorModule-DS0FLvoc.js} +20 -20
- package/lib/vite/traceViewer/assets/defaultSettingsView-GTWI-W_B.js +262 -0
- package/lib/vite/traceViewer/defaultSettingsView.B4dS75f0.css +1 -0
- package/lib/vite/traceViewer/{index.BVu7tZDe.css → index.CzXZzn5A.css} +1 -1
- package/lib/vite/traceViewer/{index.BDwrLSGN.js → index.Dtstcb7U.js} +1 -1
- package/lib/vite/traceViewer/index.html +4 -4
- package/lib/vite/traceViewer/sw.bundle.js +4 -4
- 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 +6 -1
- package/types/protocol.d.ts +947 -51
- package/types/types.d.ts +854 -74
- package/lib/client/pageAgent.js +0 -64
- package/lib/mcpBundleImpl/index.js +0 -147
- package/lib/server/agent/actionRunner.js +0 -335
- package/lib/server/agent/actions.js +0 -128
- package/lib/server/agent/codegen.js +0 -111
- package/lib/server/agent/context.js +0 -150
- package/lib/server/agent/expectTools.js +0 -156
- package/lib/server/agent/pageAgent.js +0 -204
- package/lib/server/agent/performTools.js +0 -262
- package/lib/server/agent/tool.js +0 -109
- package/lib/server/dispatchers/pageAgentDispatcher.js +0 -96
- package/lib/vite/recorder/assets/index-BhTWtUlo.js +0 -193
- package/lib/vite/traceViewer/assets/defaultSettingsView-CJSZINFr.js +0 -266
- package/lib/vite/traceViewer/defaultSettingsView.7ch9cixO.css +0 -1
- package/lib/vite/traceViewer/uiMode.CQJ9SCIQ.js +0 -5
- /package/lib/{server/utils → utils/isomorphic}/imageUtils.js +0 -0
- /package/lib/utils/isomorphic/{traceUtils.js → trace/traceUtils.js} +0 -0
|
@@ -23,6 +23,20 @@ __export(ffInput_exports, {
|
|
|
23
23
|
RawTouchscreenImpl: () => RawTouchscreenImpl
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(ffInput_exports);
|
|
26
|
+
const kFirefoxKeyOverrides = /* @__PURE__ */ new Map([
|
|
27
|
+
["AudioVolumeMute", { code: "VolumeMute", keyCodeWithoutLocation: 181 }],
|
|
28
|
+
["AudioVolumeDown", { code: "VolumeDown", keyCodeWithoutLocation: 182 }],
|
|
29
|
+
["AudioVolumeUp", { code: "VolumeUp", keyCodeWithoutLocation: 183 }]
|
|
30
|
+
]);
|
|
31
|
+
function toFirefoxKeyDescription(description) {
|
|
32
|
+
const override = kFirefoxKeyOverrides.get(description.key);
|
|
33
|
+
if (!override)
|
|
34
|
+
return description;
|
|
35
|
+
return {
|
|
36
|
+
...description,
|
|
37
|
+
...override
|
|
38
|
+
};
|
|
39
|
+
}
|
|
26
40
|
function toModifiersMask(modifiers) {
|
|
27
41
|
let mask = 0;
|
|
28
42
|
if (modifiers.has("Alt"))
|
|
@@ -59,13 +73,14 @@ class RawKeyboardImpl {
|
|
|
59
73
|
this._client = client;
|
|
60
74
|
}
|
|
61
75
|
async keydown(progress, modifiers, keyName, description, autoRepeat) {
|
|
62
|
-
|
|
76
|
+
const keyDescription = toFirefoxKeyDescription(description);
|
|
77
|
+
let text = keyDescription.text;
|
|
63
78
|
if (text === "\r")
|
|
64
79
|
text = "";
|
|
65
|
-
const { code, key, location } =
|
|
80
|
+
const { code, key, location } = keyDescription;
|
|
66
81
|
await progress.race(this._client.send("Page.dispatchKeyEvent", {
|
|
67
82
|
type: "keydown",
|
|
68
|
-
keyCode:
|
|
83
|
+
keyCode: keyDescription.keyCodeWithoutLocation,
|
|
69
84
|
code,
|
|
70
85
|
key,
|
|
71
86
|
repeat: autoRepeat,
|
|
@@ -74,11 +89,12 @@ class RawKeyboardImpl {
|
|
|
74
89
|
}));
|
|
75
90
|
}
|
|
76
91
|
async keyup(progress, modifiers, keyName, description) {
|
|
77
|
-
const
|
|
92
|
+
const keyDescription = toFirefoxKeyDescription(description);
|
|
93
|
+
const { code, key, location } = keyDescription;
|
|
78
94
|
await progress.race(this._client.send("Page.dispatchKeyEvent", {
|
|
79
95
|
type: "keyup",
|
|
80
96
|
key,
|
|
81
|
-
keyCode:
|
|
97
|
+
keyCode: keyDescription.keyCodeWithoutLocation,
|
|
82
98
|
code,
|
|
83
99
|
location,
|
|
84
100
|
repeat: false
|
|
@@ -133,8 +133,7 @@ class FFNetworkManager {
|
|
|
133
133
|
this._requests.delete(request._id);
|
|
134
134
|
response._requestFinished(responseEndTime);
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
response._setHttpVersion(event.protocolVersion);
|
|
136
|
+
response._setHttpVersion(event.protocolVersion ?? null);
|
|
138
137
|
this._page.frameManager.reportRequestFinished(request.request, response);
|
|
139
138
|
}
|
|
140
139
|
_onRequestFailed(event) {
|
|
@@ -147,6 +146,7 @@ class FFNetworkManager {
|
|
|
147
146
|
response.setTransferSize(null);
|
|
148
147
|
response.setEncodedBodySize(null);
|
|
149
148
|
response._requestFinished(-1);
|
|
149
|
+
response._setHttpVersion(null);
|
|
150
150
|
}
|
|
151
151
|
request.request._setFailureText(event.errorCode);
|
|
152
152
|
this._page.frameManager.requestFailed(request.request, event.errorCode === "NS_BINDING_ABORTED");
|
|
@@ -43,7 +43,7 @@ var import_ffInput = require("./ffInput");
|
|
|
43
43
|
var import_ffNetworkManager = require("./ffNetworkManager");
|
|
44
44
|
var import_stackTrace = require("../../utils/isomorphic/stackTrace");
|
|
45
45
|
var import_errors = require("../errors");
|
|
46
|
-
var
|
|
46
|
+
var import_videoRecorder = require("../videoRecorder");
|
|
47
47
|
const UTILITY_WORLD_NAME = "__playwright_utility_world__";
|
|
48
48
|
class FFPage {
|
|
49
49
|
constructor(session, browserContext, opener) {
|
|
@@ -89,19 +89,14 @@ class FFPage {
|
|
|
89
89
|
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.webSocketFrameSent", this._onWebSocketFrameSent.bind(this)),
|
|
90
90
|
import_eventsHelper.eventsHelper.addEventListener(this._session, "Page.screencastFrame", this._onScreencastFrame.bind(this))
|
|
91
91
|
];
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this._page.reportAsNew(this._opener?._page);
|
|
101
|
-
});
|
|
102
|
-
this.addInitScript(new import_page.InitScript(""), UTILITY_WORLD_NAME).catch((e) => this._markAsError(e));
|
|
103
|
-
}
|
|
104
|
-
async _markAsError(error) {
|
|
92
|
+
const promises = [];
|
|
93
|
+
if (!this._page.isStorageStatePage)
|
|
94
|
+
(0, import_videoRecorder.startAutomaticVideoRecording)(this._page);
|
|
95
|
+
promises.push(new Promise((f) => this._session.once("Page.ready", f)));
|
|
96
|
+
Promise.all(promises).then(() => this._reportAsNew(), (error) => this._reportAsNew(error));
|
|
97
|
+
this.addInitScript(new import_page.InitScript(this._page, ""), UTILITY_WORLD_NAME).catch((e) => this._reportAsNew(e));
|
|
98
|
+
}
|
|
99
|
+
_reportAsNew(error) {
|
|
105
100
|
if (this._reportedAsNew)
|
|
106
101
|
return;
|
|
107
102
|
this._reportedAsNew = true;
|
|
@@ -203,7 +198,8 @@ class FFPage {
|
|
|
203
198
|
const context = this._contextIdToContext.get(executionContextId);
|
|
204
199
|
if (!context)
|
|
205
200
|
return;
|
|
206
|
-
|
|
201
|
+
const timestamp = Date.now();
|
|
202
|
+
this._page.addConsoleMessage(null, type === "warn" ? "warning" : type, args.map((arg) => (0, import_ffExecutionContext.createHandle)(context, arg)), location, void 0, timestamp);
|
|
207
203
|
}
|
|
208
204
|
_onDialogOpened(params) {
|
|
209
205
|
this._page.browserContext.dialogManager.dialogDidOpen(new dialog.Dialog(
|
|
@@ -253,7 +249,7 @@ class FFPage {
|
|
|
253
249
|
workerSession.on("Runtime.console", (event2) => {
|
|
254
250
|
const { type, args, location } = event2;
|
|
255
251
|
const context = worker.existingExecutionContext;
|
|
256
|
-
this._page.addConsoleMessage(worker, type, args.map((arg) => (0, import_ffExecutionContext.createHandle)(context, arg)), location);
|
|
252
|
+
this._page.addConsoleMessage(worker, type, args.map((arg) => (0, import_ffExecutionContext.createHandle)(context, arg)), location, void 0, Date.now());
|
|
257
253
|
});
|
|
258
254
|
}
|
|
259
255
|
_onWorkerDestroyed(event) {
|
|
@@ -276,7 +272,7 @@ class FFPage {
|
|
|
276
272
|
this._page._didCrash();
|
|
277
273
|
}
|
|
278
274
|
didClose() {
|
|
279
|
-
this.
|
|
275
|
+
this._reportAsNew(new import_errors.TargetClosedError(this._page.closeReason()));
|
|
280
276
|
this._session.dispose();
|
|
281
277
|
import_eventsHelper.eventsHelper.removeEventListeners(this._eventListeners);
|
|
282
278
|
this._networkManager.dispose();
|
|
@@ -417,23 +413,22 @@ class FFPage {
|
|
|
417
413
|
throw e;
|
|
418
414
|
});
|
|
419
415
|
}
|
|
420
|
-
|
|
421
|
-
|
|
416
|
+
startScreencast(options) {
|
|
417
|
+
this._session.sendMayFail("Page.startScreencast", { width: options.width, height: options.height, quality: options.quality });
|
|
422
418
|
}
|
|
423
|
-
|
|
424
|
-
|
|
419
|
+
stopScreencast() {
|
|
420
|
+
this._session.sendMayFail("Page.stopScreencast");
|
|
425
421
|
}
|
|
426
422
|
_onScreencastFrame(event) {
|
|
427
|
-
this._page.screencast.throttleFrameAck(() => {
|
|
428
|
-
this._session.sendMayFail("Page.screencastFrameAck");
|
|
429
|
-
});
|
|
430
423
|
const buffer = Buffer.from(event.data, "base64");
|
|
431
|
-
this._page.
|
|
424
|
+
this._page.screencast.onScreencastFrame({
|
|
432
425
|
buffer,
|
|
433
426
|
frameSwapWallTime: event.timestamp * 1e3,
|
|
434
427
|
// timestamp is in seconds, we need to convert to milliseconds.
|
|
435
|
-
|
|
436
|
-
|
|
428
|
+
viewportWidth: event.deviceWidth,
|
|
429
|
+
viewportHeight: event.deviceHeight
|
|
430
|
+
}, () => {
|
|
431
|
+
this._session.sendMayFail("Page.screencastFrameAck");
|
|
437
432
|
});
|
|
438
433
|
}
|
|
439
434
|
rafCountForStablePosition() {
|
|
@@ -486,6 +481,8 @@ class FFPage {
|
|
|
486
481
|
shouldToggleStyleSheetToSyncAnimations() {
|
|
487
482
|
return false;
|
|
488
483
|
}
|
|
484
|
+
async setDockTile(image) {
|
|
485
|
+
}
|
|
489
486
|
}
|
|
490
487
|
function webSocketId(frameId, wsid) {
|
|
491
488
|
return `${frameId}---${wsid}`;
|
package/lib/server/frames.js
CHANGED
|
@@ -47,7 +47,6 @@ var import_progress = require("./progress");
|
|
|
47
47
|
var types = __toESM(require("./types"));
|
|
48
48
|
var import_utils = require("../utils");
|
|
49
49
|
var import_protocolError = require("./protocolError");
|
|
50
|
-
var import_debugLogger = require("./utils/debugLogger");
|
|
51
50
|
var import_eventsHelper = require("./utils/eventsHelper");
|
|
52
51
|
var import_selectorParser = require("../utils/isomorphic/selectorParser");
|
|
53
52
|
var import_manualPromise = require("../utils/isomorphic/manualPromise");
|
|
@@ -179,7 +178,7 @@ class FrameManager {
|
|
|
179
178
|
const navigationEvent = { url, name, newDocument: frame._currentDocument, isPublic: true };
|
|
180
179
|
this._fireInternalFrameNavigation(frame, navigationEvent);
|
|
181
180
|
if (!initial) {
|
|
182
|
-
|
|
181
|
+
frame.apiLog(` navigated to "${url}"`);
|
|
183
182
|
this._page.frameNavigatedToNewDocument(frame);
|
|
184
183
|
}
|
|
185
184
|
frame.setPendingDocument(keepPending);
|
|
@@ -195,7 +194,7 @@ class FrameManager {
|
|
|
195
194
|
frame._url = url;
|
|
196
195
|
const navigationEvent = { url, name: frame._name, isPublic: true };
|
|
197
196
|
this._fireInternalFrameNavigation(frame, navigationEvent);
|
|
198
|
-
|
|
197
|
+
frame.apiLog(` navigated to "${url}"`);
|
|
199
198
|
}
|
|
200
199
|
frameAbortedNavigation(frameId, errorText, documentId) {
|
|
201
200
|
const frame = this._frames.get(frameId);
|
|
@@ -398,7 +397,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
398
397
|
this._firedLifecycleEvents.add(event);
|
|
399
398
|
this.emit(Frame.Events.AddLifecycle, event);
|
|
400
399
|
if (this === this._page.mainFrame() && this._url !== "about:blank")
|
|
401
|
-
|
|
400
|
+
this.apiLog(` "${event}" event fired`);
|
|
402
401
|
this._page.mainFrame()._recalculateNetworkIdle();
|
|
403
402
|
}
|
|
404
403
|
_onClearLifecycle() {
|
|
@@ -470,7 +469,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
470
469
|
this._firedLifecycleEvents.add("networkidle");
|
|
471
470
|
this.emit(Frame.Events.AddLifecycle, "networkidle");
|
|
472
471
|
if (this === this._page.mainFrame() && this._url !== "about:blank")
|
|
473
|
-
|
|
472
|
+
this.apiLog(` "networkidle" event fired`);
|
|
474
473
|
}
|
|
475
474
|
if (frameThatAllowsRemovingNetworkIdle !== this && this._firedLifecycleEvents.has("networkidle") && !isNetworkIdle) {
|
|
476
475
|
this._firedLifecycleEvents.delete("networkidle");
|
|
@@ -605,7 +604,7 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
605
604
|
return value;
|
|
606
605
|
}
|
|
607
606
|
async querySelector(selector, options) {
|
|
608
|
-
|
|
607
|
+
this.apiLog(` finding element using the selector "${selector}"`);
|
|
609
608
|
return this.selectors.query(selector, options);
|
|
610
609
|
}
|
|
611
610
|
async waitForSelector(progress, selector, performActionPreChecksAndLog, options, scope) {
|
|
@@ -1145,9 +1144,6 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1145
1144
|
async waitForTimeout(progress, timeout) {
|
|
1146
1145
|
return progress.wait(timeout);
|
|
1147
1146
|
}
|
|
1148
|
-
async ariaSnapshot(progress, selector) {
|
|
1149
|
-
return await this._retryWithProgressIfNotConnected(progress, selector, { strict: true, performActionPreChecks: true }, (handle) => progress.race(handle.ariaSnapshot()));
|
|
1150
|
-
}
|
|
1151
1147
|
async expect(progress, selector, options) {
|
|
1152
1148
|
progress.log(`${(0, import_utils.renderTitleForCall)(progress.metadata)}${options.timeoutForLogs ? ` with timeout ${options.timeoutForLogs}ms` : ""}`);
|
|
1153
1149
|
const lastIntermediateResult = { isSet: false };
|
|
@@ -1306,8 +1302,17 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1306
1302
|
return JSON.parse(handle.rawValue());
|
|
1307
1303
|
}
|
|
1308
1304
|
async title() {
|
|
1309
|
-
|
|
1310
|
-
|
|
1305
|
+
try {
|
|
1306
|
+
return await this.raceAgainstEvaluationStallingEvents(async () => {
|
|
1307
|
+
const context = await this._utilityContext();
|
|
1308
|
+
return await context.evaluate(() => document.title);
|
|
1309
|
+
});
|
|
1310
|
+
} catch {
|
|
1311
|
+
const url = this.pendingDocument()?.request?.url();
|
|
1312
|
+
if (url)
|
|
1313
|
+
return `Loading ${url}`;
|
|
1314
|
+
return "";
|
|
1315
|
+
}
|
|
1311
1316
|
}
|
|
1312
1317
|
async rafrafTimeout(progress, timeout) {
|
|
1313
1318
|
if (timeout === 0)
|
|
@@ -1407,6 +1412,30 @@ class Frame extends import_instrumentation.SdkObject {
|
|
|
1407
1412
|
injectedScript.extend(source2, arg2);
|
|
1408
1413
|
}, { source, arg });
|
|
1409
1414
|
}
|
|
1415
|
+
async ariaSnapshot(progress, options = {}) {
|
|
1416
|
+
if (options.selector && options.track)
|
|
1417
|
+
throw new Error("Cannot specify both selector and track options");
|
|
1418
|
+
if (options.selector && options.mode !== "ai") {
|
|
1419
|
+
const snapshot2 = await this._retryWithProgressIfNotConnected(progress, options.selector, { strict: true, performActionPreChecks: true }, async (handle) => {
|
|
1420
|
+
return await progress.race(handle.evaluateInUtility(([injected, element, opts]) => injected.ariaSnapshot(element, opts), { mode: "default", depth: options.depth }));
|
|
1421
|
+
});
|
|
1422
|
+
return { snapshot: snapshot2 };
|
|
1423
|
+
}
|
|
1424
|
+
let targetFrame;
|
|
1425
|
+
let info;
|
|
1426
|
+
if (options.selector) {
|
|
1427
|
+
const resolved = await this.selectors.resolveInjectedForSelector(options.selector, { strict: true });
|
|
1428
|
+
if (!resolved)
|
|
1429
|
+
throw new Error(`Selector "${options.selector}" did not resolve to any element`);
|
|
1430
|
+
targetFrame = resolved.frame;
|
|
1431
|
+
info = resolved.info;
|
|
1432
|
+
} else {
|
|
1433
|
+
targetFrame = this;
|
|
1434
|
+
}
|
|
1435
|
+
const result = await (0, import_page.ariaSnapshotForFrame)(progress, targetFrame, { ...options, info });
|
|
1436
|
+
const snapshot = options.track && result.incremental ? result.incremental.join("\n") : result.full.join("\n");
|
|
1437
|
+
return { snapshot };
|
|
1438
|
+
}
|
|
1410
1439
|
_asLocator(selector) {
|
|
1411
1440
|
return (0, import_utils.asLocator)(this._page.browserContext._browser.sdkLanguage(), selector);
|
|
1412
1441
|
}
|
|
@@ -37,7 +37,6 @@ var import_artifact = require("../artifact");
|
|
|
37
37
|
var import_harTracer = require("./harTracer");
|
|
38
38
|
var import_crypto = require("../utils/crypto");
|
|
39
39
|
var import_manualPromise = require("../../utils/isomorphic/manualPromise");
|
|
40
|
-
var import_zipBundle = require("../../zipBundle");
|
|
41
40
|
class HarRecorder {
|
|
42
41
|
constructor(context, page, options) {
|
|
43
42
|
this._isFlushed = false;
|
|
@@ -56,7 +55,8 @@ class HarRecorder {
|
|
|
56
55
|
waitForContentOnStop: true,
|
|
57
56
|
urlFilter: urlFilterRe ?? options.urlGlob
|
|
58
57
|
});
|
|
59
|
-
|
|
58
|
+
const { yazl } = require("../../zipBundle");
|
|
59
|
+
this._zipFile = content === "attach" || expectsZip ? new yazl.ZipFile() : null;
|
|
60
60
|
this._tracer.start({ omitScripts: false });
|
|
61
61
|
}
|
|
62
62
|
onEntryStarted(entry) {
|
|
@@ -278,9 +278,6 @@ class HarTracer {
|
|
|
278
278
|
harEntry._securityDetails = details;
|
|
279
279
|
}));
|
|
280
280
|
}
|
|
281
|
-
const httpVersion = response.httpVersion();
|
|
282
|
-
harEntry.request.httpVersion = httpVersion;
|
|
283
|
-
harEntry.response.httpVersion = httpVersion;
|
|
284
281
|
const compressionCalculationBarrier = this._options.omitSizes ? void 0 : {
|
|
285
282
|
_encodedBodySize: -1,
|
|
286
283
|
_decodedBodySize: -1,
|
|
@@ -317,6 +314,10 @@ class HarTracer {
|
|
|
317
314
|
this._delegate.onEntryFinished(harEntry);
|
|
318
315
|
});
|
|
319
316
|
this._addBarrier(page || request.serviceWorker(), promise);
|
|
317
|
+
this._addBarrier(page || request.serviceWorker(), response.httpVersion().then((httpVersion) => {
|
|
318
|
+
harEntry.request.httpVersion = httpVersion;
|
|
319
|
+
harEntry.response.httpVersion = httpVersion;
|
|
320
|
+
}));
|
|
320
321
|
const timing = response.timing();
|
|
321
322
|
harEntry.timings.receive = response.request()._responseEndTiming !== -1 ? import_helper.helper.millisToRoundishMillis(response.request()._responseEndTiming - timing.responseStart) : -1;
|
|
322
323
|
this._computeHarEntryTotalTime(harEntry);
|
|
@@ -389,7 +390,7 @@ class HarTracer {
|
|
|
389
390
|
harEntry.response = {
|
|
390
391
|
status: response.status(),
|
|
391
392
|
statusText: response.statusText(),
|
|
392
|
-
httpVersion:
|
|
393
|
+
httpVersion: FALLBACK_HTTP_VERSION,
|
|
393
394
|
// These are bad values that will be overwritten below.
|
|
394
395
|
cookies: [],
|
|
395
396
|
headers: [],
|
package/lib/server/input.js
CHANGED
|
@@ -48,6 +48,10 @@ class Keyboard {
|
|
|
48
48
|
this._raw = raw;
|
|
49
49
|
this._page = page;
|
|
50
50
|
}
|
|
51
|
+
async apiDown(progress, key) {
|
|
52
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
53
|
+
await this.down(progress, key);
|
|
54
|
+
}
|
|
51
55
|
async down(progress, key) {
|
|
52
56
|
const description = this._keyDescriptionForString(key);
|
|
53
57
|
const autoRepeat = this._pressedKeys.has(description.code);
|
|
@@ -67,6 +71,10 @@ class Keyboard {
|
|
|
67
71
|
return { ...description, text: "" };
|
|
68
72
|
return description;
|
|
69
73
|
}
|
|
74
|
+
async apiUp(progress, key) {
|
|
75
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
76
|
+
await this.up(progress, key);
|
|
77
|
+
}
|
|
70
78
|
async up(progress, key) {
|
|
71
79
|
const description = this._keyDescriptionForString(key);
|
|
72
80
|
if (kModifiers.includes(description.key))
|
|
@@ -74,9 +82,17 @@ class Keyboard {
|
|
|
74
82
|
this._pressedKeys.delete(description.code);
|
|
75
83
|
await this._raw.keyup(progress, this._pressedModifiers, key, description);
|
|
76
84
|
}
|
|
77
|
-
async
|
|
85
|
+
async apiInsertText(progress, text) {
|
|
86
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
87
|
+
await this._insertText(progress, text);
|
|
88
|
+
}
|
|
89
|
+
async _insertText(progress, text) {
|
|
78
90
|
await this._raw.sendText(progress, text);
|
|
79
91
|
}
|
|
92
|
+
async apiType(progress, text, options) {
|
|
93
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
94
|
+
await this.type(progress, text, options);
|
|
95
|
+
}
|
|
80
96
|
async type(progress, text, options) {
|
|
81
97
|
const delay = options && options.delay || void 0;
|
|
82
98
|
for (const char of text) {
|
|
@@ -85,10 +101,14 @@ class Keyboard {
|
|
|
85
101
|
} else {
|
|
86
102
|
if (delay)
|
|
87
103
|
await progress.wait(delay);
|
|
88
|
-
await this.
|
|
104
|
+
await this._insertText(progress, char);
|
|
89
105
|
}
|
|
90
106
|
}
|
|
91
107
|
}
|
|
108
|
+
async apiPress(progress, key, options = {}) {
|
|
109
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
110
|
+
await this.press(progress, key, options);
|
|
111
|
+
}
|
|
92
112
|
async press(progress, key, options = {}) {
|
|
93
113
|
function split(keyString) {
|
|
94
114
|
const keys = [];
|
|
@@ -157,6 +177,11 @@ class Mouse {
|
|
|
157
177
|
currentPoint() {
|
|
158
178
|
return { x: this._x, y: this._y };
|
|
159
179
|
}
|
|
180
|
+
async apiMove(progress, x, y, options = {}) {
|
|
181
|
+
progress.metadata.point = { x, y };
|
|
182
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
183
|
+
await this.move(progress, x, y, options);
|
|
184
|
+
}
|
|
160
185
|
async move(progress, x, y, options = {}) {
|
|
161
186
|
const { steps = 1 } = options;
|
|
162
187
|
const fromX = this._x;
|
|
@@ -169,18 +194,33 @@ class Mouse {
|
|
|
169
194
|
await this._raw.move(progress, middleX, middleY, this._lastButton, this._buttons, this._keyboard._modifiers(), !!options.forClick);
|
|
170
195
|
}
|
|
171
196
|
}
|
|
197
|
+
async apiDown(progress, options = {}) {
|
|
198
|
+
progress.metadata.point = this.currentPoint();
|
|
199
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
200
|
+
await this.down(progress, options);
|
|
201
|
+
}
|
|
172
202
|
async down(progress, options = {}) {
|
|
173
203
|
const { button = "left", clickCount = 1 } = options;
|
|
174
204
|
this._lastButton = button;
|
|
175
205
|
this._buttons.add(button);
|
|
176
206
|
await this._raw.down(progress, this._x, this._y, this._lastButton, this._buttons, this._keyboard._modifiers(), clickCount);
|
|
177
207
|
}
|
|
208
|
+
async apiUp(progress, options = {}) {
|
|
209
|
+
progress.metadata.point = this.currentPoint();
|
|
210
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
211
|
+
await this.up(progress, options);
|
|
212
|
+
}
|
|
178
213
|
async up(progress, options = {}) {
|
|
179
214
|
const { button = "left", clickCount = 1 } = options;
|
|
180
215
|
this._lastButton = "none";
|
|
181
216
|
this._buttons.delete(button);
|
|
182
217
|
await this._raw.up(progress, this._x, this._y, button, this._buttons, this._keyboard._modifiers(), clickCount);
|
|
183
218
|
}
|
|
219
|
+
async apiClick(progress, x, y, options = {}) {
|
|
220
|
+
progress.metadata.point = { x, y };
|
|
221
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
222
|
+
await this.click(progress, x, y, options);
|
|
223
|
+
}
|
|
184
224
|
async click(progress, x, y, options = {}) {
|
|
185
225
|
const { delay = null, clickCount = 1, steps } = options;
|
|
186
226
|
if (delay) {
|
|
@@ -206,7 +246,8 @@ class Mouse {
|
|
|
206
246
|
await Promise.all(promises);
|
|
207
247
|
}
|
|
208
248
|
}
|
|
209
|
-
async
|
|
249
|
+
async apiWheel(progress, deltaX, deltaY) {
|
|
250
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
210
251
|
await this._raw.wheel(progress, this._x, this._y, this._buttons, this._keyboard._modifiers(), deltaX, deltaY);
|
|
211
252
|
}
|
|
212
253
|
}
|
|
@@ -260,9 +301,13 @@ class Touchscreen {
|
|
|
260
301
|
this._raw = raw;
|
|
261
302
|
this._page = page;
|
|
262
303
|
}
|
|
263
|
-
async
|
|
304
|
+
async apiTap(progress, x, y) {
|
|
264
305
|
if (!this._page.browserContext._options.hasTouch)
|
|
265
306
|
throw new Error("hasTouch must be enabled on the browser context before using the touchscreen.");
|
|
307
|
+
await this._page.instrumentation.onBeforeInputAction(this._page, progress.metadata);
|
|
308
|
+
await this.tap(progress, x, y);
|
|
309
|
+
}
|
|
310
|
+
async tap(progress, x, y) {
|
|
266
311
|
await this._raw.tap(progress, x, y, this._page.keyboard._modifiers());
|
|
267
312
|
}
|
|
268
313
|
}
|
|
@@ -25,6 +25,7 @@ __export(instrumentation_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(instrumentation_exports);
|
|
26
26
|
var import_events = require("events");
|
|
27
27
|
var import_crypto = require("./utils/crypto");
|
|
28
|
+
var import_debugLogger = require("./utils/debugLogger");
|
|
28
29
|
class SdkObject extends import_events.EventEmitter {
|
|
29
30
|
constructor(parent, guidPrefix, guid) {
|
|
30
31
|
super();
|
|
@@ -33,6 +34,10 @@ class SdkObject extends import_events.EventEmitter {
|
|
|
33
34
|
this.attribution = { ...parent.attribution };
|
|
34
35
|
this.instrumentation = parent.instrumentation;
|
|
35
36
|
}
|
|
37
|
+
apiLog(message) {
|
|
38
|
+
if (!this.attribution.playwright.options.isInternalPlaywright)
|
|
39
|
+
import_debugLogger.debugLogger.log("api", message);
|
|
40
|
+
}
|
|
36
41
|
closeReason() {
|
|
37
42
|
return this.attribution.page?._closeReason || this.attribution.context?._closeReason || this.attribution.browser?._closeReason;
|
|
38
43
|
}
|
package/lib/server/launchApp.js
CHANGED
|
@@ -106,7 +106,6 @@ async function syncLocalStorageWithSettings(page, appName) {
|
|
|
106
106
|
});
|
|
107
107
|
const settings = await import_fs.default.promises.readFile(settingsFile, "utf-8").catch(() => "{}");
|
|
108
108
|
await page.addInitScript(
|
|
109
|
-
progress,
|
|
110
109
|
`(${String((settings2) => {
|
|
111
110
|
if (location && location.protocol === "data:")
|
|
112
111
|
return;
|
package/lib/server/localUtils.js
CHANGED
|
@@ -45,13 +45,13 @@ var import_crypto = require("./utils/crypto");
|
|
|
45
45
|
var import_harBackend = require("./harBackend");
|
|
46
46
|
var import_manualPromise = require("../utils/isomorphic/manualPromise");
|
|
47
47
|
var import_zipFile = require("./utils/zipFile");
|
|
48
|
-
var
|
|
49
|
-
var import_traceUtils = require("../utils/isomorphic/traceUtils");
|
|
48
|
+
var import_traceUtils = require("../utils/isomorphic/trace/traceUtils");
|
|
50
49
|
var import_assert = require("../utils/isomorphic/assert");
|
|
51
50
|
var import_fileUtils = require("./utils/fileUtils");
|
|
52
51
|
async function zip(progress, stackSessions, params) {
|
|
53
52
|
const promise = new import_manualPromise.ManualPromise();
|
|
54
|
-
const
|
|
53
|
+
const { yauzl, yazl } = require("../zipBundle");
|
|
54
|
+
const zipFile = new yazl.ZipFile();
|
|
55
55
|
zipFile.on("error", (error) => promise.reject(error));
|
|
56
56
|
const addFile = (file, name) => {
|
|
57
57
|
try {
|
|
@@ -69,7 +69,7 @@ async function zip(progress, stackSessions, params) {
|
|
|
69
69
|
zipFile.addBuffer(buffer, "trace.stacks");
|
|
70
70
|
}
|
|
71
71
|
if (params.includeSources) {
|
|
72
|
-
const sourceFiles =
|
|
72
|
+
const sourceFiles = new Set(params.additionalSources);
|
|
73
73
|
for (const { stack } of stackSession?.callStacks || []) {
|
|
74
74
|
if (!stack)
|
|
75
75
|
continue;
|
|
@@ -77,7 +77,7 @@ async function zip(progress, stackSessions, params) {
|
|
|
77
77
|
sourceFiles.add(file);
|
|
78
78
|
}
|
|
79
79
|
for (const sourceFile of sourceFiles)
|
|
80
|
-
addFile(sourceFile, "resources/src@" +
|
|
80
|
+
addFile(sourceFile, "resources/src@" + (0, import_crypto.calculateSha1)(sourceFile) + ".txt");
|
|
81
81
|
}
|
|
82
82
|
if (params.mode === "write") {
|
|
83
83
|
await progress.race(import_fs.default.promises.mkdir(import_path.default.dirname(params.zipFile), { recursive: true }));
|
|
@@ -90,7 +90,7 @@ async function zip(progress, stackSessions, params) {
|
|
|
90
90
|
}
|
|
91
91
|
const tempFile = params.zipFile + ".tmp";
|
|
92
92
|
await progress.race(import_fs.default.promises.rename(params.zipFile, tempFile));
|
|
93
|
-
|
|
93
|
+
yauzl.open(tempFile, (err, inZipFile) => {
|
|
94
94
|
if (err) {
|
|
95
95
|
promise.reject(err);
|
|
96
96
|
return;
|
package/lib/server/network.js
CHANGED
|
@@ -373,7 +373,7 @@ class Route extends import_instrumentation.SdkObject {
|
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
375
|
class Response extends import_instrumentation.SdkObject {
|
|
376
|
-
constructor(request, status, statusText2, headers, timing, getResponseBodyCallback, fromServiceWorker
|
|
376
|
+
constructor(request, status, statusText2, headers, timing, getResponseBodyCallback, fromServiceWorker) {
|
|
377
377
|
super(request.frame() || request._context, "response");
|
|
378
378
|
this._contentPromise = null;
|
|
379
379
|
this._finishedPromise = new import_manualPromise.ManualPromise();
|
|
@@ -381,6 +381,7 @@ class Response extends import_instrumentation.SdkObject {
|
|
|
381
381
|
this._serverAddrPromise = new import_manualPromise.ManualPromise();
|
|
382
382
|
this._securityDetailsPromise = new import_manualPromise.ManualPromise();
|
|
383
383
|
this._rawResponseHeadersPromise = new import_manualPromise.ManualPromise();
|
|
384
|
+
this._httpVersionPromise = new import_manualPromise.ManualPromise();
|
|
384
385
|
this._encodedBodySizePromise = new import_manualPromise.ManualPromise();
|
|
385
386
|
this._transferSizePromise = new import_manualPromise.ManualPromise();
|
|
386
387
|
this._responseHeadersSizePromise = new import_manualPromise.ManualPromise();
|
|
@@ -394,7 +395,6 @@ class Response extends import_instrumentation.SdkObject {
|
|
|
394
395
|
this._headersMap.set(name.toLowerCase(), value);
|
|
395
396
|
this._getResponseBodyCallback = getResponseBodyCallback;
|
|
396
397
|
this._request._setResponse(this);
|
|
397
|
-
this._httpVersion = httpVersion;
|
|
398
398
|
this._fromServiceWorker = fromServiceWorker;
|
|
399
399
|
}
|
|
400
400
|
_serverAddrFinished(addr) {
|
|
@@ -410,7 +410,7 @@ class Response extends import_instrumentation.SdkObject {
|
|
|
410
410
|
this._finishedPromise.resolve();
|
|
411
411
|
}
|
|
412
412
|
_setHttpVersion(httpVersion) {
|
|
413
|
-
this.
|
|
413
|
+
this._httpVersionPromise.resolve(httpVersion);
|
|
414
414
|
}
|
|
415
415
|
url() {
|
|
416
416
|
return this._url;
|
|
@@ -476,14 +476,15 @@ class Response extends import_instrumentation.SdkObject {
|
|
|
476
476
|
frame() {
|
|
477
477
|
return this._request.frame();
|
|
478
478
|
}
|
|
479
|
-
httpVersion() {
|
|
480
|
-
|
|
479
|
+
async httpVersion() {
|
|
480
|
+
const httpVersion = await this._httpVersionPromise || null;
|
|
481
|
+
if (!httpVersion)
|
|
481
482
|
return "HTTP/1.1";
|
|
482
|
-
if (
|
|
483
|
+
if (httpVersion === "http/1.1")
|
|
483
484
|
return "HTTP/1.1";
|
|
484
|
-
if (
|
|
485
|
+
if (httpVersion === "h2")
|
|
485
486
|
return "HTTP/2.0";
|
|
486
|
-
return
|
|
487
|
+
return httpVersion;
|
|
487
488
|
}
|
|
488
489
|
fromServiceWorker() {
|
|
489
490
|
return this._fromServiceWorker;
|