patchright-core 1.52.5 → 1.55.1
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 +65 -123
- package/bin/reinstall_chrome_beta_mac.sh +1 -1
- package/bin/reinstall_chrome_stable_mac.sh +1 -1
- package/bin/reinstall_msedge_beta_mac.sh +1 -1
- package/bin/reinstall_msedge_dev_mac.sh +1 -1
- package/bin/reinstall_msedge_stable_mac.sh +1 -1
- package/browsers.json +14 -14
- package/index.js +1 -1
- package/lib/androidServerImpl.js +4 -2
- package/lib/browserServerImpl.js +47 -12
- package/lib/cli/program.js +116 -50
- package/lib/cli/programWithTestStub.js +1 -1
- package/lib/client/android.js +30 -34
- package/lib/client/browser.js +54 -17
- package/lib/client/browserContext.js +67 -71
- package/lib/client/browserType.js +25 -34
- package/lib/client/channelOwner.js +20 -24
- package/lib/client/connection.js +6 -10
- package/lib/client/electron.js +8 -3
- package/lib/client/elementHandle.js +18 -21
- package/lib/client/fetch.js +5 -3
- package/lib/client/frame.js +54 -32
- package/lib/client/input.js +3 -1
- package/lib/client/jsHandle.js +4 -0
- package/lib/client/localUtils.js +0 -1
- package/lib/client/locator.js +30 -26
- package/lib/client/network.js +5 -12
- package/lib/client/page.js +32 -32
- package/lib/client/playwright.js +6 -16
- package/lib/client/selectors.js +18 -38
- package/lib/client/timeoutSettings.js +12 -8
- package/lib/client/tracing.js +24 -20
- package/lib/client/waiter.js +2 -2
- package/lib/client/webSocket.js +4 -22
- package/lib/generated/bindingsControllerSource.js +28 -0
- 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 +28 -0
- package/lib/generated/utilityScriptSource.js +1 -1
- package/lib/generated/webSocketMockSource.js +12 -50
- package/lib/inProcessFactory.js +9 -6
- package/lib/outofprocess.js +0 -2
- package/lib/protocol/validator.js +421 -345
- package/lib/protocol/validatorPrimitives.js +18 -4
- package/lib/remote/playwrightConnection.js +29 -166
- package/lib/remote/playwrightServer.js +233 -35
- package/lib/server/android/android.js +97 -83
- package/lib/server/android/backendAdb.js +0 -2
- package/lib/server/bidi/bidiBrowser.js +139 -73
- package/lib/server/bidi/bidiChromium.js +23 -22
- package/lib/server/bidi/bidiExecutionContext.js +2 -1
- package/lib/server/bidi/bidiFirefox.js +17 -14
- package/lib/server/bidi/bidiInput.js +22 -22
- package/lib/server/bidi/bidiNetworkManager.js +8 -11
- package/lib/server/bidi/bidiPage.js +42 -86
- package/lib/server/bidi/third_party/bidiProtocol.js +5 -133
- package/lib/server/bidi/third_party/bidiProtocolCore.js +179 -0
- package/lib/server/{dispatchers/selectorsDispatcher.js → bidi/third_party/bidiProtocolPermissions.js} +20 -18
- package/lib/server/browser.js +30 -21
- package/lib/server/browserContext.js +203 -165
- package/lib/server/browserType.js +109 -107
- package/lib/server/chromium/chromium.js +84 -69
- package/lib/server/chromium/chromiumSwitches.js +13 -20
- package/lib/server/chromium/crBrowser.js +74 -40
- package/lib/server/chromium/crConnection.js +8 -9
- package/lib/server/chromium/crCoverage.js +11 -8
- package/lib/server/chromium/crDragDrop.js +25 -20
- package/lib/server/chromium/crExecutionContext.js +2 -1
- package/lib/server/chromium/crInput.js +32 -29
- package/lib/server/chromium/crNetworkManager.js +43 -31
- package/lib/server/chromium/crPage.js +98 -72
- package/lib/server/chromium/crServiceWorker.js +13 -18
- package/lib/server/chromium/videoRecorder.js +10 -18
- package/lib/server/clock.js +51 -39
- package/lib/server/codegen/csharp.js +10 -5
- package/lib/server/codegen/java.js +1 -1
- package/lib/server/codegen/javascript.js +1 -1
- package/lib/server/codegen/jsonl.js +2 -1
- package/lib/server/codegen/language.js +22 -1
- package/lib/server/codegen/languages.js +4 -4
- package/lib/server/codegen/python.js +1 -1
- package/lib/server/cookieStore.js +3 -1
- package/lib/server/debugController.js +105 -71
- package/lib/server/debugger.js +6 -23
- package/lib/server/deviceDescriptorsSource.json +237 -127
- package/lib/server/dialog.js +50 -6
- package/lib/server/dispatchers/androidDispatcher.js +77 -62
- package/lib/server/dispatchers/artifactDispatcher.js +18 -18
- package/lib/server/dispatchers/browserContextDispatcher.js +141 -91
- package/lib/server/dispatchers/browserDispatcher.js +55 -88
- package/lib/server/dispatchers/browserTypeDispatcher.js +18 -9
- package/lib/server/dispatchers/cdpSessionDispatcher.js +4 -4
- package/lib/server/dispatchers/debugControllerDispatcher.js +12 -21
- package/lib/server/dispatchers/dialogDispatcher.js +4 -4
- package/lib/server/dispatchers/dispatcher.js +78 -53
- package/lib/server/dispatchers/electronDispatcher.js +19 -20
- package/lib/server/dispatchers/elementHandlerDispatcher.js +83 -93
- package/lib/server/dispatchers/frameDispatcher.js +98 -101
- package/lib/server/dispatchers/jsHandleDispatcher.js +21 -16
- package/lib/server/dispatchers/jsonPipeDispatcher.js +4 -4
- package/lib/server/dispatchers/localUtilsDispatcher.js +53 -59
- package/lib/server/dispatchers/networkDispatchers.js +41 -35
- package/lib/server/dispatchers/pageDispatcher.js +156 -107
- package/lib/server/dispatchers/playwrightDispatcher.js +37 -25
- package/lib/server/dispatchers/streamDispatcher.js +15 -8
- package/lib/server/dispatchers/tracingDispatcher.js +22 -13
- package/lib/server/dispatchers/webSocketRouteDispatcher.js +46 -35
- package/lib/server/dispatchers/writableStreamDispatcher.js +16 -10
- package/lib/server/dom.js +198 -266
- package/lib/server/download.js +3 -3
- package/lib/server/electron/electron.js +96 -103
- package/lib/server/electron/loader.js +1 -1
- package/lib/server/fetch.js +22 -41
- package/lib/server/fileUploadUtils.js +1 -1
- package/lib/server/firefox/ffBrowser.js +79 -55
- package/lib/server/firefox/ffExecutionContext.js +2 -1
- package/lib/server/firefox/ffInput.js +23 -23
- package/lib/server/firefox/ffNetworkManager.js +8 -6
- package/lib/server/firefox/ffPage.js +39 -36
- package/lib/server/firefox/firefox.js +9 -10
- package/lib/server/frameSelectors.js +63 -20
- package/lib/server/frames.js +495 -555
- package/lib/server/har/harRecorder.js +1 -1
- package/lib/server/har/harTracer.js +4 -2
- package/lib/server/helper.js +3 -7
- package/lib/server/index.js +0 -3
- package/lib/server/input.js +47 -54
- package/lib/server/instrumentation.js +8 -14
- package/lib/server/javascript.js +8 -16
- package/lib/server/launchApp.js +48 -30
- package/lib/server/localUtils.js +45 -38
- package/lib/server/network.js +44 -10
- package/lib/server/page.js +232 -177
- package/lib/server/pageBinding.js +6 -7
- package/lib/server/playwright.js +4 -14
- package/lib/server/progress.js +57 -49
- package/lib/server/recorder/recorderApp.js +298 -95
- package/lib/server/recorder/recorderRunner.js +23 -24
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/recorder/recorderUtils.js +67 -10
- package/lib/server/recorder.js +284 -146
- package/lib/server/registry/index.js +83 -48
- package/lib/server/registry/nativeDeps.js +175 -0
- package/lib/server/registry/oopDownloadBrowserMain.js +1 -1
- package/lib/server/screenshotter.js +84 -83
- package/lib/server/selectors.js +12 -12
- package/lib/server/socksClientCertificatesInterceptor.js +198 -136
- package/lib/server/trace/recorder/snapshotter.js +12 -19
- package/lib/server/trace/recorder/tracing.js +36 -27
- package/lib/server/trace/viewer/traceViewer.js +11 -20
- package/lib/server/transport.js +20 -22
- package/lib/server/utils/comparators.js +2 -2
- package/lib/server/utils/debug.js +3 -8
- package/lib/server/utils/debugLogger.js +8 -0
- package/lib/server/utils/hostPlatform.js +3 -1
- package/lib/server/utils/network.js +35 -25
- package/lib/server/utils/nodePlatform.js +1 -1
- package/lib/server/utils/processLauncher.js +4 -1
- package/lib/server/utils/wsServer.js +11 -17
- package/lib/server/webkit/webkit.js +5 -2
- package/lib/server/webkit/wkBrowser.js +51 -28
- package/lib/server/webkit/wkExecutionContext.js +2 -1
- package/lib/server/webkit/wkInput.js +25 -25
- package/lib/server/webkit/wkInterceptableRequest.js +1 -1
- package/lib/server/webkit/wkPage.js +80 -59
- package/lib/server/webkit/wkProvisionalPage.js +1 -1
- package/lib/server/webkit/wkWorkers.js +7 -7
- package/lib/utils/isomorphic/ariaSnapshot.js +13 -7
- package/lib/utils/isomorphic/cssParser.js +1 -2
- package/lib/utils/isomorphic/locatorGenerators.js +18 -0
- package/lib/utils/isomorphic/manualPromise.js +1 -2
- package/lib/utils/isomorphic/mimeType.js +1 -2
- package/lib/utils/isomorphic/multimap.js +1 -2
- package/lib/utils/isomorphic/oldUtilityScriptSerializers.js +248 -0
- package/lib/utils/isomorphic/protocolFormatter.js +78 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +318 -0
- package/lib/utils/isomorphic/selectorParser.js +3 -4
- package/lib/utils/isomorphic/stringUtils.js +3 -24
- package/lib/utils/isomorphic/time.js +9 -4
- package/lib/utils/isomorphic/timeoutRunner.js +3 -4
- package/lib/utils/isomorphic/traceUtils.js +2 -3
- package/lib/utils/isomorphic/urlMatch.js +21 -7
- package/lib/utils/isomorphic/utilityScriptSerializers.js +208 -205
- package/lib/utils.js +8 -2
- package/lib/utilsBundleImpl/index.js +160 -150
- package/lib/vite/htmlReport/index.html +17 -17
- package/lib/vite/recorder/assets/{codeMirrorModule-CXVeovup.js → codeMirrorModule-DzQ0k89p.js} +1 -1
- package/lib/vite/recorder/assets/{index-eHBmevrY.css → index-CI4HQ-Zb.css} +1 -1
- package/lib/vite/recorder/assets/index-D7C7daHH.js +184 -0
- package/lib/vite/recorder/index.html +3 -3
- package/lib/vite/traceViewer/assets/{codeMirrorModule-_GLjJL-7.js → codeMirrorModule-Di48jgWx.js} +1 -1
- package/lib/vite/traceViewer/assets/defaultSettingsView-szBn8781.js +256 -0
- package/lib/vite/traceViewer/defaultSettingsView.DVJHpiGt.css +1 -0
- package/lib/vite/traceViewer/index.BFsek2M6.css +1 -0
- package/lib/vite/traceViewer/index.DQvXoPLL.js +2 -0
- package/lib/vite/traceViewer/index.html +6 -6
- package/lib/vite/traceViewer/sw.bundle.js +3 -3
- package/lib/vite/traceViewer/uiMode.dBV3oN9h.js +5 -0
- package/lib/vite/traceViewer/uiMode.html +4 -4
- package/lib/zipBundleImpl.js +4 -4
- package/package.json +1 -1
- package/types/protocol.d.ts +712 -107
- package/types/types.d.ts +128 -17
- package/lib/generated/consoleApiSource.js +0 -28
- package/lib/protocol/debug.js +0 -211
- package/lib/server/recorder/contextRecorder.js +0 -286
- package/lib/server/recorder/recorderCollection.js +0 -116
- package/lib/server/recorder/recorderFrontend.js +0 -16
- package/lib/server/storageScript.js +0 -154
- package/lib/server/timeoutSettings.js +0 -89
- package/lib/utils/isomorphic/builtins.js +0 -86
- package/lib/vite/recorder/assets/index-BsWQsSGl.js +0 -184
- package/lib/vite/traceViewer/assets/defaultSettingsView-DtCQiGHe.js +0 -265
- package/lib/vite/traceViewer/defaultSettingsView.QdHITyLI.css +0 -1
- package/lib/vite/traceViewer/index.CFOW-Ezb.css +0 -1
- package/lib/vite/traceViewer/index.cFZzK9RN.js +0 -2
- package/lib/vite/traceViewer/uiMode.XVPIqBeS.js +0 -5
|
@@ -18,231 +18,234 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var utilityScriptSerializers_exports = {};
|
|
20
20
|
__export(utilityScriptSerializers_exports, {
|
|
21
|
-
|
|
21
|
+
parseEvaluationResultValue: () => parseEvaluationResultValue,
|
|
22
|
+
serializeAsCallArgument: () => serializeAsCallArgument
|
|
22
23
|
});
|
|
23
24
|
module.exports = __toCommonJS(utilityScriptSerializers_exports);
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
25
|
+
function isRegExp(obj) {
|
|
26
|
+
try {
|
|
27
|
+
return obj instanceof RegExp || Object.prototype.toString.call(obj) === "[object RegExp]";
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return false;
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
function isURL(obj) {
|
|
40
|
-
try {
|
|
41
|
-
return obj instanceof URL || Object.prototype.toString.call(obj) === "[object URL]";
|
|
42
|
-
} catch (error) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function isError(obj) {
|
|
47
|
-
try {
|
|
48
|
-
return obj instanceof Error || obj && Object.getPrototypeOf(obj)?.name === "Error";
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
31
|
+
}
|
|
32
|
+
function isDate(obj) {
|
|
33
|
+
try {
|
|
34
|
+
return obj instanceof Date || Object.prototype.toString.call(obj) === "[object Date]";
|
|
35
|
+
} catch (error) {
|
|
36
|
+
return false;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
38
|
+
}
|
|
39
|
+
function isURL(obj) {
|
|
40
|
+
try {
|
|
41
|
+
return obj instanceof URL || Object.prototype.toString.call(obj) === "[object URL]";
|
|
42
|
+
} catch (error) {
|
|
43
|
+
return false;
|
|
59
44
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
i32: Int32Array,
|
|
67
|
-
ui32: Uint32Array,
|
|
68
|
-
// TODO: add Float16Array once it's in baseline
|
|
69
|
-
f32: Float32Array,
|
|
70
|
-
f64: Float64Array,
|
|
71
|
-
bi64: BigInt64Array,
|
|
72
|
-
bui64: BigUint64Array
|
|
73
|
-
};
|
|
74
|
-
function typedArrayToBase64(array) {
|
|
75
|
-
if ("toBase64" in array)
|
|
76
|
-
return array.toBase64();
|
|
77
|
-
const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join("");
|
|
78
|
-
return btoa(binary);
|
|
45
|
+
}
|
|
46
|
+
function isError(obj) {
|
|
47
|
+
try {
|
|
48
|
+
return obj instanceof Error || obj && Object.getPrototypeOf(obj)?.name === "Error";
|
|
49
|
+
} catch (error) {
|
|
50
|
+
return false;
|
|
79
51
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
return
|
|
52
|
+
}
|
|
53
|
+
function isTypedArray(obj, constructor) {
|
|
54
|
+
try {
|
|
55
|
+
return obj instanceof constructor || Object.prototype.toString.call(obj) === `[object ${constructor.name}]`;
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return false;
|
|
86
58
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
59
|
+
}
|
|
60
|
+
const typedArrayConstructors = {
|
|
61
|
+
i8: Int8Array,
|
|
62
|
+
ui8: Uint8Array,
|
|
63
|
+
ui8c: Uint8ClampedArray,
|
|
64
|
+
i16: Int16Array,
|
|
65
|
+
ui16: Uint16Array,
|
|
66
|
+
i32: Int32Array,
|
|
67
|
+
ui32: Uint32Array,
|
|
68
|
+
// TODO: add Float16Array once it's in baseline
|
|
69
|
+
f32: Float32Array,
|
|
70
|
+
f64: Float64Array,
|
|
71
|
+
bi64: BigInt64Array,
|
|
72
|
+
bui64: BigUint64Array
|
|
73
|
+
};
|
|
74
|
+
function typedArrayToBase64(array) {
|
|
75
|
+
if ("toBase64" in array)
|
|
76
|
+
return array.toBase64();
|
|
77
|
+
const binary = Array.from(new Uint8Array(array.buffer, array.byteOffset, array.byteLength)).map((b) => String.fromCharCode(b)).join("");
|
|
78
|
+
return btoa(binary);
|
|
79
|
+
}
|
|
80
|
+
function base64ToTypedArray(base64, TypedArrayConstructor) {
|
|
81
|
+
const binary = atob(base64);
|
|
82
|
+
const bytes = new Uint8Array(binary.length);
|
|
83
|
+
for (let i = 0; i < binary.length; i++)
|
|
84
|
+
bytes[i] = binary.charCodeAt(i);
|
|
85
|
+
return new TypedArrayConstructor(bytes.buffer);
|
|
86
|
+
}
|
|
87
|
+
function parseEvaluationResultValue(value, handles = [], refs = /* @__PURE__ */ new Map()) {
|
|
88
|
+
if (Object.is(value, void 0))
|
|
89
|
+
return void 0;
|
|
90
|
+
if (typeof value === "object" && value) {
|
|
91
|
+
if ("ref" in value)
|
|
92
|
+
return refs.get(value.ref);
|
|
93
|
+
if ("v" in value) {
|
|
94
|
+
if (value.v === "undefined")
|
|
106
95
|
return void 0;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
return error;
|
|
119
|
-
}
|
|
120
|
-
if ("r" in value)
|
|
121
|
-
return new RegExp(value.r.p, value.r.f);
|
|
122
|
-
if ("a" in value) {
|
|
123
|
-
const result = [];
|
|
124
|
-
refs.set(value.id, result);
|
|
125
|
-
for (const a of value.a)
|
|
126
|
-
result.push(parseEvaluationResultValue(a, handles, refs));
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
if ("o" in value) {
|
|
130
|
-
const result = {};
|
|
131
|
-
refs.set(value.id, result);
|
|
132
|
-
for (const { k, v } of value.o)
|
|
133
|
-
result[k] = parseEvaluationResultValue(v, handles, refs);
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
if ("h" in value)
|
|
137
|
-
return handles[value.h];
|
|
138
|
-
if ("ta" in value)
|
|
139
|
-
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
|
140
|
-
}
|
|
141
|
-
return value;
|
|
142
|
-
}
|
|
143
|
-
function serializeAsCallArgument(value, handleSerializer) {
|
|
144
|
-
return serialize(value, handleSerializer, { visited: new builtins.Map(), lastId: 0 });
|
|
145
|
-
}
|
|
146
|
-
function serialize(value, handleSerializer, visitorInfo) {
|
|
147
|
-
if (value && typeof value === "object") {
|
|
148
|
-
if (typeof globalThis.Window === "function" && value instanceof globalThis.Window)
|
|
149
|
-
return "ref: <Window>";
|
|
150
|
-
if (typeof globalThis.Document === "function" && value instanceof globalThis.Document)
|
|
151
|
-
return "ref: <Document>";
|
|
152
|
-
if (typeof globalThis.Node === "function" && value instanceof globalThis.Node)
|
|
153
|
-
return "ref: <Node>";
|
|
96
|
+
if (value.v === "null")
|
|
97
|
+
return null;
|
|
98
|
+
if (value.v === "NaN")
|
|
99
|
+
return NaN;
|
|
100
|
+
if (value.v === "Infinity")
|
|
101
|
+
return Infinity;
|
|
102
|
+
if (value.v === "-Infinity")
|
|
103
|
+
return -Infinity;
|
|
104
|
+
if (value.v === "-0")
|
|
105
|
+
return -0;
|
|
106
|
+
return void 0;
|
|
154
107
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
function innerSerialize(value, handleSerializer, visitorInfo) {
|
|
158
|
-
const result = handleSerializer(value);
|
|
159
|
-
if ("fallThrough" in result)
|
|
160
|
-
value = result.fallThrough;
|
|
161
|
-
else
|
|
162
|
-
return result;
|
|
163
|
-
if (typeof value === "symbol")
|
|
164
|
-
return { v: "undefined" };
|
|
165
|
-
if (Object.is(value, void 0))
|
|
166
|
-
return { v: "undefined" };
|
|
167
|
-
if (Object.is(value, null))
|
|
168
|
-
return { v: "null" };
|
|
169
|
-
if (Object.is(value, NaN))
|
|
170
|
-
return { v: "NaN" };
|
|
171
|
-
if (Object.is(value, Infinity))
|
|
172
|
-
return { v: "Infinity" };
|
|
173
|
-
if (Object.is(value, -Infinity))
|
|
174
|
-
return { v: "-Infinity" };
|
|
175
|
-
if (Object.is(value, -0))
|
|
176
|
-
return { v: "-0" };
|
|
177
|
-
if (typeof value === "boolean")
|
|
178
|
-
return value;
|
|
179
|
-
if (typeof value === "number")
|
|
180
|
-
return value;
|
|
181
|
-
if (typeof value === "string")
|
|
182
|
-
return value;
|
|
183
|
-
if (typeof value === "bigint")
|
|
184
|
-
return { bi: value.toString() };
|
|
185
|
-
if (isError(value)) {
|
|
186
|
-
let stack;
|
|
187
|
-
if (value.stack?.startsWith(value.name + ": " + value.message)) {
|
|
188
|
-
stack = value.stack;
|
|
189
|
-
} else {
|
|
190
|
-
stack = `${value.name}: ${value.message}
|
|
191
|
-
${value.stack}`;
|
|
192
|
-
}
|
|
193
|
-
return { e: { n: value.name, m: value.message, s: stack } };
|
|
108
|
+
if ("d" in value) {
|
|
109
|
+
return new Date(value.d);
|
|
194
110
|
}
|
|
195
|
-
if (
|
|
196
|
-
return
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
199
|
-
if (
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
111
|
+
if ("u" in value)
|
|
112
|
+
return new URL(value.u);
|
|
113
|
+
if ("bi" in value)
|
|
114
|
+
return BigInt(value.bi);
|
|
115
|
+
if ("e" in value) {
|
|
116
|
+
const error = new Error(value.e.m);
|
|
117
|
+
error.name = value.e.n;
|
|
118
|
+
error.stack = value.e.s;
|
|
119
|
+
return error;
|
|
204
120
|
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
const
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
a.push(serialize(value[i], handleSerializer, visitorInfo));
|
|
214
|
-
return { a, id: id2 };
|
|
121
|
+
if ("r" in value)
|
|
122
|
+
return new RegExp(value.r.p, value.r.f);
|
|
123
|
+
if ("a" in value) {
|
|
124
|
+
const result = [];
|
|
125
|
+
refs.set(value.id, result);
|
|
126
|
+
for (const a of value.a)
|
|
127
|
+
result.push(parseEvaluationResultValue(a, handles, refs));
|
|
128
|
+
return result;
|
|
215
129
|
}
|
|
216
|
-
if (
|
|
217
|
-
const
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
let item;
|
|
222
|
-
try {
|
|
223
|
-
item = value[name];
|
|
224
|
-
} catch (e) {
|
|
130
|
+
if ("o" in value) {
|
|
131
|
+
const result = {};
|
|
132
|
+
refs.set(value.id, result);
|
|
133
|
+
for (const { k, v } of value.o) {
|
|
134
|
+
if (k === "__proto__")
|
|
225
135
|
continue;
|
|
226
|
-
|
|
227
|
-
if (name === "toJSON" && typeof item === "function")
|
|
228
|
-
o.push({ k: name, v: { o: [], id: 0 } });
|
|
229
|
-
else
|
|
230
|
-
o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });
|
|
136
|
+
result[k] = parseEvaluationResultValue(v, handles, refs);
|
|
231
137
|
}
|
|
232
|
-
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
if ("h" in value)
|
|
141
|
+
return handles[value.h];
|
|
142
|
+
if ("ta" in value)
|
|
143
|
+
return base64ToTypedArray(value.ta.b, typedArrayConstructors[value.ta.k]);
|
|
144
|
+
}
|
|
145
|
+
return value;
|
|
146
|
+
}
|
|
147
|
+
function serializeAsCallArgument(value, handleSerializer) {
|
|
148
|
+
return serialize(value, handleSerializer, { visited: /* @__PURE__ */ new Map(), lastId: 0 });
|
|
149
|
+
}
|
|
150
|
+
function serialize(value, handleSerializer, visitorInfo) {
|
|
151
|
+
if (value && typeof value === "object") {
|
|
152
|
+
if (typeof globalThis.Window === "function" && value instanceof globalThis.Window)
|
|
153
|
+
return "ref: <Window>";
|
|
154
|
+
if (typeof globalThis.Document === "function" && value instanceof globalThis.Document)
|
|
155
|
+
return "ref: <Document>";
|
|
156
|
+
if (typeof globalThis.Node === "function" && value instanceof globalThis.Node)
|
|
157
|
+
return "ref: <Node>";
|
|
158
|
+
}
|
|
159
|
+
return innerSerialize(value, handleSerializer, visitorInfo);
|
|
160
|
+
}
|
|
161
|
+
function innerSerialize(value, handleSerializer, visitorInfo) {
|
|
162
|
+
const result = handleSerializer(value);
|
|
163
|
+
if ("fallThrough" in result)
|
|
164
|
+
value = result.fallThrough;
|
|
165
|
+
else
|
|
166
|
+
return result;
|
|
167
|
+
if (typeof value === "symbol")
|
|
168
|
+
return { v: "undefined" };
|
|
169
|
+
if (Object.is(value, void 0))
|
|
170
|
+
return { v: "undefined" };
|
|
171
|
+
if (Object.is(value, null))
|
|
172
|
+
return { v: "null" };
|
|
173
|
+
if (Object.is(value, NaN))
|
|
174
|
+
return { v: "NaN" };
|
|
175
|
+
if (Object.is(value, Infinity))
|
|
176
|
+
return { v: "Infinity" };
|
|
177
|
+
if (Object.is(value, -Infinity))
|
|
178
|
+
return { v: "-Infinity" };
|
|
179
|
+
if (Object.is(value, -0))
|
|
180
|
+
return { v: "-0" };
|
|
181
|
+
if (typeof value === "boolean")
|
|
182
|
+
return value;
|
|
183
|
+
if (typeof value === "number")
|
|
184
|
+
return value;
|
|
185
|
+
if (typeof value === "string")
|
|
186
|
+
return value;
|
|
187
|
+
if (typeof value === "bigint")
|
|
188
|
+
return { bi: value.toString() };
|
|
189
|
+
if (isError(value)) {
|
|
190
|
+
let stack;
|
|
191
|
+
if (value.stack?.startsWith(value.name + ": " + value.message)) {
|
|
192
|
+
stack = value.stack;
|
|
193
|
+
} else {
|
|
194
|
+
stack = `${value.name}: ${value.message}
|
|
195
|
+
${value.stack}`;
|
|
196
|
+
}
|
|
197
|
+
return { e: { n: value.name, m: value.message, s: stack } };
|
|
198
|
+
}
|
|
199
|
+
if (isDate(value))
|
|
200
|
+
return { d: value.toJSON() };
|
|
201
|
+
if (isURL(value))
|
|
202
|
+
return { u: value.toJSON() };
|
|
203
|
+
if (isRegExp(value))
|
|
204
|
+
return { r: { p: value.source, f: value.flags } };
|
|
205
|
+
for (const [k, ctor] of Object.entries(typedArrayConstructors)) {
|
|
206
|
+
if (isTypedArray(value, ctor))
|
|
207
|
+
return { ta: { b: typedArrayToBase64(value), k } };
|
|
208
|
+
}
|
|
209
|
+
const id = visitorInfo.visited.get(value);
|
|
210
|
+
if (id)
|
|
211
|
+
return { ref: id };
|
|
212
|
+
if (Array.isArray(value)) {
|
|
213
|
+
const a = [];
|
|
214
|
+
const id2 = ++visitorInfo.lastId;
|
|
215
|
+
visitorInfo.visited.set(value, id2);
|
|
216
|
+
for (let i = 0; i < value.length; ++i)
|
|
217
|
+
a.push(serialize(value[i], handleSerializer, visitorInfo));
|
|
218
|
+
return { a, id: id2 };
|
|
219
|
+
}
|
|
220
|
+
if (typeof value === "object") {
|
|
221
|
+
const o = [];
|
|
222
|
+
const id2 = ++visitorInfo.lastId;
|
|
223
|
+
visitorInfo.visited.set(value, id2);
|
|
224
|
+
for (const name of Object.keys(value)) {
|
|
225
|
+
let item;
|
|
233
226
|
try {
|
|
234
|
-
|
|
235
|
-
jsonWrapper = { value: value.toJSON() };
|
|
227
|
+
item = value[name];
|
|
236
228
|
} catch (e) {
|
|
229
|
+
continue;
|
|
237
230
|
}
|
|
238
|
-
if (
|
|
239
|
-
|
|
240
|
-
|
|
231
|
+
if (name === "toJSON" && typeof item === "function")
|
|
232
|
+
o.push({ k: name, v: { o: [], id: 0 } });
|
|
233
|
+
else
|
|
234
|
+
o.push({ k: name, v: serialize(item, handleSerializer, visitorInfo) });
|
|
235
|
+
}
|
|
236
|
+
let jsonWrapper;
|
|
237
|
+
try {
|
|
238
|
+
if (o.length === 0 && value.toJSON && typeof value.toJSON === "function")
|
|
239
|
+
jsonWrapper = { value: value.toJSON() };
|
|
240
|
+
} catch (e) {
|
|
241
241
|
}
|
|
242
|
+
if (jsonWrapper)
|
|
243
|
+
return innerSerialize(jsonWrapper.value, handleSerializer, visitorInfo);
|
|
244
|
+
return { o, id: id2 };
|
|
242
245
|
}
|
|
243
|
-
return { parseEvaluationResultValue, serializeAsCallArgument };
|
|
244
246
|
}
|
|
245
247
|
// Annotate the CommonJS export names for ESM import in node:
|
|
246
248
|
0 && (module.exports = {
|
|
247
|
-
|
|
249
|
+
parseEvaluationResultValue,
|
|
250
|
+
serializeAsCallArgument
|
|
248
251
|
});
|
package/lib/utils.js
CHANGED
|
@@ -22,13 +22,16 @@ __export(utils_exports, {
|
|
|
22
22
|
colors: () => import_utilsBundle.colors
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(utils_exports);
|
|
25
|
-
__reExport(utils_exports, require("./utils/isomorphic/
|
|
25
|
+
__reExport(utils_exports, require("./utils/isomorphic/ariaSnapshot"), module.exports);
|
|
26
26
|
__reExport(utils_exports, require("./utils/isomorphic/assert"), module.exports);
|
|
27
|
+
__reExport(utils_exports, require("./utils/isomorphic/colors"), module.exports);
|
|
27
28
|
__reExport(utils_exports, require("./utils/isomorphic/headers"), module.exports);
|
|
28
29
|
__reExport(utils_exports, require("./utils/isomorphic/locatorGenerators"), module.exports);
|
|
29
30
|
__reExport(utils_exports, require("./utils/isomorphic/manualPromise"), module.exports);
|
|
30
31
|
__reExport(utils_exports, require("./utils/isomorphic/mimeType"), module.exports);
|
|
31
32
|
__reExport(utils_exports, require("./utils/isomorphic/multimap"), module.exports);
|
|
33
|
+
__reExport(utils_exports, require("./utils/isomorphic/protocolFormatter"), module.exports);
|
|
34
|
+
__reExport(utils_exports, require("./utils/isomorphic/protocolMetainfo"), module.exports);
|
|
32
35
|
__reExport(utils_exports, require("./utils/isomorphic/rtti"), module.exports);
|
|
33
36
|
__reExport(utils_exports, require("./utils/isomorphic/semaphore"), module.exports);
|
|
34
37
|
__reExport(utils_exports, require("./utils/isomorphic/stackTrace"), module.exports);
|
|
@@ -62,13 +65,16 @@ var import_utilsBundle = require("./utilsBundle");
|
|
|
62
65
|
// Annotate the CommonJS export names for ESM import in node:
|
|
63
66
|
0 && (module.exports = {
|
|
64
67
|
colors,
|
|
65
|
-
...require("./utils/isomorphic/
|
|
68
|
+
...require("./utils/isomorphic/ariaSnapshot"),
|
|
66
69
|
...require("./utils/isomorphic/assert"),
|
|
70
|
+
...require("./utils/isomorphic/colors"),
|
|
67
71
|
...require("./utils/isomorphic/headers"),
|
|
68
72
|
...require("./utils/isomorphic/locatorGenerators"),
|
|
69
73
|
...require("./utils/isomorphic/manualPromise"),
|
|
70
74
|
...require("./utils/isomorphic/mimeType"),
|
|
71
75
|
...require("./utils/isomorphic/multimap"),
|
|
76
|
+
...require("./utils/isomorphic/protocolFormatter"),
|
|
77
|
+
...require("./utils/isomorphic/protocolMetainfo"),
|
|
72
78
|
...require("./utils/isomorphic/rtti"),
|
|
73
79
|
...require("./utils/isomorphic/semaphore"),
|
|
74
80
|
...require("./utils/isomorphic/stackTrace"),
|