chrome-devtools-frontend 1.0.1669021 → 1.0.1672388
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/.agents/skills/fixing-skipped-tests/SKILL.md +6 -6
- package/.agents/skills/gerrit-cli/SKILL.md +4 -10
- package/.agents/skills/gerrit-cli/references/commands.md +45 -2
- package/.agents/skills/gerrit-cli/references/workflows.md +7 -0
- package/.agents/skills/gerrit-cli/scripts/import_upstream.py +34 -152
- package/config/typescript/tsconfig.eslint.json +1 -1
- package/docs/contributing/settings-experiments-features.md +2 -8
- package/docs/ecosystem/automatic_workspace_folders.md +0 -19
- package/eslint.config.mjs +2 -2
- package/front_end/core/common/Lazy.ts +3 -3
- package/front_end/core/common/SettingRegistration.ts +0 -7
- package/front_end/core/common/Settings.ts +0 -38
- package/front_end/core/host/UserMetrics.ts +187 -953
- package/front_end/core/host/UserMetricsEnums.d.ts +949 -0
- package/front_end/core/root/Runtime.ts +21 -133
- package/front_end/core/sdk/CSSMetadata.ts +70 -65
- package/front_end/core/sdk/CategorizedBreakpoint.ts +0 -1
- package/front_end/core/sdk/ChildTargetManager.ts +0 -2
- package/front_end/core/sdk/EmulationModel.ts +0 -2
- package/front_end/core/sdk/EventBreakpointsModel.ts +0 -4
- package/front_end/core/sdk/NetworkManager.ts +0 -3
- package/front_end/core/sdk/PageResourceLoader.ts +9 -9
- package/front_end/core/sdk/RehydratingConnection.ts +52 -4
- package/front_end/core/sdk/Target.ts +0 -4
- package/front_end/devtools_compatibility.js +886 -0
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +18 -22
- package/front_end/foundation/Universe.ts +7 -2
- package/front_end/generated/InspectorBackendCommands.ts +3 -10
- package/front_end/generated/protocol-mapping.d.ts +0 -42
- package/front_end/generated/protocol-proxy-api.d.ts +0 -38
- package/front_end/generated/protocol.ts +9 -169
- package/front_end/models/ai_assistance/AiAgent2.ts +11 -3
- package/front_end/models/ai_assistance/AiConversation.ts +1 -0
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +8 -5
- package/front_end/models/ai_assistance/AiSetting.ts +108 -0
- package/front_end/models/ai_assistance/AiUtils.ts +47 -0
- package/front_end/models/ai_assistance/ChangeManager.ts +1 -0
- package/front_end/models/ai_assistance/ExtensionScope.ts +3 -12
- package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -18
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +3 -0
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +42 -17
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +3 -2
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +253 -155
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/ai_assistance.ts +4 -0
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +12 -6
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +3 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -0
- package/front_end/models/ai_assistance/injected.ts +1 -0
- package/front_end/models/ai_assistance/performance/AICallTree.ts +1 -0
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/performance.md +10 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +52 -5
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +4 -4
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +5 -4
- package/front_end/models/ai_assistance/tools/GetStyles.ts +5 -4
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +5 -4
- package/front_end/models/ai_assistance/tools/README.md +1 -1
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +63 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +5 -5
- package/front_end/models/ai_assistance/tools/Tool.ts +118 -24
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +2 -0
- package/front_end/models/badges/UserBadges.ts +2 -0
- package/front_end/models/bindings/NetworkProject.ts +5 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +2 -0
- package/front_end/models/bindings/ResourceUtils.ts +3 -0
- package/front_end/models/crux-manager/CrUXManager.ts +1 -0
- package/front_end/models/emulation/DeviceModeModel.ts +140 -7
- package/front_end/models/emulation/EmulatedDevices.ts +246 -793
- package/front_end/models/issues_manager/IssuesManager.ts +10 -2
- package/front_end/models/live-metrics/LiveMetrics.ts +41 -9
- package/front_end/models/logs/LogManager.ts +8 -5
- package/front_end/models/logs/NetworkLog.ts +1 -0
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +21 -3
- package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -0
- package/front_end/models/project_settings/ProjectSettingsModel.ts +8 -12
- package/front_end/models/trace_source_maps_resolver/SourceMapsResolver.ts +3 -1
- package/front_end/models/workspace/IgnoreListManager.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +2 -0
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +4 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +22 -22
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +0 -7
- package/front_end/panels/ai_assistance/components/ChatInput.ts +4 -0
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +79 -34
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -2
- package/front_end/panels/ai_assistance/components/walkthroughView.css +1 -1
- package/front_end/panels/application/ApplicationPanelSidebar.ts +9 -106
- package/front_end/panels/application/ApplicationPanelTreeElement.ts +1 -1
- package/front_end/panels/application/application.ts +0 -10
- package/front_end/panels/application/components/components.ts +0 -4
- package/front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts +0 -5
- package/front_end/panels/browser_debugger/EventListenerBreakpointsSidebarPane.ts +6 -12
- package/front_end/panels/browser_debugger/browser_debugger-meta.ts +5 -3
- package/front_end/panels/console/ConsoleFormat.ts +2 -62
- package/front_end/panels/console/ConsoleViewMessage.ts +14 -7
- package/front_end/panels/emulation/AdvancedApp.ts +1 -2
- package/front_end/panels/emulation/DeviceModeToolbar.ts +83 -69
- package/front_end/panels/emulation/DeviceModeView.ts +4 -134
- package/front_end/panels/emulation/DeviceModeWrapper.ts +52 -69
- package/front_end/panels/emulation/MediaQueryInspector.ts +2 -2
- package/front_end/panels/emulation/emulation-meta.ts +12 -12
- package/front_end/panels/issues/IssuesPane.ts +3 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +6 -0
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +17 -21
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryNavigator.ts +206 -126
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +1 -1
- package/front_end/panels/mobile_throttling/CalibrationController.ts +1 -1
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +3 -3
- package/front_end/panels/mobile_throttling/NetworkPanelIndicator.ts +6 -6
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +11 -11
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +13 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +10 -10
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +28 -28
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +6 -6
- package/front_end/panels/network/RequestHeadersView.ts +1 -1
- package/front_end/panels/network/ResourceChunkView.ts +243 -144
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +52 -29
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +21 -35
- package/front_end/panels/network/resourceChunkView.css +41 -36
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +21 -12
- package/front_end/panels/profiler/profiler.ts +4 -0
- package/front_end/panels/recorder/RecorderPanel.ts +6 -14
- package/front_end/panels/sensors/LocationsSettingsTab.ts +7 -7
- package/front_end/panels/settings/AISettingsTab.ts +75 -31
- package/front_end/panels/settings/SettingsScreen.ts +8 -13
- package/front_end/panels/settings/components/SyncSection.ts +3 -4
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +200 -18
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +18 -0
- package/front_end/panels/settings/settings-meta.ts +0 -1
- package/front_end/panels/sources/CategorizedBreakpointL10n.ts +0 -2
- package/front_end/panels/sources/DebuggerPausedMessage.ts +11 -5
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +12 -9
- package/front_end/panels/sources/SourcesPanel.ts +19 -17
- package/front_end/panels/sources/SourcesView.ts +191 -96
- package/front_end/panels/sources/TabbedEditorContainer.ts +3 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +2 -5
- package/front_end/panels/timeline/TimelineUIUtils.ts +15 -0
- package/front_end/panels/timeline/timeline-meta.ts +3 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1332 -193
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
- package/front_end/tsconfig.compatibility.json +2 -1
- package/front_end/tsconfig.json +1 -1
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +4 -7
- package/front_end/ui/components/settings/settings.ts +1 -2
- package/front_end/ui/legacy/Treeoutline.ts +52 -30
- package/front_end/ui/legacy/components/object_ui/CSSStyleSanitizer.ts +74 -0
- package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +6 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +47 -54
- package/front_end/ui/legacy/components/object_ui/object_ui.ts +2 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -27
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +10 -12
- package/front_end/ui/settings/SettingUIRegistration.ts +0 -8
- package/front_end/ui/visual_logging/KnownContextValues.ts +21 -0
- package/inspector_overlay/tsconfig.json +8 -2
- package/package.json +3 -2
- package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +0 -47
- package/front_end/core/sdk/CSSModel.test.api.ts +0 -102
- package/front_end/core/sdk/DOMModel.test.api.ts +0 -104
- package/front_end/foundation/Universe.test.api.ts +0 -73
- package/front_end/panels/application/SharedStorageEventsView.ts +0 -128
- package/front_end/panels/application/SharedStorageItemsView.ts +0 -179
- package/front_end/panels/application/SharedStorageListTreeElement.ts +0 -65
- package/front_end/panels/application/SharedStorageModel.ts +0 -249
- package/front_end/panels/application/SharedStorageTreeElement.ts +0 -40
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +0 -191
- package/front_end/panels/application/components/SharedStorageMetadataView.ts +0 -133
- package/front_end/panels/application/components/sharedStorageAccessGrid.css +0 -29
- package/front_end/panels/application/components/sharedStorageMetadataView.css +0 -29
- package/front_end/panels/application/sharedStorageEventsView.css +0 -9
- package/front_end/panels/network/OriginalResourceChunkView.ts +0 -340
- package/front_end/panels/network/originalResourceChunkView.css +0 -49
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +0 -47
- package/front_end/ui/components/settings/settingDeprecationWarning.css +0 -14
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright 2025 The Chromium Authors
|
|
3
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
4
3
|
// found in the LICENSE file.
|
|
5
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
6
4
|
|
|
7
5
|
import * as Common from '../../core/common/common.js';
|
|
8
6
|
import * as Host from '../../core/host/host.js';
|
|
@@ -10,12 +8,17 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
10
8
|
import * as Platform from '../../core/platform/platform.js';
|
|
11
9
|
import type * as SDK from '../../core/sdk/sdk.js';
|
|
12
10
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
11
|
+
import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
13
12
|
import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
|
|
14
13
|
import * as SourceFrame from '../../ui/legacy/components/source_frame/source_frame.js';
|
|
15
14
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
15
|
+
import * as Lit from '../../ui/lit/lit.js';
|
|
16
|
+
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
16
17
|
|
|
17
18
|
import type {BinaryResourceView} from './BinaryResourceView.js';
|
|
18
|
-
import
|
|
19
|
+
import resourceChunkViewStyles from './resourceChunkView.css.js';
|
|
20
|
+
|
|
21
|
+
const {html, render, Directives: {ifDefined}} = Lit;
|
|
19
22
|
|
|
20
23
|
const UIStrings = {
|
|
21
24
|
/**
|
|
@@ -71,110 +74,186 @@ const str_ = i18n.i18n.registerUIStrings('panels/network/ResourceChunkView.ts',
|
|
|
71
74
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
72
75
|
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
73
76
|
|
|
77
|
+
export interface GridRow {
|
|
78
|
+
chunk: unknown;
|
|
79
|
+
item: DataGridItem;
|
|
80
|
+
selected: boolean;
|
|
81
|
+
cssClass?: string;
|
|
82
|
+
index: number;
|
|
83
|
+
timeTooltip: string;
|
|
84
|
+
timeText: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface ViewInput {
|
|
88
|
+
onClear: () => void;
|
|
89
|
+
selectedFilterType: string;
|
|
90
|
+
onFilterTypeChange: (event: Event) => void;
|
|
91
|
+
filterUsingRegexHint: Common.UIString.LocalizedString;
|
|
92
|
+
filterText: string;
|
|
93
|
+
onFilterTextChange: (event: Event) => void;
|
|
94
|
+
splitWidgetSettingKey: string;
|
|
95
|
+
dataGridDisplayName: Common.UIString.LocalizedString;
|
|
96
|
+
columns: DataGrid.DataGrid.ColumnDescriptor[];
|
|
97
|
+
headerTemplate: Lit.TemplateResult;
|
|
98
|
+
rows: GridRow[];
|
|
99
|
+
onSelect: (event: CustomEvent<HTMLElement>) => void;
|
|
100
|
+
onDeselect: () => void;
|
|
101
|
+
onContextMenu: (item: DataGridItem, menu: UI.ContextMenu.ContextMenu) => void;
|
|
102
|
+
sidebarWidget: UI.Widget.Widget|null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export type View = (input: ViewInput, output: undefined, target: HTMLElement) => void;
|
|
106
|
+
|
|
107
|
+
// clang-format off
|
|
108
|
+
export function defaultHeaderTemplate(): Lit.TemplateResult {
|
|
109
|
+
return html`
|
|
110
|
+
<tr>
|
|
111
|
+
<th id="data" weight="88">${i18nString(UIStrings.data)}</th>
|
|
112
|
+
<th id="length" align="right" weight="5">${i18nString(UIStrings.length)}</th>
|
|
113
|
+
<th id="time" sortable sort="ascending" weight="7">${i18nString(UIStrings.time)}</th>
|
|
114
|
+
</tr>`;
|
|
115
|
+
}
|
|
116
|
+
// clang-format on
|
|
117
|
+
|
|
118
|
+
export const DEFAULT_VIEW: View = (input, _output, target) => {
|
|
119
|
+
// clang-format off
|
|
120
|
+
render(
|
|
121
|
+
html`
|
|
122
|
+
<style>${resourceChunkViewStyles}</style>
|
|
123
|
+
<div class="resource-chunk-view vbox">
|
|
124
|
+
<devtools-toolbar class="resource-chunk-view-toolbar" jslog=${VisualLogging.toolbar()}>
|
|
125
|
+
<devtools-button
|
|
126
|
+
.data=${{
|
|
127
|
+
variant: Buttons.Button.Variant.TOOLBAR,
|
|
128
|
+
iconName: 'clear',
|
|
129
|
+
title: i18nString(UIStrings.clearAll),
|
|
130
|
+
jslogContext: 'network.clear-all',
|
|
131
|
+
} as Buttons.Button.ButtonData}
|
|
132
|
+
aria-label=${i18nString(UIStrings.clearAll)}
|
|
133
|
+
@click=${input.onClear}>
|
|
134
|
+
</devtools-button>
|
|
135
|
+
<select
|
|
136
|
+
class="chrome-select"
|
|
137
|
+
aria-label=${i18nString(UIStrings.filter)}
|
|
138
|
+
@change=${input.onFilterTypeChange}>
|
|
139
|
+
${FILTER_TYPES.map(item => html`
|
|
140
|
+
<option
|
|
141
|
+
value=${item.name}
|
|
142
|
+
.selected=${input.selectedFilterType === item.name}
|
|
143
|
+
jslog=${VisualLogging.item(item.name).track({ click: true })}
|
|
144
|
+
aria-label=${item.label()}>
|
|
145
|
+
${item.label()}
|
|
146
|
+
</option>
|
|
147
|
+
`)}
|
|
148
|
+
</select>
|
|
149
|
+
<devtools-toolbar-input type="filter"
|
|
150
|
+
placeholder=${input.filterUsingRegexHint}
|
|
151
|
+
.value=${input.filterText}
|
|
152
|
+
@change=${input.onFilterTextChange}
|
|
153
|
+
style="flex-grow: 0.4">
|
|
154
|
+
</devtools-toolbar-input>
|
|
155
|
+
</devtools-toolbar>
|
|
156
|
+
<devtools-split-view direction="row" sidebar-position="second"
|
|
157
|
+
name=${input.splitWidgetSettingKey}>
|
|
158
|
+
<div slot="main" class="vbox flex-auto">
|
|
159
|
+
<devtools-data-grid autoscroll name=${input.dataGridDisplayName} striped autofocus
|
|
160
|
+
resize="last"
|
|
161
|
+
@deselect=${input.onDeselect}
|
|
162
|
+
.template=${html`
|
|
163
|
+
<style>${resourceChunkViewStyles}</style>
|
|
164
|
+
<table>
|
|
165
|
+
${input.headerTemplate}
|
|
166
|
+
${Lit.Directives.repeat(input.rows, row => row.chunk, row => html`
|
|
167
|
+
<tr class=${ifDefined(row.cssClass)}
|
|
168
|
+
?selected=${row.selected}
|
|
169
|
+
data-index=${row.index}
|
|
170
|
+
@select=${input.onSelect}
|
|
171
|
+
@contextmenu=${(e: Event) => {
|
|
172
|
+
if (e instanceof CustomEvent && e.detail) {
|
|
173
|
+
input.onContextMenu(row.item, e.detail);
|
|
174
|
+
}
|
|
175
|
+
}}>
|
|
176
|
+
${input.columns.map(col => {
|
|
177
|
+
const value = col.id === 'time' ? row.timeText : (row.item.data[col.id] ?? '');
|
|
178
|
+
const title = col.id === 'time' ? row.timeTooltip : undefined;
|
|
179
|
+
return html`
|
|
180
|
+
<td class="resource-chunk-view-td" title=${ifDefined(title)}
|
|
181
|
+
data-value=${ifDefined(typeof value === 'string' ? value : undefined)}>
|
|
182
|
+
${value}
|
|
183
|
+
</td>`;
|
|
184
|
+
})}
|
|
185
|
+
</tr>
|
|
186
|
+
`)}
|
|
187
|
+
</table>
|
|
188
|
+
`}>
|
|
189
|
+
</devtools-data-grid>
|
|
190
|
+
</div>
|
|
191
|
+
<div slot="sidebar" class="vbox flex-auto" jslog=${VisualLogging.pane('preview').track({ resize: true })}>
|
|
192
|
+
${input.sidebarWidget ? html`
|
|
193
|
+
<devtools-widget class="vbox flex-auto">
|
|
194
|
+
${input.sidebarWidget.element}
|
|
195
|
+
</devtools-widget>` : html`
|
|
196
|
+
<devtools-widget
|
|
197
|
+
${UI.Widget.widget(UI.EmptyWidget.EmptyWidget, {
|
|
198
|
+
header: i18nString(UIStrings.noMessageSelected),
|
|
199
|
+
text: i18nString(UIStrings.selectMessageToBrowseItsContent),
|
|
200
|
+
})}>
|
|
201
|
+
</devtools-widget>
|
|
202
|
+
`}
|
|
203
|
+
</div>
|
|
204
|
+
</devtools-split-view>
|
|
205
|
+
</div>`,
|
|
206
|
+
target,
|
|
207
|
+
);
|
|
208
|
+
// clang-format on
|
|
209
|
+
};
|
|
210
|
+
|
|
74
211
|
export abstract class ResourceChunkView<Chunk> extends UI.Widget.VBox {
|
|
75
|
-
|
|
76
|
-
private dataGrid: DataGrid.SortableDataGrid.SortableDataGrid<unknown>;
|
|
77
|
-
private readonly timeComparator:
|
|
78
|
-
(arg0: DataGrid.SortableDataGrid.SortableDataGridNode<DataGridItem>,
|
|
79
|
-
arg1: DataGrid.SortableDataGrid.SortableDataGridNode<DataGridItem>) => number;
|
|
80
|
-
private readonly mainToolbar: UI.Toolbar.Toolbar;
|
|
81
|
-
private readonly clearAllButton: UI.Toolbar.ToolbarButton;
|
|
82
|
-
private readonly filterTypeCombobox: UI.Toolbar.ToolbarComboBox;
|
|
212
|
+
readonly #view: View;
|
|
83
213
|
protected filterType: string|null = null;
|
|
84
|
-
private
|
|
214
|
+
private filterText = '';
|
|
85
215
|
protected filterRegex: RegExp|null = null;
|
|
86
|
-
private
|
|
216
|
+
private selectedChunk: Chunk|null = null;
|
|
87
217
|
private currentSelectedNode?: DataGridItem|null;
|
|
88
218
|
readonly request: SDK.NetworkRequest.NetworkRequest;
|
|
89
219
|
private readonly messageFilterSetting: Common.Settings.Setting<string>;
|
|
90
220
|
private sidebarWidget: UI.Widget.Widget|null = null;
|
|
221
|
+
private readonly splitWidgetSettingKey: string;
|
|
222
|
+
private readonly dataGridDisplayName: Common.UIString.LocalizedString;
|
|
223
|
+
private readonly filterUsingRegexHint: Common.UIString.LocalizedString;
|
|
224
|
+
protected get headerTemplate(): Lit.TemplateResult {
|
|
225
|
+
return defaultHeaderTemplate();
|
|
226
|
+
}
|
|
91
227
|
|
|
92
228
|
abstract getRequestChunks(): Chunk[];
|
|
93
229
|
abstract createGridItem(chunk: Chunk): DataGridItem;
|
|
94
230
|
abstract chunkFilter(chunk: Chunk): boolean;
|
|
95
231
|
|
|
96
|
-
constructor(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
232
|
+
constructor(request: SDK.NetworkRequest.NetworkRequest, messageFilterSettingKey: string,
|
|
233
|
+
splitWidgetSettingKey: string, dataGridDisplayName: Common.UIString.LocalizedString,
|
|
234
|
+
filterUsingRegexHint: Common.UIString.LocalizedString, opts?: UI.Widget.WidgetOptions,
|
|
235
|
+
view: View = DEFAULT_VIEW) {
|
|
236
|
+
super(opts);
|
|
237
|
+
this.#view = view;
|
|
100
238
|
this.messageFilterSetting = Common.Settings.Settings.instance().createSetting(messageFilterSettingKey, '');
|
|
101
|
-
this.
|
|
239
|
+
this.splitWidgetSettingKey = splitWidgetSettingKey;
|
|
240
|
+
this.dataGridDisplayName = dataGridDisplayName;
|
|
241
|
+
this.filterUsingRegexHint = filterUsingRegexHint;
|
|
102
242
|
this.request = request;
|
|
103
|
-
this.element.classList.add('resource-chunk-view');
|
|
104
|
-
|
|
105
|
-
this.splitWidget = new UI.SplitWidget.SplitWidget(false, true, splitWidgetSettingKey);
|
|
106
|
-
this.splitWidget.show(this.element);
|
|
107
243
|
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
displayName: dataGridDisplayName,
|
|
112
|
-
columns,
|
|
113
|
-
});
|
|
114
|
-
this.dataGrid.setRowContextMenuCallback((menu, node) => this.onRowContextMenu(menu, node));
|
|
115
|
-
this.dataGrid.setEnableAutoScrollToBottom(true);
|
|
116
|
-
this.dataGrid.setCellClass('resource-chunk-view-td');
|
|
117
|
-
this.timeComparator =
|
|
118
|
-
(resourceChunkNodeTimeComparator as
|
|
119
|
-
(arg0: DataGrid.SortableDataGrid.SortableDataGridNode<DataGridItem>,
|
|
120
|
-
arg1: DataGrid.SortableDataGrid.SortableDataGridNode<DataGridItem>) => number);
|
|
121
|
-
this.dataGrid.sortNodes(this.timeComparator, false);
|
|
122
|
-
this.dataGrid.markColumnAsSortedBy('time', DataGrid.DataGrid.Order.Ascending);
|
|
123
|
-
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SORTING_CHANGED, this.sortItems, this);
|
|
124
|
-
|
|
125
|
-
this.dataGrid.setName(splitWidgetSettingKey + '_datagrid');
|
|
126
|
-
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SELECTED_NODE, event => {
|
|
127
|
-
void this.onChunkSelected(event);
|
|
128
|
-
}, this);
|
|
129
|
-
this.dataGrid.addEventListener(DataGrid.DataGrid.Events.DESELECTED_NODE, this.onChunkDeselected, this);
|
|
130
|
-
|
|
131
|
-
this.mainToolbar = document.createElement('devtools-toolbar');
|
|
132
|
-
|
|
133
|
-
this.clearAllButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.clearAll), 'clear');
|
|
134
|
-
this.clearAllButton.addEventListener(UI.Toolbar.ToolbarButton.Events.CLICK, this.clearChunks, this);
|
|
135
|
-
this.mainToolbar.appendToolbarItem(this.clearAllButton);
|
|
136
|
-
|
|
137
|
-
this.filterTypeCombobox =
|
|
138
|
-
new UI.Toolbar.ToolbarComboBox(this.onFilterTypeChanged.bind(this), i18nString(UIStrings.filter));
|
|
139
|
-
for (const filterItem of FILTER_TYPES) {
|
|
140
|
-
const option = this.filterTypeCombobox.createOption(filterItem.label(), filterItem.name);
|
|
141
|
-
this.filterTypeCombobox.addOption(option);
|
|
142
|
-
}
|
|
143
|
-
this.mainToolbar.appendToolbarItem(this.filterTypeCombobox);
|
|
144
|
-
|
|
145
|
-
this.filterTextInput = new UI.Toolbar.ToolbarFilter(filterUsingRegexHint, 0.4);
|
|
146
|
-
this.filterTextInput.addEventListener(UI.Toolbar.ToolbarInput.Event.TEXT_CHANGED, this.onFilterTextChanged, this);
|
|
147
|
-
const filter = this.messageFilterSetting.get();
|
|
148
|
-
if (filter) {
|
|
149
|
-
this.filterTextInput.setValue(filter);
|
|
150
|
-
}
|
|
151
|
-
this.mainToolbar.appendToolbarItem(this.filterTextInput);
|
|
152
|
-
|
|
153
|
-
const mainContainer = new UI.Widget.VBox();
|
|
154
|
-
mainContainer.element.appendChild(this.mainToolbar);
|
|
155
|
-
this.dataGrid.asWidget().show(mainContainer.element);
|
|
156
|
-
mainContainer.setMinimumSize(0, 72);
|
|
157
|
-
this.splitWidget.setMainWidget(mainContainer);
|
|
158
|
-
|
|
159
|
-
this.frameEmptyWidget = new UI.EmptyWidget.EmptyWidget(
|
|
160
|
-
i18nString(UIStrings.noMessageSelected), i18nString(UIStrings.selectMessageToBrowseItsContent));
|
|
161
|
-
this.sidebarWidget = this.frameEmptyWidget;
|
|
162
|
-
this.splitWidget.setSidebarWidget(this.sidebarWidget);
|
|
163
|
-
|
|
164
|
-
if (filter) {
|
|
165
|
-
this.applyFilter(filter);
|
|
244
|
+
const initialFilter = this.messageFilterSetting.get();
|
|
245
|
+
if (initialFilter) {
|
|
246
|
+
this.applyFilter(initialFilter);
|
|
166
247
|
}
|
|
167
248
|
}
|
|
168
249
|
|
|
169
|
-
private onRowContextMenu(contextMenu: UI.ContextMenu.ContextMenu,
|
|
170
|
-
|
|
171
|
-
const item = node as DataGridItem;
|
|
172
|
-
const binaryView = item.binaryView();
|
|
250
|
+
private onRowContextMenu(contextMenu: UI.ContextMenu.ContextMenu, node: DataGridItem): void {
|
|
251
|
+
const binaryView = node.binaryView();
|
|
173
252
|
if (binaryView) {
|
|
174
253
|
binaryView.addCopyToContextMenu(contextMenu, i18nString(UIStrings.copyMessageD));
|
|
175
254
|
} else {
|
|
176
|
-
const dataVal =
|
|
177
|
-
const textToCopy = typeof dataVal === 'string' ? dataVal :
|
|
255
|
+
const dataVal = node.data.data;
|
|
256
|
+
const textToCopy = typeof dataVal === 'string' ? dataVal : node.dataText();
|
|
178
257
|
contextMenu.clipboardSection().appendItem(
|
|
179
258
|
i18nString(UIStrings.copyMessage),
|
|
180
259
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText.bind(
|
|
@@ -203,28 +282,30 @@ export abstract class ResourceChunkView<Chunk> extends UI.Widget.VBox {
|
|
|
203
282
|
if (!this.chunkFilter(chunk)) {
|
|
204
283
|
return;
|
|
205
284
|
}
|
|
206
|
-
this.
|
|
285
|
+
this.requestUpdate();
|
|
207
286
|
}
|
|
208
287
|
|
|
209
288
|
private clearChunks(): void {
|
|
210
289
|
// TODO(allada): actually remove frames from request.
|
|
211
290
|
clearChunkOffsets.set(this.request, this.getRequestChunks().length);
|
|
212
|
-
this.
|
|
291
|
+
this.requestUpdate();
|
|
213
292
|
}
|
|
214
293
|
|
|
215
|
-
private onFilterTypeChanged(): void {
|
|
216
|
-
const
|
|
217
|
-
this.filterType =
|
|
218
|
-
this.
|
|
294
|
+
private onFilterTypeChanged(event: Event): void {
|
|
295
|
+
const select = event.target as HTMLSelectElement;
|
|
296
|
+
this.filterType = select.value === 'all' ? null : select.value;
|
|
297
|
+
this.requestUpdate();
|
|
219
298
|
}
|
|
220
299
|
|
|
221
|
-
private onFilterTextChanged(): void {
|
|
222
|
-
const
|
|
300
|
+
private onFilterTextChanged(event: Event): void {
|
|
301
|
+
const target = event.target as HTMLInputElement;
|
|
302
|
+
const text = target.value;
|
|
223
303
|
this.messageFilterSetting.set(text);
|
|
224
304
|
this.applyFilter(text);
|
|
225
305
|
}
|
|
226
306
|
|
|
227
307
|
private applyFilter(text: string): void {
|
|
308
|
+
this.filterText = text;
|
|
228
309
|
if (text) {
|
|
229
310
|
try {
|
|
230
311
|
this.filterRegex = new RegExp(text, 'i');
|
|
@@ -234,40 +315,47 @@ export abstract class ResourceChunkView<Chunk> extends UI.Widget.VBox {
|
|
|
234
315
|
} else {
|
|
235
316
|
this.filterRegex = null;
|
|
236
317
|
}
|
|
237
|
-
this.
|
|
318
|
+
this.requestUpdate();
|
|
238
319
|
}
|
|
239
320
|
|
|
240
|
-
private async onChunkSelected(
|
|
241
|
-
|
|
242
|
-
|
|
321
|
+
private async onChunkSelected(chunk: unknown, item: DataGridItem): Promise<void> {
|
|
322
|
+
if (this.selectedChunk === chunk && this.currentSelectedNode === item && this.sidebarWidget) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
this.selectedChunk = chunk as Chunk;
|
|
326
|
+
this.currentSelectedNode = item;
|
|
243
327
|
await this.updateSidebar();
|
|
244
328
|
}
|
|
245
329
|
|
|
246
330
|
private onChunkDeselected(): void {
|
|
331
|
+
if (this.selectedChunk === null && this.currentSelectedNode === null && this.sidebarWidget === null) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
this.selectedChunk = null;
|
|
247
335
|
this.currentSelectedNode = null;
|
|
248
336
|
void this.updateSidebar();
|
|
249
337
|
}
|
|
250
338
|
|
|
251
339
|
async updateSidebar(): Promise<void> {
|
|
252
|
-
|
|
340
|
+
const selectedNode = this.currentSelectedNode;
|
|
341
|
+
if (!selectedNode) {
|
|
253
342
|
this.sidebarWidget = null;
|
|
254
|
-
this.
|
|
343
|
+
this.requestUpdate();
|
|
255
344
|
return;
|
|
256
345
|
}
|
|
257
346
|
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
const binaryView = this.currentSelectedNode.binaryView();
|
|
347
|
+
const binaryView = selectedNode.binaryView();
|
|
261
348
|
if (binaryView) {
|
|
262
349
|
this.sidebarWidget = binaryView;
|
|
263
|
-
this.
|
|
350
|
+
this.requestUpdate();
|
|
264
351
|
return;
|
|
265
352
|
}
|
|
266
353
|
|
|
354
|
+
const content = selectedNode.dataText();
|
|
267
355
|
const jsonView = await SourceFrame.JSONView.JSONView.createView(content);
|
|
268
356
|
if (jsonView) {
|
|
269
357
|
this.sidebarWidget = jsonView;
|
|
270
|
-
this.
|
|
358
|
+
this.requestUpdate();
|
|
271
359
|
return;
|
|
272
360
|
}
|
|
273
361
|
|
|
@@ -275,50 +363,63 @@ export abstract class ResourceChunkView<Chunk> extends UI.Widget.VBox {
|
|
|
275
363
|
TextUtils.StaticContentProvider.StaticContentProvider.fromString(this.request.url(),
|
|
276
364
|
this.request.resourceType(), content),
|
|
277
365
|
'');
|
|
278
|
-
this.
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
private updateSidebarWidget(): void {
|
|
282
|
-
const activeSidebar = this.sidebarWidget || this.frameEmptyWidget;
|
|
283
|
-
if (this.splitWidget.sidebarWidget() !== activeSidebar) {
|
|
284
|
-
this.splitWidget.setSidebarWidget(activeSidebar);
|
|
285
|
-
}
|
|
366
|
+
this.requestUpdate();
|
|
286
367
|
}
|
|
287
368
|
|
|
288
369
|
override performUpdate(): void {
|
|
289
|
-
this.dataGrid.rootNode().removeChildren();
|
|
290
370
|
let chunks = this.getRequestChunks();
|
|
291
371
|
const offset = clearChunkOffsets.get(this.request) || 0;
|
|
292
372
|
chunks = chunks.slice(offset).filter(this.chunkFilter.bind(this));
|
|
293
|
-
chunks.forEach(chunk => this.dataGrid.insertChild(this.createGridItem(chunk)));
|
|
294
|
-
|
|
295
|
-
this.updateSidebarWidget();
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
refresh(): void {
|
|
299
|
-
this.performUpdate();
|
|
300
|
-
}
|
|
301
373
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
374
|
+
const rows: GridRow[] = chunks.map((chunk, index) => {
|
|
375
|
+
const item = this.createGridItem(chunk);
|
|
376
|
+
const time = new Date(item.getTime() * 1000);
|
|
377
|
+
const timeText = ('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2) + ':' +
|
|
378
|
+
('0' + time.getSeconds()).slice(-2) + '.' + ('00' + time.getMilliseconds()).slice(-3);
|
|
379
|
+
return {
|
|
380
|
+
chunk,
|
|
381
|
+
item,
|
|
382
|
+
selected: chunk === this.selectedChunk,
|
|
383
|
+
cssClass: item.cssClass,
|
|
384
|
+
index,
|
|
385
|
+
timeTooltip: time.toLocaleString(),
|
|
386
|
+
timeText,
|
|
387
|
+
};
|
|
388
|
+
});
|
|
309
389
|
|
|
310
|
-
|
|
311
|
-
|
|
390
|
+
const input: ViewInput = {
|
|
391
|
+
onClear: this.clearChunks.bind(this),
|
|
392
|
+
selectedFilterType: this.filterType ?? 'all',
|
|
393
|
+
onFilterTypeChange: this.onFilterTypeChanged.bind(this),
|
|
394
|
+
filterUsingRegexHint: this.filterUsingRegexHint,
|
|
395
|
+
filterText: this.filterText,
|
|
396
|
+
onFilterTextChange: this.onFilterTextChanged.bind(this),
|
|
397
|
+
splitWidgetSettingKey: this.splitWidgetSettingKey,
|
|
398
|
+
dataGridDisplayName: this.dataGridDisplayName,
|
|
399
|
+
columns: this.getColumns(),
|
|
400
|
+
headerTemplate: this.headerTemplate,
|
|
401
|
+
rows,
|
|
402
|
+
onSelect: (e: CustomEvent<HTMLElement>) => {
|
|
403
|
+
const target = e.target as HTMLElement;
|
|
404
|
+
const index = target?.dataset.index;
|
|
405
|
+
if (index !== undefined) {
|
|
406
|
+
const row = rows[Number(index)];
|
|
407
|
+
if (row) {
|
|
408
|
+
void this.onChunkSelected(row.chunk, row.item);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
onDeselect: this.onChunkDeselected.bind(this),
|
|
413
|
+
onContextMenu: (item: DataGridItem, menu: UI.ContextMenu.ContextMenu) => {
|
|
414
|
+
this.onRowContextMenu(menu, item);
|
|
415
|
+
},
|
|
416
|
+
sidebarWidget: this.sidebarWidget,
|
|
417
|
+
};
|
|
418
|
+
this.#view(input, undefined, this.contentElement);
|
|
312
419
|
}
|
|
313
420
|
|
|
314
|
-
|
|
315
|
-
return this.
|
|
316
|
-
}
|
|
317
|
-
getClearAllButtonForTest(): UI.Toolbar.ToolbarButton {
|
|
318
|
-
return this.clearAllButton;
|
|
319
|
-
}
|
|
320
|
-
getFilterTypeComboboxForTest(): UI.Toolbar.ToolbarComboBox {
|
|
321
|
-
return this.filterTypeCombobox;
|
|
421
|
+
getSplitWidgetForTest(): UI.Widget.Widget|null {
|
|
422
|
+
return this.sidebarWidget;
|
|
322
423
|
}
|
|
323
424
|
}
|
|
324
425
|
|
|
@@ -328,15 +429,13 @@ const FILTER_TYPES: UI.FilterBar.Item[] = [
|
|
|
328
429
|
{name: 'receive', label: i18nLazyString(UIStrings.receive), jslogContext: 'receive'},
|
|
329
430
|
];
|
|
330
431
|
|
|
331
|
-
export abstract class DataGridItem
|
|
432
|
+
export abstract class DataGridItem {
|
|
433
|
+
abstract data: Record<string, string|HTMLElement>;
|
|
434
|
+
abstract cssClass?: string;
|
|
332
435
|
abstract binaryView(): BinaryResourceView|null;
|
|
333
436
|
abstract getTime(): number;
|
|
334
437
|
abstract dataText(): string;
|
|
335
438
|
abstract readonly isTextFrame: boolean;
|
|
336
439
|
}
|
|
337
440
|
|
|
338
|
-
function resourceChunkNodeTimeComparator(a: DataGridItem, b: DataGridItem): number {
|
|
339
|
-
return a.getTime() - b.getTime();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
441
|
const clearChunkOffsets = new WeakMap<SDK.NetworkRequest.NetworkRequest, number>();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// Copyright 2025 The Chromium Authors
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
4
|
|
|
6
5
|
import * as Common from '../../core/common/common.js';
|
|
7
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
@@ -9,11 +8,15 @@ import * as Platform from '../../core/platform/platform.js';
|
|
|
9
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
9
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
11
10
|
import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
|
|
12
|
-
import * as
|
|
11
|
+
import * as Lit from '../../ui/lit/lit.js';
|
|
13
12
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
14
13
|
|
|
15
14
|
import {BinaryResourceView} from './BinaryResourceView.js';
|
|
16
|
-
import {DataGridItem,
|
|
15
|
+
import {DataGridItem, defaultHeaderTemplate, ResourceChunkView} from './ResourceChunkView.js';
|
|
16
|
+
|
|
17
|
+
const {
|
|
18
|
+
html,
|
|
19
|
+
} = Lit;
|
|
17
20
|
|
|
18
21
|
const UIStrings = {
|
|
19
22
|
/**
|
|
@@ -47,13 +50,33 @@ const UIStrings = {
|
|
|
47
50
|
} as const;
|
|
48
51
|
const str_ = i18n.i18n.registerUIStrings('panels/network/ResourceDirectSocketChunkView.ts', UIStrings);
|
|
49
52
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
53
|
+
const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
|
|
54
|
+
|
|
55
|
+
// clang-format off
|
|
56
|
+
function udpBoundHeaderTemplate(): Lit.TemplateResult {
|
|
57
|
+
return html`
|
|
58
|
+
<tr>
|
|
59
|
+
<th id="data" weight="63">${i18nLazyString(UIStrings.data)}</th>
|
|
60
|
+
<th id="address" align="right" weight="15">${i18nLazyString(UIStrings.address)}</th>
|
|
61
|
+
<th id="port" align="right" weight="10">${i18nLazyString(UIStrings.port)}</th>
|
|
62
|
+
<th id="length" align="right" weight="5">${i18nLazyString(UIStrings.length)}</th>
|
|
63
|
+
<th id="time" sortable sort="ascending" weight="7">${i18nLazyString(UIStrings.time)}</th>
|
|
64
|
+
</tr>`;
|
|
65
|
+
}
|
|
66
|
+
// clang-format on
|
|
67
|
+
|
|
68
|
+
export class ResourceDirectSocketChunkView extends ResourceChunkView<SDK.NetworkRequest.DirectSocketChunk> {
|
|
69
|
+
override get headerTemplate(): Lit.TemplateResult {
|
|
70
|
+
if (this.request.directSocketInfo?.type === SDK.NetworkRequest.DirectSocketType.UDP_BOUND) {
|
|
71
|
+
return udpBoundHeaderTemplate();
|
|
72
|
+
}
|
|
73
|
+
return defaultHeaderTemplate();
|
|
74
|
+
}
|
|
50
75
|
|
|
51
|
-
export class ResourceDirectSocketChunkView extends OriginalResourceChunkView<SDK.NetworkRequest.DirectSocketChunk> {
|
|
52
76
|
constructor(request: SDK.NetworkRequest.NetworkRequest) {
|
|
53
|
-
super(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
this.element.setAttribute('jslog', `${VisualLogging.pane('direct-socket-messages').track({resize: true})}`);
|
|
77
|
+
super(request, 'network-direct-socket-chunk-filter', 'resource-direct-socket-chunk-split-view-state',
|
|
78
|
+
i18nString(UIStrings.directSocketChunk), i18nString(UIStrings.filterUsingRegex),
|
|
79
|
+
{jslog: `${VisualLogging.pane('direct-socket-messages').track({resize: true})}`});
|
|
57
80
|
}
|
|
58
81
|
|
|
59
82
|
override getRequestChunks(): SDK.NetworkRequest.DirectSocketChunk[] {
|
|
@@ -73,7 +96,7 @@ export class ResourceDirectSocketChunkView extends OriginalResourceChunkView<SDK
|
|
|
73
96
|
|
|
74
97
|
override wasShown(): void {
|
|
75
98
|
super.wasShown();
|
|
76
|
-
this.
|
|
99
|
+
this.requestUpdate();
|
|
77
100
|
this.request.addEventListener(
|
|
78
101
|
SDK.NetworkRequest.Events.DIRECTSOCKET_CHUNK_ADDED, this.onDirectSocketChunkAdded, this);
|
|
79
102
|
}
|
|
@@ -135,14 +158,11 @@ class ResourceChunkNode extends DataGridItem {
|
|
|
135
158
|
#binaryView: BinaryResourceView|null = null;
|
|
136
159
|
readonly chunk: SDK.NetworkRequest.DirectSocketChunk;
|
|
137
160
|
override readonly isTextFrame = false;
|
|
161
|
+
override readonly data: Record<string, string|HTMLElement>;
|
|
162
|
+
override readonly cssClass: string;
|
|
138
163
|
|
|
139
164
|
constructor(chunk: SDK.NetworkRequest.DirectSocketChunk, boundSocket: boolean) {
|
|
140
|
-
|
|
141
|
-
const timeText = ('0' + time.getHours()).substr(-2) + ':' + ('0' + time.getMinutes()).substr(-2) + ':' +
|
|
142
|
-
('0' + time.getSeconds()).substr(-2) + '.' + ('00' + time.getMilliseconds()).substr(-3);
|
|
143
|
-
const timeNode = document.createElement('div');
|
|
144
|
-
UI.UIUtils.createTextChild(timeNode, timeText);
|
|
145
|
-
UI.Tooltip.Tooltip.install(timeNode, time.toLocaleString());
|
|
165
|
+
super();
|
|
146
166
|
|
|
147
167
|
let description: string;
|
|
148
168
|
const length = i18n.ByteUtilities.bytesToString(Platform.StringUtilities.base64ToSize(chunk.data));
|
|
@@ -154,26 +174,29 @@ class ResourceChunkNode extends DataGridItem {
|
|
|
154
174
|
}
|
|
155
175
|
|
|
156
176
|
if (boundSocket) {
|
|
157
|
-
|
|
177
|
+
this.data = {
|
|
178
|
+
data: description,
|
|
179
|
+
address: chunk.remoteAddress ?? '',
|
|
180
|
+
port: chunk.remotePort?.toString() ?? '',
|
|
181
|
+
length,
|
|
182
|
+
};
|
|
158
183
|
} else {
|
|
159
|
-
|
|
184
|
+
this.data = {
|
|
185
|
+
data: description,
|
|
186
|
+
length,
|
|
187
|
+
};
|
|
160
188
|
}
|
|
161
189
|
|
|
190
|
+
let cssClass = '';
|
|
191
|
+
if (chunk.type === SDK.NetworkRequest.DirectSocketChunkType.SEND) {
|
|
192
|
+
cssClass = 'resource-chunk-view-row-send';
|
|
193
|
+
} else if (chunk.type === SDK.NetworkRequest.DirectSocketChunkType.RECEIVE) {
|
|
194
|
+
cssClass = 'resource-chunk-view-row-receive';
|
|
195
|
+
}
|
|
196
|
+
this.cssClass = cssClass;
|
|
162
197
|
this.chunk = chunk;
|
|
163
198
|
}
|
|
164
199
|
|
|
165
|
-
override createCells(element: Element): void {
|
|
166
|
-
element.classList.toggle(
|
|
167
|
-
'resource-chunk-view-row-send', this.chunk.type === SDK.NetworkRequest.DirectSocketChunkType.SEND);
|
|
168
|
-
element.classList.toggle(
|
|
169
|
-
'resource-chunk-view-row-receive', this.chunk.type === SDK.NetworkRequest.DirectSocketChunkType.RECEIVE);
|
|
170
|
-
super.createCells(element);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
override nodeSelfHeight(): number {
|
|
174
|
-
return 21;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
200
|
override dataText(): string {
|
|
178
201
|
return this.chunk.data;
|
|
179
202
|
}
|