@memlab/core 1.1.19 → 1.1.21
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/dist/__tests__/parser/StringNode.test.js +12 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -1
- package/dist/lib/Config.d.ts +4 -0
- package/dist/lib/Config.js +13 -0
- package/dist/lib/FileManager.d.ts +6 -0
- package/dist/lib/FileManager.js +56 -4
- package/dist/lib/HeapAnalyzer.d.ts +5 -1
- package/dist/lib/HeapAnalyzer.js +33 -21
- package/dist/lib/RunInfoUtils.d.ts +39 -0
- package/dist/lib/RunInfoUtils.js +86 -0
- package/dist/lib/Types.d.ts +80 -2
- package/dist/lib/Utils.d.ts +30 -20
- package/dist/lib/Utils.js +119 -151
- package/dist/lib/charts/MemoryBarChart.d.ts +1 -0
- package/dist/lib/charts/MemoryBarChart.js +23 -2
- package/dist/lib/heap-data/HeapEdge.d.ts +3 -1
- package/dist/lib/heap-data/HeapEdge.js +13 -0
- package/dist/lib/heap-data/HeapLocation.d.ts +3 -1
- package/dist/lib/heap-data/HeapLocation.js +14 -0
- package/dist/lib/heap-data/HeapNode.d.ts +6 -1
- package/dist/lib/heap-data/HeapNode.js +46 -0
- package/dist/lib/heap-data/HeapSnapshot.d.ts +3 -1
- package/dist/lib/heap-data/HeapSnapshot.js +7 -0
- package/dist/lib/heap-data/HeapStringNode.d.ts +2 -1
- package/dist/lib/heap-data/HeapStringNode.js +5 -0
- package/dist/lib/trace-filters/BaseTraceFilter.rule.d.ts +29 -0
- package/dist/lib/trace-filters/BaseTraceFilter.rule.js +22 -0
- package/dist/lib/trace-filters/LeakTraceFilter.d.ts +20 -0
- package/dist/lib/trace-filters/LeakTraceFilter.js +37 -0
- package/dist/lib/trace-filters/TraceFilterRuleList.d.ts +13 -0
- package/dist/lib/trace-filters/TraceFilterRuleList.js +33 -0
- package/dist/lib/trace-filters/rules/FilterAttachedDOMToDetachedDOMTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterAttachedDOMToDetachedDOMTrace.rule.js +55 -0
- package/dist/lib/trace-filters/rules/FilterDOMNodeChainTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterDOMNodeChainTrace.rule.js +41 -0
- package/dist/lib/trace-filters/rules/FilterHermesTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterHermesTrace.rule.js +29 -0
- package/dist/lib/trace-filters/rules/FilterInternalNodeTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterInternalNodeTrace.rule.js +57 -0
- package/dist/lib/trace-filters/rules/FilterPendingActivitiesTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterPendingActivitiesTrace.rule.js +62 -0
- package/dist/lib/trace-filters/rules/FilterShadowRootTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterShadowRootTrace.rule.js +44 -0
- package/dist/lib/trace-filters/rules/FilterStyleEngineTrace.rule.d.ts +15 -0
- package/dist/lib/trace-filters/rules/FilterStyleEngineTrace.rule.js +49 -0
- package/dist/logger/LeakClusterLogger.js +1 -0
- package/dist/paths/TraceFinder.js +16 -2
- package/dist/trace-cluster/TraceBucket.d.ts +2 -1
- package/dist/trace-cluster/TraceBucket.js +22 -4
- package/dist/trace-cluster/TraceElement.d.ts +6 -1
- package/dist/trace-cluster/TraceElement.js +33 -0
- package/dist/trace-cluster/strategies/TraceSimilarityStrategy.js +10 -0
- package/package.json +1 -1
- package/static/visit-order-single-snapshot.json +19 -0
|
@@ -129,6 +129,13 @@ class HeapSnapshot {
|
|
|
129
129
|
},
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
+
getJSONifyableObject() {
|
|
133
|
+
return Object.assign({}, this.snapshot.snapshot);
|
|
134
|
+
}
|
|
135
|
+
toJSONString(...args) {
|
|
136
|
+
const rep = this.getJSONifyableObject();
|
|
137
|
+
return JSON.stringify(rep, ...args);
|
|
138
|
+
}
|
|
132
139
|
hasObjectWithClassName(className) {
|
|
133
140
|
let detected = false;
|
|
134
141
|
this.nodes.forEach((node) => {
|
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
* @lightSyntaxTransform
|
|
9
9
|
* @oncall web_perf_infra
|
|
10
10
|
*/
|
|
11
|
-
import type { IHeapStringNode } from '../Types';
|
|
11
|
+
import type { AnyRecord, IHeapStringNode } from '../Types';
|
|
12
12
|
import type HeapSnapshot from './HeapSnapshot';
|
|
13
13
|
import HeapNode from './HeapNode';
|
|
14
14
|
export default class HeapStringNode extends HeapNode implements IHeapStringNode {
|
|
15
15
|
constructor(heapSnapshot: HeapSnapshot, idx: number);
|
|
16
16
|
get stringValue(): string;
|
|
17
|
+
getJSONifyableObject(): AnyRecord;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=HeapStringNode.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { MemLabConfig } from '../Config';
|
|
11
|
+
import type { HeapNodeIdSet, IHeapSnapshot, LeakTracePathItem } from '../Types';
|
|
12
|
+
/**
|
|
13
|
+
* Every leak trace filter rule needs to give a label
|
|
14
|
+
* to each leak trace passed to the filter
|
|
15
|
+
*/
|
|
16
|
+
export declare enum TraceDecision {
|
|
17
|
+
INSIGHTFUL = "insightful",
|
|
18
|
+
MAYBE_INSIGHTFUL = "maybe-insightful",
|
|
19
|
+
NOT_INSIGHTFUL = "not-insightful"
|
|
20
|
+
}
|
|
21
|
+
export declare type LeakTraceFilterOptions = {
|
|
22
|
+
config?: MemLabConfig;
|
|
23
|
+
snapshot?: IHeapSnapshot;
|
|
24
|
+
leakedNodeIds?: HeapNodeIdSet;
|
|
25
|
+
};
|
|
26
|
+
export interface ILeakTraceFilterRule {
|
|
27
|
+
filter(p: LeakTracePathItem, options: LeakTraceFilterOptions): TraceDecision;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=BaseTraceFilter.rule.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TraceDecision = void 0;
|
|
13
|
+
/**
|
|
14
|
+
* Every leak trace filter rule needs to give a label
|
|
15
|
+
* to each leak trace passed to the filter
|
|
16
|
+
*/
|
|
17
|
+
var TraceDecision;
|
|
18
|
+
(function (TraceDecision) {
|
|
19
|
+
TraceDecision["INSIGHTFUL"] = "insightful";
|
|
20
|
+
TraceDecision["MAYBE_INSIGHTFUL"] = "maybe-insightful";
|
|
21
|
+
TraceDecision["NOT_INSIGHTFUL"] = "not-insightful";
|
|
22
|
+
})(TraceDecision = exports.TraceDecision || (exports.TraceDecision = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../Types';
|
|
11
|
+
import type { LeakTraceFilterOptions } from './BaseTraceFilter.rule';
|
|
12
|
+
/**
|
|
13
|
+
* apply the leak trace filter rules chain and decide
|
|
14
|
+
* if a leak trace is useful for memory debugging,
|
|
15
|
+
* by default all leak traces are considered useful
|
|
16
|
+
*/
|
|
17
|
+
export declare class LeakTraceFilter {
|
|
18
|
+
filter(p: LeakTracePathItem, options: LeakTraceFilterOptions): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=LeakTraceFilter.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.LeakTraceFilter = void 0;
|
|
16
|
+
const BaseTraceFilter_rule_1 = require("./BaseTraceFilter.rule");
|
|
17
|
+
const TraceFilterRuleList_1 = __importDefault(require("./TraceFilterRuleList"));
|
|
18
|
+
/**
|
|
19
|
+
* apply the leak trace filter rules chain and decide
|
|
20
|
+
* if a leak trace is useful for memory debugging,
|
|
21
|
+
* by default all leak traces are considered useful
|
|
22
|
+
*/
|
|
23
|
+
class LeakTraceFilter {
|
|
24
|
+
filter(p, options) {
|
|
25
|
+
for (const rule of TraceFilterRuleList_1.default) {
|
|
26
|
+
const decision = rule.filter(p, options);
|
|
27
|
+
if (decision === BaseTraceFilter_rule_1.TraceDecision.INSIGHTFUL) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
if (decision === BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.LeakTraceFilter = LeakTraceFilter;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import { ILeakTraceFilterRule } from './BaseTraceFilter.rule';
|
|
11
|
+
declare const _default: ILeakTraceFilterRule[];
|
|
12
|
+
export default _default;
|
|
13
|
+
//# sourceMappingURL=TraceFilterRuleList.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const Constant_1 = __importDefault(require("../Constant"));
|
|
16
|
+
const InternalValueSetter_1 = require("../InternalValueSetter");
|
|
17
|
+
const FilterAttachedDOMToDetachedDOMTrace_rule_1 = require("./rules/FilterAttachedDOMToDetachedDOMTrace.rule");
|
|
18
|
+
const FilterDOMNodeChainTrace_rule_1 = require("./rules/FilterDOMNodeChainTrace.rule");
|
|
19
|
+
const FilterHermesTrace_rule_1 = require("./rules/FilterHermesTrace.rule");
|
|
20
|
+
const FilterInternalNodeTrace_rule_1 = require("./rules/FilterInternalNodeTrace.rule");
|
|
21
|
+
const FilterPendingActivitiesTrace_rule_1 = require("./rules/FilterPendingActivitiesTrace.rule");
|
|
22
|
+
const FilterShadowRootTrace_rule_1 = require("./rules/FilterShadowRootTrace.rule");
|
|
23
|
+
const FilterStyleEngineTrace_rule_1 = require("./rules/FilterStyleEngineTrace.rule");
|
|
24
|
+
const list = [
|
|
25
|
+
new FilterHermesTrace_rule_1.FilterHermesTraceRule(),
|
|
26
|
+
new FilterInternalNodeTrace_rule_1.FilterInternalNodeTraceRule(),
|
|
27
|
+
new FilterShadowRootTrace_rule_1.FilterShadowRootTraceRule(),
|
|
28
|
+
new FilterStyleEngineTrace_rule_1.FilterStyleEngineTraceRule(),
|
|
29
|
+
new FilterPendingActivitiesTrace_rule_1.FilterPendingActivitiesTraceRule(),
|
|
30
|
+
new FilterDOMNodeChainTrace_rule_1.FilterDOMNodeChainTraceRule(),
|
|
31
|
+
new FilterAttachedDOMToDetachedDOMTrace_rule_1.FilterAttachedDOMToDetachedDOMTraceRule(),
|
|
32
|
+
];
|
|
33
|
+
exports.default = (0, InternalValueSetter_1.setInternalValue)(list, __filename, Constant_1.default.internalDir);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterAttachedDOMToDetachedDOMTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterAttachedDOMToDetachedDOMTrace.rule.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterAttachedDOMToDetachedDOMTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterAttachedDOMToDetachedDOMTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path consists of only DOM native nodes/elements
|
|
24
|
+
if (curConfig.hideBrowserLeak && isAttachedDOMToDetachedDOMChain(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterAttachedDOMToDetachedDOMTraceRule = FilterAttachedDOMToDetachedDOMTraceRule;
|
|
31
|
+
// check if the path has pattern:
|
|
32
|
+
// [Attached Element] -> [InternalNode | Text]+ -> [Detached Element]
|
|
33
|
+
function isAttachedDOMToDetachedDOMChain(path) {
|
|
34
|
+
if (!path) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
let p = path;
|
|
38
|
+
let hasEncounteredAttachedNode = false;
|
|
39
|
+
// skip the rest InternalNode
|
|
40
|
+
while (p != null && p.node) {
|
|
41
|
+
if (Utils_1.default.isDetachedDOMNode(p.node)) {
|
|
42
|
+
return hasEncounteredAttachedNode;
|
|
43
|
+
}
|
|
44
|
+
// else if this is an attached node
|
|
45
|
+
if (Utils_1.default.isDOMNodeIncomplete(p.node)) {
|
|
46
|
+
hasEncounteredAttachedNode = true;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
// else if this not a DOM element
|
|
50
|
+
hasEncounteredAttachedNode = false;
|
|
51
|
+
}
|
|
52
|
+
p = p.next;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterDOMNodeChainTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterDOMNodeChainTrace.rule.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterDOMNodeChainTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterDOMNodeChainTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path consists of only DOM native nodes/elements
|
|
24
|
+
if (curConfig.hideBrowserLeak && isDOMNodeChain(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterDOMNodeChainTraceRule = FilterDOMNodeChainTraceRule;
|
|
31
|
+
function isDOMNodeChain(path) {
|
|
32
|
+
let p = path;
|
|
33
|
+
// all the reference chain consists of DOM elements/nodes
|
|
34
|
+
while (p && p.node) {
|
|
35
|
+
if (!Utils_1.default.isRootNode(p.node) && !Utils_1.default.isDOMNodeIncomplete(p.node)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
p = p.next;
|
|
39
|
+
}
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterHermesTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(_p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterHermesTrace.rule.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterHermesTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
18
|
+
class FilterHermesTraceRule {
|
|
19
|
+
filter(_p, options = {}) {
|
|
20
|
+
var _a;
|
|
21
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
22
|
+
// do not filter out paths when analyzing Hermes snapshots
|
|
23
|
+
if (curConfig.jsEngine === 'hermes') {
|
|
24
|
+
return BaseTraceFilter_rule_1.TraceDecision.INSIGHTFUL;
|
|
25
|
+
}
|
|
26
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.FilterHermesTraceRule = FilterHermesTraceRule;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterInternalNodeTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterInternalNodeTrace.rule.d.ts.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterInternalNodeTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterInternalNodeTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path has pattern: Window -> [InternalNode]+ -> DetachedElement
|
|
24
|
+
if (curConfig.hideBrowserLeak && internalNodeRetainsDetachedElement(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterInternalNodeTraceRule = FilterInternalNodeTraceRule;
|
|
31
|
+
// check if the path has pattern:
|
|
32
|
+
// Window -> [InternalNode | Text]+ -> DetachedElement
|
|
33
|
+
function internalNodeRetainsDetachedElement(path) {
|
|
34
|
+
var _a, _b;
|
|
35
|
+
if (!path) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
let p = path;
|
|
39
|
+
// GC root is not Window
|
|
40
|
+
if (!p.node || !p.node.name.startsWith('Window')) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
p = p.next;
|
|
44
|
+
// Window is not poining to InternalNode
|
|
45
|
+
if (!p || !p.node || p.node.name !== 'InternalNode') {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
// skip the rest InternalNode
|
|
49
|
+
while (((_a = p.node) === null || _a === void 0 ? void 0 : _a.name) === 'InternalNode' || ((_b = p.node) === null || _b === void 0 ? void 0 : _b.name) === 'Text') {
|
|
50
|
+
p = p.next;
|
|
51
|
+
if (!p) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
// check if the node is a detached element
|
|
56
|
+
return p && Utils_1.default.isDetachedDOMNode(p.node);
|
|
57
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterPendingActivitiesTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterPendingActivitiesTrace.rule.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterPendingActivitiesTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterPendingActivitiesTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path has pattern: Pending activitiies -> DetachedElement
|
|
24
|
+
if (curConfig.hideBrowserLeak &&
|
|
25
|
+
pendingActivitiesRetainsDetachedElementChain(p)) {
|
|
26
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
27
|
+
}
|
|
28
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.FilterPendingActivitiesTraceRule = FilterPendingActivitiesTraceRule;
|
|
32
|
+
function pendingActivitiesRetainsDetachedElementChain(path) {
|
|
33
|
+
let p = path;
|
|
34
|
+
// find the Pending activities
|
|
35
|
+
while (p && p.node && !Utils_1.default.isPendingActivityNode(p.node)) {
|
|
36
|
+
p = p.next;
|
|
37
|
+
if (!p) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
p = p.next;
|
|
42
|
+
if (!p || !p.node) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
// Scan the rest of the trace, if the following check is met,
|
|
46
|
+
// the leak trace is considered as not suitable for debugging:
|
|
47
|
+
// If the scanner encounters an object o on the
|
|
48
|
+
// rest of the leak trace, where o is neither a detached DOM node nor a
|
|
49
|
+
// Fiber Node and if the scanner didn't hit a detached DOM node first
|
|
50
|
+
while (p && p.node) {
|
|
51
|
+
if (Utils_1.default.isDetachedDOMNode(p.node)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (!Utils_1.default.isDOMInternalNode(p.node) &&
|
|
55
|
+
!Utils_1.default.isDetachedDOMNode(p.node) &&
|
|
56
|
+
!Utils_1.default.isFiberNode(p.node)) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
p = p.next;
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterShadowRootTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterShadowRootTrace.rule.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterShadowRootTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterShadowRootTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path has pattern: ShadowRoot -> DetachedElement
|
|
24
|
+
if (curConfig.hideBrowserLeak && shadowRootRetainsDetachedElement(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterShadowRootTraceRule = FilterShadowRootTraceRule;
|
|
31
|
+
// check if the path has pattern: ShadowRoot -> DetachedElement
|
|
32
|
+
function shadowRootRetainsDetachedElement(path) {
|
|
33
|
+
let p = path;
|
|
34
|
+
// find the ShadowRoot
|
|
35
|
+
while (p && p.node && p.node.name !== 'ShadowRoot') {
|
|
36
|
+
p = p.next;
|
|
37
|
+
if (!p) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
p = p.next;
|
|
42
|
+
// check if the node is a detached element
|
|
43
|
+
return !!p && Utils_1.default.isDetachedDOMNode(p.node);
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @format
|
|
8
|
+
* @oncall web_perf_infra
|
|
9
|
+
*/
|
|
10
|
+
import type { LeakTracePathItem } from '../../Types';
|
|
11
|
+
import { ILeakTraceFilterRule, LeakTraceFilterOptions, TraceDecision } from '../BaseTraceFilter.rule';
|
|
12
|
+
export declare class FilterStyleEngineTraceRule implements ILeakTraceFilterRule {
|
|
13
|
+
filter(p: LeakTracePathItem, options?: LeakTraceFilterOptions): TraceDecision;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=FilterStyleEngineTrace.rule.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall web_perf_infra
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FilterStyleEngineTraceRule = void 0;
|
|
16
|
+
const Config_1 = __importDefault(require("../../Config"));
|
|
17
|
+
const Utils_1 = __importDefault(require("../../Utils"));
|
|
18
|
+
const BaseTraceFilter_rule_1 = require("../BaseTraceFilter.rule");
|
|
19
|
+
class FilterStyleEngineTraceRule {
|
|
20
|
+
filter(p, options = {}) {
|
|
21
|
+
var _a;
|
|
22
|
+
const curConfig = (_a = options.config) !== null && _a !== void 0 ? _a : Config_1.default;
|
|
23
|
+
// if the path has pattern: StyleEngine -> InternalNode -> DetachedElement
|
|
24
|
+
if (curConfig.hideBrowserLeak && styleEngineRetainsDetachedElement(p)) {
|
|
25
|
+
return BaseTraceFilter_rule_1.TraceDecision.NOT_INSIGHTFUL;
|
|
26
|
+
}
|
|
27
|
+
return BaseTraceFilter_rule_1.TraceDecision.MAYBE_INSIGHTFUL;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FilterStyleEngineTraceRule = FilterStyleEngineTraceRule;
|
|
31
|
+
// check if the path has pattern: StyleEngine -> InternalNode -> DetachedElement
|
|
32
|
+
function styleEngineRetainsDetachedElement(path) {
|
|
33
|
+
let p = path;
|
|
34
|
+
// find the StyleEngine
|
|
35
|
+
while (p && p.node && p.node.name !== 'StyleEngine') {
|
|
36
|
+
p = p.next;
|
|
37
|
+
if (!p) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
p = p.next;
|
|
42
|
+
// StyleEngine is not poining to InternalNode
|
|
43
|
+
if (!p || !p.node || p.node.name !== 'InternalNode') {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
p = p.next;
|
|
47
|
+
// check if the InternalNode is pointing to a detached element
|
|
48
|
+
return !!p && Utils_1.default.isDetachedDOMNode(p.node);
|
|
49
|
+
}
|