@checkly/playwright-core 1.48.24-beta.0 → 1.48.24-beta.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/lib/vite/recorder/assets/{codeMirrorModule-xqJWdfrS.js → codeMirrorModule-d0KhC1qL.js} +11 -11
- package/lib/vite/recorder/assets/{index-DDT9w7gI.js → index-Bxxcmxlu.js} +2 -2
- package/lib/vite/recorder/index.html +1 -1
- package/lib/vite/traceViewer/embedded.html +3 -3
- package/lib/vite/traceViewer/index.html +3 -3
- package/lib/vite/traceViewer/recorder.html +2 -2
- package/lib/vite/traceViewer/uiMode.html +3 -3
- package/package.json +1 -1
- package/lib/client/clientStackTrace.js +0 -65
- package/lib/client/fileUtils.js +0 -31
- package/lib/client/platform.js +0 -71
- package/lib/client/timeoutSettings.js +0 -65
- package/lib/client/webSocket.js +0 -106
- package/lib/server/callLog.js +0 -79
- package/lib/server/harBackend.js +0 -157
- package/lib/server/localUtils.js +0 -203
- package/lib/server/recorder/chat.js +0 -177
- package/lib/server/storageScript.js +0 -160
- package/lib/server/timeoutSettings.js +0 -74
- package/lib/server/utils/ascii.js +0 -31
- package/lib/server/utils/comparators.js +0 -159
- package/lib/server/utils/crypto.js +0 -171
- package/lib/server/utils/debug.js +0 -38
- package/lib/server/utils/debugLogger.js +0 -93
- package/lib/server/utils/env.js +0 -53
- package/lib/server/utils/eventsHelper.js +0 -38
- package/lib/server/utils/expectUtils.js +0 -33
- package/lib/server/utils/fileUtils.js +0 -204
- package/lib/server/utils/happyEyeballs.js +0 -209
- package/lib/server/utils/hostPlatform.js +0 -145
- package/lib/server/utils/httpServer.js +0 -233
- package/lib/server/utils/image_tools/colorUtils.js +0 -98
- package/lib/server/utils/image_tools/compare.js +0 -108
- package/lib/server/utils/image_tools/imageChannel.js +0 -70
- package/lib/server/utils/image_tools/stats.js +0 -102
- package/lib/server/utils/linuxUtils.js +0 -58
- package/lib/server/utils/network.js +0 -160
- package/lib/server/utils/nodePlatform.js +0 -140
- package/lib/server/utils/pipeTransport.js +0 -82
- package/lib/server/utils/processLauncher.js +0 -248
- package/lib/server/utils/profiler.js +0 -52
- package/lib/server/utils/socksProxy.js +0 -570
- package/lib/server/utils/spawnAsync.js +0 -45
- package/lib/server/utils/task.js +0 -58
- package/lib/server/utils/userAgent.js +0 -91
- package/lib/server/utils/wsServer.js +0 -128
- package/lib/server/utils/zipFile.js +0 -75
- package/lib/server/utils/zones.js +0 -54
- package/lib/utils/isomorphic/ariaSnapshot.js +0 -392
- package/lib/utils/isomorphic/assert.js +0 -25
- package/lib/utils/isomorphic/colors.js +0 -65
- package/lib/utils/isomorphic/headers.js +0 -52
- package/lib/utils/isomorphic/manualPromise.js +0 -107
- package/lib/utils/isomorphic/multimap.js +0 -73
- package/lib/utils/isomorphic/rtti.js +0 -41
- package/lib/utils/isomorphic/semaphore.js +0 -51
- package/lib/utils/isomorphic/stackTrace.js +0 -169
- package/lib/utils/isomorphic/time.js +0 -25
- package/lib/utils/isomorphic/timeoutRunner.js +0 -66
- package/lib/utils/isomorphic/types.js +0 -5
- package/lib/utils.js +0 -447
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
21
21
|
<link rel="icon" href="/playwright-logo.svg" type="image/svg+xml">
|
|
22
22
|
<title>Playwright Inspector</title>
|
|
23
|
-
<script type="module" crossorigin src="/assets/index-
|
|
23
|
+
<script type="module" crossorigin src="/assets/index-Bxxcmxlu.js"></script>
|
|
24
24
|
<link rel="stylesheet" crossorigin href="/assets/index-BW-aOBcL.css">
|
|
25
25
|
</head>
|
|
26
26
|
<body>
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
<meta charset="UTF-8">
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<title>Playwright Trace Viewer for VS Code</title>
|
|
8
|
-
<script type="module" crossorigin src="./embedded.
|
|
9
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
8
|
+
<script type="module" crossorigin src="./embedded.BXYl5zRv.js"></script>
|
|
9
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-wfvwpMHs.js">
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-LKskf2Iy.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./workbench.DlsCx8k5.css">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./embedded.w7WN2u1R.css">
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<link rel="manifest" href="./manifest.webmanifest">
|
|
9
9
|
<title>Playwright Trace Viewer</title>
|
|
10
|
-
<script type="module" crossorigin src="./index.
|
|
11
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
10
|
+
<script type="module" crossorigin src="./index.DZkJsFod.js"></script>
|
|
11
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-wfvwpMHs.js">
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-LKskf2Iy.js">
|
|
13
13
|
<link rel="modulepreload" crossorigin href="./assets/testServerConnection-DeE2kSzz.js">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="./workbench.DlsCx8k5.css">
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<title>Playwright Recorder</title>
|
|
9
|
-
<script type="module" crossorigin src="./recorder.
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
9
|
+
<script type="module" crossorigin src="./recorder.BVExlUUk.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-wfvwpMHs.js">
|
|
11
11
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./recorder.B_SY1GJM.css">
|
|
13
13
|
</head>
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
7
|
<link rel="icon" href="./playwright-logo.svg" type="image/svg+xml">
|
|
8
8
|
<title>Playwright Test</title>
|
|
9
|
-
<script type="module" crossorigin src="./uiMode.
|
|
10
|
-
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-
|
|
9
|
+
<script type="module" crossorigin src="./uiMode.DjTS7tqC.js"></script>
|
|
10
|
+
<link rel="modulepreload" crossorigin href="./assets/inspectorTab-wfvwpMHs.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="./assets/testServerConnection-DeE2kSzz.js">
|
|
12
|
-
<link rel="modulepreload" crossorigin href="./assets/workbench-
|
|
12
|
+
<link rel="modulepreload" crossorigin href="./assets/workbench-LKskf2Iy.js">
|
|
13
13
|
<link rel="stylesheet" crossorigin href="./inspectorTab.DLjBDrQR.css">
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./workbench.DlsCx8k5.css">
|
|
15
15
|
<link rel="stylesheet" crossorigin href="./uiMode.CAYqod-m.css">
|
package/package.json
CHANGED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.captureLibraryStackTrace = captureLibraryStackTrace;
|
|
7
|
-
var _stackTrace = require("../utils/isomorphic/stackTrace");
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function captureLibraryStackTrace(platform) {
|
|
25
|
-
const stack = (0, _stackTrace.captureRawStack)();
|
|
26
|
-
let parsedFrames = stack.map(line => {
|
|
27
|
-
const frame = (0, _stackTrace.parseStackFrame)(line, platform.pathSeparator, platform.showInternalStackFrames());
|
|
28
|
-
if (!frame || !frame.file) return null;
|
|
29
|
-
const isPlaywrightLibrary = !!platform.coreDir && frame.file.startsWith(platform.coreDir);
|
|
30
|
-
const parsed = {
|
|
31
|
-
frame,
|
|
32
|
-
frameText: line,
|
|
33
|
-
isPlaywrightLibrary
|
|
34
|
-
};
|
|
35
|
-
return parsed;
|
|
36
|
-
}).filter(Boolean);
|
|
37
|
-
let apiName = '';
|
|
38
|
-
|
|
39
|
-
// Deepest transition between non-client code calling into client
|
|
40
|
-
// code is the api entry.
|
|
41
|
-
for (let i = 0; i < parsedFrames.length - 1; i++) {
|
|
42
|
-
const parsedFrame = parsedFrames[i];
|
|
43
|
-
if (parsedFrame.isPlaywrightLibrary && !parsedFrames[i + 1].isPlaywrightLibrary) {
|
|
44
|
-
apiName = apiName || normalizeAPIName(parsedFrame.frame.function);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
function normalizeAPIName(name) {
|
|
49
|
-
if (!name) return '';
|
|
50
|
-
const match = name.match(/(API|JS|CDP|[A-Z])(.*)/);
|
|
51
|
-
if (!match) return name;
|
|
52
|
-
return match[1].toLowerCase() + match[2];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// This is for the inspector so that it did not include the test runner stack frames.
|
|
56
|
-
const filterPrefixes = platform.boxedStackPrefixes();
|
|
57
|
-
parsedFrames = parsedFrames.filter(f => {
|
|
58
|
-
if (filterPrefixes.some(prefix => f.frame.file.startsWith(prefix))) return false;
|
|
59
|
-
return true;
|
|
60
|
-
});
|
|
61
|
-
return {
|
|
62
|
-
frames: parsedFrames.map(p => p.frame),
|
|
63
|
-
apiName
|
|
64
|
-
};
|
|
65
|
-
}
|
package/lib/client/fileUtils.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.fileUploadSizeLimit = void 0;
|
|
7
|
-
exports.mkdirIfNeeded = mkdirIfNeeded;
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
// Keep in sync with the server.
|
|
25
|
-
const fileUploadSizeLimit = exports.fileUploadSizeLimit = 50 * 1024 * 1024;
|
|
26
|
-
async function mkdirIfNeeded(platform, filePath) {
|
|
27
|
-
// This will harmlessly throw on windows if the dirname is the root directory.
|
|
28
|
-
await platform.fs().promises.mkdir(platform.path().dirname(filePath), {
|
|
29
|
-
recursive: true
|
|
30
|
-
}).catch(() => {});
|
|
31
|
-
}
|
package/lib/client/platform.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.emptyPlatform = void 0;
|
|
7
|
-
var _colors = require("../utils/isomorphic/colors");
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const noopZone = {
|
|
25
|
-
push: () => noopZone,
|
|
26
|
-
pop: () => noopZone,
|
|
27
|
-
run: func => func(),
|
|
28
|
-
data: () => undefined
|
|
29
|
-
};
|
|
30
|
-
const emptyPlatform = exports.emptyPlatform = {
|
|
31
|
-
name: 'empty',
|
|
32
|
-
boxedStackPrefixes: () => [],
|
|
33
|
-
calculateSha1: async () => {
|
|
34
|
-
throw new Error('Not implemented');
|
|
35
|
-
},
|
|
36
|
-
colors: _colors.webColors,
|
|
37
|
-
createGuid: () => {
|
|
38
|
-
throw new Error('Not implemented');
|
|
39
|
-
},
|
|
40
|
-
defaultMaxListeners: () => 10,
|
|
41
|
-
env: {},
|
|
42
|
-
fs: () => {
|
|
43
|
-
throw new Error('Not implemented');
|
|
44
|
-
},
|
|
45
|
-
inspectCustom: undefined,
|
|
46
|
-
isDebugMode: () => false,
|
|
47
|
-
isJSDebuggerAttached: () => false,
|
|
48
|
-
isLogEnabled(name) {
|
|
49
|
-
return false;
|
|
50
|
-
},
|
|
51
|
-
isUnderTest: () => false,
|
|
52
|
-
log(name, message) {},
|
|
53
|
-
path: () => {
|
|
54
|
-
throw new Error('Function not implemented.');
|
|
55
|
-
},
|
|
56
|
-
pathSeparator: '/',
|
|
57
|
-
showInternalStackFrames: () => false,
|
|
58
|
-
streamFile(path, writable) {
|
|
59
|
-
throw new Error('Streams are not available');
|
|
60
|
-
},
|
|
61
|
-
streamReadable: channel => {
|
|
62
|
-
throw new Error('Streams are not available');
|
|
63
|
-
},
|
|
64
|
-
streamWritable: channel => {
|
|
65
|
-
throw new Error('Streams are not available');
|
|
66
|
-
},
|
|
67
|
-
zones: {
|
|
68
|
-
empty: noopZone,
|
|
69
|
-
current: () => noopZone
|
|
70
|
-
}
|
|
71
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.TimeoutSettings = exports.DEFAULT_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* Copyright 2019 Google Inc. All rights reserved.
|
|
9
|
-
* Modifications copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
// Keep in sync with server.
|
|
25
|
-
const DEFAULT_TIMEOUT = exports.DEFAULT_TIMEOUT = 30000;
|
|
26
|
-
const DEFAULT_LAUNCH_TIMEOUT = exports.DEFAULT_LAUNCH_TIMEOUT = 3 * 60 * 1000; // 3 minutes
|
|
27
|
-
|
|
28
|
-
class TimeoutSettings {
|
|
29
|
-
constructor(platform, parent) {
|
|
30
|
-
this._parent = void 0;
|
|
31
|
-
this._defaultTimeout = void 0;
|
|
32
|
-
this._defaultNavigationTimeout = void 0;
|
|
33
|
-
this._platform = void 0;
|
|
34
|
-
this._parent = parent;
|
|
35
|
-
this._platform = platform;
|
|
36
|
-
}
|
|
37
|
-
setDefaultTimeout(timeout) {
|
|
38
|
-
this._defaultTimeout = timeout;
|
|
39
|
-
}
|
|
40
|
-
setDefaultNavigationTimeout(timeout) {
|
|
41
|
-
this._defaultNavigationTimeout = timeout;
|
|
42
|
-
}
|
|
43
|
-
defaultNavigationTimeout() {
|
|
44
|
-
return this._defaultNavigationTimeout;
|
|
45
|
-
}
|
|
46
|
-
defaultTimeout() {
|
|
47
|
-
return this._defaultTimeout;
|
|
48
|
-
}
|
|
49
|
-
navigationTimeout(options) {
|
|
50
|
-
if (typeof options.timeout === 'number') return options.timeout;
|
|
51
|
-
if (this._defaultNavigationTimeout !== undefined) return this._defaultNavigationTimeout;
|
|
52
|
-
if (this._platform.isDebugMode()) return 0;
|
|
53
|
-
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
|
|
54
|
-
if (this._parent) return this._parent.navigationTimeout(options);
|
|
55
|
-
return DEFAULT_TIMEOUT;
|
|
56
|
-
}
|
|
57
|
-
timeout(options) {
|
|
58
|
-
if (typeof options.timeout === 'number') return options.timeout;
|
|
59
|
-
if (this._platform.isDebugMode()) return 0;
|
|
60
|
-
if (this._defaultTimeout !== undefined) return this._defaultTimeout;
|
|
61
|
-
if (this._parent) return this._parent.timeout(options);
|
|
62
|
-
return DEFAULT_TIMEOUT;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.TimeoutSettings = TimeoutSettings;
|
package/lib/client/webSocket.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.connectOverWebSocket = connectOverWebSocket;
|
|
7
|
-
var _connection = require("./connection");
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
async function connectOverWebSocket(parentConnection, params) {
|
|
25
|
-
const localUtils = parentConnection.localUtils();
|
|
26
|
-
const transport = localUtils ? new JsonPipeTransport(localUtils) : new WebSocketTransport();
|
|
27
|
-
const connectHeaders = await transport.connect(params);
|
|
28
|
-
const connection = new _connection.Connection(parentConnection._platform, localUtils, parentConnection._instrumentation, connectHeaders);
|
|
29
|
-
connection.markAsRemote();
|
|
30
|
-
connection.on('close', () => transport.close());
|
|
31
|
-
let closeError;
|
|
32
|
-
const onTransportClosed = reason => {
|
|
33
|
-
connection.close(reason || closeError);
|
|
34
|
-
};
|
|
35
|
-
transport.onClose(reason => onTransportClosed(reason));
|
|
36
|
-
connection.onmessage = message => transport.send(message).catch(() => onTransportClosed());
|
|
37
|
-
transport.onMessage(message => {
|
|
38
|
-
try {
|
|
39
|
-
connection.dispatch(message);
|
|
40
|
-
} catch (e) {
|
|
41
|
-
closeError = String(e);
|
|
42
|
-
transport.close().catch(() => {});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return connection;
|
|
46
|
-
}
|
|
47
|
-
class JsonPipeTransport {
|
|
48
|
-
constructor(owner) {
|
|
49
|
-
this._pipe = void 0;
|
|
50
|
-
this._owner = void 0;
|
|
51
|
-
this._owner = owner;
|
|
52
|
-
}
|
|
53
|
-
async connect(params) {
|
|
54
|
-
const {
|
|
55
|
-
pipe,
|
|
56
|
-
headers: connectHeaders
|
|
57
|
-
} = await this._owner._wrapApiCall(async () => {
|
|
58
|
-
return await this._owner._channel.connect(params);
|
|
59
|
-
}, /* isInternal */true);
|
|
60
|
-
this._pipe = pipe;
|
|
61
|
-
return connectHeaders;
|
|
62
|
-
}
|
|
63
|
-
async send(message) {
|
|
64
|
-
await this._owner._wrapApiCall(async () => {
|
|
65
|
-
await this._pipe.send({
|
|
66
|
-
message
|
|
67
|
-
});
|
|
68
|
-
}, /* isInternal */true);
|
|
69
|
-
}
|
|
70
|
-
onMessage(callback) {
|
|
71
|
-
this._pipe.on('message', ({
|
|
72
|
-
message
|
|
73
|
-
}) => callback(message));
|
|
74
|
-
}
|
|
75
|
-
onClose(callback) {
|
|
76
|
-
this._pipe.on('closed', ({
|
|
77
|
-
reason
|
|
78
|
-
}) => callback(reason));
|
|
79
|
-
}
|
|
80
|
-
async close() {
|
|
81
|
-
await this._owner._wrapApiCall(async () => {
|
|
82
|
-
await this._pipe.close().catch(() => {});
|
|
83
|
-
}, /* isInternal */true);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
class WebSocketTransport {
|
|
87
|
-
constructor() {
|
|
88
|
-
this._ws = void 0;
|
|
89
|
-
}
|
|
90
|
-
async connect(params) {
|
|
91
|
-
this._ws = new window.WebSocket(params.wsEndpoint);
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
async send(message) {
|
|
95
|
-
this._ws.send(JSON.stringify(message));
|
|
96
|
-
}
|
|
97
|
-
onMessage(callback) {
|
|
98
|
-
this._ws.addEventListener('message', event => callback(JSON.parse(event.data)));
|
|
99
|
-
}
|
|
100
|
-
onClose(callback) {
|
|
101
|
-
this._ws.addEventListener('close', () => callback());
|
|
102
|
-
}
|
|
103
|
-
async close() {
|
|
104
|
-
this._ws.close();
|
|
105
|
-
}
|
|
106
|
-
}
|
package/lib/server/callLog.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.compressCallLog = compressCallLog;
|
|
7
|
-
exports.findRepeatedSubsequencesForTest = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Copyright (c) Microsoft Corporation.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the 'License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
function compressCallLog(log) {
|
|
25
|
-
const lines = [];
|
|
26
|
-
for (const block of findRepeatedSubsequences(log)) {
|
|
27
|
-
for (let i = 0; i < block.sequence.length; i++) {
|
|
28
|
-
const line = block.sequence[i];
|
|
29
|
-
const leadingWhitespace = line.match(/^\s*/);
|
|
30
|
-
const whitespacePrefix = ' ' + (leadingWhitespace === null || leadingWhitespace === void 0 ? void 0 : leadingWhitespace[0]) || '';
|
|
31
|
-
const countPrefix = `${block.count} × `;
|
|
32
|
-
if (block.count > 1 && i === 0) lines.push(whitespacePrefix + countPrefix + line.trim());else if (block.count > 1) lines.push(whitespacePrefix + ' '.repeat(countPrefix.length - 2) + '- ' + line.trim());else lines.push(whitespacePrefix + '- ' + line.trim());
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return lines;
|
|
36
|
-
}
|
|
37
|
-
function findRepeatedSubsequences(s) {
|
|
38
|
-
const n = s.length;
|
|
39
|
-
const result = [];
|
|
40
|
-
let i = 0;
|
|
41
|
-
const arraysEqual = (a1, a2) => {
|
|
42
|
-
if (a1.length !== a2.length) return false;
|
|
43
|
-
for (let j = 0; j < a1.length; j++) {
|
|
44
|
-
if (a1[j] !== a2[j]) return false;
|
|
45
|
-
}
|
|
46
|
-
return true;
|
|
47
|
-
};
|
|
48
|
-
while (i < n) {
|
|
49
|
-
let maxRepeatCount = 1;
|
|
50
|
-
let maxRepeatSubstr = [s[i]]; // Initialize with the element at index i
|
|
51
|
-
let maxRepeatLength = 1;
|
|
52
|
-
|
|
53
|
-
// Try substrings of length from 1 to the remaining length of the array
|
|
54
|
-
for (let p = 1; p <= n - i; p++) {
|
|
55
|
-
const substr = s.slice(i, i + p); // Extract substring as array
|
|
56
|
-
let k = 1;
|
|
57
|
-
|
|
58
|
-
// Count how many times the substring repeats consecutively
|
|
59
|
-
while (i + p * k <= n && arraysEqual(s.slice(i + p * (k - 1), i + p * k), substr)) k += 1;
|
|
60
|
-
k -= 1; // Adjust k since it increments one extra time in the loop
|
|
61
|
-
|
|
62
|
-
// Update the maximal repeating substring if necessary
|
|
63
|
-
if (k > 1 && k * p > maxRepeatCount * maxRepeatLength) {
|
|
64
|
-
maxRepeatCount = k;
|
|
65
|
-
maxRepeatSubstr = substr;
|
|
66
|
-
maxRepeatLength = p;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Record the substring and its count
|
|
71
|
-
result.push({
|
|
72
|
-
sequence: maxRepeatSubstr,
|
|
73
|
-
count: maxRepeatCount
|
|
74
|
-
});
|
|
75
|
-
i += maxRepeatLength * maxRepeatCount; // Move index forward
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}
|
|
79
|
-
const findRepeatedSubsequencesForTest = exports.findRepeatedSubsequencesForTest = findRepeatedSubsequences;
|
package/lib/server/harBackend.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.HarBackend = void 0;
|
|
7
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
8
|
-
var _path = _interopRequireDefault(require("path"));
|
|
9
|
-
var _crypto = require("./utils/crypto");
|
|
10
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
/**
|
|
12
|
-
* Copyright (c) Microsoft Corporation.
|
|
13
|
-
*
|
|
14
|
-
* Licensed under the Apache License, Version 2.0 (the 'License");
|
|
15
|
-
* you may not use this file except in compliance with the License.
|
|
16
|
-
* You may obtain a copy of the License at
|
|
17
|
-
*
|
|
18
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
19
|
-
*
|
|
20
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
21
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
22
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
|
-
* See the License for the specific language governing permissions and
|
|
24
|
-
* limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
const redirectStatus = [301, 302, 303, 307, 308];
|
|
28
|
-
class HarBackend {
|
|
29
|
-
constructor(harFile, baseDir, zipFile) {
|
|
30
|
-
this.id = void 0;
|
|
31
|
-
this._harFile = void 0;
|
|
32
|
-
this._zipFile = void 0;
|
|
33
|
-
this._baseDir = void 0;
|
|
34
|
-
this.id = (0, _crypto.createGuid)();
|
|
35
|
-
this._harFile = harFile;
|
|
36
|
-
this._baseDir = baseDir;
|
|
37
|
-
this._zipFile = zipFile;
|
|
38
|
-
}
|
|
39
|
-
async lookup(url, method, headers, postData, isNavigationRequest) {
|
|
40
|
-
let entry;
|
|
41
|
-
try {
|
|
42
|
-
entry = await this._harFindResponse(url, method, headers, postData);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
return {
|
|
45
|
-
action: 'error',
|
|
46
|
-
message: 'HAR error: ' + e.message
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
if (!entry) return {
|
|
50
|
-
action: 'noentry'
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// If navigation is being redirected, restart it with the final url to ensure the document's url changes.
|
|
54
|
-
if (entry.request.url !== url && isNavigationRequest) return {
|
|
55
|
-
action: 'redirect',
|
|
56
|
-
redirectURL: entry.request.url
|
|
57
|
-
};
|
|
58
|
-
const response = entry.response;
|
|
59
|
-
try {
|
|
60
|
-
const buffer = await this._loadContent(response.content);
|
|
61
|
-
return {
|
|
62
|
-
action: 'fulfill',
|
|
63
|
-
status: response.status,
|
|
64
|
-
headers: response.headers,
|
|
65
|
-
body: buffer
|
|
66
|
-
};
|
|
67
|
-
} catch (e) {
|
|
68
|
-
return {
|
|
69
|
-
action: 'error',
|
|
70
|
-
message: e.message
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async _loadContent(content) {
|
|
75
|
-
const file = content._file;
|
|
76
|
-
let buffer;
|
|
77
|
-
if (file) {
|
|
78
|
-
if (this._zipFile) buffer = await this._zipFile.read(file);else buffer = await _fs.default.promises.readFile(_path.default.resolve(this._baseDir, file));
|
|
79
|
-
} else {
|
|
80
|
-
buffer = Buffer.from(content.text || '', content.encoding === 'base64' ? 'base64' : 'utf-8');
|
|
81
|
-
}
|
|
82
|
-
return buffer;
|
|
83
|
-
}
|
|
84
|
-
async _harFindResponse(url, method, headers, postData) {
|
|
85
|
-
const harLog = this._harFile.log;
|
|
86
|
-
const visited = new Set();
|
|
87
|
-
while (true) {
|
|
88
|
-
const entries = [];
|
|
89
|
-
for (const candidate of harLog.entries) {
|
|
90
|
-
if (candidate.request.url !== url || candidate.request.method !== method) continue;
|
|
91
|
-
if (method === 'POST' && postData && candidate.request.postData) {
|
|
92
|
-
const buffer = await this._loadContent(candidate.request.postData);
|
|
93
|
-
if (!buffer.equals(postData)) {
|
|
94
|
-
const boundary = multipartBoundary(headers);
|
|
95
|
-
if (!boundary) continue;
|
|
96
|
-
const candidataBoundary = multipartBoundary(candidate.request.headers);
|
|
97
|
-
if (!candidataBoundary) continue;
|
|
98
|
-
// Try to match multipart/form-data ignroing boundary as it changes between requests.
|
|
99
|
-
if (postData.toString().replaceAll(boundary, '') !== buffer.toString().replaceAll(candidataBoundary, '')) continue;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
entries.push(candidate);
|
|
103
|
-
}
|
|
104
|
-
if (!entries.length) return;
|
|
105
|
-
let entry = entries[0];
|
|
106
|
-
|
|
107
|
-
// Disambiguate using headers - then one with most matching headers wins.
|
|
108
|
-
if (entries.length > 1) {
|
|
109
|
-
const list = [];
|
|
110
|
-
for (const candidate of entries) {
|
|
111
|
-
const matchingHeaders = countMatchingHeaders(candidate.request.headers, headers);
|
|
112
|
-
list.push({
|
|
113
|
-
candidate,
|
|
114
|
-
matchingHeaders
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
list.sort((a, b) => b.matchingHeaders - a.matchingHeaders);
|
|
118
|
-
entry = list[0].candidate;
|
|
119
|
-
}
|
|
120
|
-
if (visited.has(entry)) throw new Error(`Found redirect cycle for ${url}`);
|
|
121
|
-
visited.add(entry);
|
|
122
|
-
|
|
123
|
-
// Follow redirects.
|
|
124
|
-
const locationHeader = entry.response.headers.find(h => h.name.toLowerCase() === 'location');
|
|
125
|
-
if (redirectStatus.includes(entry.response.status) && locationHeader) {
|
|
126
|
-
const locationURL = new URL(locationHeader.value, url);
|
|
127
|
-
url = locationURL.toString();
|
|
128
|
-
if ((entry.response.status === 301 || entry.response.status === 302) && method === 'POST' || entry.response.status === 303 && !['GET', 'HEAD'].includes(method)) {
|
|
129
|
-
// HTTP-redirect fetch step 13 (https://fetch.spec.whatwg.org/#http-redirect-fetch)
|
|
130
|
-
method = 'GET';
|
|
131
|
-
}
|
|
132
|
-
continue;
|
|
133
|
-
}
|
|
134
|
-
return entry;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
dispose() {
|
|
138
|
-
var _this$_zipFile;
|
|
139
|
-
(_this$_zipFile = this._zipFile) === null || _this$_zipFile === void 0 || _this$_zipFile.close();
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
exports.HarBackend = HarBackend;
|
|
143
|
-
function countMatchingHeaders(harHeaders, headers) {
|
|
144
|
-
const set = new Set(headers.map(h => h.name.toLowerCase() + ':' + h.value));
|
|
145
|
-
let matches = 0;
|
|
146
|
-
for (const h of harHeaders) {
|
|
147
|
-
if (set.has(h.name.toLowerCase() + ':' + h.value)) ++matches;
|
|
148
|
-
}
|
|
149
|
-
return matches;
|
|
150
|
-
}
|
|
151
|
-
function multipartBoundary(headers) {
|
|
152
|
-
const contentType = headers.find(h => h.name.toLowerCase() === 'content-type');
|
|
153
|
-
if (!(contentType !== null && contentType !== void 0 && contentType.value.includes('multipart/form-data'))) return undefined;
|
|
154
|
-
const boundary = contentType.value.match(/boundary=(\S+)/);
|
|
155
|
-
if (boundary) return boundary[1];
|
|
156
|
-
return undefined;
|
|
157
|
-
}
|