chrome-devtools-frontend 1.0.951410 → 1.0.952713
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/config/gni/devtools_grd_files.gni +3 -0
- package/extension-api/ExtensionAPI.d.ts +1 -1
- package/front_end/.eslintrc.js +6 -0
- package/front_end/Tests.js +10 -0
- package/front_end/core/common/App.ts +0 -3
- package/front_end/core/common/AppProvider.ts +0 -3
- package/front_end/core/common/JavaScriptMetaData.ts +0 -3
- package/front_end/core/common/QueryParamHandler.ts +0 -3
- package/front_end/core/common/Runnable.ts +0 -3
- package/front_end/core/common/SimpleHistoryManager.ts +0 -3
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +0 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/core/sdk/TracingManager.ts +0 -3
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +203 -203
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
- package/front_end/entrypoints/main/MainImpl.ts +49 -49
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
- package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
- package/front_end/generated/InspectorBackendCommands.js +5 -1
- package/front_end/generated/protocol.d.ts +16 -0
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -3
- package/front_end/models/bindings/FileUtils.ts +0 -3
- package/front_end/models/extensions/ExtensionAPI.ts +2 -1
- package/front_end/models/extensions/ExtensionTraceProvider.ts +0 -3
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -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 +61 -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/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/timeline_model/TimelineModel.ts +1 -1
- 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/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -25
- package/front_end/panels/console/consoleView.css +5 -0
- 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/ElementsTreeElement.ts +2 -6
- 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/event_listeners/EventListenersUtils.ts +2 -1
- 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 +92 -37
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/search/SearchConfig.ts +0 -6
- package/front_end/panels/settings/KeybindsSettingsTab.ts +4 -0
- 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/sources/NavigatorView.ts +3 -9
- package/front_end/panels/sources/SourceMapNamesResolver.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +1 -3
- package/front_end/panels/sources/SourcesView.ts +0 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +0 -3
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineLoader.ts +0 -3
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- 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/third_party/codemirror.next/bundle.ts +3 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +10 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -1
- package/front_end/third_party/codemirror.next/package.json +3 -3
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- 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 +64 -64
- package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- 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_editor/cursor_tooltip.ts +7 -1
- 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/ContextFlavorListener.ts +0 -4
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/SuggestBox.ts +0 -3
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +6 -6
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
- 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
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -34,80 +34,80 @@ 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
|
-
this
|
|
54
|
-
this
|
|
55
|
-
this
|
|
56
|
-
this
|
|
57
|
-
this
|
|
58
|
-
this
|
|
53
|
+
this.#reset();
|
|
54
|
+
this.#progress = new HeapSnapshotProgress(dispatcher);
|
|
55
|
+
this.#buffer = '';
|
|
56
|
+
this.#dataCallback = null;
|
|
57
|
+
this.#done = false;
|
|
58
|
+
this.#parseInput();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
dispose(): void {
|
|
62
|
-
this
|
|
62
|
+
this.#reset();
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
this
|
|
67
|
-
this
|
|
65
|
+
#reset(): void {
|
|
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
|
|
82
|
-
this
|
|
80
|
+
this.#progress.updateStatus('Processing snapshot…');
|
|
81
|
+
const result = new JSHeapSnapshot((this.#snapshot as Profile), this.#progress);
|
|
82
|
+
this.#reset();
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
#parseUintArray(): boolean {
|
|
87
87
|
let index = 0;
|
|
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,141 +116,142 @@ 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
|
-
|
|
130
|
-
this
|
|
131
|
-
const closingBracketIndex = this
|
|
129
|
+
#parseStringsArray(): void {
|
|
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
|
-
|
|
154
|
-
return this
|
|
155
|
-
this
|
|
153
|
+
#fetchChunk(): Promise<string> {
|
|
154
|
+
return this.#done ? Promise.resolve(this.#buffer) : new Promise(r => {
|
|
155
|
+
this.#dataCallback = r;
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
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
|
-
|
|
171
|
-
const nameIndex = await this
|
|
172
|
-
const bracketIndex = await this
|
|
173
|
-
this
|
|
174
|
-
this
|
|
175
|
-
this
|
|
176
|
-
while (this
|
|
170
|
+
async #parseArray(name: string, title: string, length?: number): Promise<number[]|Uint32Array> {
|
|
171
|
+
const nameIndex = await this.#findToken(name);
|
|
172
|
+
const bracketIndex = await this.#findToken('[', nameIndex);
|
|
173
|
+
this.#json = this.#json.slice(bracketIndex + 1);
|
|
174
|
+
this.#array = length ? new Uint32Array(length) : [];
|
|
175
|
+
this.#arrayIndex = 0;
|
|
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
|
|
|
189
|
-
|
|
189
|
+
async #parseInput(): Promise<void> {
|
|
190
190
|
const snapshotToken = '"snapshot"';
|
|
191
|
-
const snapshotTokenIndex = await this
|
|
191
|
+
const snapshotTokenIndex = await this.#findToken(snapshotToken);
|
|
192
192
|
if (snapshotTokenIndex === -1) {
|
|
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
|
|
211
|
-
const nodes = await this
|
|
210
|
+
this.#snapshot = this.#snapshot || {};
|
|
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
|
-
const edges = await this
|
|
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
|
|
222
|
-
const traceFunctionInfos = await this
|
|
221
|
+
if (this.#snapshot.snapshot.trace_function_count) {
|
|
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
|
-
const thisTokenEndIndex = await this
|
|
228
|
-
const nextTokenIndex = await this
|
|
229
|
-
const openBracketIndex = this
|
|
230
|
-
const closeBracketIndex = this
|
|
231
|
-
this
|
|
232
|
-
this
|
|
228
|
+
const thisTokenEndIndex = await this.#findToken(':');
|
|
229
|
+
const nextTokenIndex = await this.#findToken('"', thisTokenEndIndex);
|
|
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
|
-
const samples = await this
|
|
237
|
-
this
|
|
236
|
+
if (this.#snapshot.snapshot.meta.sample_fields) {
|
|
237
|
+
const samples = await this.#parseArray('"samples"', 'Loading samples…');
|
|
238
|
+
this.#snapshot.samples = (samples as number[]);
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
if (this
|
|
241
|
-
const locations = await this
|
|
242
|
-
this
|
|
241
|
+
if (this.#snapshot.snapshot.meta['location_fields']) {
|
|
242
|
+
const locations = await this.#parseArray('"locations"', 'Loading locations…');
|
|
243
|
+
this.#snapshot.locations = (locations as number[]);
|
|
243
244
|
} else {
|
|
244
|
-
this
|
|
245
|
+
this.#snapshot.locations = [];
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
this
|
|
248
|
-
const stringsTokenIndex = await this
|
|
249
|
-
const bracketIndex = await this
|
|
250
|
-
this
|
|
251
|
-
while (!this
|
|
252
|
-
this
|
|
248
|
+
this.#progress.updateStatus('Loading strings…');
|
|
249
|
+
const stringsTokenIndex = await this.#findToken('"strings"');
|
|
250
|
+
const bracketIndex = await this.#findToken('[', stringsTokenIndex);
|
|
251
|
+
this.#json = this.#json.slice(bracketIndex);
|
|
252
|
+
while (!this.#done) {
|
|
253
|
+
this.#json += await this.#fetchChunk();
|
|
253
254
|
}
|
|
254
|
-
this
|
|
255
|
+
this.#parseStringsArray();
|
|
255
256
|
}
|
|
256
257
|
}
|
|
@@ -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
|
+
#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 {
|
|
@@ -73,32 +73,32 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
73
73
|
try {
|
|
74
74
|
switch (data.disposition) {
|
|
75
75
|
case 'create': {
|
|
76
|
-
const constructorFunction = this
|
|
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,21 +145,21 @@ 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
|
-
SDK.TargetManager.Events.AvailableTargetsChanged, event => this
|
|
161
|
-
this
|
|
162
|
-
this
|
|
160
|
+
SDK.TargetManager.Events.AvailableTargetsChanged, event => this.#update(event.data));
|
|
161
|
+
this.#button.setVisible(false);
|
|
162
|
+
this.#update([]);
|
|
163
163
|
}
|
|
164
164
|
static instance(opts: {
|
|
165
165
|
forceNew: boolean|null,
|
|
@@ -172,16 +172,16 @@ export class NodeIndicator implements UI.Toolbar.Provider {
|
|
|
172
172
|
return nodeIndicatorInstance;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
#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,44 +205,44 @@ 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
|
|
215
|
-
this
|
|
213
|
+
this.#autoAttachSetting = Common.Settings.Settings.instance().moduleSetting('autoAttachToCreatedPages');
|
|
214
|
+
this.#autoAttachSetting.addChangeListener(this.#updateAutoAttach, this);
|
|
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
|
}
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
#updateTarget(target: SDK.Target.Target): void {
|
|
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
|
-
|
|
235
|
-
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setOpenNewWindowForPopups(this
|
|
234
|
+
#updateAutoAttach(): void {
|
|
235
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setOpenNewWindowForPopups(this.#autoAttachSetting.get());
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
#update(): void {
|
|
239
239
|
for (const target of SDK.TargetManager.TargetManager.instance().targets()) {
|
|
240
|
-
this
|
|
240
|
+
this.#updateTarget(target);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
targetAdded(target: SDK.Target.Target): void {
|
|
245
|
-
this
|
|
245
|
+
this.#updateTarget(target);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
targetRemoved(_target: SDK.Target.Target): void {
|