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
|
@@ -0,0 +1,401 @@
|
|
|
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 traceModernizer_exports = {};
|
|
20
|
+
__export(traceModernizer_exports, {
|
|
21
|
+
TraceModernizer: () => TraceModernizer,
|
|
22
|
+
TraceVersionError: () => TraceVersionError
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(traceModernizer_exports);
|
|
25
|
+
class TraceVersionError extends Error {
|
|
26
|
+
constructor(message) {
|
|
27
|
+
super(message);
|
|
28
|
+
this.name = "TraceVersionError";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const latestVersion = 8;
|
|
32
|
+
class TraceModernizer {
|
|
33
|
+
constructor(contextEntry, snapshotStorage) {
|
|
34
|
+
this._actionMap = /* @__PURE__ */ new Map();
|
|
35
|
+
this._pageEntries = /* @__PURE__ */ new Map();
|
|
36
|
+
this._jsHandles = /* @__PURE__ */ new Map();
|
|
37
|
+
this._consoleObjects = /* @__PURE__ */ new Map();
|
|
38
|
+
this._contextEntry = contextEntry;
|
|
39
|
+
this._snapshotStorage = snapshotStorage;
|
|
40
|
+
}
|
|
41
|
+
appendTrace(trace) {
|
|
42
|
+
for (const line of trace.split("\n"))
|
|
43
|
+
this._appendEvent(line);
|
|
44
|
+
}
|
|
45
|
+
actions() {
|
|
46
|
+
return [...this._actionMap.values()];
|
|
47
|
+
}
|
|
48
|
+
_pageEntry(pageId) {
|
|
49
|
+
let pageEntry = this._pageEntries.get(pageId);
|
|
50
|
+
if (!pageEntry) {
|
|
51
|
+
pageEntry = {
|
|
52
|
+
pageId,
|
|
53
|
+
screencastFrames: []
|
|
54
|
+
};
|
|
55
|
+
this._pageEntries.set(pageId, pageEntry);
|
|
56
|
+
this._contextEntry.pages.push(pageEntry);
|
|
57
|
+
}
|
|
58
|
+
return pageEntry;
|
|
59
|
+
}
|
|
60
|
+
_appendEvent(line) {
|
|
61
|
+
if (!line)
|
|
62
|
+
return;
|
|
63
|
+
const events = this._modernize(JSON.parse(line));
|
|
64
|
+
for (const event of events)
|
|
65
|
+
this._innerAppendEvent(event);
|
|
66
|
+
}
|
|
67
|
+
_innerAppendEvent(event) {
|
|
68
|
+
const contextEntry = this._contextEntry;
|
|
69
|
+
switch (event.type) {
|
|
70
|
+
case "context-options": {
|
|
71
|
+
if (event.version > latestVersion)
|
|
72
|
+
throw new TraceVersionError("The trace was created by a newer version of Playwright and is not supported by this version of the viewer. Please use latest Playwright to open the trace.");
|
|
73
|
+
this._version = event.version;
|
|
74
|
+
contextEntry.origin = event.origin;
|
|
75
|
+
contextEntry.browserName = event.browserName;
|
|
76
|
+
contextEntry.channel = event.channel;
|
|
77
|
+
contextEntry.title = event.title;
|
|
78
|
+
contextEntry.platform = event.platform;
|
|
79
|
+
contextEntry.playwrightVersion = event.playwrightVersion;
|
|
80
|
+
contextEntry.wallTime = event.wallTime;
|
|
81
|
+
contextEntry.startTime = event.monotonicTime;
|
|
82
|
+
contextEntry.sdkLanguage = event.sdkLanguage;
|
|
83
|
+
contextEntry.options = event.options;
|
|
84
|
+
contextEntry.testIdAttributeName = event.testIdAttributeName;
|
|
85
|
+
contextEntry.contextId = event.contextId ?? "";
|
|
86
|
+
contextEntry.testTimeout = event.testTimeout;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case "screencast-frame": {
|
|
90
|
+
this._pageEntry(event.pageId).screencastFrames.push(event);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
case "before": {
|
|
94
|
+
this._actionMap.set(event.callId, { ...event, type: "action", endTime: 0, log: [] });
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
case "input": {
|
|
98
|
+
const existing = this._actionMap.get(event.callId);
|
|
99
|
+
existing.inputSnapshot = event.inputSnapshot;
|
|
100
|
+
existing.point = event.point;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
case "log": {
|
|
104
|
+
const existing = this._actionMap.get(event.callId);
|
|
105
|
+
if (!existing)
|
|
106
|
+
return;
|
|
107
|
+
existing.log.push({
|
|
108
|
+
time: event.time,
|
|
109
|
+
message: event.message
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
case "after": {
|
|
114
|
+
const existing = this._actionMap.get(event.callId);
|
|
115
|
+
existing.afterSnapshot = event.afterSnapshot;
|
|
116
|
+
existing.endTime = event.endTime;
|
|
117
|
+
existing.result = event.result;
|
|
118
|
+
existing.error = event.error;
|
|
119
|
+
existing.attachments = event.attachments;
|
|
120
|
+
existing.annotations = event.annotations;
|
|
121
|
+
if (event.point)
|
|
122
|
+
existing.point = event.point;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
case "action": {
|
|
126
|
+
this._actionMap.set(event.callId, { ...event, log: [] });
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case "event": {
|
|
130
|
+
contextEntry.events.push(event);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
case "stdout": {
|
|
134
|
+
contextEntry.stdio.push(event);
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case "stderr": {
|
|
138
|
+
contextEntry.stdio.push(event);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
case "error": {
|
|
142
|
+
contextEntry.errors.push(event);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "console": {
|
|
146
|
+
contextEntry.events.push(event);
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
case "resource-snapshot":
|
|
150
|
+
this._snapshotStorage.addResource(this._contextEntry.contextId, event.snapshot);
|
|
151
|
+
contextEntry.resources.push(event.snapshot);
|
|
152
|
+
break;
|
|
153
|
+
case "frame-snapshot":
|
|
154
|
+
this._snapshotStorage.addFrameSnapshot(this._contextEntry.contextId, event.snapshot, this._pageEntry(event.snapshot.pageId).screencastFrames);
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if ("pageId" in event && event.pageId)
|
|
158
|
+
this._pageEntry(event.pageId);
|
|
159
|
+
if (event.type === "action" || event.type === "before")
|
|
160
|
+
contextEntry.startTime = Math.min(contextEntry.startTime, event.startTime);
|
|
161
|
+
if (event.type === "action" || event.type === "after")
|
|
162
|
+
contextEntry.endTime = Math.max(contextEntry.endTime, event.endTime);
|
|
163
|
+
if (event.type === "event") {
|
|
164
|
+
contextEntry.startTime = Math.min(contextEntry.startTime, event.time);
|
|
165
|
+
contextEntry.endTime = Math.max(contextEntry.endTime, event.time);
|
|
166
|
+
}
|
|
167
|
+
if (event.type === "screencast-frame") {
|
|
168
|
+
contextEntry.startTime = Math.min(contextEntry.startTime, event.timestamp);
|
|
169
|
+
contextEntry.endTime = Math.max(contextEntry.endTime, event.timestamp);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
_processedContextCreatedEvent() {
|
|
173
|
+
return this._version !== void 0;
|
|
174
|
+
}
|
|
175
|
+
_modernize(event) {
|
|
176
|
+
let version = this._version ?? event.version ?? 6;
|
|
177
|
+
let events = [event];
|
|
178
|
+
for (; version < latestVersion; ++version)
|
|
179
|
+
events = this[`_modernize_${version}_to_${version + 1}`].call(this, events);
|
|
180
|
+
return events;
|
|
181
|
+
}
|
|
182
|
+
_modernize_0_to_1(events) {
|
|
183
|
+
for (const event of events) {
|
|
184
|
+
if (event.type !== "action")
|
|
185
|
+
continue;
|
|
186
|
+
if (typeof event.metadata.error === "string")
|
|
187
|
+
event.metadata.error = { error: { name: "Error", message: event.metadata.error } };
|
|
188
|
+
}
|
|
189
|
+
return events;
|
|
190
|
+
}
|
|
191
|
+
_modernize_1_to_2(events) {
|
|
192
|
+
for (const event of events) {
|
|
193
|
+
if (event.type !== "frame-snapshot" || !event.snapshot.isMainFrame)
|
|
194
|
+
continue;
|
|
195
|
+
event.snapshot.viewport = this._contextEntry.options?.viewport || { width: 1280, height: 720 };
|
|
196
|
+
}
|
|
197
|
+
return events;
|
|
198
|
+
}
|
|
199
|
+
_modernize_2_to_3(events) {
|
|
200
|
+
for (const event of events) {
|
|
201
|
+
if (event.type !== "resource-snapshot" || event.snapshot.request)
|
|
202
|
+
continue;
|
|
203
|
+
const resource = event.snapshot;
|
|
204
|
+
event.snapshot = {
|
|
205
|
+
_frameref: resource.frameId,
|
|
206
|
+
request: {
|
|
207
|
+
url: resource.url,
|
|
208
|
+
method: resource.method,
|
|
209
|
+
headers: resource.requestHeaders,
|
|
210
|
+
postData: resource.requestSha1 ? { _sha1: resource.requestSha1 } : void 0
|
|
211
|
+
},
|
|
212
|
+
response: {
|
|
213
|
+
status: resource.status,
|
|
214
|
+
headers: resource.responseHeaders,
|
|
215
|
+
content: {
|
|
216
|
+
mimeType: resource.contentType,
|
|
217
|
+
_sha1: resource.responseSha1
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
_monotonicTime: resource.timestamp
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
return events;
|
|
224
|
+
}
|
|
225
|
+
_modernize_3_to_4(events) {
|
|
226
|
+
const result = [];
|
|
227
|
+
for (const event of events) {
|
|
228
|
+
const e = this._modernize_event_3_to_4(event);
|
|
229
|
+
if (e)
|
|
230
|
+
result.push(e);
|
|
231
|
+
}
|
|
232
|
+
return result;
|
|
233
|
+
}
|
|
234
|
+
_modernize_event_3_to_4(event) {
|
|
235
|
+
if (event.type !== "action" && event.type !== "event") {
|
|
236
|
+
return event;
|
|
237
|
+
}
|
|
238
|
+
const metadata = event.metadata;
|
|
239
|
+
if (metadata.internal || metadata.method.startsWith("tracing"))
|
|
240
|
+
return null;
|
|
241
|
+
if (event.type === "event") {
|
|
242
|
+
if (metadata.method === "__create__" && metadata.type === "ConsoleMessage") {
|
|
243
|
+
return {
|
|
244
|
+
type: "object",
|
|
245
|
+
class: metadata.type,
|
|
246
|
+
guid: metadata.params.guid,
|
|
247
|
+
initializer: metadata.params.initializer
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
type: "event",
|
|
252
|
+
time: metadata.startTime,
|
|
253
|
+
class: metadata.type,
|
|
254
|
+
method: metadata.method,
|
|
255
|
+
params: metadata.params,
|
|
256
|
+
pageId: metadata.pageId
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
return {
|
|
260
|
+
type: "action",
|
|
261
|
+
callId: metadata.id,
|
|
262
|
+
startTime: metadata.startTime,
|
|
263
|
+
endTime: metadata.endTime,
|
|
264
|
+
apiName: metadata.apiName || metadata.type + "." + metadata.method,
|
|
265
|
+
class: metadata.type,
|
|
266
|
+
method: metadata.method,
|
|
267
|
+
params: metadata.params,
|
|
268
|
+
// eslint-disable-next-line no-restricted-globals
|
|
269
|
+
wallTime: metadata.wallTime || Date.now(),
|
|
270
|
+
log: metadata.log,
|
|
271
|
+
beforeSnapshot: metadata.snapshots.find((s) => s.title === "before")?.snapshotName,
|
|
272
|
+
inputSnapshot: metadata.snapshots.find((s) => s.title === "input")?.snapshotName,
|
|
273
|
+
afterSnapshot: metadata.snapshots.find((s) => s.title === "after")?.snapshotName,
|
|
274
|
+
error: metadata.error?.error,
|
|
275
|
+
result: metadata.result,
|
|
276
|
+
point: metadata.point,
|
|
277
|
+
pageId: metadata.pageId
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
_modernize_4_to_5(events) {
|
|
281
|
+
const result = [];
|
|
282
|
+
for (const event of events) {
|
|
283
|
+
const e = this._modernize_event_4_to_5(event);
|
|
284
|
+
if (e)
|
|
285
|
+
result.push(e);
|
|
286
|
+
}
|
|
287
|
+
return result;
|
|
288
|
+
}
|
|
289
|
+
_modernize_event_4_to_5(event) {
|
|
290
|
+
if (event.type === "event" && event.method === "__create__" && event.class === "JSHandle")
|
|
291
|
+
this._jsHandles.set(event.params.guid, event.params.initializer);
|
|
292
|
+
if (event.type === "object") {
|
|
293
|
+
if (event.class !== "ConsoleMessage")
|
|
294
|
+
return null;
|
|
295
|
+
const args = event.initializer.args?.map((arg) => {
|
|
296
|
+
if (arg.guid) {
|
|
297
|
+
const handle = this._jsHandles.get(arg.guid);
|
|
298
|
+
return { preview: handle?.preview || "", value: "" };
|
|
299
|
+
}
|
|
300
|
+
return { preview: arg.preview || "", value: arg.value || "" };
|
|
301
|
+
});
|
|
302
|
+
this._consoleObjects.set(event.guid, {
|
|
303
|
+
type: event.initializer.type,
|
|
304
|
+
text: event.initializer.text,
|
|
305
|
+
location: event.initializer.location,
|
|
306
|
+
args
|
|
307
|
+
});
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
if (event.type === "event" && event.method === "console") {
|
|
311
|
+
const consoleMessage = this._consoleObjects.get(event.params.message?.guid || "");
|
|
312
|
+
if (!consoleMessage)
|
|
313
|
+
return null;
|
|
314
|
+
return {
|
|
315
|
+
type: "console",
|
|
316
|
+
time: event.time,
|
|
317
|
+
pageId: event.pageId,
|
|
318
|
+
messageType: consoleMessage.type,
|
|
319
|
+
text: consoleMessage.text,
|
|
320
|
+
args: consoleMessage.args,
|
|
321
|
+
location: consoleMessage.location
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return event;
|
|
325
|
+
}
|
|
326
|
+
_modernize_5_to_6(events) {
|
|
327
|
+
const result = [];
|
|
328
|
+
for (const event of events) {
|
|
329
|
+
result.push(event);
|
|
330
|
+
if (event.type !== "after" || !event.log.length)
|
|
331
|
+
continue;
|
|
332
|
+
for (const log of event.log) {
|
|
333
|
+
result.push({
|
|
334
|
+
type: "log",
|
|
335
|
+
callId: event.callId,
|
|
336
|
+
message: log,
|
|
337
|
+
time: -1
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return result;
|
|
342
|
+
}
|
|
343
|
+
_modernize_6_to_7(events) {
|
|
344
|
+
const result = [];
|
|
345
|
+
if (!this._processedContextCreatedEvent() && events[0].type !== "context-options") {
|
|
346
|
+
const event = {
|
|
347
|
+
type: "context-options",
|
|
348
|
+
origin: "testRunner",
|
|
349
|
+
version: 6,
|
|
350
|
+
browserName: "",
|
|
351
|
+
options: {},
|
|
352
|
+
platform: "unknown",
|
|
353
|
+
wallTime: 0,
|
|
354
|
+
monotonicTime: 0,
|
|
355
|
+
sdkLanguage: "javascript",
|
|
356
|
+
contextId: ""
|
|
357
|
+
};
|
|
358
|
+
result.push(event);
|
|
359
|
+
}
|
|
360
|
+
for (const event of events) {
|
|
361
|
+
if (event.type === "context-options") {
|
|
362
|
+
result.push({ ...event, monotonicTime: 0, origin: "library", contextId: "" });
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
if (event.type === "before" || event.type === "action") {
|
|
366
|
+
if (!this._contextEntry.wallTime)
|
|
367
|
+
this._contextEntry.wallTime = event.wallTime;
|
|
368
|
+
const eventAsV6 = event;
|
|
369
|
+
const eventAsV7 = event;
|
|
370
|
+
eventAsV7.stepId = `${eventAsV6.apiName}@${eventAsV6.wallTime}`;
|
|
371
|
+
result.push(eventAsV7);
|
|
372
|
+
} else {
|
|
373
|
+
result.push(event);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return result;
|
|
377
|
+
}
|
|
378
|
+
_modernize_7_to_8(events) {
|
|
379
|
+
const result = [];
|
|
380
|
+
for (const event of events) {
|
|
381
|
+
if (event.type === "before" || event.type === "action") {
|
|
382
|
+
const eventAsV7 = event;
|
|
383
|
+
const eventAsV8 = event;
|
|
384
|
+
if (eventAsV7.apiName) {
|
|
385
|
+
eventAsV8.title = eventAsV7.apiName;
|
|
386
|
+
delete eventAsV8.apiName;
|
|
387
|
+
}
|
|
388
|
+
eventAsV8.stepId = eventAsV7.stepId ?? eventAsV7.callId;
|
|
389
|
+
result.push(eventAsV8);
|
|
390
|
+
} else {
|
|
391
|
+
result.push(event);
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return result;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
398
|
+
0 && (module.exports = {
|
|
399
|
+
TraceModernizer,
|
|
400
|
+
TraceVersionError
|
|
401
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV3_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV3_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV4_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV4_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV5_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV5_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV6_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV6_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV7_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV7_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var traceV8_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(traceV8_exports);
|
|
@@ -19,8 +19,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var urlMatch_exports = {};
|
|
20
20
|
__export(urlMatch_exports, {
|
|
21
21
|
constructURLBasedOnBaseURL: () => constructURLBasedOnBaseURL,
|
|
22
|
+
deserializeURLMatch: () => deserializeURLMatch,
|
|
22
23
|
globToRegexPattern: () => globToRegexPattern,
|
|
24
|
+
isURLPattern: () => isURLPattern,
|
|
23
25
|
resolveGlobToRegexPattern: () => resolveGlobToRegexPattern,
|
|
26
|
+
serializeURLMatch: () => serializeURLMatch,
|
|
27
|
+
serializeURLPattern: () => serializeURLPattern,
|
|
24
28
|
urlMatches: () => urlMatches,
|
|
25
29
|
urlMatchesEqual: () => urlMatchesEqual
|
|
26
30
|
});
|
|
@@ -86,6 +90,49 @@ function globToRegexPattern(glob) {
|
|
|
86
90
|
function isRegExp(obj) {
|
|
87
91
|
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
88
92
|
}
|
|
93
|
+
const isURLPattern = (v) => typeof globalThis.URLPattern === "function" && v instanceof globalThis.URLPattern;
|
|
94
|
+
function serializeURLPattern(v) {
|
|
95
|
+
return {
|
|
96
|
+
hash: v.hash,
|
|
97
|
+
hostname: v.hostname,
|
|
98
|
+
password: v.password,
|
|
99
|
+
pathname: v.pathname,
|
|
100
|
+
port: v.port,
|
|
101
|
+
protocol: v.protocol,
|
|
102
|
+
search: v.search,
|
|
103
|
+
username: v.username
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function serializeURLMatch(match) {
|
|
107
|
+
if ((0, import_stringUtils.isString)(match))
|
|
108
|
+
return { glob: match };
|
|
109
|
+
if (isRegExp(match))
|
|
110
|
+
return { regexSource: match.source, regexFlags: match.flags };
|
|
111
|
+
if (isURLPattern(match))
|
|
112
|
+
return { urlPattern: serializeURLPattern(match) };
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
function deserializeURLPattern(v) {
|
|
116
|
+
if (typeof globalThis.URLPattern !== "function")
|
|
117
|
+
return () => true;
|
|
118
|
+
return new globalThis.URLPattern({
|
|
119
|
+
hash: v.hash,
|
|
120
|
+
hostname: v.hostname,
|
|
121
|
+
password: v.password,
|
|
122
|
+
pathname: v.pathname,
|
|
123
|
+
port: v.port,
|
|
124
|
+
protocol: v.protocol,
|
|
125
|
+
search: v.search,
|
|
126
|
+
username: v.username
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function deserializeURLMatch(match) {
|
|
130
|
+
if (match.regexSource)
|
|
131
|
+
return new RegExp(match.regexSource, match.regexFlags);
|
|
132
|
+
if (match.urlPattern)
|
|
133
|
+
return deserializeURLPattern(match.urlPattern);
|
|
134
|
+
return match.glob;
|
|
135
|
+
}
|
|
89
136
|
function urlMatchesEqual(match1, match2) {
|
|
90
137
|
if (isRegExp(match1) && isRegExp(match2))
|
|
91
138
|
return match1.source === match2.source && match1.flags === match2.flags;
|
|
@@ -103,8 +150,10 @@ function urlMatches(baseURL, urlString, match, webSocketUrl) {
|
|
|
103
150
|
const url = parseURL(urlString);
|
|
104
151
|
if (!url)
|
|
105
152
|
return false;
|
|
153
|
+
if (isURLPattern(match))
|
|
154
|
+
return match.test(url.href);
|
|
106
155
|
if (typeof match !== "function")
|
|
107
|
-
throw new Error("url parameter should be string, RegExp or function");
|
|
156
|
+
throw new Error("url parameter should be string, RegExp, URLPattern or function");
|
|
108
157
|
return match(url);
|
|
109
158
|
}
|
|
110
159
|
function resolveGlobToRegexPattern(baseURL, glob, webSocketUrl) {
|
|
@@ -183,8 +232,12 @@ function resolveBaseURL(baseURL, givenURL) {
|
|
|
183
232
|
// Annotate the CommonJS export names for ESM import in node:
|
|
184
233
|
0 && (module.exports = {
|
|
185
234
|
constructURLBasedOnBaseURL,
|
|
235
|
+
deserializeURLMatch,
|
|
186
236
|
globToRegexPattern,
|
|
237
|
+
isURLPattern,
|
|
187
238
|
resolveGlobToRegexPattern,
|
|
239
|
+
serializeURLMatch,
|
|
240
|
+
serializeURLPattern,
|
|
188
241
|
urlMatches,
|
|
189
242
|
urlMatchesEqual
|
|
190
243
|
});
|
|
@@ -57,6 +57,13 @@ function isTypedArray(obj, constructor) {
|
|
|
57
57
|
return false;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
function isArrayBuffer(obj) {
|
|
61
|
+
try {
|
|
62
|
+
return obj instanceof ArrayBuffer || Object.prototype.toString.call(obj) === "[object ArrayBuffer]";
|
|
63
|
+
} catch (error) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
60
67
|
const typedArrayConstructors = {
|
|
61
68
|
i8: Int8Array,
|
|
62
69
|
ui8: Uint8Array,
|
|
@@ -141,6 +148,8 @@ function parseEvaluationResultValue(value, handles = [], refs = /* @__PURE__ */
|
|
|
141
148
|
return handles[value.h];
|
|
142
149
|
if ("ta" in value)
|
|
143
150
|
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
|
151
|
+
if ("ab" in value)
|
|
152
|
+
return base64ToTypedArray(value.ab.b, Uint8Array).buffer;
|
|
144
153
|
}
|
|
145
154
|
return value;
|
|
146
155
|
}
|
|
@@ -206,6 +215,8 @@ ${value.stack}`;
|
|
|
206
215
|
if (isTypedArray(value, ctor))
|
|
207
216
|
return { ta: { b: typedArrayToBase64(value), k } };
|
|
208
217
|
}
|
|
218
|
+
if (isArrayBuffer(value))
|
|
219
|
+
return { ab: { b: typedArrayToBase64(new Uint8Array(value)) } };
|
|
209
220
|
const id = visitorInfo.visited.get(value);
|
|
210
221
|
if (id)
|
|
211
222
|
return { ref: id };
|