chrome-devtools-mcp 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -874
- package/build/src/McpContext.js +98 -45
- package/build/src/McpPage.js +10 -4
- package/build/src/McpResponse.js +22 -4
- package/build/src/ToolHandler.js +81 -57
- package/build/src/bin/chrome-devtools-mcp-main.js +4 -4
- package/build/src/bin/chrome-devtools.js +29 -30
- package/build/src/browser.js +8 -17
- package/build/src/{PageCollector.js → collectors/PageCollector.js} +7 -7
- package/build/src/{ServiceWorkerCollector.js → collectors/ServiceWorkerCollector.js} +1 -1
- package/build/src/config/browser-options.js +123 -0
- package/build/src/config/category-options.js +80 -0
- package/build/src/{bin/chrome-devtools-cli-options.js → config/cli-options.js} +380 -25
- package/build/src/{bin/chrome-devtools-mcp-cli-options.js → config/mcp-options.js} +113 -148
- package/build/src/daemon/client.js +11 -2
- package/build/src/daemon/daemon.js +2 -2
- package/build/src/daemon/utils.js +6 -0
- package/build/src/devtools/DevtoolsUtils.js +29 -35
- package/build/src/formatters/ConsoleFormatter.js +43 -10
- package/build/src/formatters/HeapSnapshotFormatter.js +10 -2
- package/build/src/formatters/IssueFormatter.js +1 -1
- package/build/src/formatters/NetworkFormatter.js +12 -9
- package/build/src/index.js +185 -91
- package/build/src/{HeapSnapshotManager.js → processors/HeapSnapshotManager.js} +21 -5
- package/build/src/{trace-processing/parse.js → processors/PerformanceTrace.js} +1 -1
- package/build/src/telemetry/ClearcutLogger.js +18 -5
- package/build/src/telemetry/flagUtils.js +4 -3
- package/build/src/telemetry/types.js +4 -0
- package/build/src/third_party/THIRD_PARTY_NOTICES +8 -65
- package/build/src/third_party/bundled-packages.json +4 -4
- package/build/src/third_party/devtools-formatter-worker.js +22 -0
- package/build/src/third_party/devtools-heap-snapshot-worker.js +296 -42
- package/build/src/third_party/index.js +38728 -37176
- package/build/src/third_party/issue-descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
- package/build/src/third_party/issue-descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestAccountsBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestConfigBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestIdTokenBlockedByConnectionAllowlist.md +1 -0
- package/build/src/third_party/issue-descriptions/federatedAuthRequestWellKnownBlockedByConnectionAllowlist.md +1 -0
- package/build/src/tools/ToolDefinition.js +15 -0
- package/build/src/tools/categories.js +2 -5
- package/build/src/tools/console.js +9 -3
- package/build/src/tools/emulation.js +2 -2
- package/build/src/tools/extensions.js +7 -5
- package/build/src/tools/input.js +26 -16
- package/build/src/tools/lighthouse.js +3 -1
- package/build/src/tools/memory.js +112 -16
- package/build/src/tools/network.js +7 -4
- package/build/src/tools/pages.js +34 -23
- package/build/src/tools/performance.js +16 -25
- package/build/src/tools/pwa.js +128 -0
- package/build/src/tools/screencast.js +7 -4
- package/build/src/tools/screenshot.js +42 -9
- package/build/src/tools/script.js +29 -8
- package/build/src/tools/slim/tools.js +43 -35
- package/build/src/tools/snapshot.js +5 -3
- package/build/src/tools/thirdPartyDeveloper.js +2 -2
- package/build/src/tools/tools.js +2 -0
- package/build/src/tools/webmcp.js +2 -2
- package/build/src/{WaitForHelper.js → utils/WaitForHelper.js} +74 -38
- package/build/src/utils/bytes.js +105 -0
- package/build/src/utils/logger.js +25 -11
- package/build/src/utils/url.js +73 -0
- package/build/src/version.js +1 -1
- package/package.json +21 -13
- package/skills/a11y-debugging/SKILL.md +2 -0
- package/skills/chrome-devtools/SKILL.md +5 -4
- package/skills/chrome-devtools-cli/SKILL.md +103 -64
- package/skills/cookie-debugging/SKILL.md +149 -0
- package/skills/debug-optimize-lcp/SKILL.md +9 -9
- package/skills/memory-leak-debugging/SKILL.md +6 -2
- package/skills/troubleshooting/SKILL.md +1 -0
- package/build/src/utils/string.js +0 -37
|
@@ -1001,6 +1001,16 @@ class ColorConverter {
|
|
|
1001
1001
|
const rgbOutput = NAMED_GAMUTS.displayP3_INVERSE.multiply(xyzInput);
|
|
1002
1002
|
return applyTransferFns(NAMED_TRANSFER_FN.sRGB_INVERSE, rgbOutput.values[0], rgbOutput.values[1], rgbOutput.values[2]);
|
|
1003
1003
|
}
|
|
1004
|
+
static displayP3LinearToXyzd50(r, g, b) {
|
|
1005
|
+
const rgbInput = new Vector3([r, g, b]);
|
|
1006
|
+
const xyzOutput = NAMED_GAMUTS.displayP3.multiply(rgbInput);
|
|
1007
|
+
return xyzOutput.values;
|
|
1008
|
+
}
|
|
1009
|
+
static xyzd50ToDisplayP3Linear(x, y, z) {
|
|
1010
|
+
const xyzInput = new Vector3([x, y, z]);
|
|
1011
|
+
const rgbResult = NAMED_GAMUTS.displayP3_INVERSE.multiply(xyzInput);
|
|
1012
|
+
return rgbResult.values;
|
|
1013
|
+
}
|
|
1004
1014
|
static proPhotoToXyzd50(r, g, b) {
|
|
1005
1015
|
const [mappedR, mappedG, mappedB] = applyTransferFns(NAMED_TRANSFER_FN.proPhotoRGB, r, g, b);
|
|
1006
1016
|
const rgbInput = new Vector3([mappedR, mappedG, mappedB]);
|
|
@@ -1200,6 +1210,8 @@ function getColorSpace(colorSpaceText) {
|
|
|
1200
1210
|
return "srgb-linear" ;
|
|
1201
1211
|
case "display-p3" :
|
|
1202
1212
|
return "display-p3" ;
|
|
1213
|
+
case "display-p3-linear" :
|
|
1214
|
+
return "display-p3-linear" ;
|
|
1203
1215
|
case "a98-rgb" :
|
|
1204
1216
|
return "a98-rgb" ;
|
|
1205
1217
|
case "prophoto-rgb" :
|
|
@@ -1418,6 +1430,7 @@ class Lab {
|
|
|
1418
1430
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
1419
1431
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
1420
1432
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
1433
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
1421
1434
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
1422
1435
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
1423
1436
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -1534,6 +1547,7 @@ class LCH {
|
|
|
1534
1547
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
1535
1548
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
1536
1549
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
1550
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
1537
1551
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
1538
1552
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
1539
1553
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -1652,6 +1666,7 @@ class Oklab {
|
|
|
1652
1666
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
1653
1667
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
1654
1668
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
1669
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
1655
1670
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
1656
1671
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
1657
1672
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -1768,6 +1783,7 @@ class Oklch {
|
|
|
1768
1783
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
1769
1784
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
1770
1785
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
1786
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
1771
1787
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
1772
1788
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
1773
1789
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -1887,6 +1903,7 @@ class ColorFunction {
|
|
|
1887
1903
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
1888
1904
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
1889
1905
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
1906
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
1890
1907
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
1891
1908
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
1892
1909
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -1903,6 +1920,8 @@ class ColorFunction {
|
|
|
1903
1920
|
return ColorConverter.srgbLinearToXyzd50(p0, p1, p2);
|
|
1904
1921
|
case "display-p3" :
|
|
1905
1922
|
return ColorConverter.displayP3ToXyzd50(p0, p1, p2);
|
|
1923
|
+
case "display-p3-linear" :
|
|
1924
|
+
return ColorConverter.displayP3LinearToXyzd50(p0, p1, p2);
|
|
1906
1925
|
case "a98-rgb" :
|
|
1907
1926
|
return ColorConverter.adobeRGBToXyzd50(p0, p1, p2);
|
|
1908
1927
|
case "prophoto-rgb" :
|
|
@@ -2058,6 +2077,7 @@ class HSL {
|
|
|
2058
2077
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
2059
2078
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
2060
2079
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
2080
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
2061
2081
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
2062
2082
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
2063
2083
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -2185,6 +2205,7 @@ class HWB {
|
|
|
2185
2205
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
2186
2206
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
2187
2207
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
2208
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
2188
2209
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
2189
2210
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
2190
2211
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -2413,6 +2434,7 @@ class Legacy {
|
|
|
2413
2434
|
["srgb" ]: (self) => new ColorFunction("srgb" , ...ColorConverter.xyzd50ToSrgb(...self.#toXyzd50()), self.alpha),
|
|
2414
2435
|
["srgb-linear" ]: (self) => new ColorFunction("srgb-linear" , ...ColorConverter.xyzd50TosRGBLinear(...self.#toXyzd50()), self.alpha),
|
|
2415
2436
|
["display-p3" ]: (self) => new ColorFunction("display-p3" , ...ColorConverter.xyzd50ToDisplayP3(...self.#toXyzd50()), self.alpha),
|
|
2437
|
+
["display-p3-linear" ]: (self) => new ColorFunction("display-p3-linear" , ...ColorConverter.xyzd50ToDisplayP3Linear(...self.#toXyzd50()), self.alpha),
|
|
2416
2438
|
["a98-rgb" ]: (self) => new ColorFunction("a98-rgb" , ...ColorConverter.xyzd50ToAdobeRGB(...self.#toXyzd50()), self.alpha),
|
|
2417
2439
|
["prophoto-rgb" ]: (self) => new ColorFunction("prophoto-rgb" , ...ColorConverter.xyzd50ToProPhoto(...self.#toXyzd50()), self.alpha),
|
|
2418
2440
|
["rec2020" ]: (self) => new ColorFunction("rec2020" , ...ColorConverter.xyzd50ToRec2020(...self.#toXyzd50()), self.alpha),
|
|
@@ -5661,15 +5683,21 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5661
5683
|
}
|
|
5662
5684
|
evaluateForTest(script, callback) {
|
|
5663
5685
|
const callId = this.nextCallId++;
|
|
5664
|
-
this.callbacks.set(callId,
|
|
5686
|
+
this.callbacks.set(callId, (error, result) => {
|
|
5687
|
+
callback(error, result);
|
|
5688
|
+
});
|
|
5665
5689
|
this.postMessage({ callId, disposition: 'evaluateForTest', source: script });
|
|
5666
5690
|
}
|
|
5667
5691
|
callFactoryMethod(callback, objectId, methodName, proxyConstructor, transfer, ...methodArguments) {
|
|
5668
5692
|
const callId = this.nextCallId++;
|
|
5669
5693
|
const newObjectId = this.nextObjectId++;
|
|
5670
5694
|
if (callback) {
|
|
5671
|
-
this.callbacks.set(callId, remoteResult => {
|
|
5672
|
-
|
|
5695
|
+
this.callbacks.set(callId, (error, remoteResult) => {
|
|
5696
|
+
if (error) {
|
|
5697
|
+
callback(error);
|
|
5698
|
+
return;
|
|
5699
|
+
}
|
|
5700
|
+
callback(undefined, remoteResult ? new proxyConstructor(this, newObjectId) : undefined);
|
|
5673
5701
|
});
|
|
5674
5702
|
this.postMessage({
|
|
5675
5703
|
callId,
|
|
@@ -5694,7 +5722,9 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5694
5722
|
callMethod(callback, objectId, methodName, ...methodArguments) {
|
|
5695
5723
|
const callId = this.nextCallId++;
|
|
5696
5724
|
if (callback) {
|
|
5697
|
-
this.callbacks.set(callId,
|
|
5725
|
+
this.callbacks.set(callId, (error, result) => {
|
|
5726
|
+
callback(error, result);
|
|
5727
|
+
});
|
|
5698
5728
|
}
|
|
5699
5729
|
this.postMessage({
|
|
5700
5730
|
callId,
|
|
@@ -5725,8 +5755,15 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5725
5755
|
}
|
|
5726
5756
|
setupForSecondaryInit(port) {
|
|
5727
5757
|
const callId = this.nextCallId++;
|
|
5728
|
-
const done = new Promise(resolve => {
|
|
5729
|
-
this.callbacks.set(callId,
|
|
5758
|
+
const done = new Promise((resolve, reject) => {
|
|
5759
|
+
this.callbacks.set(callId, error => {
|
|
5760
|
+
if (error) {
|
|
5761
|
+
reject(new Error(error));
|
|
5762
|
+
}
|
|
5763
|
+
else {
|
|
5764
|
+
resolve();
|
|
5765
|
+
}
|
|
5766
|
+
});
|
|
5730
5767
|
});
|
|
5731
5768
|
this.postMessage({
|
|
5732
5769
|
callId,
|
|
@@ -5746,15 +5783,17 @@ class HeapSnapshotWorkerProxy extends ObjectWrapper {
|
|
|
5746
5783
|
if (data.error) {
|
|
5747
5784
|
this.#console.error(`An error occurred when a call to method '${data.errorMethodName}' was requested`);
|
|
5748
5785
|
this.#console.error(data['errorCallStack']);
|
|
5749
|
-
this.callbacks.delete(data.callId);
|
|
5750
|
-
return;
|
|
5751
5786
|
}
|
|
5752
5787
|
const callback = this.callbacks.get(data.callId);
|
|
5753
5788
|
if (!callback) {
|
|
5754
5789
|
return;
|
|
5755
5790
|
}
|
|
5756
5791
|
this.callbacks.delete(data.callId);
|
|
5757
|
-
|
|
5792
|
+
if (data.error) {
|
|
5793
|
+
callback(data.error);
|
|
5794
|
+
return;
|
|
5795
|
+
}
|
|
5796
|
+
callback(undefined, data.result);
|
|
5758
5797
|
}
|
|
5759
5798
|
postMessage(message, transfer) {
|
|
5760
5799
|
this.worker.postMessage(message, transfer);
|
|
@@ -5774,10 +5813,27 @@ class HeapSnapshotProxyObject {
|
|
|
5774
5813
|
return this.worker.callFactoryMethod(null, String(this.objectId), methodName, proxyConstructor, [], ...args);
|
|
5775
5814
|
}
|
|
5776
5815
|
callFactoryMethodPromise(methodName, proxyConstructor, transfer, ...args) {
|
|
5777
|
-
return new Promise(resolve => this.worker.callFactoryMethod(
|
|
5816
|
+
return new Promise((resolve, reject) => this.worker.callFactoryMethod((error, result) => {
|
|
5817
|
+
if (error) {
|
|
5818
|
+
reject(new Error(error));
|
|
5819
|
+
}
|
|
5820
|
+
else if (result) {
|
|
5821
|
+
resolve(result);
|
|
5822
|
+
}
|
|
5823
|
+
else {
|
|
5824
|
+
reject(new Error(`Failed to create ${proxyConstructor.name}`));
|
|
5825
|
+
}
|
|
5826
|
+
}, String(this.objectId), methodName, proxyConstructor, transfer, ...args));
|
|
5778
5827
|
}
|
|
5779
5828
|
callMethodPromise(methodName, ...args) {
|
|
5780
|
-
return new Promise(resolve => this.worker.callMethod(
|
|
5829
|
+
return new Promise((resolve, reject) => this.worker.callMethod((error, result) => {
|
|
5830
|
+
if (error) {
|
|
5831
|
+
reject(new Error(error));
|
|
5832
|
+
}
|
|
5833
|
+
else {
|
|
5834
|
+
resolve(result);
|
|
5835
|
+
}
|
|
5836
|
+
}, String(this.objectId), methodName, ...args));
|
|
5781
5837
|
}
|
|
5782
5838
|
}
|
|
5783
5839
|
class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject {
|
|
@@ -5796,12 +5852,16 @@ class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject {
|
|
|
5796
5852
|
const secondWorker = new HeapSnapshotWorkerProxy(() => { }, this.worker.console, this.worker.workerUrl);
|
|
5797
5853
|
const channel = new MessageChannel();
|
|
5798
5854
|
await secondWorker.setupForSecondaryInit(channel.port2);
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5855
|
+
try {
|
|
5856
|
+
const snapshotProxy = await this.callFactoryMethodPromise('buildSnapshot', HeapSnapshotProxy, [channel.port1]);
|
|
5857
|
+
snapshotProxy.setProfileUid(this.profileUid);
|
|
5858
|
+
await snapshotProxy.updateStaticData();
|
|
5859
|
+
this.snapshotReceivedCallback(snapshotProxy);
|
|
5860
|
+
}
|
|
5861
|
+
finally {
|
|
5862
|
+
secondWorker.dispose();
|
|
5863
|
+
this.dispose();
|
|
5864
|
+
}
|
|
5805
5865
|
}
|
|
5806
5866
|
}
|
|
5807
5867
|
class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
@@ -5820,6 +5880,9 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5820
5880
|
getNativeContextSizes() {
|
|
5821
5881
|
return this.callMethodPromise('getNativeContextSizes');
|
|
5822
5882
|
}
|
|
5883
|
+
getRetainedByContextSummary() {
|
|
5884
|
+
return this.callMethodPromise('getRetainedByContextSummary');
|
|
5885
|
+
}
|
|
5823
5886
|
aggregatesWithFilter(filter) {
|
|
5824
5887
|
return this.callMethodPromise('aggregatesWithFilter', filter);
|
|
5825
5888
|
}
|
|
@@ -5841,8 +5904,8 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5841
5904
|
getObjectInfo(nodeIndex) {
|
|
5842
5905
|
return this.callMethodPromise('getObjectInfo', nodeIndex);
|
|
5843
5906
|
}
|
|
5844
|
-
createEdgesProvider(nodeIndex) {
|
|
5845
|
-
return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex);
|
|
5907
|
+
createEdgesProvider(nodeIndex, options) {
|
|
5908
|
+
return this.callFactoryMethod('createEdgesProvider', HeapSnapshotProviderProxy, nodeIndex, options);
|
|
5846
5909
|
}
|
|
5847
5910
|
createRetainingEdgesProvider(nodeIndex) {
|
|
5848
5911
|
return this.callFactoryMethod('createRetainingEdgesProvider', HeapSnapshotProviderProxy, nodeIndex);
|
|
@@ -5859,6 +5922,9 @@ class HeapSnapshotProxy extends HeapSnapshotProxyObject {
|
|
|
5859
5922
|
createNodesProviderForClass(classKey, nodeFilter) {
|
|
5860
5923
|
return this.callFactoryMethod('createNodesProviderForClass', HeapSnapshotProviderProxy, classKey, nodeFilter);
|
|
5861
5924
|
}
|
|
5925
|
+
queryObjects(queryOptions) {
|
|
5926
|
+
return this.callFactoryMethod('queryObjects', HeapSnapshotProviderProxy, queryOptions);
|
|
5927
|
+
}
|
|
5862
5928
|
allocationTracesTops() {
|
|
5863
5929
|
return this.callMethodPromise('allocationTracesTops');
|
|
5864
5930
|
}
|
|
@@ -6586,21 +6652,10 @@ class HeapSnapshotNode {
|
|
|
6586
6652
|
return false;
|
|
6587
6653
|
}
|
|
6588
6654
|
#detachednessAndClassIndex() {
|
|
6589
|
-
|
|
6590
|
-
const nodeDetachednessAndClassIndexOffset = snapshot.nodeDetachednessAndClassIndexOffset;
|
|
6591
|
-
return nodeDetachednessAndClassIndexOffset !== -1 ?
|
|
6592
|
-
snapshot.nodes.getValue(nodeIndex + nodeDetachednessAndClassIndexOffset) :
|
|
6593
|
-
snapshot.detachednessAndClassIndexArray[nodeIndex / snapshot.nodeFieldCount];
|
|
6655
|
+
return this.snapshot.detachednessAndClassIndexArray[this.nodeIndex / this.snapshot.nodeFieldCount];
|
|
6594
6656
|
}
|
|
6595
6657
|
#setDetachednessAndClassIndex(value) {
|
|
6596
|
-
|
|
6597
|
-
const nodeDetachednessAndClassIndexOffset = snapshot.nodeDetachednessAndClassIndexOffset;
|
|
6598
|
-
if (nodeDetachednessAndClassIndexOffset !== -1) {
|
|
6599
|
-
snapshot.nodes.setValue(nodeIndex + nodeDetachednessAndClassIndexOffset, value);
|
|
6600
|
-
}
|
|
6601
|
-
else {
|
|
6602
|
-
snapshot.detachednessAndClassIndexArray[nodeIndex / snapshot.nodeFieldCount] = value;
|
|
6603
|
-
}
|
|
6658
|
+
this.snapshot.detachednessAndClassIndexArray[this.nodeIndex / this.snapshot.nodeFieldCount] = value;
|
|
6604
6659
|
}
|
|
6605
6660
|
detachedness() {
|
|
6606
6661
|
return this.#detachednessAndClassIndex() & BITMASK_FOR_DOM_LINK_STATE;
|
|
@@ -6995,6 +7050,7 @@ class HeapSnapshot {
|
|
|
6995
7050
|
this.#progress.updateStatus('Building retainers…');
|
|
6996
7051
|
const resultsFromSecondWorker = this.startInitStep1InSecondThread(secondWorker);
|
|
6997
7052
|
this.#progress.updateStatus('Propagating DOM state…');
|
|
7053
|
+
this.initDetachednessAndClassIndex();
|
|
6998
7054
|
this.propagateDOMState();
|
|
6999
7055
|
this.#progress.updateStatus('Calculating node flags…');
|
|
7000
7056
|
this.calculateFlags();
|
|
@@ -8030,9 +8086,6 @@ class HeapSnapshot {
|
|
|
8030
8086
|
}
|
|
8031
8087
|
calculateObjectNames() {
|
|
8032
8088
|
const { nodes, nodeCount, nodeNameOffset, nodeNativeType, nodeHiddenType, nodeObjectType, nodeCodeType, nodeClosureType, nodeRegExpType, } = this;
|
|
8033
|
-
if (this.nodeDetachednessAndClassIndexOffset === -1) {
|
|
8034
|
-
this.detachednessAndClassIndexArray = new Uint32Array(nodeCount);
|
|
8035
|
-
}
|
|
8036
8089
|
const stringTable = new Map();
|
|
8037
8090
|
const getIndexForString = (s) => {
|
|
8038
8091
|
let index = stringTable.get(s);
|
|
@@ -8243,6 +8296,43 @@ class HeapSnapshot {
|
|
|
8243
8296
|
getNativeContextSizes() {
|
|
8244
8297
|
return this.#nativeContextSizes;
|
|
8245
8298
|
}
|
|
8299
|
+
getRetainedByContextSummary() {
|
|
8300
|
+
const isRetainedByContext = this.createNamedFilter('objectsRetainedByContexts');
|
|
8301
|
+
let contextCount = 0;
|
|
8302
|
+
let retainedByContextSize = 0;
|
|
8303
|
+
let retainedByContextCount = 0;
|
|
8304
|
+
let notRetainedByContextSize = 0;
|
|
8305
|
+
let notRetainedByContextCount = 0;
|
|
8306
|
+
const node = this.rootNode();
|
|
8307
|
+
const { nodes, nodeFieldCount, nodeSelfSizeOffset: selfSizeOffset } = this;
|
|
8308
|
+
const nodesLength = nodes.length;
|
|
8309
|
+
for (let nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount) {
|
|
8310
|
+
const selfSize = nodes.getValue(nodeIndex + selfSizeOffset);
|
|
8311
|
+
if (!selfSize) {
|
|
8312
|
+
continue;
|
|
8313
|
+
}
|
|
8314
|
+
node.nodeIndex = nodeIndex;
|
|
8315
|
+
if (isRetainedByContext(node)) {
|
|
8316
|
+
retainedByContextCount++;
|
|
8317
|
+
retainedByContextSize += selfSize;
|
|
8318
|
+
}
|
|
8319
|
+
else {
|
|
8320
|
+
notRetainedByContextCount++;
|
|
8321
|
+
notRetainedByContextSize += selfSize;
|
|
8322
|
+
}
|
|
8323
|
+
if (this.isContextObject(node)) {
|
|
8324
|
+
contextCount++;
|
|
8325
|
+
}
|
|
8326
|
+
}
|
|
8327
|
+
return {
|
|
8328
|
+
contextCount,
|
|
8329
|
+
retainedByContextSize,
|
|
8330
|
+
retainedByContextCount,
|
|
8331
|
+
notRetainedByContextSize,
|
|
8332
|
+
notRetainedByContextCount,
|
|
8333
|
+
totalSize: retainedByContextSize + notRetainedByContextSize,
|
|
8334
|
+
};
|
|
8335
|
+
}
|
|
8246
8336
|
nodeNativeContext(nodeIndex) {
|
|
8247
8337
|
const ordinal = nodeIndex / this.nodeFieldCount;
|
|
8248
8338
|
const nativeContextOrdinal = this.nodeNativeContextAttribution[ordinal];
|
|
@@ -8431,6 +8521,28 @@ class HeapSnapshot {
|
|
|
8431
8521
|
}
|
|
8432
8522
|
return null;
|
|
8433
8523
|
}
|
|
8524
|
+
initDetachednessAndClassIndex() {
|
|
8525
|
+
this.detachednessAndClassIndexArray = new Uint32Array(this.nodeCount);
|
|
8526
|
+
if (this.nodeDetachednessAndClassIndexOffset !== -1) {
|
|
8527
|
+
const { nodeFieldCount, nodeDetachednessAndClassIndexOffset: offset } = this;
|
|
8528
|
+
for (let i = 0; i < this.nodeCount; ++i) {
|
|
8529
|
+
this.detachednessAndClassIndexArray[i] = Number(this.nodes.getValue(i * nodeFieldCount + offset));
|
|
8530
|
+
}
|
|
8531
|
+
}
|
|
8532
|
+
else {
|
|
8533
|
+
const node = this.rootNode();
|
|
8534
|
+
const nodesLength = this.nodes.length;
|
|
8535
|
+
const { nodeFieldCount, nodeNativeType, nodeTypeOffset } = this;
|
|
8536
|
+
for (let nodeIndex = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount) {
|
|
8537
|
+
if (this.nodes.getValue(nodeIndex + nodeTypeOffset) === nodeNativeType) {
|
|
8538
|
+
node.nodeIndex = nodeIndex;
|
|
8539
|
+
if (node.name().startsWith('Detached ')) {
|
|
8540
|
+
node.setDetachedness(2 );
|
|
8541
|
+
}
|
|
8542
|
+
}
|
|
8543
|
+
}
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8434
8546
|
propagateDOMState() {
|
|
8435
8547
|
if (this.nodeDetachednessAndClassIndexOffset === -1) {
|
|
8436
8548
|
return;
|
|
@@ -8658,11 +8770,54 @@ class HeapSnapshot {
|
|
|
8658
8770
|
}
|
|
8659
8771
|
return null;
|
|
8660
8772
|
}
|
|
8661
|
-
createEdgesProvider(nodeIndex) {
|
|
8773
|
+
createEdgesProvider(nodeIndex, options) {
|
|
8662
8774
|
const node = this.createNode(nodeIndex);
|
|
8663
|
-
const
|
|
8775
|
+
const defaultFilter = this.containmentEdgesFilter();
|
|
8776
|
+
const minRetainedSize = options?.minRetainedSize;
|
|
8777
|
+
const excludePrimitives = options?.excludePrimitives ?? false;
|
|
8778
|
+
let filter = defaultFilter;
|
|
8779
|
+
if (minRetainedSize !== undefined || excludePrimitives) {
|
|
8780
|
+
filter = (edge) => {
|
|
8781
|
+
if (defaultFilter && !defaultFilter(edge)) {
|
|
8782
|
+
return false;
|
|
8783
|
+
}
|
|
8784
|
+
const targetNode = edge.node();
|
|
8785
|
+
if (minRetainedSize !== undefined && targetNode.retainedSize() < minRetainedSize) {
|
|
8786
|
+
return false;
|
|
8787
|
+
}
|
|
8788
|
+
if (excludePrimitives) {
|
|
8789
|
+
const rawType = targetNode.rawType();
|
|
8790
|
+
if (rawType === this.nodeNumberType) {
|
|
8791
|
+
return false;
|
|
8792
|
+
}
|
|
8793
|
+
if (rawType === this.nodeNativeType) {
|
|
8794
|
+
const targetName = targetNode.rawName();
|
|
8795
|
+
if (targetName === 'undefined' || targetName === 'null' || targetName === 'true' ||
|
|
8796
|
+
targetName === 'false') {
|
|
8797
|
+
return false;
|
|
8798
|
+
}
|
|
8799
|
+
}
|
|
8800
|
+
}
|
|
8801
|
+
return true;
|
|
8802
|
+
};
|
|
8803
|
+
}
|
|
8664
8804
|
const indexProvider = new HeapSnapshotEdgeIndexProvider(this);
|
|
8665
|
-
|
|
8805
|
+
const provider = new HeapSnapshotEdgesProvider(this, filter, node.edges(), indexProvider);
|
|
8806
|
+
if (options?.sortBy) {
|
|
8807
|
+
const sortBy = options.sortBy;
|
|
8808
|
+
let comparator;
|
|
8809
|
+
if (sortBy === 'selfSize') {
|
|
8810
|
+
comparator = new ComparatorConfig('selfSize', false, '!edgeName', true);
|
|
8811
|
+
}
|
|
8812
|
+
else if (sortBy === 'name') {
|
|
8813
|
+
comparator = new ComparatorConfig('!edgeName', true, 'retainedSize', false);
|
|
8814
|
+
}
|
|
8815
|
+
else {
|
|
8816
|
+
comparator = new ComparatorConfig('retainedSize', false, '!edgeName', true);
|
|
8817
|
+
}
|
|
8818
|
+
provider.sortAndRewind(comparator);
|
|
8819
|
+
}
|
|
8820
|
+
return provider;
|
|
8666
8821
|
}
|
|
8667
8822
|
createEdgesProviderForTest(nodeIndex, filter) {
|
|
8668
8823
|
const node = this.createNode(nodeIndex);
|
|
@@ -8819,6 +8974,85 @@ class HeapSnapshot {
|
|
|
8819
8974
|
createNodesProviderForClass(classKey, nodeFilter) {
|
|
8820
8975
|
return new HeapSnapshotNodesProvider(this, this.aggregatesWithFilter(nodeFilter)[classKey].idxs);
|
|
8821
8976
|
}
|
|
8977
|
+
queryObjects(queryOptions) {
|
|
8978
|
+
const { nodes, nodeFieldCount, retainedSizes } = this;
|
|
8979
|
+
const nodesLength = nodes.length;
|
|
8980
|
+
const matchingIndexes = [];
|
|
8981
|
+
const classNamePattern = queryOptions.className ? new RegExp(queryOptions.className, 'i') : null;
|
|
8982
|
+
const propertyNamePattern = queryOptions.propertyName ? new RegExp(queryOptions.propertyName, 'i') : null;
|
|
8983
|
+
const targetNodeType = queryOptions.nodeType ? queryOptions.nodeType.toLowerCase() : null;
|
|
8984
|
+
const node = this.rootNode();
|
|
8985
|
+
for (let nodeIndex = 0, ordinal = 0; nodeIndex < nodesLength; nodeIndex += nodeFieldCount, ordinal++) {
|
|
8986
|
+
node.nodeIndex = nodeIndex;
|
|
8987
|
+
if (queryOptions.minSelfSize !== undefined && node.selfSize() < queryOptions.minSelfSize) {
|
|
8988
|
+
continue;
|
|
8989
|
+
}
|
|
8990
|
+
if (queryOptions.maxSelfSize !== undefined && node.selfSize() > queryOptions.maxSelfSize) {
|
|
8991
|
+
continue;
|
|
8992
|
+
}
|
|
8993
|
+
const retainedSize = retainedSizes[ordinal];
|
|
8994
|
+
if (queryOptions.minRetainedSize !== undefined && retainedSize < queryOptions.minRetainedSize) {
|
|
8995
|
+
continue;
|
|
8996
|
+
}
|
|
8997
|
+
if (queryOptions.maxRetainedSize !== undefined && retainedSize > queryOptions.maxRetainedSize) {
|
|
8998
|
+
continue;
|
|
8999
|
+
}
|
|
9000
|
+
if (queryOptions.isDetached !== undefined) {
|
|
9001
|
+
const isDetached = node.detachedness() === 2 ;
|
|
9002
|
+
if (isDetached !== queryOptions.isDetached) {
|
|
9003
|
+
continue;
|
|
9004
|
+
}
|
|
9005
|
+
}
|
|
9006
|
+
if (classNamePattern) {
|
|
9007
|
+
const name = node.name();
|
|
9008
|
+
if (!classNamePattern.test(name)) {
|
|
9009
|
+
continue;
|
|
9010
|
+
}
|
|
9011
|
+
}
|
|
9012
|
+
if (targetNodeType) {
|
|
9013
|
+
const typeStr = node.type();
|
|
9014
|
+
if (typeStr.toLowerCase() !== targetNodeType) {
|
|
9015
|
+
continue;
|
|
9016
|
+
}
|
|
9017
|
+
}
|
|
9018
|
+
if (propertyNamePattern) {
|
|
9019
|
+
let propMatch = false;
|
|
9020
|
+
for (const iter = node.edges(); iter.hasNext(); iter.next()) {
|
|
9021
|
+
if (propertyNamePattern.test(iter.edge.name())) {
|
|
9022
|
+
propMatch = true;
|
|
9023
|
+
break;
|
|
9024
|
+
}
|
|
9025
|
+
}
|
|
9026
|
+
if (!propMatch) {
|
|
9027
|
+
continue;
|
|
9028
|
+
}
|
|
9029
|
+
}
|
|
9030
|
+
matchingIndexes.push(nodeIndex);
|
|
9031
|
+
}
|
|
9032
|
+
const sortBy = queryOptions.sortBy ?? 'retainedSize';
|
|
9033
|
+
if (sortBy === 'retainedSize') {
|
|
9034
|
+
matchingIndexes.sort((a, b) => retainedSizes[b / nodeFieldCount] - retainedSizes[a / nodeFieldCount]);
|
|
9035
|
+
}
|
|
9036
|
+
else if (sortBy === 'selfSize') {
|
|
9037
|
+
matchingIndexes.sort((a, b) => {
|
|
9038
|
+
node.nodeIndex = b;
|
|
9039
|
+
const sizeB = node.selfSize();
|
|
9040
|
+
node.nodeIndex = a;
|
|
9041
|
+
const sizeA = node.selfSize();
|
|
9042
|
+
return sizeB - sizeA;
|
|
9043
|
+
});
|
|
9044
|
+
}
|
|
9045
|
+
else if (sortBy === 'id') {
|
|
9046
|
+
matchingIndexes.sort((a, b) => {
|
|
9047
|
+
node.nodeIndex = b;
|
|
9048
|
+
const idB = node.id();
|
|
9049
|
+
node.nodeIndex = a;
|
|
9050
|
+
const idA = node.id();
|
|
9051
|
+
return idA - idB;
|
|
9052
|
+
});
|
|
9053
|
+
}
|
|
9054
|
+
return new HeapSnapshotNodesProvider(this, matchingIndexes);
|
|
9055
|
+
}
|
|
8822
9056
|
maxJsNodeId() {
|
|
8823
9057
|
const nodeFieldCount = this.nodeFieldCount;
|
|
8824
9058
|
const nodes = this.nodes;
|
|
@@ -9326,7 +9560,7 @@ class JSHeapSnapshot extends HeapSnapshot {
|
|
|
9326
9560
|
continue;
|
|
9327
9561
|
}
|
|
9328
9562
|
node.nodeIndex = nodeIndex;
|
|
9329
|
-
if (node.
|
|
9563
|
+
if (node.detachedness() === 2 ) {
|
|
9330
9564
|
this.flags[ordinal] |= flag;
|
|
9331
9565
|
}
|
|
9332
9566
|
}
|
|
@@ -9895,6 +10129,7 @@ class HeapSnapshotLoader {
|
|
|
9895
10129
|
this.#dataCallback = null;
|
|
9896
10130
|
this.#done = false;
|
|
9897
10131
|
this.parsingComplete = this.#parseInput();
|
|
10132
|
+
this.parsingComplete.catch(() => { });
|
|
9898
10133
|
}
|
|
9899
10134
|
dispose() {
|
|
9900
10135
|
this.#reset();
|
|
@@ -9907,6 +10142,7 @@ class HeapSnapshotLoader {
|
|
|
9907
10142
|
this.#done = true;
|
|
9908
10143
|
if (this.#dataCallback) {
|
|
9909
10144
|
this.#dataCallback('');
|
|
10145
|
+
this.#dataCallback = null;
|
|
9910
10146
|
}
|
|
9911
10147
|
}
|
|
9912
10148
|
async buildSnapshot(secondWorker) {
|
|
@@ -9974,6 +10210,9 @@ class HeapSnapshotLoader {
|
|
|
9974
10210
|
this.#snapshot.strings = JSON.parse(this.#json);
|
|
9975
10211
|
}
|
|
9976
10212
|
write(chunk) {
|
|
10213
|
+
if (!chunk) {
|
|
10214
|
+
return;
|
|
10215
|
+
}
|
|
9977
10216
|
this.#buffer.push(chunk);
|
|
9978
10217
|
if (!this.#dataCallback) {
|
|
9979
10218
|
return;
|
|
@@ -9985,6 +10224,9 @@ class HeapSnapshotLoader {
|
|
|
9985
10224
|
if (this.#buffer.length > 0) {
|
|
9986
10225
|
return Promise.resolve(this.#buffer.shift());
|
|
9987
10226
|
}
|
|
10227
|
+
if (this.#done) {
|
|
10228
|
+
return Promise.resolve('');
|
|
10229
|
+
}
|
|
9988
10230
|
const { promise, resolve } = Promise.withResolvers();
|
|
9989
10231
|
this.#dataCallback = resolve;
|
|
9990
10232
|
return promise;
|
|
@@ -9996,7 +10238,11 @@ class HeapSnapshotLoader {
|
|
|
9996
10238
|
return pos;
|
|
9997
10239
|
}
|
|
9998
10240
|
startIndex = this.#json.length - token.length + 1;
|
|
9999
|
-
|
|
10241
|
+
const chunk = await this.#fetchChunk();
|
|
10242
|
+
if (!chunk) {
|
|
10243
|
+
throw new Error(`Token ${token} not found (unexpected end of input)`);
|
|
10244
|
+
}
|
|
10245
|
+
this.#json += chunk;
|
|
10000
10246
|
}
|
|
10001
10247
|
}
|
|
10002
10248
|
async #parseArray(name, title, length) {
|
|
@@ -10013,7 +10259,11 @@ class HeapSnapshotLoader {
|
|
|
10013
10259
|
else {
|
|
10014
10260
|
this.#progress.updateStatus(title);
|
|
10015
10261
|
}
|
|
10016
|
-
|
|
10262
|
+
const chunk = await this.#fetchChunk();
|
|
10263
|
+
if (!chunk) {
|
|
10264
|
+
throw new Error(`Unexpected end of input while ${title}`);
|
|
10265
|
+
}
|
|
10266
|
+
this.#json += chunk;
|
|
10017
10267
|
}
|
|
10018
10268
|
const result = this.#array;
|
|
10019
10269
|
this.#array = null;
|
|
@@ -10036,7 +10286,11 @@ class HeapSnapshotLoader {
|
|
|
10036
10286
|
});
|
|
10037
10287
|
jsonTokenizer.write(json);
|
|
10038
10288
|
while (!jsonTokenizerDone) {
|
|
10039
|
-
|
|
10289
|
+
const chunk = await this.#fetchChunk();
|
|
10290
|
+
if (!chunk) {
|
|
10291
|
+
throw new Error('Unexpected end of input while loading snapshot info');
|
|
10292
|
+
}
|
|
10293
|
+
jsonTokenizer.write(chunk);
|
|
10040
10294
|
}
|
|
10041
10295
|
this.#snapshot = this.#snapshot || {};
|
|
10042
10296
|
const nodes = await this.#parseArray('"nodes"', 'Loading nodes… {PH1}%', this.#snapshot.snapshot.meta.node_fields.length * this.#snapshot.snapshot.node_count);
|