@checkly/playwright-core 1.51.17-beta.2 → 1.51.17-beta.4
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/lib/checkly/index.js +16 -0
- package/lib/checkly/secretsFilter.js +18 -11
- package/lib/client/fetch.js +10 -2
- package/lib/generated/bindingsControllerSource.js +7 -0
- package/lib/generated/clockSource.js +1 -2
- package/lib/generated/consoleApiSource.js +1 -2
- package/lib/generated/injectedScriptSource.js +1 -2
- package/lib/generated/pollingRecorderSource.js +1 -2
- package/lib/generated/storageScriptSource.js +7 -0
- package/lib/generated/utilityScriptSource.js +1 -2
- package/lib/generated/webSocketMockSource.js +1 -2
- package/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
- package/lib/server/bidi/third_party/bidiProtocolCore.js +152 -0
- package/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
- package/lib/server/chromium/protocol.d.js +16 -0
- package/lib/server/firefox/protocol.d.js +16 -0
- package/lib/server/har/harRecorder.js +3 -1
- package/lib/server/pageBinding.js +88 -0
- package/lib/server/recorder/recorderSignalProcessor.js +83 -0
- package/lib/server/trace/recorder/tracing.js +9 -20
- package/lib/server/utils/fileUtils.js +65 -2
- package/lib/server/webkit/protocol.d.js +16 -0
- package/lib/utils/isomorphic/builtins.js +90 -0
- package/lib/utils/isomorphic/protocolFormatter.js +68 -0
- package/lib/utils/isomorphic/protocolMetainfo.js +320 -0
- package/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
- package/lib/vite/traceViewer/uiMode.html +1 -1
- package/package.json +2 -1
- package/lib/common/socksProxy.js +0 -569
- package/lib/common/timeoutSettings.js +0 -73
- package/lib/common/types.js +0 -5
- package/lib/image_tools/colorUtils.js +0 -98
- package/lib/image_tools/compare.js +0 -108
- package/lib/image_tools/imageChannel.js +0 -70
- package/lib/image_tools/stats.js +0 -102
- package/lib/protocol/transport.js +0 -82
- package/lib/third_party/diff_match_patch.js +0 -2222
- package/lib/utils/ascii.js +0 -31
- package/lib/utils/comparators.js +0 -171
- package/lib/utils/crypto.js +0 -174
- package/lib/utils/debug.js +0 -46
- package/lib/utils/debugLogger.js +0 -91
- package/lib/utils/env.js +0 -49
- package/lib/utils/eventsHelper.js +0 -38
- package/lib/utils/happy-eyeballs.js +0 -210
- package/lib/utils/headers.js +0 -52
- package/lib/utils/hostPlatform.js +0 -133
- package/lib/utils/httpServer.js +0 -237
- package/lib/utils/linuxUtils.js +0 -78
- package/lib/utils/manualPromise.js +0 -109
- package/lib/utils/multimap.js +0 -75
- package/lib/utils/network.js +0 -160
- package/lib/utils/processLauncher.js +0 -248
- package/lib/utils/profiler.js +0 -53
- package/lib/utils/rtti.js +0 -44
- package/lib/utils/semaphore.js +0 -51
- package/lib/utils/spawnAsync.js +0 -45
- package/lib/utils/task.js +0 -58
- package/lib/utils/time.js +0 -37
- package/lib/utils/traceUtils.js +0 -44
- package/lib/utils/userAgent.js +0 -105
- package/lib/utils/wsServer.js +0 -127
- package/lib/utils/zipFile.js +0 -75
|
@@ -0,0 +1,152 @@
|
|
|
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 bidiProtocolCore_exports = {};
|
|
20
|
+
__export(bidiProtocolCore_exports, {
|
|
21
|
+
BrowsingContext: () => BrowsingContext,
|
|
22
|
+
ErrorCode: () => ErrorCode,
|
|
23
|
+
Input: () => Input,
|
|
24
|
+
Log: () => Log,
|
|
25
|
+
Network: () => Network,
|
|
26
|
+
Script: () => Script,
|
|
27
|
+
Session: () => Session
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(bidiProtocolCore_exports);
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2024 Google Inc.
|
|
33
|
+
* Modifications copyright (c) Microsoft Corporation.
|
|
34
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
35
|
+
*/
|
|
36
|
+
var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
37
|
+
ErrorCode2["InvalidArgument"] = "invalid argument";
|
|
38
|
+
ErrorCode2["InvalidSelector"] = "invalid selector";
|
|
39
|
+
ErrorCode2["InvalidSessionId"] = "invalid session id";
|
|
40
|
+
ErrorCode2["InvalidWebExtension"] = "invalid web extension";
|
|
41
|
+
ErrorCode2["MoveTargetOutOfBounds"] = "move target out of bounds";
|
|
42
|
+
ErrorCode2["NoSuchAlert"] = "no such alert";
|
|
43
|
+
ErrorCode2["NoSuchElement"] = "no such element";
|
|
44
|
+
ErrorCode2["NoSuchFrame"] = "no such frame";
|
|
45
|
+
ErrorCode2["NoSuchHandle"] = "no such handle";
|
|
46
|
+
ErrorCode2["NoSuchHistoryEntry"] = "no such history entry";
|
|
47
|
+
ErrorCode2["NoSuchIntercept"] = "no such intercept";
|
|
48
|
+
ErrorCode2["NoSuchNode"] = "no such node";
|
|
49
|
+
ErrorCode2["NoSuchRequest"] = "no such request";
|
|
50
|
+
ErrorCode2["NoSuchScript"] = "no such script";
|
|
51
|
+
ErrorCode2["NoSuchStoragePartition"] = "no such storage partition";
|
|
52
|
+
ErrorCode2["NoSuchUserContext"] = "no such user context";
|
|
53
|
+
ErrorCode2["NoSuchWebExtension"] = "no such web extension";
|
|
54
|
+
ErrorCode2["SessionNotCreated"] = "session not created";
|
|
55
|
+
ErrorCode2["UnableToCaptureScreen"] = "unable to capture screen";
|
|
56
|
+
ErrorCode2["UnableToCloseBrowser"] = "unable to close browser";
|
|
57
|
+
ErrorCode2["UnableToSetCookie"] = "unable to set cookie";
|
|
58
|
+
ErrorCode2["UnableToSetFileInput"] = "unable to set file input";
|
|
59
|
+
ErrorCode2["UnderspecifiedStoragePartition"] = "underspecified storage partition";
|
|
60
|
+
ErrorCode2["UnknownCommand"] = "unknown command";
|
|
61
|
+
ErrorCode2["UnknownError"] = "unknown error";
|
|
62
|
+
ErrorCode2["UnsupportedOperation"] = "unsupported operation";
|
|
63
|
+
return ErrorCode2;
|
|
64
|
+
})(ErrorCode || {});
|
|
65
|
+
var Session;
|
|
66
|
+
((Session2) => {
|
|
67
|
+
let UserPromptHandlerType;
|
|
68
|
+
((UserPromptHandlerType2) => {
|
|
69
|
+
UserPromptHandlerType2["Accept"] = "accept";
|
|
70
|
+
UserPromptHandlerType2["Dismiss"] = "dismiss";
|
|
71
|
+
UserPromptHandlerType2["Ignore"] = "ignore";
|
|
72
|
+
})(UserPromptHandlerType = Session2.UserPromptHandlerType || (Session2.UserPromptHandlerType = {}));
|
|
73
|
+
})(Session || (Session = {}));
|
|
74
|
+
var BrowsingContext;
|
|
75
|
+
((BrowsingContext2) => {
|
|
76
|
+
let ReadinessState;
|
|
77
|
+
((ReadinessState2) => {
|
|
78
|
+
ReadinessState2["None"] = "none";
|
|
79
|
+
ReadinessState2["Interactive"] = "interactive";
|
|
80
|
+
ReadinessState2["Complete"] = "complete";
|
|
81
|
+
})(ReadinessState = BrowsingContext2.ReadinessState || (BrowsingContext2.ReadinessState = {}));
|
|
82
|
+
})(BrowsingContext || (BrowsingContext = {}));
|
|
83
|
+
((BrowsingContext2) => {
|
|
84
|
+
let UserPromptType;
|
|
85
|
+
((UserPromptType2) => {
|
|
86
|
+
UserPromptType2["Alert"] = "alert";
|
|
87
|
+
UserPromptType2["Beforeunload"] = "beforeunload";
|
|
88
|
+
UserPromptType2["Confirm"] = "confirm";
|
|
89
|
+
UserPromptType2["Prompt"] = "prompt";
|
|
90
|
+
})(UserPromptType = BrowsingContext2.UserPromptType || (BrowsingContext2.UserPromptType = {}));
|
|
91
|
+
})(BrowsingContext || (BrowsingContext = {}));
|
|
92
|
+
((BrowsingContext2) => {
|
|
93
|
+
let CreateType;
|
|
94
|
+
((CreateType2) => {
|
|
95
|
+
CreateType2["Tab"] = "tab";
|
|
96
|
+
CreateType2["Window"] = "window";
|
|
97
|
+
})(CreateType = BrowsingContext2.CreateType || (BrowsingContext2.CreateType = {}));
|
|
98
|
+
})(BrowsingContext || (BrowsingContext = {}));
|
|
99
|
+
var Network;
|
|
100
|
+
((Network2) => {
|
|
101
|
+
let SameSite;
|
|
102
|
+
((SameSite2) => {
|
|
103
|
+
SameSite2["Strict"] = "strict";
|
|
104
|
+
SameSite2["Lax"] = "lax";
|
|
105
|
+
SameSite2["None"] = "none";
|
|
106
|
+
})(SameSite = Network2.SameSite || (Network2.SameSite = {}));
|
|
107
|
+
})(Network || (Network = {}));
|
|
108
|
+
((Network2) => {
|
|
109
|
+
let InterceptPhase;
|
|
110
|
+
((InterceptPhase2) => {
|
|
111
|
+
InterceptPhase2["BeforeRequestSent"] = "beforeRequestSent";
|
|
112
|
+
InterceptPhase2["ResponseStarted"] = "responseStarted";
|
|
113
|
+
InterceptPhase2["AuthRequired"] = "authRequired";
|
|
114
|
+
})(InterceptPhase = Network2.InterceptPhase || (Network2.InterceptPhase = {}));
|
|
115
|
+
})(Network || (Network = {}));
|
|
116
|
+
var Script;
|
|
117
|
+
((Script2) => {
|
|
118
|
+
let ResultOwnership;
|
|
119
|
+
((ResultOwnership2) => {
|
|
120
|
+
ResultOwnership2["Root"] = "root";
|
|
121
|
+
ResultOwnership2["None"] = "none";
|
|
122
|
+
})(ResultOwnership = Script2.ResultOwnership || (Script2.ResultOwnership = {}));
|
|
123
|
+
})(Script || (Script = {}));
|
|
124
|
+
var Log;
|
|
125
|
+
((Log2) => {
|
|
126
|
+
let Level;
|
|
127
|
+
((Level2) => {
|
|
128
|
+
Level2["Debug"] = "debug";
|
|
129
|
+
Level2["Info"] = "info";
|
|
130
|
+
Level2["Warn"] = "warn";
|
|
131
|
+
Level2["Error"] = "error";
|
|
132
|
+
})(Level = Log2.Level || (Log2.Level = {}));
|
|
133
|
+
})(Log || (Log = {}));
|
|
134
|
+
var Input;
|
|
135
|
+
((Input2) => {
|
|
136
|
+
let PointerType;
|
|
137
|
+
((PointerType2) => {
|
|
138
|
+
PointerType2["Mouse"] = "mouse";
|
|
139
|
+
PointerType2["Pen"] = "pen";
|
|
140
|
+
PointerType2["Touch"] = "touch";
|
|
141
|
+
})(PointerType = Input2.PointerType || (Input2.PointerType = {}));
|
|
142
|
+
})(Input || (Input = {}));
|
|
143
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
144
|
+
0 && (module.exports = {
|
|
145
|
+
BrowsingContext,
|
|
146
|
+
ErrorCode,
|
|
147
|
+
Input,
|
|
148
|
+
Log,
|
|
149
|
+
Network,
|
|
150
|
+
Script,
|
|
151
|
+
Session
|
|
152
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
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 bidiProtocolPermissions_exports = {};
|
|
20
|
+
__export(bidiProtocolPermissions_exports, {
|
|
21
|
+
Permissions: () => Permissions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(bidiProtocolPermissions_exports);
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2024 Google Inc.
|
|
27
|
+
* Modifications copyright (c) Microsoft Corporation.
|
|
28
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
29
|
+
*/
|
|
30
|
+
var Permissions;
|
|
31
|
+
((Permissions2) => {
|
|
32
|
+
let PermissionState;
|
|
33
|
+
((PermissionState2) => {
|
|
34
|
+
PermissionState2["Granted"] = "granted";
|
|
35
|
+
PermissionState2["Denied"] = "denied";
|
|
36
|
+
PermissionState2["Prompt"] = "prompt";
|
|
37
|
+
})(PermissionState = Permissions2.PermissionState || (Permissions2.PermissionState = {}));
|
|
38
|
+
})(Permissions || (Permissions = {}));
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
Permissions
|
|
42
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var protocol_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(protocol_d_exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var protocol_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(protocol_d_exports);
|
|
@@ -11,6 +11,8 @@ var _harTracer = require("./harTracer");
|
|
|
11
11
|
var _crypto = require("../utils/crypto");
|
|
12
12
|
var _manualPromise = require("../../utils/isomorphic/manualPromise");
|
|
13
13
|
var _zipBundle = require("../../zipBundle");
|
|
14
|
+
var _fileUtils = require("../utils/fileUtils");
|
|
15
|
+
var _secretsFilter = require("../../checkly/secretsFilter");
|
|
14
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
17
|
/**
|
|
16
18
|
* Copyright (c) Microsoft Corporation.
|
|
@@ -48,7 +50,7 @@ class HarRecorder {
|
|
|
48
50
|
waitForContentOnStop: true,
|
|
49
51
|
urlFilter: urlFilterRe !== null && urlFilterRe !== void 0 ? urlFilterRe : options.urlGlob
|
|
50
52
|
});
|
|
51
|
-
this._zipFile = content === 'attach' || expectsZip ? new _zipBundle.yazl.ZipFile() : null;
|
|
53
|
+
this._zipFile = content === 'attach' || expectsZip ? new (new _fileUtils.SecretSerializedFS((0, _secretsFilter.secretsFilter)()).createScrubbingZipFile(_zipBundle.yazl.ZipFile))() : null;
|
|
52
54
|
this._tracer.start({
|
|
53
55
|
omitScripts: false
|
|
54
56
|
});
|
|
@@ -0,0 +1,88 @@
|
|
|
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 pageBinding_exports = {};
|
|
20
|
+
__export(pageBinding_exports, {
|
|
21
|
+
createPageBindingScript: () => createPageBindingScript,
|
|
22
|
+
deliverBindingResult: () => deliverBindingResult,
|
|
23
|
+
takeBindingHandle: () => takeBindingHandle
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(pageBinding_exports);
|
|
26
|
+
var import_builtins = require("../utils/isomorphic/builtins");
|
|
27
|
+
var import_utilityScriptSerializers = require("../utils/isomorphic/utilityScriptSerializers");
|
|
28
|
+
function addPageBinding(playwrightBinding, bindingName, needsHandle, utilityScriptSerializersFactory, builtins2) {
|
|
29
|
+
const { serializeAsCallArgument } = utilityScriptSerializersFactory(builtins2);
|
|
30
|
+
const binding = globalThis[playwrightBinding];
|
|
31
|
+
globalThis[bindingName] = (...args) => {
|
|
32
|
+
const me = globalThis[bindingName];
|
|
33
|
+
if (needsHandle && args.slice(1).some((arg) => arg !== void 0))
|
|
34
|
+
throw new Error(`exposeBindingHandle supports a single argument, ${args.length} received`);
|
|
35
|
+
let callbacks = me["callbacks"];
|
|
36
|
+
if (!callbacks) {
|
|
37
|
+
callbacks = new builtins2.Map();
|
|
38
|
+
me["callbacks"] = callbacks;
|
|
39
|
+
}
|
|
40
|
+
const seq = (me["lastSeq"] || 0) + 1;
|
|
41
|
+
me["lastSeq"] = seq;
|
|
42
|
+
let handles = me["handles"];
|
|
43
|
+
if (!handles) {
|
|
44
|
+
handles = new builtins2.Map();
|
|
45
|
+
me["handles"] = handles;
|
|
46
|
+
}
|
|
47
|
+
const promise = new Promise((resolve, reject) => callbacks.set(seq, { resolve, reject }));
|
|
48
|
+
let payload;
|
|
49
|
+
if (needsHandle) {
|
|
50
|
+
handles.set(seq, args[0]);
|
|
51
|
+
payload = { name: bindingName, seq };
|
|
52
|
+
} else {
|
|
53
|
+
const serializedArgs = [];
|
|
54
|
+
for (let i = 0; i < args.length; i++) {
|
|
55
|
+
serializedArgs[i] = serializeAsCallArgument(args[i], (v) => {
|
|
56
|
+
return { fallThrough: v };
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
payload = { name: bindingName, seq, serializedArgs };
|
|
60
|
+
}
|
|
61
|
+
binding(JSON.stringify(payload));
|
|
62
|
+
return promise;
|
|
63
|
+
};
|
|
64
|
+
globalThis[bindingName].__installed = true;
|
|
65
|
+
}
|
|
66
|
+
function takeBindingHandle(arg) {
|
|
67
|
+
const handles = globalThis[arg.name]["handles"];
|
|
68
|
+
const handle = handles.get(arg.seq);
|
|
69
|
+
handles.delete(arg.seq);
|
|
70
|
+
return handle;
|
|
71
|
+
}
|
|
72
|
+
function deliverBindingResult(arg) {
|
|
73
|
+
const callbacks = globalThis[arg.name]["callbacks"];
|
|
74
|
+
if ("error" in arg)
|
|
75
|
+
callbacks.get(arg.seq).reject(arg.error);
|
|
76
|
+
else
|
|
77
|
+
callbacks.get(arg.seq).resolve(arg.result);
|
|
78
|
+
callbacks.delete(arg.seq);
|
|
79
|
+
}
|
|
80
|
+
function createPageBindingScript(playwrightBinding, name, needsHandle) {
|
|
81
|
+
return `(${addPageBinding.toString()})(${JSON.stringify(playwrightBinding)}, ${JSON.stringify(name)}, ${needsHandle}, (${import_utilityScriptSerializers.source}), (${import_builtins.builtins})())`;
|
|
82
|
+
}
|
|
83
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
84
|
+
0 && (module.exports = {
|
|
85
|
+
createPageBindingScript,
|
|
86
|
+
deliverBindingResult,
|
|
87
|
+
takeBindingHandle
|
|
88
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
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 recorderSignalProcessor_exports = {};
|
|
20
|
+
__export(recorderSignalProcessor_exports, {
|
|
21
|
+
RecorderSignalProcessor: () => RecorderSignalProcessor
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(recorderSignalProcessor_exports);
|
|
24
|
+
var import_debug = require("../utils/debug");
|
|
25
|
+
var import_time = require("../../utils/isomorphic/time");
|
|
26
|
+
var import_recorderUtils = require("./recorderUtils");
|
|
27
|
+
class RecorderSignalProcessor {
|
|
28
|
+
constructor(actionSink) {
|
|
29
|
+
this._lastAction = null;
|
|
30
|
+
this._delegate = actionSink;
|
|
31
|
+
}
|
|
32
|
+
addAction(actionInContext) {
|
|
33
|
+
this._lastAction = actionInContext;
|
|
34
|
+
this._delegate.addAction(actionInContext);
|
|
35
|
+
}
|
|
36
|
+
signal(pageAlias, frame, signal) {
|
|
37
|
+
const timestamp = (0, import_time.monotonicTime)();
|
|
38
|
+
if (signal.name === "navigation" && frame._page.mainFrame() === frame) {
|
|
39
|
+
const lastAction = this._lastAction;
|
|
40
|
+
const signalThreshold = (0, import_debug.isUnderTest)() ? 500 : 5e3;
|
|
41
|
+
let generateGoto = false;
|
|
42
|
+
if (!lastAction)
|
|
43
|
+
generateGoto = true;
|
|
44
|
+
else if (lastAction.action.name !== "click" && lastAction.action.name !== "press" && lastAction.action.name !== "fill")
|
|
45
|
+
generateGoto = true;
|
|
46
|
+
else if (timestamp - lastAction.startTime > signalThreshold)
|
|
47
|
+
generateGoto = true;
|
|
48
|
+
if (generateGoto) {
|
|
49
|
+
this.addAction({
|
|
50
|
+
frame: {
|
|
51
|
+
pageGuid: frame._page.guid,
|
|
52
|
+
pageAlias,
|
|
53
|
+
framePath: []
|
|
54
|
+
},
|
|
55
|
+
action: {
|
|
56
|
+
name: "navigate",
|
|
57
|
+
url: frame.url(),
|
|
58
|
+
signals: []
|
|
59
|
+
},
|
|
60
|
+
startTime: timestamp,
|
|
61
|
+
endTime: timestamp
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
(0, import_recorderUtils.generateFrameSelector)(frame).then((framePath) => {
|
|
67
|
+
const signalInContext = {
|
|
68
|
+
frame: {
|
|
69
|
+
pageGuid: frame._page.guid,
|
|
70
|
+
pageAlias,
|
|
71
|
+
framePath
|
|
72
|
+
},
|
|
73
|
+
signal,
|
|
74
|
+
timestamp
|
|
75
|
+
};
|
|
76
|
+
this._delegate.addSignal(signalInContext);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
RecorderSignalProcessor
|
|
83
|
+
});
|
|
@@ -49,7 +49,7 @@ const kScreencastOptions = {
|
|
|
49
49
|
class Tracing extends _instrumentation.SdkObject {
|
|
50
50
|
constructor(context, tracesDir) {
|
|
51
51
|
super(context, 'tracing');
|
|
52
|
-
this._fs =
|
|
52
|
+
this._fs = void 0;
|
|
53
53
|
this._snapshotter = void 0;
|
|
54
54
|
this._harTracer = void 0;
|
|
55
55
|
this._screencastListeners = [];
|
|
@@ -63,10 +63,10 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
63
63
|
this._allResources = new Set();
|
|
64
64
|
this._contextCreatedEvent = void 0;
|
|
65
65
|
this._pendingHarEntries = new Set();
|
|
66
|
-
this._secretsFilter = void 0;
|
|
67
66
|
this._context = context;
|
|
68
67
|
this._precreatedTracesDir = tracesDir;
|
|
69
|
-
|
|
68
|
+
// [Checkly] We use SecretSerializedFS to handle secret scrubbing before writing to files.
|
|
69
|
+
this._fs = new _fileUtils.SecretSerializedFS((0, _secretsFilter.secretsFilter)());
|
|
70
70
|
this._harTracer = new _harTracer.HarTracer(context, null, this, {
|
|
71
71
|
content: 'attach',
|
|
72
72
|
includeTraceInfo: true,
|
|
@@ -394,7 +394,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
394
394
|
type: 'resource-snapshot',
|
|
395
395
|
snapshot: entry
|
|
396
396
|
};
|
|
397
|
-
const visited = visitTraceEvent(event, this._state.networkSha1s
|
|
397
|
+
const visited = visitTraceEvent(event, this._state.networkSha1s);
|
|
398
398
|
this._fs.appendFile(this._state.networkFile, JSON.stringify(visited) + '\n', true /* flush */);
|
|
399
399
|
}
|
|
400
400
|
flushHarEntries() {
|
|
@@ -404,7 +404,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
404
404
|
type: 'resource-snapshot',
|
|
405
405
|
snapshot: entry
|
|
406
406
|
};
|
|
407
|
-
const visited = visitTraceEvent(event, this._state.networkSha1s
|
|
407
|
+
const visited = visitTraceEvent(event, this._state.networkSha1s);
|
|
408
408
|
harLines.push(JSON.stringify(visited));
|
|
409
409
|
}
|
|
410
410
|
this._pendingHarEntries.clear();
|
|
@@ -527,7 +527,7 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
527
527
|
}));
|
|
528
528
|
}
|
|
529
529
|
_appendTraceEvent(event) {
|
|
530
|
-
const visited = visitTraceEvent(event, this._state.traceSha1s
|
|
530
|
+
const visited = visitTraceEvent(event, this._state.traceSha1s);
|
|
531
531
|
// Do not flush (console) events, they are too noisy, unless we are in ui mode (live).
|
|
532
532
|
const flush = this._state.options.live || event.type !== 'event' && event.type !== 'console' && event.type !== 'log';
|
|
533
533
|
this._fs.appendFile(this._state.traceFile, JSON.stringify(visited) + '\n', flush);
|
|
@@ -540,13 +540,8 @@ class Tracing extends _instrumentation.SdkObject {
|
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
542
|
exports.Tracing = Tracing;
|
|
543
|
-
function visitTraceEvent(object, sha1s
|
|
544
|
-
if (Array.isArray(object)) return object.map(o =>
|
|
545
|
-
if (typeof o === 'string' && new Date(o).toString() === 'Invalid Date') {
|
|
546
|
-
return secretsFilter(o);
|
|
547
|
-
}
|
|
548
|
-
return visitTraceEvent(o, sha1s, secretsFilter);
|
|
549
|
-
});
|
|
543
|
+
function visitTraceEvent(object, sha1s) {
|
|
544
|
+
if (Array.isArray(object)) return object.map(o => visitTraceEvent(o, sha1s));
|
|
550
545
|
if (object instanceof _dispatcher.Dispatcher) return `<${object._type}>`;
|
|
551
546
|
if (object instanceof Buffer) return `<Buffer>`;
|
|
552
547
|
if (object instanceof Date) return object;
|
|
@@ -557,13 +552,7 @@ function visitTraceEvent(object, sha1s, secretsFilter) {
|
|
|
557
552
|
if (key === 'sha1' || key === '_sha1' || key.endsWith('Sha1')) {
|
|
558
553
|
if (value) sha1s.add(value);
|
|
559
554
|
}
|
|
560
|
-
|
|
561
|
-
// Some values like numbers or certain strings shouldn't be scrubbed,
|
|
562
|
-
// Otherwise parts of the trace will be unreadable.
|
|
563
|
-
result[key] = key.endsWith('Sha1') || ['pageref', '_sha1', 'downloadsPath', 'tracesDir', 'pageId', 'sha1'].includes(key) ? value : secretsFilter(value);
|
|
564
|
-
} else {
|
|
565
|
-
result[key] = visitTraceEvent(value, sha1s, secretsFilter);
|
|
566
|
-
}
|
|
555
|
+
result[key] = visitTraceEvent(value, sha1s);
|
|
567
556
|
}
|
|
568
557
|
return result;
|
|
569
558
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.SerializedFS = void 0;
|
|
6
|
+
exports.SerializedFS = exports.SecretSerializedFS = void 0;
|
|
7
7
|
exports.canAccessFile = canAccessFile;
|
|
8
8
|
exports.copyFileAndMakeWritable = copyFileAndMakeWritable;
|
|
9
9
|
exports.existsAsync = void 0;
|
|
@@ -201,4 +201,67 @@ class SerializedFS {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
|
|
204
|
+
|
|
205
|
+
// [Checkly] SecretSerializedFS extends SerializedFS to apply secret scrubbing to all file writes
|
|
206
|
+
exports.SerializedFS = SerializedFS;
|
|
207
|
+
class SecretSerializedFS extends SerializedFS {
|
|
208
|
+
constructor(secretsFilter) {
|
|
209
|
+
super();
|
|
210
|
+
this._secretsFilter = void 0;
|
|
211
|
+
this._secretsFilter = secretsFilter;
|
|
212
|
+
}
|
|
213
|
+
writeFile(file, content, skipIfExists) {
|
|
214
|
+
const scrubbedContent = this._scrubContent(content);
|
|
215
|
+
super.writeFile(file, scrubbedContent, skipIfExists);
|
|
216
|
+
}
|
|
217
|
+
appendFile(file, text, flush) {
|
|
218
|
+
const scrubbedText = this._scrubContent(text);
|
|
219
|
+
super.appendFile(file, scrubbedText, flush);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// [Checkly] Create a scrubbing-enabled zip file wrapper
|
|
223
|
+
createScrubbingZipFile(ZipFileClass) {
|
|
224
|
+
const scrubContent = this._scrubContent.bind(this);
|
|
225
|
+
return class ScrubbingZipFile extends ZipFileClass {
|
|
226
|
+
addBuffer(buffer, metadataPath) {
|
|
227
|
+
const scrubbedBuffer = scrubContent(buffer);
|
|
228
|
+
super.addBuffer(scrubbedBuffer, metadataPath);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// [Checkly] Apply secret scrubbing to any content being written
|
|
234
|
+
_scrubContent(content) {
|
|
235
|
+
if (Buffer.isBuffer(content)) {
|
|
236
|
+
// Handle buffer content - only scrub if it looks like text
|
|
237
|
+
try {
|
|
238
|
+
const text = content.toString('utf8');
|
|
239
|
+
if (this._isLikelyTextContent(text)) {
|
|
240
|
+
const scrubbedText = this._secretsFilter(text);
|
|
241
|
+
return Buffer.from(scrubbedText, 'utf8');
|
|
242
|
+
}
|
|
243
|
+
return content; // Return original buffer for non-text content
|
|
244
|
+
} catch {
|
|
245
|
+
return content; // Return original if can't decode as UTF-8
|
|
246
|
+
}
|
|
247
|
+
} else {
|
|
248
|
+
// Handle string content
|
|
249
|
+
return this._secretsFilter(content);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// [Checkly] Check if content looks like text that could contain secrets
|
|
254
|
+
_isLikelyTextContent(text) {
|
|
255
|
+
if (text.length === 0) return false;
|
|
256
|
+
|
|
257
|
+
// Check if the string contains mostly printable characters, but only sample the first 1000 chars
|
|
258
|
+
const sampleSize = Math.min(1000, text.length);
|
|
259
|
+
let printableCount = 0;
|
|
260
|
+
for (let i = 0; i < sampleSize; i++) {
|
|
261
|
+
const code = text.charCodeAt(i);
|
|
262
|
+
if (code >= 32 && code <= 126 || code === 9 || code === 10 || code === 13) printableCount++;
|
|
263
|
+
}
|
|
264
|
+
return printableCount / sampleSize > 0.8;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.SecretSerializedFS = SecretSerializedFS;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var protocol_d_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(protocol_d_exports);
|