chrome-devtools-frontend 1.0.951864 → 1.0.952284
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/front_end/.eslintrc.js +6 -0
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +36 -36
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +53 -53
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +11 -11
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +43 -43
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +106 -105
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +26 -26
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +50 -55
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +200 -200
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +84 -83
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +15 -15
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +21 -21
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +30 -30
- package/front_end/entrypoints/main/MainImpl.ts +12 -12
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +33 -33
- package/front_end/entrypoints/node_app/NodeMain.ts +35 -35
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
- package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
- package/front_end/models/issues_manager/CorsIssue.ts +9 -9
- package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
- package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
- package/front_end/models/issues_manager/GenericIssue.ts +5 -5
- package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
- package/front_end/models/issues_manager/Issue.ts +10 -10
- package/front_end/models/issues_manager/IssueResolver.ts +11 -10
- package/front_end/models/issues_manager/IssuesManager.ts +56 -56
- package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
- package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
- package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
- package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
- package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
- package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
- package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
- package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
- package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
- package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
- package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
- package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
- package/front_end/panels/application/components/ReportsGrid.ts +30 -30
- package/front_end/panels/application/components/StackTrace.ts +48 -47
- package/front_end/panels/application/components/TrustTokensView.ts +31 -31
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
- package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
- package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
- package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
- package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
- package/front_end/panels/elements/components/AdornerManager.ts +21 -21
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
- package/front_end/panels/elements/components/CSSQuery.ts +16 -16
- package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
- package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
- package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
- package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
- package/front_end/panels/elements/components/LayoutPane.ts +47 -47
- package/front_end/panels/elements/components/NodeText.ts +18 -18
- package/front_end/panels/elements/components/QueryContainer.ts +40 -40
- package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
- package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
- package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
- package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
- package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
- package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
- package/front_end/panels/issues/AffectedElementsView.ts +4 -4
- package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
- package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
- package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
- package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
- package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
- package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
- package/front_end/panels/issues/CSPViolationsView.ts +17 -17
- package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
- package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
- package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
- package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
- package/front_end/panels/issues/IssueAggregator.ts +95 -95
- package/front_end/panels/issues/IssueKindView.ts +14 -14
- package/front_end/panels/issues/IssueView.ts +98 -98
- package/front_end/panels/issues/IssuesPane.ts +102 -102
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
- package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
- package/front_end/panels/media/PlayerListView.ts +160 -97
- package/front_end/panels/media/PlayerMessagesView.ts +1 -0
- package/front_end/panels/media/playerListView.css +58 -0
- package/front_end/panels/network/NetworkLogView.ts +2 -6
- package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
- package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
- package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +6 -12
- package/front_end/panels/settings/components/SyncSection.ts +14 -14
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
- package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
- package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
- package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
- package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
- package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
- package/front_end/ui/components/adorners/Adorner.ts +2 -2
- package/front_end/ui/components/buttons/Button.ts +9 -9
- package/front_end/ui/components/data_grid/DataGrid.ts +62 -62
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/diff_view/DiffView.ts +6 -6
- package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
- package/front_end/ui/components/icon_button/Icon.ts +4 -4
- package/front_end/ui/components/icon_button/IconButton.ts +4 -4
- package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
- package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
- package/front_end/ui/components/report_view/ReportView.ts +16 -16
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
- package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
- package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
- package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
- package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
- package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +12 -0
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
- package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
- package/scripts/migration/class-fields/migrate.js +2 -3
- package/scripts/migration/class-fields/migrate.sh +1 -3
- package/scripts/migration/class-fields/package.json +1 -1
|
@@ -34,27 +34,27 @@ import type {HeapSnapshotHeader, Profile} from './HeapSnapshot.js';
|
|
|
34
34
|
import type {HeapSnapshotWorkerDispatcher} from './HeapSnapshotWorkerDispatcher.js';
|
|
35
35
|
|
|
36
36
|
export class HeapSnapshotLoader {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
readonly #progress: HeapSnapshotProgress;
|
|
38
|
+
#buffer: string;
|
|
39
|
+
#dataCallback: ((value: string|PromiseLike<string>) => void)|null;
|
|
40
|
+
#done: boolean;
|
|
41
41
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
#snapshot?: {[x: string]: any};
|
|
44
|
+
#array!: number[]|Uint32Array|null;
|
|
45
|
+
#arrayIndex!: number;
|
|
46
46
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
-
|
|
48
|
+
#json?: any;
|
|
49
49
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
|
|
51
|
+
#jsonTokenizer?: any;
|
|
52
52
|
constructor(dispatcher: HeapSnapshotWorkerDispatcher) {
|
|
53
53
|
this.reset();
|
|
54
|
-
this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
54
|
+
this.#progress = new HeapSnapshotProgress(dispatcher);
|
|
55
|
+
this.#buffer = '';
|
|
56
|
+
this.#dataCallback = null;
|
|
57
|
+
this.#done = false;
|
|
58
58
|
this.parseInput();
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -63,22 +63,22 @@ export class HeapSnapshotLoader {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
private reset(): void {
|
|
66
|
-
this
|
|
67
|
-
this
|
|
66
|
+
this.#json = '';
|
|
67
|
+
this.#snapshot = undefined;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
close(): void {
|
|
71
|
-
this
|
|
72
|
-
if (this
|
|
73
|
-
this
|
|
71
|
+
this.#done = true;
|
|
72
|
+
if (this.#dataCallback) {
|
|
73
|
+
this.#dataCallback('');
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
buildSnapshot(): JSHeapSnapshot {
|
|
78
|
-
this
|
|
78
|
+
this.#snapshot = this.#snapshot || {};
|
|
79
79
|
|
|
80
|
-
this
|
|
81
|
-
const result = new JSHeapSnapshot((this
|
|
80
|
+
this.#progress.updateStatus('Processing snapshot…');
|
|
81
|
+
const result = new JSHeapSnapshot((this.#snapshot as Profile), this.#progress);
|
|
82
82
|
this.reset();
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
@@ -88,26 +88,26 @@ export class HeapSnapshotLoader {
|
|
|
88
88
|
const char0 = '0'.charCodeAt(0);
|
|
89
89
|
const char9 = '9'.charCodeAt(0);
|
|
90
90
|
const closingBracket = ']'.charCodeAt(0);
|
|
91
|
-
const length = this
|
|
91
|
+
const length = this.#json.length;
|
|
92
92
|
while (true) {
|
|
93
93
|
while (index < length) {
|
|
94
|
-
const code = this
|
|
94
|
+
const code = this.#json.charCodeAt(index);
|
|
95
95
|
if (char0 <= code && code <= char9) {
|
|
96
96
|
break;
|
|
97
97
|
} else if (code === closingBracket) {
|
|
98
|
-
this
|
|
98
|
+
this.#json = this.#json.slice(index + 1);
|
|
99
99
|
return false;
|
|
100
100
|
}
|
|
101
101
|
++index;
|
|
102
102
|
}
|
|
103
103
|
if (index === length) {
|
|
104
|
-
this
|
|
104
|
+
this.#json = '';
|
|
105
105
|
return true;
|
|
106
106
|
}
|
|
107
107
|
let nextNumber = 0;
|
|
108
108
|
const startIndex = index;
|
|
109
109
|
while (index < length) {
|
|
110
|
-
const code = this
|
|
110
|
+
const code = this.#json.charCodeAt(index);
|
|
111
111
|
if (char0 > code || code > char9) {
|
|
112
112
|
break;
|
|
113
113
|
}
|
|
@@ -116,73 +116,73 @@ export class HeapSnapshotLoader {
|
|
|
116
116
|
++index;
|
|
117
117
|
}
|
|
118
118
|
if (index === length) {
|
|
119
|
-
this
|
|
119
|
+
this.#json = this.#json.slice(startIndex);
|
|
120
120
|
return true;
|
|
121
121
|
}
|
|
122
|
-
if (!this
|
|
122
|
+
if (!this.#array) {
|
|
123
123
|
throw new Error('Array not instantiated');
|
|
124
124
|
}
|
|
125
|
-
this
|
|
125
|
+
this.#array[this.#arrayIndex++] = nextNumber;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
private parseStringsArray(): void {
|
|
130
|
-
this
|
|
131
|
-
const closingBracketIndex = this
|
|
130
|
+
this.#progress.updateStatus('Parsing strings…');
|
|
131
|
+
const closingBracketIndex = this.#json.lastIndexOf(']');
|
|
132
132
|
if (closingBracketIndex === -1) {
|
|
133
133
|
throw new Error('Incomplete JSON');
|
|
134
134
|
}
|
|
135
|
-
this
|
|
135
|
+
this.#json = this.#json.slice(0, closingBracketIndex + 1);
|
|
136
136
|
|
|
137
|
-
if (!this
|
|
137
|
+
if (!this.#snapshot) {
|
|
138
138
|
throw new Error('No snapshot in parseStringsArray');
|
|
139
139
|
}
|
|
140
|
-
this
|
|
140
|
+
this.#snapshot.strings = JSON.parse(this.#json);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
write(chunk: string): void {
|
|
144
|
-
this
|
|
145
|
-
if (!this
|
|
144
|
+
this.#buffer += chunk;
|
|
145
|
+
if (!this.#dataCallback) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
this
|
|
149
|
-
this
|
|
150
|
-
this
|
|
148
|
+
this.#dataCallback(this.#buffer);
|
|
149
|
+
this.#dataCallback = null;
|
|
150
|
+
this.#buffer = '';
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
private fetchChunk(): Promise<string> {
|
|
154
|
-
return this
|
|
155
|
-
this
|
|
154
|
+
return this.#done ? Promise.resolve(this.#buffer) : new Promise(r => {
|
|
155
|
+
this.#dataCallback = r;
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
private async findToken(token: string, startIndex?: number): Promise<number> {
|
|
160
160
|
while (true) {
|
|
161
|
-
const pos = this
|
|
161
|
+
const pos = this.#json.indexOf(token, startIndex || 0);
|
|
162
162
|
if (pos !== -1) {
|
|
163
163
|
return pos;
|
|
164
164
|
}
|
|
165
|
-
startIndex = this
|
|
166
|
-
this
|
|
165
|
+
startIndex = this.#json.length - token.length + 1;
|
|
166
|
+
this.#json += await this.fetchChunk();
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
private async parseArray(name: string, title: string, length?: number): Promise<number[]|Uint32Array> {
|
|
171
171
|
const nameIndex = await this.findToken(name);
|
|
172
172
|
const bracketIndex = await this.findToken('[', nameIndex);
|
|
173
|
-
this
|
|
174
|
-
this
|
|
175
|
-
this
|
|
173
|
+
this.#json = this.#json.slice(bracketIndex + 1);
|
|
174
|
+
this.#array = length ? new Uint32Array(length) : [];
|
|
175
|
+
this.#arrayIndex = 0;
|
|
176
176
|
while (this.parseUintArray()) {
|
|
177
177
|
if (length) {
|
|
178
|
-
this
|
|
178
|
+
this.#progress.updateProgress(title, this.#arrayIndex, this.#array.length);
|
|
179
179
|
} else {
|
|
180
|
-
this
|
|
180
|
+
this.#progress.updateStatus(title);
|
|
181
181
|
}
|
|
182
|
-
this
|
|
182
|
+
this.#json += await this.fetchChunk();
|
|
183
183
|
}
|
|
184
|
-
const result = this
|
|
185
|
-
this
|
|
184
|
+
const result = this.#array;
|
|
185
|
+
this.#array = null;
|
|
186
186
|
return result;
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -193,63 +193,64 @@ export class HeapSnapshotLoader {
|
|
|
193
193
|
throw new Error('Snapshot token not found');
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
-
this
|
|
197
|
-
const json = this
|
|
198
|
-
this
|
|
199
|
-
this
|
|
200
|
-
this
|
|
196
|
+
this.#progress.updateStatus('Loading snapshot info…');
|
|
197
|
+
const json = this.#json.slice(snapshotTokenIndex + snapshotToken.length + 1);
|
|
198
|
+
this.#jsonTokenizer = new TextUtils.TextUtils.BalancedJSONTokenizer(metaJSON => {
|
|
199
|
+
this.#json = this.#jsonTokenizer.remainder();
|
|
200
|
+
this.#jsonTokenizer = null;
|
|
201
201
|
|
|
202
|
-
this
|
|
203
|
-
this
|
|
202
|
+
this.#snapshot = this.#snapshot || {};
|
|
203
|
+
this.#snapshot.snapshot = (JSON.parse(metaJSON) as HeapSnapshotHeader);
|
|
204
204
|
});
|
|
205
|
-
this
|
|
206
|
-
while (this
|
|
207
|
-
this
|
|
205
|
+
this.#jsonTokenizer.write(json);
|
|
206
|
+
while (this.#jsonTokenizer) {
|
|
207
|
+
this.#jsonTokenizer.write(await this.fetchChunk());
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
this
|
|
210
|
+
this.#snapshot = this.#snapshot || {};
|
|
211
211
|
const nodes = await this.parseArray(
|
|
212
212
|
'"nodes"', 'Loading nodes… {PH1}%',
|
|
213
|
-
this
|
|
214
|
-
this
|
|
213
|
+
this.#snapshot.snapshot.meta.node_fields.length * this.#snapshot.snapshot.node_count);
|
|
214
|
+
this.#snapshot.nodes = (nodes as Uint32Array);
|
|
215
215
|
|
|
216
216
|
const edges = await this.parseArray(
|
|
217
217
|
'"edges"', 'Loading edges… {PH1}%',
|
|
218
|
-
this
|
|
219
|
-
this
|
|
218
|
+
this.#snapshot.snapshot.meta.edge_fields.length * this.#snapshot.snapshot.edge_count);
|
|
219
|
+
this.#snapshot.edges = (edges as Uint32Array);
|
|
220
220
|
|
|
221
|
-
if (this
|
|
221
|
+
if (this.#snapshot.snapshot.trace_function_count) {
|
|
222
222
|
const traceFunctionInfos = await this.parseArray(
|
|
223
223
|
'"trace_function_infos"', 'Loading allocation traces… {PH1}%',
|
|
224
|
-
this
|
|
225
|
-
|
|
224
|
+
this.#snapshot.snapshot.meta.trace_function_info_fields.length *
|
|
225
|
+
this.#snapshot.snapshot.trace_function_count);
|
|
226
|
+
this.#snapshot.trace_function_infos = (traceFunctionInfos as Uint32Array);
|
|
226
227
|
|
|
227
228
|
const thisTokenEndIndex = await this.findToken(':');
|
|
228
229
|
const nextTokenIndex = await this.findToken('"', thisTokenEndIndex);
|
|
229
|
-
const openBracketIndex = this
|
|
230
|
-
const closeBracketIndex = this
|
|
231
|
-
this
|
|
232
|
-
this
|
|
230
|
+
const openBracketIndex = this.#json.indexOf('[');
|
|
231
|
+
const closeBracketIndex = this.#json.lastIndexOf(']', nextTokenIndex);
|
|
232
|
+
this.#snapshot.trace_tree = JSON.parse(this.#json.substring(openBracketIndex, closeBracketIndex + 1));
|
|
233
|
+
this.#json = this.#json.slice(closeBracketIndex + 1);
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
if (this
|
|
236
|
+
if (this.#snapshot.snapshot.meta.sample_fields) {
|
|
236
237
|
const samples = await this.parseArray('"samples"', 'Loading samples…');
|
|
237
|
-
this
|
|
238
|
+
this.#snapshot.samples = (samples as number[]);
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
if (this
|
|
241
|
+
if (this.#snapshot.snapshot.meta['location_fields']) {
|
|
241
242
|
const locations = await this.parseArray('"locations"', 'Loading locations…');
|
|
242
|
-
this
|
|
243
|
+
this.#snapshot.locations = (locations as number[]);
|
|
243
244
|
} else {
|
|
244
|
-
this
|
|
245
|
+
this.#snapshot.locations = [];
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
this
|
|
248
|
+
this.#progress.updateStatus('Loading strings…');
|
|
248
249
|
const stringsTokenIndex = await this.findToken('"strings"');
|
|
249
250
|
const bracketIndex = await this.findToken('[', stringsTokenIndex);
|
|
250
|
-
this
|
|
251
|
-
while (!this
|
|
252
|
-
this
|
|
251
|
+
this.#json = this.#json.slice(bracketIndex);
|
|
252
|
+
while (!this.#done) {
|
|
253
|
+
this.#json += await this.fetchChunk();
|
|
253
254
|
}
|
|
254
255
|
this.parseStringsArray();
|
|
255
256
|
}
|
|
@@ -41,20 +41,20 @@ interface DispatcherResponse {
|
|
|
41
41
|
export class HeapSnapshotWorkerDispatcher {
|
|
42
42
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
43
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
#objects: any[];
|
|
45
|
+
readonly #global: Worker;
|
|
46
|
+
readonly #postMessage: Function;
|
|
47
47
|
constructor(globalObject: Worker, postMessage: Function) {
|
|
48
|
-
this
|
|
49
|
-
this
|
|
50
|
-
this
|
|
48
|
+
this.#objects = [];
|
|
49
|
+
this.#global = globalObject;
|
|
50
|
+
this.#postMessage = postMessage;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
private findFunction(name: string): Function {
|
|
54
54
|
const path = name.split('.');
|
|
55
55
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
-
let result = (this
|
|
57
|
+
let result = (this.#global as any);
|
|
58
58
|
for (let i = 0; i < path.length; ++i) {
|
|
59
59
|
result = result[path[i]];
|
|
60
60
|
}
|
|
@@ -64,7 +64,7 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
64
64
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
65
65
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
66
66
|
sendEvent(name: string, data: any): void {
|
|
67
|
-
this
|
|
67
|
+
this.#postMessage({eventName: name, data: data});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
dispatchMessage({data}: {data: HeapSnapshotModel.HeapSnapshotModel.WorkerCommand}): void {
|
|
@@ -75,30 +75,30 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
75
75
|
case 'create': {
|
|
76
76
|
const constructorFunction = this.findFunction(data.methodName);
|
|
77
77
|
// @ts-ignore
|
|
78
|
-
this
|
|
78
|
+
this.#objects[data.objectId] = new constructorFunction(this);
|
|
79
79
|
break;
|
|
80
80
|
}
|
|
81
81
|
case 'dispose': {
|
|
82
|
-
delete this
|
|
82
|
+
delete this.#objects[data.objectId];
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case 'getter': {
|
|
86
|
-
const object = this
|
|
86
|
+
const object = this.#objects[data.objectId];
|
|
87
87
|
const result = object[data.methodName];
|
|
88
88
|
response.result = result;
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
case 'factory': {
|
|
92
|
-
const object = this
|
|
92
|
+
const object = this.#objects[data.objectId];
|
|
93
93
|
const result = object[data.methodName].apply(object, data.methodArguments);
|
|
94
94
|
if (result) {
|
|
95
|
-
this
|
|
95
|
+
this.#objects[data.newObjectId] = result;
|
|
96
96
|
}
|
|
97
97
|
response.result = Boolean(result);
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
100
|
case 'method': {
|
|
101
|
-
const object = this
|
|
101
|
+
const object = this.#objects[data.objectId];
|
|
102
102
|
response.result = object[data.methodName].apply(object, data.methodArguments);
|
|
103
103
|
break;
|
|
104
104
|
}
|
|
@@ -118,6 +118,6 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
118
118
|
response.errorMethodName = data.methodName;
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
this
|
|
121
|
+
this.#postMessage(response);
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -145,20 +145,20 @@ export class FocusDebuggeeActionDelegate implements UI.ActionRegistration.Action
|
|
|
145
145
|
let nodeIndicatorInstance: NodeIndicator;
|
|
146
146
|
|
|
147
147
|
export class NodeIndicator implements UI.Toolbar.Provider {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
readonly #element: Element;
|
|
149
|
+
readonly #button: UI.Toolbar.ToolbarItem;
|
|
150
150
|
private constructor() {
|
|
151
151
|
const element = document.createElement('div');
|
|
152
152
|
const shadowRoot =
|
|
153
153
|
UI.Utils.createShadowRootWithCoreStyles(element, {cssFile: [nodeIconStyles], delegatesFocus: undefined});
|
|
154
|
-
this
|
|
154
|
+
this.#element = shadowRoot.createChild('div', 'node-icon');
|
|
155
155
|
element.addEventListener(
|
|
156
156
|
'click', () => Host.InspectorFrontendHost.InspectorFrontendHostInstance.openNodeFrontend(), false);
|
|
157
|
-
this
|
|
158
|
-
this
|
|
157
|
+
this.#button = new UI.Toolbar.ToolbarItem(element);
|
|
158
|
+
this.#button.setTitle(i18nString(UIStrings.openDedicatedTools));
|
|
159
159
|
SDK.TargetManager.TargetManager.instance().addEventListener(
|
|
160
160
|
SDK.TargetManager.Events.AvailableTargetsChanged, event => this.update(event.data));
|
|
161
|
-
this
|
|
161
|
+
this.#button.setVisible(false);
|
|
162
162
|
this.update([]);
|
|
163
163
|
}
|
|
164
164
|
static instance(opts: {
|
|
@@ -174,14 +174,14 @@ export class NodeIndicator implements UI.Toolbar.Provider {
|
|
|
174
174
|
|
|
175
175
|
private update(targetInfos: Protocol.Target.TargetInfo[]): void {
|
|
176
176
|
const hasNode = Boolean(targetInfos.find(target => target.type === 'node' && !target.attached));
|
|
177
|
-
this
|
|
177
|
+
this.#element.classList.toggle('inactive', !hasNode);
|
|
178
178
|
if (hasNode) {
|
|
179
|
-
this
|
|
179
|
+
this.#button.setVisible(true);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
item(): UI.Toolbar.ToolbarItem|null {
|
|
184
|
-
return this
|
|
184
|
+
return this.#button;
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -205,20 +205,20 @@ export class SourcesPanelIndicator {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export class BackendSettingsSync implements SDK.TargetManager.Observer {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
readonly #autoAttachSetting: Common.Settings.Setting<boolean>;
|
|
209
|
+
readonly #adBlockEnabledSetting: Common.Settings.Setting<boolean>;
|
|
210
|
+
readonly #emulatePageFocusSetting: Common.Settings.Setting<boolean>;
|
|
211
211
|
|
|
212
212
|
constructor() {
|
|
213
|
-
this
|
|
214
|
-
this
|
|
213
|
+
this.#autoAttachSetting = Common.Settings.Settings.instance().moduleSetting('autoAttachToCreatedPages');
|
|
214
|
+
this.#autoAttachSetting.addChangeListener(this.updateAutoAttach, this);
|
|
215
215
|
this.updateAutoAttach();
|
|
216
216
|
|
|
217
|
-
this
|
|
218
|
-
this
|
|
217
|
+
this.#adBlockEnabledSetting = Common.Settings.Settings.instance().moduleSetting('network.adBlockingEnabled');
|
|
218
|
+
this.#adBlockEnabledSetting.addChangeListener(this.update, this);
|
|
219
219
|
|
|
220
|
-
this
|
|
221
|
-
this
|
|
220
|
+
this.#emulatePageFocusSetting = Common.Settings.Settings.instance().moduleSetting('emulatePageFocus');
|
|
221
|
+
this.#emulatePageFocusSetting.addChangeListener(this.update, this);
|
|
222
222
|
|
|
223
223
|
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
224
224
|
}
|
|
@@ -227,12 +227,12 @@ export class BackendSettingsSync implements SDK.TargetManager.Observer {
|
|
|
227
227
|
if (target.type() !== SDK.Target.Type.Frame || target.parentTarget()) {
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
230
|
-
target.pageAgent().invoke_setAdBlockingEnabled({enabled: this
|
|
231
|
-
target.emulationAgent().invoke_setFocusEmulationEnabled({enabled: this
|
|
230
|
+
target.pageAgent().invoke_setAdBlockingEnabled({enabled: this.#adBlockEnabledSetting.get()});
|
|
231
|
+
target.emulationAgent().invoke_setFocusEmulationEnabled({enabled: this.#emulatePageFocusSetting.get()});
|
|
232
232
|
}
|
|
233
233
|
|
|
234
234
|
private updateAutoAttach(): void {
|
|
235
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setOpenNewWindowForPopups(this
|
|
235
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setOpenNewWindowForPopups(this.#autoAttachSetting.get());
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
private update(): void {
|
|
@@ -7,10 +7,10 @@ import type * as Common from '../../core/common/common.js';
|
|
|
7
7
|
import type * as UI from '../../ui/legacy/legacy.js';
|
|
8
8
|
|
|
9
9
|
export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObserver<SDK.RuntimeModel.RuntimeModel> {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
#targetManager: SDK.TargetManager.TargetManager;
|
|
11
|
+
#context: UI.Context.Context;
|
|
12
|
+
#lastSelectedContextId?: string;
|
|
13
|
+
#ignoreContextChanged?: boolean;
|
|
14
14
|
|
|
15
15
|
constructor(targetManager: SDK.TargetManager.TargetManager, context: UI.Context.Context) {
|
|
16
16
|
context.addFlavorChangeListener(SDK.RuntimeModel.ExecutionContext, this.executionContextChanged, this);
|
|
@@ -25,8 +25,8 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
25
25
|
targetManager.addModelListener(
|
|
26
26
|
SDK.RuntimeModel.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextOrderChanged,
|
|
27
27
|
this.onExecutionContextOrderChanged, this);
|
|
28
|
-
this
|
|
29
|
-
this
|
|
28
|
+
this.#targetManager = targetManager;
|
|
29
|
+
this.#context = context;
|
|
30
30
|
targetManager.observeModels(SDK.RuntimeModel.RuntimeModel, this);
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -37,21 +37,21 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
37
37
|
|
|
38
38
|
function deferred(this: ExecutionContextSelector): void {
|
|
39
39
|
// We always want the second context for the service worker targets.
|
|
40
|
-
if (!this
|
|
41
|
-
this
|
|
40
|
+
if (!this.#context.flavor(SDK.Target.Target)) {
|
|
41
|
+
this.#context.setFlavor(SDK.Target.Target, runtimeModel.target());
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
modelRemoved(runtimeModel: SDK.RuntimeModel.RuntimeModel): void {
|
|
47
|
-
const currentExecutionContext = this
|
|
47
|
+
const currentExecutionContext = this.#context.flavor(SDK.RuntimeModel.ExecutionContext);
|
|
48
48
|
if (currentExecutionContext && currentExecutionContext.runtimeModel === runtimeModel) {
|
|
49
49
|
this.currentExecutionContextGone();
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const models = this
|
|
53
|
-
if (this
|
|
54
|
-
this
|
|
52
|
+
const models = this.#targetManager.models(SDK.RuntimeModel.RuntimeModel);
|
|
53
|
+
if (this.#context.flavor(SDK.Target.Target) === runtimeModel.target() && models.length) {
|
|
54
|
+
this.#context.setFlavor(SDK.Target.Target, models[0].target());
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -59,9 +59,9 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
59
59
|
data: newContext,
|
|
60
60
|
}: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.ExecutionContext|null>): void {
|
|
61
61
|
if (newContext) {
|
|
62
|
-
this
|
|
63
|
-
if (!this
|
|
64
|
-
this
|
|
62
|
+
this.#context.setFlavor(SDK.Target.Target, newContext.target());
|
|
63
|
+
if (!this.#ignoreContextChanged) {
|
|
64
|
+
this.#lastSelectedContextId = this.contextPersistentId(newContext);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -71,7 +71,7 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
private targetChanged({data: newTarget}: Common.EventTarget.EventTargetEvent<SDK.Target.Target|null>): void {
|
|
74
|
-
const currentContext = this
|
|
74
|
+
const currentContext = this.#context.flavor(SDK.RuntimeModel.ExecutionContext);
|
|
75
75
|
|
|
76
76
|
if (!newTarget || (currentContext && currentContext.target() === newTarget)) {
|
|
77
77
|
return;
|
|
@@ -94,16 +94,16 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
94
94
|
newContext = executionContexts[i];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
|
-
this
|
|
98
|
-
this
|
|
99
|
-
this
|
|
97
|
+
this.#ignoreContextChanged = true;
|
|
98
|
+
this.#context.setFlavor(SDK.RuntimeModel.ExecutionContext, newContext || executionContexts[0]);
|
|
99
|
+
this.#ignoreContextChanged = false;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
private shouldSwitchToContext(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
103
|
-
if (this
|
|
103
|
+
if (this.#lastSelectedContextId && this.#lastSelectedContextId === this.contextPersistentId(executionContext)) {
|
|
104
104
|
return true;
|
|
105
105
|
}
|
|
106
|
-
return !this
|
|
106
|
+
return !this.#lastSelectedContextId && this.isDefaultContext(executionContext);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
private isDefaultContext(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
@@ -126,7 +126,7 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
126
126
|
private onExecutionContextDestroyed(event: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.ExecutionContext>):
|
|
127
127
|
void {
|
|
128
128
|
const executionContext = event.data;
|
|
129
|
-
if (this
|
|
129
|
+
if (this.#context.flavor(SDK.RuntimeModel.ExecutionContext) === executionContext) {
|
|
130
130
|
this.currentExecutionContextGone();
|
|
131
131
|
}
|
|
132
132
|
}
|
|
@@ -143,17 +143,17 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
private switchContextIfNecessary(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
146
|
-
if (!this
|
|
147
|
-
this
|
|
148
|
-
this
|
|
149
|
-
this
|
|
146
|
+
if (!this.#context.flavor(SDK.RuntimeModel.ExecutionContext) || this.shouldSwitchToContext(executionContext)) {
|
|
147
|
+
this.#ignoreContextChanged = true;
|
|
148
|
+
this.#context.setFlavor(SDK.RuntimeModel.ExecutionContext, executionContext);
|
|
149
|
+
this.#ignoreContextChanged = false;
|
|
150
150
|
return true;
|
|
151
151
|
}
|
|
152
152
|
return false;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
155
|
private currentExecutionContextGone(): void {
|
|
156
|
-
const runtimeModels = this
|
|
156
|
+
const runtimeModels = this.#targetManager.models(SDK.RuntimeModel.RuntimeModel);
|
|
157
157
|
let newContext: SDK.RuntimeModel.ExecutionContext|null = null;
|
|
158
158
|
for (let i = 0; i < runtimeModels.length && !newContext; ++i) {
|
|
159
159
|
const executionContexts = runtimeModels[i].executionContexts();
|
|
@@ -173,8 +173,8 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
this
|
|
177
|
-
this
|
|
178
|
-
this
|
|
176
|
+
this.#ignoreContextChanged = true;
|
|
177
|
+
this.#context.setFlavor(SDK.RuntimeModel.ExecutionContext, newContext);
|
|
178
|
+
this.#ignoreContextChanged = false;
|
|
179
179
|
}
|
|
180
180
|
}
|