chrome-devtools-frontend 1.0.1656291 → 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 +44 -13
- 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/SourceMapCache.ts +2 -4
- package/front_end/core/sdk/SourceMapManager.ts +8 -7
- 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/SimpleApp.ts +0 -13
- package/front_end/entrypoints/main/main-meta.ts +2 -2
- package/front_end/entrypoints/node_app/app/NodeConnectionsPanel.ts +2 -3
- package/front_end/foundation/Universe.ts +44 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -2
- package/front_end/generated/protocol.ts +5 -5
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +2 -1
- package/front_end/models/crux-manager/CrUXManager.ts +16 -11
- 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 +177 -163
- package/front_end/panels/application/components/StorageMetadataView.ts +7 -2
- package/front_end/panels/application/serviceWorkersView.css +8 -0
- package/front_end/panels/common/BadgeNotification.ts +1 -1
- package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -1
- package/front_end/panels/elements/ElementsPanel.ts +35 -28
- 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/elements/elements-meta.ts +3 -2
- 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
|
@@ -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
|
}
|