chrome-devtools-frontend 1.0.1656897 → 1.0.1657110
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/AUTHORS +2 -0
- package/docs/get_the_code.md +6 -6
- package/front_end/Tests.js +1 -1
- package/front_end/core/common/Settings.ts +0 -8
- package/front_end/core/host/Platform.ts +4 -0
- package/front_end/core/sdk/CSSMetadata.ts +11 -0
- package/front_end/core/sdk/CSSModel.ts +3 -0
- package/front_end/core/sdk/DOMModel.ts +37 -8
- package/front_end/core/sdk/DebuggerModel.ts +5 -4
- package/front_end/core/sdk/EmulationModel.ts +6 -4
- package/front_end/core/sdk/NetworkManager.ts +21 -14
- package/front_end/core/sdk/RuntimeModel.ts +1 -1
- package/front_end/core/sdk/TargetManager.ts +10 -0
- package/front_end/design_system_tokens.css +6 -0
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +1 -11
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -1
- package/front_end/entrypoints/main/GlobalAiButton.ts +29 -35
- package/front_end/entrypoints/main/MainImpl.ts +1 -1
- package/front_end/entrypoints/main/main-meta.ts +1 -1
- package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +2 -3
- package/front_end/foundation/Universe.ts +33 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +2 -1
- package/front_end/models/emulation/DeviceModeModel.ts +43 -24
- package/front_end/models/live-metrics/LiveMetrics.ts +47 -23
- package/front_end/models/project_settings/ProjectSettingsModel.ts +2 -37
- package/front_end/models/workspace/FileManager.ts +9 -6
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -1
- package/front_end/panels/application/ServiceWorkersView.ts +9 -20
- package/front_end/panels/application/components/StorageMetadataView.ts +7 -2
- package/front_end/panels/common/BadgeNotification.ts +1 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +208 -143
- package/front_end/panels/elements/ElementsTreeOutline.ts +3 -2
- package/front_end/panels/elements/components/AdornerManager.ts +1 -0
- package/front_end/panels/emulation/DeviceModeToolbar.ts +19 -19
- package/front_end/panels/explain/components/ConsoleInsight.ts +2 -1
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +13 -12
- package/front_end/panels/mobile_throttling/ThrottlingManager.ts +8 -7
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +6 -7
- package/front_end/panels/mobile_throttling/mobile_throttling-meta.ts +3 -2
- package/front_end/panels/settings/components/SyncSection.ts +2 -1
- package/front_end/panels/timeline/AppenderUtils.ts +12 -4
- package/front_end/panels/timeline/ThreadAppender.ts +3 -3
- package/front_end/panels/timeline/TimelinePanel.ts +5 -5
- package/front_end/panels/timeline/timelineFlameChartView.css +2 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/chromium/ahem/ahem.js +792 -0
- package/front_end/tsconfig.json +7 -1
- package/front_end/ui/legacy/ActionRegistration.ts +1 -1
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +109 -23
- package/front_end/ui/legacy/theme_support/ThemeSupport.ts +2 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/package.json +1 -1
|
@@ -477,7 +477,7 @@ export class MainImpl {
|
|
|
477
477
|
|
|
478
478
|
new ExecutionContextSelector(targetManager, UI.Context.Context.instance());
|
|
479
479
|
|
|
480
|
-
LiveMetrics.LiveMetrics.instance();
|
|
480
|
+
void LiveMetrics.LiveMetrics.instance().enable();
|
|
481
481
|
CrUXManager.CrUXManager.instance();
|
|
482
482
|
|
|
483
483
|
const builtInAi = AiAssistanceModel.BuiltInAi.BuiltInAi.instance();
|
|
@@ -913,7 +913,7 @@ UI.Toolbar.registerToolbarItem({
|
|
|
913
913
|
},
|
|
914
914
|
async loadItem() {
|
|
915
915
|
const Main = await loadMainModule();
|
|
916
|
-
return Main.GlobalAiButton.GlobalAiButtonToolbarProvider
|
|
916
|
+
return new Main.GlobalAiButton.GlobalAiButtonToolbarProvider();
|
|
917
917
|
},
|
|
918
918
|
order: 98,
|
|
919
919
|
location: UI.Toolbar.ToolbarItemLocation.MAIN_TOOLBAR_RIGHT,
|
|
@@ -95,9 +95,8 @@ export class NodeConnectionsView extends UI.Widget.VBox implements UI.ListWidget
|
|
|
95
95
|
this.element.classList.add('network-discovery-view');
|
|
96
96
|
|
|
97
97
|
const networkDiscoveryFooter = this.element.createChild('div', 'network-discovery-footer');
|
|
98
|
-
const documentationLink = Link.create(
|
|
99
|
-
|
|
100
|
-
'node-js-debugging');
|
|
98
|
+
const documentationLink = Link.create('https://nodejs.org/learn/getting-started/debugging',
|
|
99
|
+
i18nString(UIStrings.nodejsDebuggingGuide), undefined, 'node-js-debugging');
|
|
101
100
|
networkDiscoveryFooter.appendChild(
|
|
102
101
|
uiI18n.getFormatLocalizedString(str_, UIStrings.specifyNetworkEndpointAnd, {PH1: documentationLink}));
|
|
103
102
|
|
|
@@ -10,6 +10,7 @@ import * as AutofillManager from '../models/autofill_manager/autofill_manager.js
|
|
|
10
10
|
import * as Bindings from '../models/bindings/bindings.js';
|
|
11
11
|
import * as Breakpoints from '../models/breakpoints/breakpoints.js';
|
|
12
12
|
import * as CrUXManager from '../models/crux-manager/crux-manager.js';
|
|
13
|
+
import * as Emulation from '../models/emulation/emulation.js';
|
|
13
14
|
import * as JavaScriptMetadata from '../models/javascript_metadata/javascript_metadata.js';
|
|
14
15
|
import * as Logs from '../models/logs/logs.js';
|
|
15
16
|
import * as Persistence from '../models/persistence/persistence.js';
|
|
@@ -60,6 +61,10 @@ export class Universe {
|
|
|
60
61
|
const multitargetNetworkManager = new SDK.NetworkManager.MultitargetNetworkManager(targetManager);
|
|
61
62
|
context.set(SDK.NetworkManager.MultitargetNetworkManager, multitargetNetworkManager);
|
|
62
63
|
|
|
64
|
+
const deviceModeModel =
|
|
65
|
+
new Emulation.DeviceModeModel.DeviceModeModel(targetManager, settings, multitargetNetworkManager);
|
|
66
|
+
context.set(Emulation.DeviceModeModel.DeviceModeModel, deviceModeModel);
|
|
67
|
+
|
|
63
68
|
const pageResourceLoader =
|
|
64
69
|
new SDK.PageResourceLoader.PageResourceLoader(targetManager, settings, multitargetNetworkManager, null);
|
|
65
70
|
context.set(SDK.PageResourceLoader.PageResourceLoader, pageResourceLoader);
|
|
@@ -84,6 +89,14 @@ export class Universe {
|
|
|
84
89
|
const cruxManager = new CrUXManager.CrUXManager(targetManager, settings);
|
|
85
90
|
context.set(CrUXManager.CrUXManager, cruxManager);
|
|
86
91
|
|
|
92
|
+
const isolateManager = new SDK.IsolateManager.IsolateManager(targetManager);
|
|
93
|
+
context.set(SDK.IsolateManager.IsolateManager, isolateManager);
|
|
94
|
+
const eventBreakpointsManager = new SDK.EventBreakpointsModel.EventBreakpointsManager(targetManager);
|
|
95
|
+
context.set(SDK.EventBreakpointsModel.EventBreakpointsManager, eventBreakpointsManager);
|
|
96
|
+
|
|
97
|
+
const domModelUndoStack = new SDK.DOMModel.DOMModelUndoStack();
|
|
98
|
+
context.set(SDK.DOMModel.DOMModelUndoStack, domModelUndoStack);
|
|
99
|
+
|
|
87
100
|
const workspace = new Workspace.Workspace.WorkspaceImpl();
|
|
88
101
|
context.set(Workspace.Workspace.WorkspaceImpl, workspace);
|
|
89
102
|
|
|
@@ -155,19 +168,34 @@ export class Universe {
|
|
|
155
168
|
get cpuThrottlingManager(): SDK.CPUThrottlingManager.CPUThrottlingManager {
|
|
156
169
|
return this.context.get(SDK.CPUThrottlingManager.CPUThrottlingManager);
|
|
157
170
|
}
|
|
158
|
-
|
|
159
171
|
get cruxManager(): CrUXManager.CrUXManager {
|
|
160
172
|
return this.context.get(CrUXManager.CrUXManager);
|
|
161
173
|
}
|
|
162
174
|
|
|
175
|
+
get deviceModeModel(): Emulation.DeviceModeModel.DeviceModeModel {
|
|
176
|
+
return this.context.get(Emulation.DeviceModeModel.DeviceModeModel);
|
|
177
|
+
}
|
|
178
|
+
|
|
163
179
|
get domDebuggerManager(): SDK.DOMDebuggerModel.DOMDebuggerManager {
|
|
164
180
|
return this.context.get(SDK.DOMDebuggerModel.DOMDebuggerManager);
|
|
165
181
|
}
|
|
166
182
|
|
|
183
|
+
get domModelUndoStack(): SDK.DOMModel.DOMModelUndoStack {
|
|
184
|
+
return this.context.get(SDK.DOMModel.DOMModelUndoStack);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
get eventBreakpointsManager(): SDK.EventBreakpointsModel.EventBreakpointsManager {
|
|
188
|
+
return this.context.get(SDK.EventBreakpointsModel.EventBreakpointsManager);
|
|
189
|
+
}
|
|
190
|
+
|
|
167
191
|
get isolatedFileSystemManager(): Persistence.IsolatedFileSystemManager.IsolatedFileSystemManager {
|
|
168
192
|
return this.context.get(Persistence.IsolatedFileSystemManager.IsolatedFileSystemManager);
|
|
169
193
|
}
|
|
170
194
|
|
|
195
|
+
get isolateManager(): SDK.IsolateManager.IsolateManager {
|
|
196
|
+
return this.context.get(SDK.IsolateManager.IsolateManager);
|
|
197
|
+
}
|
|
198
|
+
|
|
171
199
|
get networkPersistenceManager(): Persistence.NetworkPersistenceManager.NetworkPersistenceManager {
|
|
172
200
|
return this.context.get(Persistence.NetworkPersistenceManager.NetworkPersistenceManager);
|
|
173
201
|
}
|
|
@@ -191,4 +219,8 @@ export class Universe {
|
|
|
191
219
|
get targetManager(): SDK.TargetManager.TargetManager {
|
|
192
220
|
return this.context.get(SDK.TargetManager.TargetManager);
|
|
193
221
|
}
|
|
222
|
+
|
|
223
|
+
get workspace(): Workspace.Workspace.WorkspaceImpl {
|
|
224
|
+
return this.context.get(Workspace.Workspace.WorkspaceImpl);
|
|
225
|
+
}
|
|
194
226
|
}
|
|
@@ -489,7 +489,8 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
489
489
|
}
|
|
490
490
|
const functionLocation = frame.functionLocation();
|
|
491
491
|
if (!autoSteppingContext || debuggerPausedDetails.reason !== Protocol.Debugger.PausedEventReason.Step ||
|
|
492
|
-
!functionLocation || !frame.script.isWasm() ||
|
|
492
|
+
!functionLocation || !frame.script.isWasm() ||
|
|
493
|
+
!Common.Settings.Settings.instance().moduleSetting('wasm-auto-stepping').get() ||
|
|
493
494
|
!this.pluginManager.hasPluginForScript(frame.script)) {
|
|
494
495
|
return true;
|
|
495
496
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
|
+
import * as Root from '../../core/root/root.js';
|
|
8
9
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
9
10
|
import * as Protocol from '../../generated/protocol.js';
|
|
10
11
|
import * as Geometry from '../geometry/geometry.js';
|
|
@@ -84,8 +85,6 @@ const UIStrings = {
|
|
|
84
85
|
const str_ = i18n.i18n.registerUIStrings('models/emulation/DeviceModeModel.ts', UIStrings);
|
|
85
86
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
86
87
|
|
|
87
|
-
let deviceModeModelInstance: DeviceModeModel|null;
|
|
88
|
-
|
|
89
88
|
export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements
|
|
90
89
|
SDK.TargetManager.SDKModelObserver<SDK.EmulationModel.EmulationModel> {
|
|
91
90
|
#screenRect: Rect;
|
|
@@ -114,9 +113,19 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
114
113
|
#onModelAvailable: (() => void)|null;
|
|
115
114
|
#outlineRect?: Rect;
|
|
116
115
|
#screenOrientationLocked: boolean;
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
117
|
+
readonly #settings: Common.Settings.Settings;
|
|
118
|
+
readonly #multitargetNetworkManager: SDK.NetworkManager.MultitargetNetworkManager;
|
|
119
|
+
|
|
120
|
+
constructor(
|
|
121
|
+
targetManager: SDK.TargetManager.TargetManager,
|
|
122
|
+
settings: Common.Settings.Settings,
|
|
123
|
+
multitargetNetworkManager: SDK.NetworkManager.MultitargetNetworkManager,
|
|
124
|
+
) {
|
|
119
125
|
super();
|
|
126
|
+
this.#targetManager = targetManager;
|
|
127
|
+
this.#settings = settings;
|
|
128
|
+
this.#multitargetNetworkManager = multitargetNetworkManager;
|
|
120
129
|
this.#screenRect = new Rect(0, 0, 1, 1);
|
|
121
130
|
this.#visiblePageRect = new Rect(0, 0, 1, 1);
|
|
122
131
|
this.#availableSize = new Geometry.Size(1, 1);
|
|
@@ -126,7 +135,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
126
135
|
this.#appliedDeviceScaleFactor = globalThis.devicePixelRatio;
|
|
127
136
|
this.#appliedUserAgentType = UA.DESKTOP;
|
|
128
137
|
|
|
129
|
-
this.#scaleSetting =
|
|
138
|
+
this.#scaleSetting = this.#settings.createSetting('emulation.device-scale', 1);
|
|
130
139
|
// We've used to allow zero before.
|
|
131
140
|
if (!this.#scaleSetting.get()) {
|
|
132
141
|
this.#scaleSetting.set(1);
|
|
@@ -134,7 +143,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
134
143
|
this.#scaleSetting.addChangeListener(this.scaleSettingChanged, this);
|
|
135
144
|
this.#scale = 1;
|
|
136
145
|
|
|
137
|
-
this.#widthSetting =
|
|
146
|
+
this.#widthSetting = this.#settings.createSetting('emulation.device-width', 400);
|
|
138
147
|
if (this.#widthSetting.get() < MinDeviceSize) {
|
|
139
148
|
this.#widthSetting.set(MinDeviceSize);
|
|
140
149
|
}
|
|
@@ -143,7 +152,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
143
152
|
}
|
|
144
153
|
this.#widthSetting.addChangeListener(this.widthSettingChanged, this);
|
|
145
154
|
|
|
146
|
-
this.#heightSetting =
|
|
155
|
+
this.#heightSetting = this.#settings.createSetting('emulation.device-height', 0);
|
|
147
156
|
if (this.#heightSetting.get() && this.#heightSetting.get() < MinDeviceSize) {
|
|
148
157
|
this.#heightSetting.set(MinDeviceSize);
|
|
149
158
|
}
|
|
@@ -152,17 +161,16 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
152
161
|
}
|
|
153
162
|
this.#heightSetting.addChangeListener(this.heightSettingChanged, this);
|
|
154
163
|
|
|
155
|
-
this.#uaSetting =
|
|
164
|
+
this.#uaSetting = this.#settings.createSetting('emulation.device-ua', UA.MOBILE);
|
|
156
165
|
this.#uaSetting.addChangeListener(this.uaSettingChanged, this);
|
|
157
|
-
this.#deviceScaleFactorSetting =
|
|
158
|
-
Common.Settings.Settings.instance().createSetting('emulation.device-scale-factor', 0);
|
|
166
|
+
this.#deviceScaleFactorSetting = this.#settings.createSetting('emulation.device-scale-factor', 0);
|
|
159
167
|
this.#deviceScaleFactorSetting.addChangeListener(this.deviceScaleFactorSettingChanged, this);
|
|
160
168
|
|
|
161
|
-
this.#deviceOutlineSetting =
|
|
169
|
+
this.#deviceOutlineSetting = this.#settings.createSetting('emulation.show-device-outline', false);
|
|
162
170
|
this.#deviceOutlineSetting.addChangeListener(this.deviceOutlineSettingChanged, this);
|
|
163
171
|
|
|
164
|
-
this.#toolbarControlsEnabledSetting =
|
|
165
|
-
|
|
172
|
+
this.#toolbarControlsEnabledSetting = this.#settings.createSetting('emulation.toolbar-controls-enabled', true,
|
|
173
|
+
Common.Settings.SettingStorageType.SESSION);
|
|
166
174
|
|
|
167
175
|
this.#type = Type.None;
|
|
168
176
|
this.#device = null;
|
|
@@ -174,15 +182,20 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
174
182
|
this.#emulationModel = null;
|
|
175
183
|
this.#onModelAvailable = null;
|
|
176
184
|
this.#screenOrientationLocked = false;
|
|
177
|
-
|
|
185
|
+
this.#targetManager.observeModels(SDK.EmulationModel.EmulationModel, this);
|
|
178
186
|
}
|
|
179
187
|
|
|
180
188
|
static instance(opts?: {forceNew: boolean}): DeviceModeModel {
|
|
181
|
-
if (!
|
|
182
|
-
|
|
189
|
+
if (!Root.DevToolsContext.globalInstance().has(DeviceModeModel) || opts?.forceNew) {
|
|
190
|
+
Root.DevToolsContext.globalInstance().set(DeviceModeModel,
|
|
191
|
+
new DeviceModeModel(
|
|
192
|
+
SDK.TargetManager.TargetManager.instance(),
|
|
193
|
+
Common.Settings.Settings.instance(),
|
|
194
|
+
SDK.NetworkManager.MultitargetNetworkManager.instance(),
|
|
195
|
+
));
|
|
183
196
|
}
|
|
184
197
|
|
|
185
|
-
return
|
|
198
|
+
return Root.DevToolsContext.globalInstance().get(DeviceModeModel);
|
|
186
199
|
}
|
|
187
200
|
|
|
188
201
|
/**
|
|
@@ -201,11 +214,14 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
201
214
|
}
|
|
202
215
|
|
|
203
216
|
static removeInstance(): void {
|
|
204
|
-
|
|
217
|
+
if (Root.DevToolsContext.globalInstance().has(DeviceModeModel)) {
|
|
218
|
+
Root.DevToolsContext.globalInstance().get(DeviceModeModel).dispose();
|
|
219
|
+
}
|
|
220
|
+
Root.DevToolsContext.globalInstance().delete(DeviceModeModel);
|
|
205
221
|
}
|
|
206
222
|
|
|
207
223
|
dispose(): void {
|
|
208
|
-
|
|
224
|
+
this.#targetManager.unobserveModels(SDK.EmulationModel.EmulationModel, this);
|
|
209
225
|
}
|
|
210
226
|
|
|
211
227
|
static widthValidator(value: string): {
|
|
@@ -363,6 +379,10 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
363
379
|
'';
|
|
364
380
|
}
|
|
365
381
|
|
|
382
|
+
canShowDeviceFrame(): boolean {
|
|
383
|
+
return Boolean(this.#device && this.#mode && this.#device.outlineImage(this.#mode));
|
|
384
|
+
}
|
|
385
|
+
|
|
366
386
|
outlineRect(): Rect|null {
|
|
367
387
|
return this.#outlineRect || null;
|
|
368
388
|
}
|
|
@@ -412,7 +432,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
412
432
|
}
|
|
413
433
|
|
|
414
434
|
enabledSetting(): Common.Settings.Setting<boolean> {
|
|
415
|
-
return
|
|
435
|
+
return this.#settings.createSetting('emulation.show-device-mode', false);
|
|
416
436
|
}
|
|
417
437
|
|
|
418
438
|
scaleSetting(): Common.Settings.Setting<number> {
|
|
@@ -444,7 +464,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
444
464
|
}
|
|
445
465
|
|
|
446
466
|
modelAdded(emulationModel: SDK.EmulationModel.EmulationModel): void {
|
|
447
|
-
if (emulationModel.target() ===
|
|
467
|
+
if (emulationModel.target() === this.#targetManager.primaryPageTarget() &&
|
|
448
468
|
emulationModel.supportsDeviceEmulation()) {
|
|
449
469
|
this.#emulationModel = emulationModel;
|
|
450
470
|
if (this.#onModelAvailable) {
|
|
@@ -713,8 +733,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
713
733
|
// When the user agent string is empty (e.g. custom desktop device without
|
|
714
734
|
// a UA override), metadata must also be cleared. The backend rejects
|
|
715
735
|
// setUserAgentOverride calls that provide metadata without a UA string.
|
|
716
|
-
|
|
717
|
-
userAgent, userAgent ? userAgentMetadata : null);
|
|
736
|
+
this.#multitargetNetworkManager.setUserAgentOverride(userAgent, userAgent ? userAgentMetadata : null);
|
|
718
737
|
}
|
|
719
738
|
|
|
720
739
|
private applyDeviceMetrics(
|
|
@@ -854,7 +873,7 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
854
873
|
private applyTouch(touchEnabled: boolean, mobile: boolean): void {
|
|
855
874
|
this.#touchEnabled = touchEnabled;
|
|
856
875
|
this.#touchMobile = mobile;
|
|
857
|
-
for (const emulationModel of
|
|
876
|
+
for (const emulationModel of this.#targetManager.models(SDK.EmulationModel.EmulationModel)) {
|
|
858
877
|
void emulationModel.emulateTouch(touchEnabled, mobile);
|
|
859
878
|
}
|
|
860
879
|
}
|
|
@@ -6,6 +6,7 @@ import * as Common from '../../core/common/common.js';
|
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
8
8
|
import * as Platform from '../../core/platform/platform.js';
|
|
9
|
+
import * as Root from '../../core/root/root.js';
|
|
9
10
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
10
11
|
import type * as Protocol from '../../generated/protocol.js';
|
|
11
12
|
import * as EmulationModel from '../../models/emulation/emulation.js';
|
|
@@ -29,8 +30,6 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
|
29
30
|
|
|
30
31
|
const LIVE_METRICS_WORLD_NAME = 'DevTools Performance Metrics';
|
|
31
32
|
|
|
32
|
-
let liveMetricsInstance: LiveMetrics;
|
|
33
|
-
|
|
34
33
|
class InjectedScript {
|
|
35
34
|
static #injectedScript?: string;
|
|
36
35
|
static async get(): Promise<string> {
|
|
@@ -47,6 +46,7 @@ export type InteractionMap = Map<InteractionId, Interaction>;
|
|
|
47
46
|
|
|
48
47
|
export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements SDK.TargetManager.Observer {
|
|
49
48
|
#enabled = false;
|
|
49
|
+
#isCollectingMetrics = false;
|
|
50
50
|
#target?: SDK.Target.Target;
|
|
51
51
|
#scriptIdentifier?: Protocol.Page.ScriptIdentifier;
|
|
52
52
|
#lastResetContextId?: Protocol.Runtime.ExecutionContextId;
|
|
@@ -58,21 +58,24 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
58
58
|
#layoutShifts: LayoutShift[] = [];
|
|
59
59
|
#lastEmulationChangeTime?: number;
|
|
60
60
|
#mutex = new Common.Mutex.Mutex();
|
|
61
|
-
#
|
|
61
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
62
|
+
readonly #deviceModeModel: EmulationModel.DeviceModeModel.DeviceModeModel|null;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
constructor(targetManager: SDK.TargetManager.TargetManager,
|
|
65
|
+
deviceModeModel: EmulationModel.DeviceModeModel.DeviceModeModel|null) {
|
|
64
66
|
super();
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
targetManager.
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
this.#targetManager = targetManager;
|
|
68
|
+
this.#deviceModeModel = deviceModeModel;
|
|
69
|
+
this.#targetManager.observeTargets(this, {scoped: true});
|
|
70
|
+
this.#targetManager.addModelListener(SDK.ResourceTreeModel.ResourceTreeModel,
|
|
71
|
+
SDK.ResourceTreeModel.Events.PrimaryPageChanged, this.#onPrimaryPageChanged,
|
|
72
|
+
this);
|
|
70
73
|
}
|
|
71
74
|
|
|
72
75
|
#onPrimaryPageChanged(
|
|
73
76
|
event: Common.EventTarget.EventTargetEvent<
|
|
74
77
|
{frame: SDK.ResourceTreeModel.ResourceTreeFrame, type: SDK.ResourceTreeModel.PrimaryPageChangeType}>): void {
|
|
75
|
-
const primaryTarget =
|
|
78
|
+
const primaryTarget = this.#targetManager.primaryPageTarget();
|
|
76
79
|
if (!primaryTarget) {
|
|
77
80
|
return;
|
|
78
81
|
}
|
|
@@ -86,19 +89,22 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
86
89
|
|
|
87
90
|
async #switchToTarget(newTarget: SDK.Target.Target): Promise<void> {
|
|
88
91
|
if (this.#target) {
|
|
89
|
-
await this
|
|
92
|
+
await this.#stopCollectingMetrics();
|
|
90
93
|
}
|
|
91
94
|
this.#target = newTarget;
|
|
92
|
-
await this
|
|
95
|
+
await this.#startCollectingMetrics();
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
static instance(opts: {forceNew?: boolean} = {forceNew: false}): LiveMetrics {
|
|
96
99
|
const {forceNew} = opts;
|
|
97
|
-
if (!
|
|
98
|
-
|
|
100
|
+
if (!Root.DevToolsContext.globalInstance().has(LiveMetrics) || forceNew) {
|
|
101
|
+
Root.DevToolsContext.globalInstance().set(
|
|
102
|
+
LiveMetrics,
|
|
103
|
+
new LiveMetrics(SDK.TargetManager.TargetManager.instance(),
|
|
104
|
+
EmulationModel.DeviceModeModel.DeviceModeModel.tryInstance()));
|
|
99
105
|
}
|
|
100
106
|
|
|
101
|
-
return
|
|
107
|
+
return Root.DevToolsContext.globalInstance().get(LiveMetrics);
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
get lcpValue(): LcpValue|undefined {
|
|
@@ -481,11 +487,11 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
481
487
|
|
|
482
488
|
async targetAdded(target: SDK.Target.Target): Promise<void> {
|
|
483
489
|
// Scoped observers can also receive events for OOPIFs and workers.
|
|
484
|
-
if (target !==
|
|
490
|
+
if (target !== this.#targetManager.primaryPageTarget()) {
|
|
485
491
|
return;
|
|
486
492
|
}
|
|
487
493
|
this.#target = target;
|
|
488
|
-
await this
|
|
494
|
+
await this.#startCollectingMetrics();
|
|
489
495
|
}
|
|
490
496
|
|
|
491
497
|
async targetRemoved(target: SDK.Target.Target): Promise<void> {
|
|
@@ -493,11 +499,29 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
493
499
|
if (target !== this.#target) {
|
|
494
500
|
return;
|
|
495
501
|
}
|
|
496
|
-
await this
|
|
502
|
+
await this.#stopCollectingMetrics();
|
|
497
503
|
this.#target = undefined;
|
|
498
504
|
}
|
|
499
505
|
|
|
500
506
|
async enable(): Promise<void> {
|
|
507
|
+
if (this.#enabled) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
this.#enabled = true;
|
|
511
|
+
if (this.#target) {
|
|
512
|
+
await this.#startCollectingMetrics();
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
async disable(): Promise<void> {
|
|
517
|
+
if (!this.#enabled) {
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
this.#enabled = false;
|
|
521
|
+
await this.#stopCollectingMetrics();
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
async #startCollectingMetrics(): Promise<void> {
|
|
501
525
|
if (Host.InspectorFrontendHost.isUnderTest()) {
|
|
502
526
|
// Enabling this impacts a lot of layout tests; we will work on fixing
|
|
503
527
|
// them but for now it is easier to not run this page in layout tests.
|
|
@@ -505,7 +529,7 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
505
529
|
return;
|
|
506
530
|
}
|
|
507
531
|
|
|
508
|
-
if (!this.#target || this.#enabled) {
|
|
532
|
+
if (!this.#target || !this.#enabled || this.#isCollectingMetrics) {
|
|
509
533
|
return;
|
|
510
534
|
}
|
|
511
535
|
|
|
@@ -556,11 +580,11 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
556
580
|
this.#deviceModeModel?.addEventListener(
|
|
557
581
|
EmulationModel.DeviceModeModel.Events.UPDATED, this.#onEmulationChanged, this);
|
|
558
582
|
|
|
559
|
-
this.#
|
|
583
|
+
this.#isCollectingMetrics = true;
|
|
560
584
|
}
|
|
561
585
|
|
|
562
|
-
async
|
|
563
|
-
if (!this.#target || !this.#
|
|
586
|
+
async #stopCollectingMetrics(): Promise<void> {
|
|
587
|
+
if (!this.#target || !this.#isCollectingMetrics) {
|
|
564
588
|
return;
|
|
565
589
|
}
|
|
566
590
|
|
|
@@ -594,7 +618,7 @@ export class LiveMetrics extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
594
618
|
this.#deviceModeModel?.removeEventListener(
|
|
595
619
|
EmulationModel.DeviceModeModel.Events.UPDATED, this.#onEmulationChanged, this);
|
|
596
620
|
|
|
597
|
-
this.#
|
|
621
|
+
this.#isCollectingMetrics = false;
|
|
598
622
|
}
|
|
599
623
|
}
|
|
600
624
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
|
-
import * as Root from '../../core/root/root.js';
|
|
7
|
+
import type * as Root from '../../core/root/root.js';
|
|
8
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
9
9
|
|
|
10
10
|
/** The security origin for all DevTools (front-end) resources. */
|
|
@@ -127,42 +127,7 @@ export class ProjectSettingsModel extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
* Yields the `ProjectSettingsModel` singleton.
|
|
132
|
-
*
|
|
133
|
-
* @returns the singleton.
|
|
134
|
-
*/
|
|
135
|
-
static instance({forceNew, hostConfig, pageResourceLoader, targetManager}: {
|
|
136
|
-
forceNew: boolean|null,
|
|
137
|
-
hostConfig: Root.Runtime.HostConfig|null,
|
|
138
|
-
pageResourceLoader: SDK.PageResourceLoader.PageResourceLoader|null,
|
|
139
|
-
targetManager: SDK.TargetManager.TargetManager|null,
|
|
140
|
-
}): ProjectSettingsModel {
|
|
141
|
-
if (!Root.DevToolsContext.globalInstance().has(ProjectSettingsModel) || forceNew) {
|
|
142
|
-
if (!hostConfig || !pageResourceLoader || !targetManager) {
|
|
143
|
-
throw new Error(
|
|
144
|
-
'Unable to create ProjectSettingsModel: ' +
|
|
145
|
-
'hostConfig, pageResourceLoader, and targetManager must be provided');
|
|
146
|
-
}
|
|
147
|
-
Root.DevToolsContext.globalInstance().set(
|
|
148
|
-
ProjectSettingsModel,
|
|
149
|
-
new ProjectSettingsModel(hostConfig, pageResourceLoader, targetManager),
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
return Root.DevToolsContext.globalInstance().get(ProjectSettingsModel);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Clears the `ProjectSettingsModel` singleton (if any);
|
|
157
|
-
*/
|
|
158
|
-
static removeInstance(): void {
|
|
159
|
-
if (Root.DevToolsContext.globalInstance().has(ProjectSettingsModel)) {
|
|
160
|
-
Root.DevToolsContext.globalInstance().get(ProjectSettingsModel).#dispose();
|
|
161
|
-
Root.DevToolsContext.globalInstance().delete(ProjectSettingsModel);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
#dispose(): void {
|
|
130
|
+
disposeForTest(): void {
|
|
166
131
|
this.#targetManager.removeEventListener(
|
|
167
132
|
SDK.TargetManager.Events.INSPECTED_URL_CHANGED,
|
|
168
133
|
this.#inspectedURLChanged,
|
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
|
7
7
|
import type * as Platform from '../../core/platform/platform.js';
|
|
8
|
+
import * as Root from '../../core/root/root.js';
|
|
8
9
|
import type * as TextUtils from '../text_utils/text_utils.js';
|
|
9
10
|
|
|
10
|
-
let fileManagerInstance: FileManager|null;
|
|
11
|
-
|
|
12
11
|
export interface SaveCallbackParam {
|
|
13
12
|
fileSystemPath?: Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString;
|
|
14
13
|
}
|
|
@@ -16,7 +15,7 @@ export interface SaveCallbackParam {
|
|
|
16
15
|
export class FileManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
17
16
|
readonly #saveCallbacks = new Map<
|
|
18
17
|
Platform.DevToolsPath.RawPathString|Platform.DevToolsPath.UrlString, (arg0: SaveCallbackParam|null) => void>();
|
|
19
|
-
|
|
18
|
+
constructor() {
|
|
20
19
|
super();
|
|
21
20
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.events.addEventListener(
|
|
22
21
|
Host.InspectorFrontendHostAPI.Events.SavedURL, this.savedURL, this);
|
|
@@ -28,11 +27,15 @@ export class FileManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
|
28
27
|
|
|
29
28
|
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): FileManager {
|
|
30
29
|
const {forceNew} = opts;
|
|
31
|
-
if (!
|
|
32
|
-
|
|
30
|
+
if (!Root.DevToolsContext.globalInstance().has(FileManager) || forceNew) {
|
|
31
|
+
Root.DevToolsContext.globalInstance().set(FileManager, new FileManager());
|
|
33
32
|
}
|
|
34
33
|
|
|
35
|
-
return
|
|
34
|
+
return Root.DevToolsContext.globalInstance().get(FileManager);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static removeInstance(): void {
|
|
38
|
+
Root.DevToolsContext.globalInstance().delete(FileManager);
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
/**
|
|
@@ -950,7 +950,8 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
950
950
|
|
|
951
951
|
#getAiAssistanceEnabledSetting(): Common.Settings.Setting<boolean>|undefined {
|
|
952
952
|
try {
|
|
953
|
-
return Common.Settings.moduleSetting('ai-assistance-enabled') as
|
|
953
|
+
return Common.Settings.Settings.instance().moduleSetting('ai-assistance-enabled') as
|
|
954
|
+
Common.Settings.Setting<boolean>;
|
|
954
955
|
} catch {
|
|
955
956
|
return;
|
|
956
957
|
}
|
|
@@ -509,9 +509,12 @@ export class Section {
|
|
|
509
509
|
this.section.appendButtonToHeader(this.deleteButton);
|
|
510
510
|
|
|
511
511
|
// Preserve the order.
|
|
512
|
-
this.sourceField = this.
|
|
513
|
-
this.statusField = this.
|
|
514
|
-
this.clientsField = this.
|
|
512
|
+
this.sourceField = this.section.appendField(i18nString(UIStrings.source));
|
|
513
|
+
this.statusField = this.section.appendField(i18nString(UIStrings.status));
|
|
514
|
+
this.clientsField = this.section.appendField(i18nString(UIStrings.clients));
|
|
515
|
+
|
|
516
|
+
UI.DOMUtilities.appendStyle(this.section.getFieldElement(), serviceWorkersViewStyles,
|
|
517
|
+
serviceWorkerUpdateCycleViewStyles);
|
|
515
518
|
this.createSyncNotificationField(i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(),
|
|
516
519
|
i18nString(UIStrings.pushData), this.push.bind(this), 'push-message');
|
|
517
520
|
this.createSyncNotificationField(i18nString(UIStrings.syncString), this.syncTagNameSetting.get(),
|
|
@@ -528,7 +531,7 @@ export class Section {
|
|
|
528
531
|
|
|
529
532
|
private createSyncNotificationField(label: string, initialValue: string, placeholder: string,
|
|
530
533
|
callback: (arg0: string) => void, jslogContext: string): void {
|
|
531
|
-
const fieldElement = this.
|
|
534
|
+
const fieldElement = this.section.appendField(label);
|
|
532
535
|
|
|
533
536
|
// clang-format off
|
|
534
537
|
// eslint-disable-next-line @devtools/no-lit-render-outside-of-view
|
|
@@ -714,7 +717,7 @@ export class Section {
|
|
|
714
717
|
}
|
|
715
718
|
|
|
716
719
|
private createUpdateCycleField(): void {
|
|
717
|
-
this.updateCycleField = this.
|
|
720
|
+
this.updateCycleField = this.section.appendField(i18nString(UIStrings.updateCycle));
|
|
718
721
|
this.updateCycleField.appendChild(this.updateCycleView.tableElement);
|
|
719
722
|
}
|
|
720
723
|
|
|
@@ -725,7 +728,7 @@ export class Section {
|
|
|
725
728
|
if (active?.routerRules && active.routerRules.length > 0) {
|
|
726
729
|
// If there is at least one registered rule in the active version, append the router filed.
|
|
727
730
|
if (!this.routerField) {
|
|
728
|
-
this.routerField = this.
|
|
731
|
+
this.routerField = this.section.appendField(title);
|
|
729
732
|
}
|
|
730
733
|
if (!this.routerField.lastElementChild) {
|
|
731
734
|
this.routerView.show(this.routerField);
|
|
@@ -819,18 +822,4 @@ export class Section {
|
|
|
819
822
|
private stopButtonClicked(versionId: string): void {
|
|
820
823
|
void this.manager.stopWorker(versionId);
|
|
821
824
|
}
|
|
822
|
-
|
|
823
|
-
private wrapWidget(container: Element): HTMLElement {
|
|
824
|
-
const shadowRoot = UI.UIUtils.createShadowRootWithCoreStyles(container, {
|
|
825
|
-
cssFile: [
|
|
826
|
-
serviceWorkersViewStyles,
|
|
827
|
-
/* These styles are for the timing table in serviceWorkerUpdateCycleView but this is the widget that it is rendered
|
|
828
|
-
* inside so we are registering the files here. */
|
|
829
|
-
serviceWorkerUpdateCycleViewStyles,
|
|
830
|
-
],
|
|
831
|
-
});
|
|
832
|
-
const contentElement = document.createElement('div');
|
|
833
|
-
shadowRoot.appendChild(contentElement);
|
|
834
|
-
return contentElement;
|
|
835
|
-
}
|
|
836
825
|
}
|
|
@@ -254,6 +254,9 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
254
254
|
${this.key(i18nString(UIStrings.bucketName))}
|
|
255
255
|
${this.value(renderBucketName())}`;
|
|
256
256
|
}
|
|
257
|
+
// If quota is 0, it means no custom quota limit has been set on the bucket.
|
|
258
|
+
// We do not render it here to avoid confusing the user (who might interpret
|
|
259
|
+
// a 0 quota as a full bucket/0 capacity rather than sharing the default origin limit).
|
|
257
260
|
// clang-format off
|
|
258
261
|
return html`
|
|
259
262
|
${this.key(i18nString(UIStrings.bucketName))}
|
|
@@ -262,8 +265,10 @@ export class StorageMetadataView extends LegacyWrapper.LegacyWrapper.WrappableCo
|
|
|
262
265
|
${this.value(persistent ? i18nString(UIStrings.yes) : i18nString(UIStrings.no))}
|
|
263
266
|
${this.key(i18nString(UIStrings.durability))}
|
|
264
267
|
${this.value(durability)}
|
|
265
|
-
${
|
|
266
|
-
|
|
268
|
+
${quota !== 0 ? html`
|
|
269
|
+
${this.key(i18nString(UIStrings.quota))}
|
|
270
|
+
${this.value(i18n.ByteUtilities.bytesToString(quota))}
|
|
271
|
+
` : nothing}
|
|
267
272
|
${this.key(i18nString(UIStrings.expiration))}
|
|
268
273
|
${this.value(this.#getExpirationString())}`;
|
|
269
274
|
}
|
|
@@ -139,7 +139,7 @@ const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement)
|
|
|
139
139
|
type View = typeof DEFAULT_VIEW;
|
|
140
140
|
|
|
141
141
|
function revealBadgeSettings(): void {
|
|
142
|
-
void Common.Revealer.reveal(Common.Settings.moduleSetting('receive-gdp-badges'));
|
|
142
|
+
void Common.Revealer.reveal(Common.Settings.Settings.instance().moduleSetting('receive-gdp-badges'));
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
export class BadgeNotification extends UI.Widget.Widget {
|