chrome-devtools-frontend 1.0.1654411 → 1.0.1656291
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/ui-eng-vision-local-lit-renderer/SKILL.md +116 -0
- package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +82 -0
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +123 -0
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +125 -0
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +75 -0
- package/AUTHORS +1 -0
- package/config/owner/COMMON_OWNERS +0 -4
- package/docs/playbook.md +1 -1
- package/front_end/Tests.js +1 -0
- package/front_end/core/common/Settings.ts +47 -30
- package/front_end/core/sdk/CPUThrottlingManager.ts +10 -159
- package/front_end/core/sdk/ConsoleModel.ts +13 -11
- package/front_end/core/sdk/DOMDebuggerModel.ts +11 -5
- package/front_end/core/sdk/EventBreakpointsModel.ts +9 -5
- package/front_end/core/sdk/IsolateManager.ts +6 -6
- package/front_end/core/sdk/ResourceTreeModel.ts +5 -3
- package/front_end/core/sdk/TargetManager.ts +17 -0
- package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
- package/front_end/entrypoints/main/MainImpl.ts +12 -36
- package/front_end/foundation/Universe.ts +98 -3
- package/front_end/generated/InspectorBackendCommands.ts +5 -1
- package/front_end/generated/SupportedCSSProperties.js +2 -6
- package/front_end/generated/protocol-mapping.d.ts +8 -0
- package/front_end/generated/protocol-proxy-api.d.ts +15 -0
- package/front_end/generated/protocol.ts +36 -1
- package/front_end/models/ai_assistance/AiConversation.ts +0 -6
- package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -156
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -358
- package/front_end/models/ai_assistance/ai_assistance.ts +0 -6
- package/front_end/models/ai_assistance/contexts/RequestContext.snapshot.txt +0 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +0 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -14
- package/front_end/models/autofill_manager/AutofillManager.ts +1 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
- package/front_end/models/persistence/AutomaticFileSystemManager.ts +14 -13
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +12 -9
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +18 -9
- package/front_end/models/project_settings/ProjectSettingsModel.ts +12 -11
- package/front_end/models/trace/handlers/ScreenshotsHandler.ts +14 -59
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +3 -29
- package/front_end/panels/application/DeviceBoundSessionsView.ts +15 -3
- package/front_end/panels/application/FrameDetailsView.ts +2 -1
- package/front_end/panels/application/ServiceWorkersView.ts +23 -16
- package/front_end/panels/common/CPUThrottlingOption.ts +142 -0
- package/front_end/panels/common/ThrottlingUtils.ts +9 -4
- package/front_end/panels/common/common.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +45 -0
- package/front_end/panels/elements/ElementsPanel.ts +0 -74
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -4
- package/front_end/panels/emulation/DeviceModeToolbar.ts +46 -45
- package/front_end/panels/mobile_throttling/CalibrationController.ts +6 -5
- package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +1 -1
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +40 -13
- package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +13 -17
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +15 -13
- package/front_end/panels/network/NetworkLogView.ts +0 -9
- package/front_end/panels/network/NetworkPanel.ts +1 -63
- package/front_end/panels/network/RequestInitiatorView.ts +29 -4
- package/front_end/panels/network/components/HeaderSectionRow.css +9 -7
- package/front_end/panels/network/components/HeaderSectionRow.ts +20 -1
- package/front_end/panels/network/components/RequestHeaderSection.css +5 -3
- package/front_end/panels/network/components/RequestHeaderSection.ts +1 -2
- package/front_end/panels/network/components/RequestHeadersView.css +1 -1
- package/front_end/panels/security/SecurityPanel.ts +36 -23
- package/front_end/panels/settings/SettingsScreen.ts +18 -103
- package/front_end/panels/settings/settings-meta.ts +0 -24
- package/front_end/panels/timeline/TimelineController.ts +3 -2
- package/front_end/panels/timeline/TimelinePanel.ts +20 -3
- package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +15 -14
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -0
- package/front_end/panels/utils/utils.ts +25 -24
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +96 -83
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +10 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +5 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +23 -13
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Input.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts +3 -41
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +4 -2
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js +5 -5
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +34 -55
- package/front_end/third_party/puppeteer/package/package.json +4 -4
- package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
- package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -3
- package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +3 -2
- package/front_end/third_party/puppeteer/package/src/api/Realm.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/api/Target.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +1 -2
- package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +3 -1
- package/front_end/third_party/puppeteer/package/src/bidi/core/Realm.ts +1 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +13 -3
- package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +24 -13
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/cdp/LifecycleWatcher.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +2 -4
- package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -76
- package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +1 -4
- package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +4 -1
- package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +5 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
- package/front_end/third_party/puppeteer/package/src/util/httpUtils.ts +5 -5
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +3 -0
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -7
- package/front_end/ui/helpers/OpenInNewTab.ts +15 -7
- package/front_end/ui/legacy/TabbedPane.ts +1 -108
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -0
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +172 -123
- package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +89 -0
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +10 -0
- package/front_end/ui/legacy/components/data_grid/data_grid.ts +3 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +89 -40
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
- package/package.json +1 -1
- package/front_end/Images/navigationControls.png +0 -0
- package/front_end/Images/navigationControls_2x.png +0 -0
- package/front_end/Images/popoverArrows.png +0 -0
- package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -746
- package/front_end/entrypoints/greendev_floaty/floaty.css +0 -301
- package/front_end/entrypoints/greendev_floaty/floaty.html +0 -38
- package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -415
- package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +0 -834
- package/front_end/models/ai_assistance/agents/GreenDevAgentAntigravityCliSocketClient.ts +0 -53
- package/front_end/models/ai_assistance/agents/GreenDevAgentGeminiCliSocketClient.ts +0 -117
- package/front_end/models/annotations/AnnotationRepository.ts +0 -238
- package/front_end/models/annotations/AnnotationType.ts +0 -10
- package/front_end/models/annotations/README.md +0 -7
- package/front_end/models/annotations/annotations.ts +0 -6
- package/front_end/models/greendev/Prototypes.ts +0 -68
- package/front_end/models/greendev/README.md +0 -5
- package/front_end/models/greendev/greendev.ts +0 -5
- package/front_end/panels/common/Annotation.ts +0 -184
- package/front_end/panels/common/AnnotationManager.ts +0 -208
- package/front_end/panels/common/annotation.css +0 -40
- package/front_end/panels/greendev/GreenDevPanel.css +0 -282
- package/front_end/panels/greendev/GreenDevPanel.ts +0 -364
- package/front_end/panels/greendev/GreenDevShared.ts +0 -13
- package/front_end/panels/greendev/greendev-meta.ts +0 -52
- package/front_end/panels/greendev/greendev.ts +0 -9
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
6
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
7
|
+
import * as PanelsCommon from '../common/common.js';
|
|
7
8
|
|
|
8
9
|
const UIStrings = {
|
|
9
10
|
/**
|
|
@@ -55,7 +56,7 @@ export class CalibrationController {
|
|
|
55
56
|
#runtimeModel!: SDK.RuntimeModel.RuntimeModel;
|
|
56
57
|
#emulationModel!: SDK.EmulationModel.EmulationModel;
|
|
57
58
|
#originalUrl!: string;
|
|
58
|
-
#result?:
|
|
59
|
+
#result?: PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling;
|
|
59
60
|
#state: 'idle'|'running'|'aborting' = 'idle';
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -220,14 +221,14 @@ export class CalibrationController {
|
|
|
220
221
|
if (actualScore < midScore) {
|
|
221
222
|
if (actualScore < lowScore) {
|
|
222
223
|
this.#result = {
|
|
223
|
-
low:
|
|
224
|
-
mid:
|
|
224
|
+
low: PanelsCommon.CPUThrottlingOption.CalibrationError.DEVICE_TOO_WEAK,
|
|
225
|
+
mid: PanelsCommon.CPUThrottlingOption.CalibrationError.DEVICE_TOO_WEAK,
|
|
225
226
|
};
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
228
229
|
|
|
229
230
|
// Can still emulate the low-end device.
|
|
230
|
-
this.#result = {mid:
|
|
231
|
+
this.#result = {mid: PanelsCommon.CPUThrottlingOption.CalibrationError.DEVICE_TOO_WEAK};
|
|
231
232
|
isHalfwayDone = true;
|
|
232
233
|
}
|
|
233
234
|
}
|
|
@@ -258,7 +259,7 @@ export class CalibrationController {
|
|
|
258
259
|
}
|
|
259
260
|
}
|
|
260
261
|
|
|
261
|
-
result():
|
|
262
|
+
result(): PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling|undefined {
|
|
262
263
|
return this.#result;
|
|
263
264
|
}
|
|
264
265
|
|
|
@@ -70,7 +70,7 @@ export class MobileThrottlingSelector {
|
|
|
70
70
|
this.populateOptions();
|
|
71
71
|
|
|
72
72
|
const networkConditions = SDK.NetworkManager.MultitargetNetworkManager.instance().networkConditions();
|
|
73
|
-
const cpuThrottlingOption =
|
|
73
|
+
const cpuThrottlingOption = throttlingManager().cpuThrottlingOption();
|
|
74
74
|
for (let index = 0; index < this.options.length; ++index) {
|
|
75
75
|
const option = this.options[index];
|
|
76
76
|
if (option && 'network' in option && option.network === networkConditions &&
|
|
@@ -11,6 +11,7 @@ import {Icon} from '../../ui/kit/kit.js';
|
|
|
11
11
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
12
12
|
import {html, render} from '../../ui/lit/lit.js';
|
|
13
13
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
14
|
+
import * as PanelsCommon from '../common/common.js';
|
|
14
15
|
|
|
15
16
|
import {MobileThrottlingSelector} from './MobileThrottlingSelector.js';
|
|
16
17
|
import {
|
|
@@ -22,7 +23,7 @@ import {
|
|
|
22
23
|
|
|
23
24
|
export interface CPUThrottlingSelectorWrapper {
|
|
24
25
|
control: UI.Toolbar.ToolbarComboBox;
|
|
25
|
-
updateRecommendedOption(recommendedOption:
|
|
26
|
+
updateRecommendedOption(recommendedOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption|null): void;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
const UIStrings = {
|
|
@@ -109,15 +110,17 @@ class PromiseQueue<T> {
|
|
|
109
110
|
|
|
110
111
|
export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<ThrottlingManager.EventTypes> {
|
|
111
112
|
private readonly cpuThrottlingControls: Set<UI.Toolbar.ToolbarComboBox>;
|
|
112
|
-
private readonly cpuThrottlingOptions:
|
|
113
|
+
private readonly cpuThrottlingOptions: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption[];
|
|
113
114
|
private readonly customNetworkConditionsSetting: Common.Settings.Setting<SDK.NetworkManager.Conditions[]>;
|
|
114
115
|
private readonly currentNetworkThrottlingConditionKeySetting:
|
|
115
116
|
Common.Settings.Setting<SDK.NetworkManager.ThrottlingConditionKey>;
|
|
116
117
|
private readonly calibratedCpuThrottlingSetting:
|
|
117
|
-
Common.Settings.Setting<
|
|
118
|
+
Common.Settings.Setting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>;
|
|
118
119
|
private lastNetworkThrottlingConditions!: SDK.NetworkManager.Conditions;
|
|
119
120
|
private readonly cpuThrottlingManager: SDK.CPUThrottlingManager.CPUThrottlingManager;
|
|
120
121
|
#hardwareConcurrencyOverrideEnabled = false;
|
|
122
|
+
#currentCPUThrottlingOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption =
|
|
123
|
+
PanelsCommon.CPUThrottlingOption.NoThrottlingOption;
|
|
121
124
|
readonly #emulationQueue = new PromiseQueue<void>();
|
|
122
125
|
get hardwareConcurrencyOverrideEnabled(): boolean {
|
|
123
126
|
return this.#hardwareConcurrencyOverrideEnabled;
|
|
@@ -136,8 +139,9 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
|
|
|
136
139
|
this.currentNetworkThrottlingConditionKeySetting = SDK.NetworkManager.activeNetworkThrottlingKeySetting();
|
|
137
140
|
|
|
138
141
|
this.calibratedCpuThrottlingSetting =
|
|
139
|
-
Common.Settings.Settings.instance().createSetting<
|
|
142
|
+
Common.Settings.Settings.instance().createSetting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>(
|
|
140
143
|
'calibrated-cpu-throttling', {}, Common.Settings.SettingStorageType.GLOBAL);
|
|
144
|
+
this.calibratedCpuThrottlingSetting.addChangeListener(this.onCalibratedSettingChanged, this);
|
|
141
145
|
|
|
142
146
|
SDK.NetworkManager.MultitargetNetworkManager.instance().addEventListener(
|
|
143
147
|
SDK.NetworkManager.MultitargetNetworkManager.Events.CONDITIONS_CHANGED, () => {
|
|
@@ -250,23 +254,46 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
|
|
|
250
254
|
|
|
251
255
|
private updatePanelIcon(): void {
|
|
252
256
|
const warnings = [];
|
|
253
|
-
if (this.cpuThrottlingManager.cpuThrottlingRate() !==
|
|
257
|
+
if (this.cpuThrottlingManager.cpuThrottlingRate() !==
|
|
258
|
+
PanelsCommon.CPUThrottlingOption.CPUThrottlingRates.NO_THROTTLING) {
|
|
254
259
|
warnings.push(i18nString(UIStrings.cpuThrottlingIsEnabled));
|
|
255
260
|
}
|
|
256
261
|
UI.InspectorView.InspectorView.instance().setPanelWarnings('timeline', warnings);
|
|
257
262
|
}
|
|
258
263
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
264
|
+
cpuThrottlingOption(): PanelsCommon.CPUThrottlingOption.CPUThrottlingOption {
|
|
265
|
+
return this.#currentCPUThrottlingOption;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
setCPUThrottlingOption(option: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption): void {
|
|
269
|
+
if (this.#currentCPUThrottlingOption === option) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
this.#currentCPUThrottlingOption = option;
|
|
273
|
+
this.cpuThrottlingManager.setCPUThrottlingRate(option.rate());
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private onCalibratedSettingChanged(): void {
|
|
277
|
+
if (!this.#currentCPUThrottlingOption.calibratedDeviceType) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const rate = this.#currentCPUThrottlingOption.rate();
|
|
281
|
+
if (rate === 0) {
|
|
282
|
+
this.setCPUThrottlingOption(PanelsCommon.CPUThrottlingOption.NoThrottlingOption);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
this.cpuThrottlingManager.setCPUThrottlingRate(rate);
|
|
262
286
|
}
|
|
263
287
|
|
|
264
288
|
onCPUThrottlingRateChangedOnSDK(rate: number): void {
|
|
265
|
-
if (rate !==
|
|
289
|
+
if (rate !== PanelsCommon.CPUThrottlingOption.CPUThrottlingRates.NO_THROTTLING) {
|
|
266
290
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.CpuThrottlingEnabled);
|
|
267
291
|
}
|
|
268
292
|
|
|
269
|
-
const
|
|
293
|
+
const option = PanelsCommon.CPUThrottlingOption.determineOptionFromRate(rate, this.#currentCPUThrottlingOption);
|
|
294
|
+
this.#currentCPUThrottlingOption = option;
|
|
295
|
+
|
|
296
|
+
const index = this.cpuThrottlingOptions.indexOf(option);
|
|
270
297
|
for (const control of this.cpuThrottlingControls) {
|
|
271
298
|
control.setSelectedIndex(index);
|
|
272
299
|
}
|
|
@@ -282,7 +309,7 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
|
|
|
282
309
|
|
|
283
310
|
const optionSelected = (): void => {
|
|
284
311
|
if (control.selectedIndex() === control.options().length - 1) {
|
|
285
|
-
const index = this.cpuThrottlingOptions.indexOf(this
|
|
312
|
+
const index = this.cpuThrottlingOptions.indexOf(this.#currentCPUThrottlingOption);
|
|
286
313
|
control.setSelectedIndex(index);
|
|
287
314
|
void Common.Revealer.reveal(this.calibratedCpuThrottlingSetting);
|
|
288
315
|
} else {
|
|
@@ -293,7 +320,7 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
|
|
|
293
320
|
const control =
|
|
294
321
|
new UI.Toolbar.ToolbarComboBox(optionSelected, i18nString(UIStrings.cpuThrottling), '', 'cpu-throttling');
|
|
295
322
|
this.cpuThrottlingControls.add(control);
|
|
296
|
-
const currentOption = this
|
|
323
|
+
const currentOption = this.#currentCPUThrottlingOption;
|
|
297
324
|
|
|
298
325
|
const optionEls: HTMLOptionElement[] = [];
|
|
299
326
|
const options = this.cpuThrottlingOptions;
|
|
@@ -317,7 +344,7 @@ export class ThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Thrott
|
|
|
317
344
|
|
|
318
345
|
return {
|
|
319
346
|
control,
|
|
320
|
-
updateRecommendedOption(recommendedOption:
|
|
347
|
+
updateRecommendedOption(recommendedOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption|null) {
|
|
321
348
|
for (let i = 0; i < optionEls.length - 1; i++) {
|
|
322
349
|
const option = options[i];
|
|
323
350
|
optionEls[i].text = option === recommendedOption ?
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
6
6
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
7
|
+
import * as PanelsCommon from '../common/common.js';
|
|
7
8
|
|
|
8
9
|
const UIStrings = {
|
|
9
10
|
/**
|
|
@@ -61,7 +62,7 @@ export class ThrottlingPresets {
|
|
|
61
62
|
title,
|
|
62
63
|
description: i18nString(UIStrings.noThrottling),
|
|
63
64
|
network: SDK.NetworkManager.NoThrottlingConditions,
|
|
64
|
-
cpuThrottlingOption:
|
|
65
|
+
cpuThrottlingOption: PanelsCommon.CPUThrottlingOption.NoThrottlingOption,
|
|
65
66
|
jslogContext: 'no-throttling',
|
|
66
67
|
};
|
|
67
68
|
}
|
|
@@ -74,15 +75,16 @@ export class ThrottlingPresets {
|
|
|
74
75
|
title,
|
|
75
76
|
description: i18nString(UIStrings.noInternetConnectivity),
|
|
76
77
|
network: SDK.NetworkManager.OfflineConditions,
|
|
77
|
-
cpuThrottlingOption:
|
|
78
|
+
cpuThrottlingOption: PanelsCommon.CPUThrottlingOption.NoThrottlingOption,
|
|
78
79
|
jslogContext: 'offline',
|
|
79
80
|
};
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
static getLowEndMobileConditions(): Conditions {
|
|
83
|
-
const useCalibrated =
|
|
84
|
-
const cpuThrottlingOption = useCalibrated ?
|
|
85
|
-
|
|
84
|
+
const useCalibrated = PanelsCommon.CPUThrottlingOption.CalibratedLowTierMobileThrottlingOption.rate() !== 0;
|
|
85
|
+
const cpuThrottlingOption = useCalibrated ?
|
|
86
|
+
PanelsCommon.CPUThrottlingOption.CalibratedLowTierMobileThrottlingOption :
|
|
87
|
+
PanelsCommon.CPUThrottlingOption.LowTierThrottlingOption;
|
|
86
88
|
const description = useCalibrated ?
|
|
87
89
|
i18nString(UIStrings.slowGXCpuSlowdownCalibrated, {PH1: cpuThrottlingOption.rate()}) :
|
|
88
90
|
i18nString(UIStrings.slowGXCpuSlowdown);
|
|
@@ -97,9 +99,10 @@ export class ThrottlingPresets {
|
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
static getMidTierMobileConditions(): Conditions {
|
|
100
|
-
const useCalibrated =
|
|
101
|
-
const cpuThrottlingOption = useCalibrated ?
|
|
102
|
-
|
|
102
|
+
const useCalibrated = PanelsCommon.CPUThrottlingOption.CalibratedMidTierMobileThrottlingOption.rate() !== 0;
|
|
103
|
+
const cpuThrottlingOption = useCalibrated ?
|
|
104
|
+
PanelsCommon.CPUThrottlingOption.CalibratedMidTierMobileThrottlingOption :
|
|
105
|
+
PanelsCommon.CPUThrottlingOption.MidTierThrottlingOption;
|
|
103
106
|
const description = useCalibrated ?
|
|
104
107
|
i18nString(UIStrings.fastGXCpuSlowdownCalibrated, {PH1: cpuThrottlingOption.rate()}) :
|
|
105
108
|
i18nString(UIStrings.fastGXCpuSlowdown);
|
|
@@ -142,14 +145,7 @@ export class ThrottlingPresets {
|
|
|
142
145
|
SDK.NetworkManager.OfflineConditions,
|
|
143
146
|
];
|
|
144
147
|
|
|
145
|
-
static cpuThrottlingPresets
|
|
146
|
-
SDK.CPUThrottlingManager.NoThrottlingOption,
|
|
147
|
-
SDK.CPUThrottlingManager.MidTierThrottlingOption,
|
|
148
|
-
SDK.CPUThrottlingManager.LowTierThrottlingOption,
|
|
149
|
-
SDK.CPUThrottlingManager.ExtraSlowThrottlingOption,
|
|
150
|
-
SDK.CPUThrottlingManager.CalibratedLowTierMobileThrottlingOption,
|
|
151
|
-
SDK.CPUThrottlingManager.CalibratedMidTierMobileThrottlingOption,
|
|
152
|
-
];
|
|
148
|
+
static cpuThrottlingPresets = PanelsCommon.CPUThrottlingOption.cpuThrottlingPresets;
|
|
153
149
|
}
|
|
154
150
|
|
|
155
151
|
// @ts-expect-error exported for Tests.js
|
|
@@ -161,7 +157,7 @@ export interface Conditions {
|
|
|
161
157
|
title: string;
|
|
162
158
|
description: string;
|
|
163
159
|
network: SDK.NetworkManager.Conditions;
|
|
164
|
-
cpuThrottlingOption:
|
|
160
|
+
cpuThrottlingOption: PanelsCommon.CPUThrottlingOption.CPUThrottlingOption;
|
|
165
161
|
jslogContext?: string;
|
|
166
162
|
}
|
|
167
163
|
|
|
@@ -12,6 +12,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
|
|
|
12
12
|
import {type Card, createIcon} from '../../ui/kit/kit.js';
|
|
13
13
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
14
14
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
15
|
+
import * as PanelsCommon from '../common/common.js';
|
|
15
16
|
|
|
16
17
|
import {CalibrationController} from './CalibrationController.js';
|
|
17
18
|
import {ThrottlingPresets} from './ThrottlingPresets.js';
|
|
@@ -214,7 +215,7 @@ function createComputePressurePromise(): Promise<{state: string}> {
|
|
|
214
215
|
export class CPUThrottlingCard {
|
|
215
216
|
element: Card;
|
|
216
217
|
|
|
217
|
-
private readonly setting: Common.Settings.Setting<
|
|
218
|
+
private readonly setting: Common.Settings.Setting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>;
|
|
218
219
|
private computePressurePromise?: ReturnType<typeof createComputePressurePromise>;
|
|
219
220
|
private controller?: CalibrationController;
|
|
220
221
|
|
|
@@ -230,8 +231,9 @@ export class CPUThrottlingCard {
|
|
|
230
231
|
private warnings: string[] = [];
|
|
231
232
|
|
|
232
233
|
constructor() {
|
|
233
|
-
this.setting =
|
|
234
|
-
|
|
234
|
+
this.setting =
|
|
235
|
+
Common.Settings.Settings.instance().createSetting<PanelsCommon.CPUThrottlingOption.CalibratedCPUThrottling>(
|
|
236
|
+
'calibrated-cpu-throttling', {}, Common.Settings.SettingStorageType.GLOBAL);
|
|
235
237
|
|
|
236
238
|
this.element = document.createElement('devtools-card');
|
|
237
239
|
this.element.heading = i18nString(UIStrings.cpuThrottlingPresets);
|
|
@@ -331,13 +333,13 @@ export class CPUThrottlingCard {
|
|
|
331
333
|
this.progress.style.display = '';
|
|
332
334
|
}
|
|
333
335
|
|
|
334
|
-
const resultToString = (result: number|
|
|
336
|
+
const resultToString = (result: number|PanelsCommon.CPUThrottlingOption.CalibrationError|undefined): string => {
|
|
335
337
|
if (result === undefined) {
|
|
336
338
|
return i18nString(UIStrings.needsCalibration);
|
|
337
339
|
}
|
|
338
340
|
|
|
339
341
|
if (typeof result === 'string') {
|
|
340
|
-
return
|
|
342
|
+
return PanelsCommon.CPUThrottlingOption.calibrationErrorToString(result);
|
|
341
343
|
}
|
|
342
344
|
|
|
343
345
|
// Shouldn't happen, but let's not throw an error (.toFixed) if the setting
|
|
@@ -349,15 +351,15 @@ export class CPUThrottlingCard {
|
|
|
349
351
|
return i18nString(UIStrings.dSlowdown, {PH1: result.toFixed(1)});
|
|
350
352
|
};
|
|
351
353
|
|
|
352
|
-
const setPresetResult =
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
354
|
+
const setPresetResult = (element: HTMLElement|null,
|
|
355
|
+
result: number|PanelsCommon.CPUThrottlingOption.CalibrationError|undefined): void => {
|
|
356
|
+
if (!element) {
|
|
357
|
+
throw new Error('expected HTMLElement');
|
|
358
|
+
}
|
|
357
359
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
element.textContent = resultToString(result);
|
|
361
|
+
element.classList.toggle('not-calibrated', result === undefined);
|
|
362
|
+
};
|
|
361
363
|
|
|
362
364
|
setPresetResult(this.lowTierMobileDeviceEl.querySelector('.cpu-preset-result'), result.low);
|
|
363
365
|
setPresetResult(this.midTierMobileDeviceEl.querySelector('.cpu-preset-result'), result.mid);
|
|
@@ -41,7 +41,6 @@ import * as i18n from '../../core/i18n/i18n.js';
|
|
|
41
41
|
import * as Platform from '../../core/platform/platform.js';
|
|
42
42
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
43
43
|
import * as Protocol from '../../generated/protocol.js';
|
|
44
|
-
import * as Annotations from '../../models/annotations/annotations.js';
|
|
45
44
|
import * as Bindings from '../../models/bindings/bindings.js';
|
|
46
45
|
import * as HAR from '../../models/har/har.js';
|
|
47
46
|
import * as Logs from '../../models/logs/logs.js';
|
|
@@ -998,14 +997,6 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
|
998
997
|
return this.summaryToolbarInternal;
|
|
999
998
|
}
|
|
1000
999
|
|
|
1001
|
-
getDataGrid(): DataGrid.SortableDataGrid.SortableDataGrid<NetworkNode>|null {
|
|
1002
|
-
if (Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
1003
|
-
return this.dataGrid;
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
return null;
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
1000
|
modelAdded(networkManager: SDK.NetworkManager.NetworkManager): void {
|
|
1010
1001
|
// TODO(allada) Remove dependency on networkManager and instead use NetworkLog and PageLoad for needed data.
|
|
1011
1002
|
const target = networkManager.target();
|
|
@@ -40,12 +40,11 @@ import * as Host from '../../core/host/host.js';
|
|
|
40
40
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
41
41
|
import * as Platform from '../../core/platform/platform.js';
|
|
42
42
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
43
|
-
import * as Annotations from '../../models/annotations/annotations.js';
|
|
44
43
|
import * as Logs from '../../models/logs/logs.js';
|
|
45
44
|
import * as NetworkTimeCalculator from '../../models/network_time_calculator/network_time_calculator.js';
|
|
46
45
|
import * as Trace from '../../models/trace/trace.js';
|
|
47
46
|
import * as Workspace from '../../models/workspace/workspace.js';
|
|
48
|
-
import * as PanelCommon from '../../panels/common/common.js';
|
|
47
|
+
import type * as PanelCommon from '../../panels/common/common.js';
|
|
49
48
|
import * as NetworkForward from '../../panels/network/forward/forward.js';
|
|
50
49
|
import * as Tracing from '../../services/tracing/tracing.js';
|
|
51
50
|
import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
|
|
@@ -340,14 +339,6 @@ export class NetworkPanel extends UI.Panel.Panel implements
|
|
|
340
339
|
HTMLElement);
|
|
341
340
|
panel.element.appendChild(this.fileSelectorElement);
|
|
342
341
|
|
|
343
|
-
if (Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
344
|
-
const dataGrid = this.networkLogView.getDataGrid();
|
|
345
|
-
if (dataGrid) {
|
|
346
|
-
PanelCommon.AnnotationManager.instance().initializePlacementForAnnotationType(
|
|
347
|
-
Annotations.AnnotationType.NETWORK_REQUEST, this.resolveInitialState.bind(this), dataGrid.scrollContainer);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
|
|
351
342
|
this.detailsWidget = new UI.Widget.VBox();
|
|
352
343
|
this.detailsWidget.element.classList.add('network-details-view');
|
|
353
344
|
this.splitWidget.setMainWidget(this.detailsWidget);
|
|
@@ -661,11 +652,6 @@ export class NetworkPanel extends UI.Panel.Panel implements
|
|
|
661
652
|
|
|
662
653
|
// Record the network tool load time after the panel has loaded.
|
|
663
654
|
UI.UIUserMetrics.UIUserMetrics.instance().panelLoaded('network', 'DevTools.Launch.Network');
|
|
664
|
-
|
|
665
|
-
if (Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
666
|
-
void PanelCommon.AnnotationManager.instance().resolveAnnotationsOfType(
|
|
667
|
-
Annotations.AnnotationType.NETWORK_REQUEST);
|
|
668
|
-
}
|
|
669
655
|
}
|
|
670
656
|
|
|
671
657
|
override willHide(): void {
|
|
@@ -765,47 +751,6 @@ export class NetworkPanel extends UI.Panel.Panel implements
|
|
|
765
751
|
return this.networkItemView;
|
|
766
752
|
}
|
|
767
753
|
|
|
768
|
-
async resolveInitialState(
|
|
769
|
-
parentElement: Element, reveal: boolean, lookupId: string,
|
|
770
|
-
anchor?: SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest): Promise<{x: number, y: number}|null> {
|
|
771
|
-
let request = anchor as SDK.NetworkRequest.NetworkRequest;
|
|
772
|
-
if (!this.isShowing()) {
|
|
773
|
-
return null;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
|
-
if (!request) {
|
|
777
|
-
const networkManager =
|
|
778
|
-
SDK.TargetManager.TargetManager.instance().scopeTarget()?.model(SDK.NetworkManager.NetworkManager);
|
|
779
|
-
if (!networkManager) {
|
|
780
|
-
return null;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
const requests = Logs.NetworkLog.NetworkLog.instance().requestsForId(lookupId);
|
|
784
|
-
if (requests.length === 0) {
|
|
785
|
-
console.warn('Network Request list is empty');
|
|
786
|
-
return null;
|
|
787
|
-
}
|
|
788
|
-
request = requests[0];
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
if (reveal) {
|
|
792
|
-
await Common.Revealer.reveal(request);
|
|
793
|
-
await this.selectAndActivateRequest(request);
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
const requestNode = this.networkLogView?.nodeForRequest(request);
|
|
797
|
-
if (requestNode?.element()) {
|
|
798
|
-
const targetRect = requestNode.element().getBoundingClientRect();
|
|
799
|
-
const parentRect = parentElement.getBoundingClientRect();
|
|
800
|
-
const relativeX = 4;
|
|
801
|
-
const relativeY = targetRect.y - parentRect.y + parentElement.scrollTop;
|
|
802
|
-
return {x: relativeX, y: relativeY};
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
console.warn('Could not find element for request:', anchor);
|
|
806
|
-
return null;
|
|
807
|
-
}
|
|
808
|
-
|
|
809
754
|
private updateUI(): void {
|
|
810
755
|
if (this.detailsWidget) {
|
|
811
756
|
this.detailsWidget.element.classList.toggle(
|
|
@@ -905,13 +850,6 @@ export class NetworkPanel extends UI.Panel.Panel implements
|
|
|
905
850
|
Trace.Types.Timing.Milli(this.calculator.minimumBoundary() * 1000),
|
|
906
851
|
Trace.Types.Timing.Milli(this.calculator.maximumBoundary() * 1000));
|
|
907
852
|
this.networkOverview.updateRequest(request);
|
|
908
|
-
|
|
909
|
-
if (Annotations.AnnotationRepository.annotationsEnabled()) {
|
|
910
|
-
requestAnimationFrame(() => {
|
|
911
|
-
void PanelCommon.AnnotationManager.instance().resolveAnnotationsOfType(
|
|
912
|
-
Annotations.AnnotationType.NETWORK_REQUEST);
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
853
|
}
|
|
916
854
|
|
|
917
855
|
resolveLocation(locationName: string): UI.View.ViewLocation|null {
|
|
@@ -2,7 +2,6 @@
|
|
|
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
4
|
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
|
-
|
|
6
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
6
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
7
|
import * as Bindings from '../../models/bindings/bindings.js';
|
|
@@ -10,7 +9,7 @@ import * as Logs from '../../models/logs/logs.js';
|
|
|
10
9
|
import type * as StackTrace from '../../models/stack_trace/stack_trace.js';
|
|
11
10
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
|
12
11
|
import * as UI from '../../ui/legacy/legacy.js';
|
|
13
|
-
import {html, type LitTemplate, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
12
|
+
import {Directives, html, type LitTemplate, nothing, render, type TemplateResult} from '../../ui/lit/lit.js';
|
|
14
13
|
import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
|
|
15
14
|
|
|
16
15
|
import requestInitiatorViewStyles from './requestInitiatorView.css.js';
|
|
@@ -34,6 +33,20 @@ const UIStrings = {
|
|
|
34
33
|
} as const;
|
|
35
34
|
const str_ = i18n.i18n.registerUIStrings('panels/network/RequestInitiatorView.ts', UIStrings);
|
|
36
35
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
36
|
+
|
|
37
|
+
const MAX_URL_LENGTH = 150;
|
|
38
|
+
|
|
39
|
+
function trimUrl(url: string): string {
|
|
40
|
+
if (url.length <= MAX_URL_LENGTH) {
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
// To avoid performance issues with extremely long URLs (e.g. 2MB base64 data URLs),
|
|
44
|
+
// we do a fast O(1) slice instead of using the O(N) Platform.StringUtilities.trimMiddle
|
|
45
|
+
// utility which instantiates Intl.Segmenter and iterates over every grapheme.
|
|
46
|
+
const halfMaxLength = Math.floor(MAX_URL_LENGTH / 2);
|
|
47
|
+
return url.substring(0, halfMaxLength) + '…' + url.substring(url.length - halfMaxLength);
|
|
48
|
+
}
|
|
49
|
+
|
|
37
50
|
export interface ViewInput {
|
|
38
51
|
initiatorGraph: Logs.NetworkLog.InitiatorGraph;
|
|
39
52
|
stackTrace: StackTrace.StackTrace.StackTrace|null;
|
|
@@ -87,11 +100,17 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
|
|
|
87
100
|
const isCurrentRequest = (index === initiators.length - 1);
|
|
88
101
|
const hasFurtherInitiatedNodes = index + 1 < initiators.length;
|
|
89
102
|
const renderedChildren = isCurrentRequest ? renderInitiatedNodes(initiated, request, visited) : nothing;
|
|
103
|
+
const url = request.url();
|
|
104
|
+
// To avoid layout and rendering lag from extremely long URLs (like data: URLs),
|
|
105
|
+
// we only set the title/tooltip attribute if the URL is under 2000 characters.
|
|
106
|
+
const title = url.length < 2000 ? url : undefined;
|
|
90
107
|
|
|
91
108
|
// clang-format off
|
|
92
109
|
return html`
|
|
93
110
|
<li role="treeitem" ?selected=${isCurrentRequest} aria-expanded="true" open>
|
|
94
|
-
<span style=${isCurrentRequest ? 'font-weight: bold' : ''}
|
|
111
|
+
<span style=${isCurrentRequest ? 'font-weight: bold' : ''} title=${Directives.ifDefined(title) as string}>
|
|
112
|
+
${trimUrl(url)}
|
|
113
|
+
</span>
|
|
95
114
|
${hasFurtherInitiatedNodes || renderedChildren !== nothing ? html`
|
|
96
115
|
<ul role="group">
|
|
97
116
|
${renderInitiatorNodes(initiators, index + 1, initiated, visited)}
|
|
@@ -121,9 +140,15 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLE
|
|
|
121
140
|
visited.add(child);
|
|
122
141
|
}
|
|
123
142
|
const renderedChildren = shouldRecurse ? renderInitiatedNodes(initiated, child, visited) : nothing;
|
|
143
|
+
const url = child.url();
|
|
144
|
+
// To avoid layout and rendering lag from extremely long URLs (like data: URLs),
|
|
145
|
+
// we only set the title/tooltip attribute if the URL is under 2000 characters.
|
|
146
|
+
const title = url.length < 2000 ? url : undefined;
|
|
124
147
|
return html`
|
|
125
148
|
<li role="treeitem" aria-expanded="true" open>
|
|
126
|
-
<span
|
|
149
|
+
<span title=${Directives.ifDefined(title) as string}>
|
|
150
|
+
${trimUrl(url)}
|
|
151
|
+
</span>
|
|
127
152
|
${renderedChildren !== nothing ? html`<ul role="group">${renderedChildren}</ul>` : nothing}
|
|
128
153
|
</li>
|
|
129
154
|
`;
|
|
@@ -17,9 +17,8 @@
|
|
|
17
17
|
margin: var(--sys-size-3) 0;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
.row
|
|
21
|
-
|
|
22
|
-
font-size: var(--monospace-font-size);
|
|
20
|
+
.row:hover {
|
|
21
|
+
background-color: var(--sys-color-state-hover-on-subtle);
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
.header-name {
|
|
@@ -57,7 +56,8 @@
|
|
|
57
56
|
display: flex;
|
|
58
57
|
overflow-wrap: anywhere;
|
|
59
58
|
margin-inline-end: 14px;
|
|
60
|
-
font: var(--
|
|
59
|
+
font-family: var(--monospace-font-family);
|
|
60
|
+
font-size: var(--monospace-font-size);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.header-badge-text {
|
|
@@ -85,10 +85,12 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
.call-to-action-body {
|
|
88
|
+
display: flex;
|
|
89
|
+
gap: var(--sys-size-4);
|
|
88
90
|
padding: 6px 0;
|
|
89
|
-
margin-left:
|
|
91
|
+
margin-left: var(--sys-size-1);
|
|
90
92
|
border-left: 2px solid var(--issue-color-yellow);
|
|
91
|
-
padding-left:
|
|
93
|
+
padding-left: 11px;
|
|
92
94
|
line-height: 20px;
|
|
93
95
|
}
|
|
94
96
|
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
}
|
|
118
120
|
|
|
119
121
|
.inline-icon {
|
|
120
|
-
|
|
122
|
+
margin-top: var(--sys-size-2);
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
.row-flex-icon {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
5
5
|
|
|
6
6
|
import '../../../ui/kit/kit.js';
|
|
7
|
-
import '../../../ui/legacy/legacy.js';
|
|
8
7
|
|
|
9
8
|
import * as Host from '../../../core/host/host.js';
|
|
10
9
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
@@ -14,6 +13,7 @@ import type * as Protocol from '../../../generated/protocol.js';
|
|
|
14
13
|
import * as ClientVariations from '../../../third_party/chromium/client-variations/client-variations.js';
|
|
15
14
|
import * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
16
15
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
16
|
+
import * as UI from '../../../ui/legacy/legacy.js';
|
|
17
17
|
import * as Lit from '../../../ui/lit/lit.js';
|
|
18
18
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
19
19
|
|
|
@@ -23,6 +23,10 @@ import headerSectionRowStyles from './HeaderSectionRow.css.js';
|
|
|
23
23
|
const {render, html} = Lit;
|
|
24
24
|
|
|
25
25
|
const UIStrings = {
|
|
26
|
+
/**
|
|
27
|
+
* @description A context menu item to copy the value of a header.
|
|
28
|
+
*/
|
|
29
|
+
copyValue: 'Copy value',
|
|
26
30
|
/**
|
|
27
31
|
* @description Comment used in decoded X-Client-Data HTTP header output in Headers View of the Network panel
|
|
28
32
|
*/
|
|
@@ -197,6 +201,7 @@ export class HeaderSectionRow extends HTMLElement {
|
|
|
197
201
|
<div
|
|
198
202
|
class=${headerValueClasses}
|
|
199
203
|
@copy=${():void => Host.userMetrics.actionTaken(Host.UserMetrics.Action.NetworkPanelCopyValue)}
|
|
204
|
+
@contextmenu=${this.#onContextMenu}
|
|
200
205
|
>
|
|
201
206
|
${this.#renderHeaderValue()}
|
|
202
207
|
</div>
|
|
@@ -483,6 +488,20 @@ export class HeaderSectionRow extends HTMLElement {
|
|
|
483
488
|
}
|
|
484
489
|
event.preventDefault();
|
|
485
490
|
}
|
|
491
|
+
|
|
492
|
+
#onContextMenu(event: Event): void {
|
|
493
|
+
if (!this.#header) {
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
event.stopPropagation();
|
|
497
|
+
event.preventDefault();
|
|
498
|
+
const contextMenu = new UI.ContextMenu.ContextMenu(event);
|
|
499
|
+
contextMenu.clipboardSection().appendItem(i18nString(UIStrings.copyValue), () => {
|
|
500
|
+
Host.InspectorFrontendHost.InspectorFrontendHostInstance.copyText(this.#header?.value || '');
|
|
501
|
+
Host.userMetrics.actionTaken(Host.UserMetrics.Action.NetworkPanelCopyValue);
|
|
502
|
+
});
|
|
503
|
+
void contextMenu.show();
|
|
504
|
+
}
|
|
486
505
|
}
|
|
487
506
|
|
|
488
507
|
customElements.define('devtools-header-section-row', HeaderSectionRow);
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.call-to-action-body {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: var(--sys-size-4);
|
|
27
29
|
padding: 6px 0;
|
|
28
|
-
margin-left:
|
|
30
|
+
margin-left: var(--sys-size-1);
|
|
29
31
|
border-left: 2px solid var(--issue-color-yellow);
|
|
30
|
-
padding-left:
|
|
32
|
+
padding-left: 11px;
|
|
31
33
|
line-height: 20px;
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
.inline-icon {
|
|
59
|
-
|
|
61
|
+
margin-top: var(--sys-size-2);
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
@media (forced-colors: active) {
|
|
@@ -83,9 +83,8 @@ function renderProvisionalHeadersWarning(isRequestCached: boolean): Lit.LitTempl
|
|
|
83
83
|
return html`
|
|
84
84
|
<div class="call-to-action">
|
|
85
85
|
<div class="call-to-action-body">
|
|
86
|
+
<devtools-icon class="inline-icon medium" name='warning-filled'></devtools-icon>
|
|
86
87
|
<div class="explanation" title=${cautionTitle}>
|
|
87
|
-
<devtools-icon class="inline-icon medium" name='warning-filled'>
|
|
88
|
-
</devtools-icon>
|
|
89
88
|
${cautionText} <devtools-link href="https://developer.chrome.com/docs/devtools/network/reference/#provisional-headers" class="link">${i18nString(UIStrings.learnMore)}</devtools-link>
|
|
90
89
|
</div>
|
|
91
90
|
</div>
|