chrome-devtools-frontend 1.0.1602543 → 1.0.1604514
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/version-control/SKILL.md +17 -2
- package/front_end/core/host/AidaClient.ts +39 -462
- package/front_end/core/host/AidaClientTypes.ts +470 -0
- package/front_end/core/host/AidaGcaTranslation.ts +225 -122
- package/front_end/core/host/GcaTypes.ts +107 -155
- package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +24 -22
- package/front_end/core/sdk/EmulationModel.ts +21 -23
- package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
- package/front_end/core/sdk/NetworkManager.ts +35 -28
- package/front_end/core/sdk/OverlayModel.ts +23 -23
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +13 -10
- package/front_end/core/sdk/PreloadingModel.ts +3 -4
- package/front_end/core/sdk/RuntimeModel.ts +5 -5
- package/front_end/core/sdk/ServiceWorkerManager.ts +6 -5
- package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
- package/front_end/core/sdk/TargetManager.ts +5 -0
- package/front_end/core/sdk/WebMCPModel.ts +6 -0
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +7 -0
- package/front_end/generated/SupportedCSSProperties.js +68 -2
- package/front_end/generated/protocol-mapping.d.ts +15 -0
- package/front_end/generated/protocol-proxy-api.d.ts +24 -0
- package/front_end/generated/protocol.ts +79 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +16 -5
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +60 -9
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +71 -15
- package/front_end/models/bindings/TempFile.ts +1 -4
- package/front_end/models/extensions/ExtensionAPI.ts +1 -1
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
- package/front_end/models/javascript_metadata/NativeFunctions.js +12 -8
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +10 -8
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +91 -21
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +90 -32
- package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
- package/front_end/panels/ai_assistance/components/WalkthroughView.ts +65 -17
- package/front_end/panels/ai_assistance/components/chatMessage.css +33 -7
- package/front_end/panels/ai_assistance/components/walkthroughView.css +35 -5
- package/front_end/panels/common/ThrottlingUtils.ts +46 -0
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/elements/ComputedStyleWidget.ts +11 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
- package/front_end/panels/elements/StandaloneStylesContainer.ts +0 -3
- package/front_end/panels/elements/StylePropertiesSection.ts +0 -49
- package/front_end/panels/elements/StylesContainer.ts +0 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +32 -7
- package/front_end/panels/elements/elementsTreeOutline.css +18 -0
- package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +14 -0
- package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
- package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
- package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
- package/front_end/panels/profiler/ProfileView.ts +0 -9
- package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
- package/front_end/panels/sensors/SensorsView.ts +0 -2
- package/front_end/panels/settings/keybindsSettingsTab.css +25 -31
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +8 -0
- package/front_end/panels/timeline/TimelinePanel.ts +15 -5
- package/front_end/panels/timeline/components/FieldSettingsDialog.ts +5 -9
- package/front_end/panels/timeline/components/LiveMetricsView.ts +36 -65
- package/front_end/panels/timeline/components/OriginMap.ts +176 -159
- package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
- package/front_end/panels/timeline/components/originMap.css +4 -51
- package/front_end/panels/timeline/thirdPartyTreeView.css +6 -0
- package/front_end/panels/timeline/timeline-meta.ts +11 -0
- package/front_end/panels/timeline/utils/Helpers.ts +5 -25
- package/front_end/third_party/acorn/README.chromium +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/{list → lists}/List.ts +1 -1
- package/front_end/ui/components/{list → lists}/list.css +0 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +3 -3
- package/package.json +1 -1
- /package/front_end/ui/components/{list → lists}/lists.ts +0 -0
|
@@ -11,21 +11,18 @@ import type {RemoteObject} from './RemoteObject.js';
|
|
|
11
11
|
import {RuntimeModel} from './RuntimeModel.js';
|
|
12
12
|
import {SDKModel} from './SDKModel.js';
|
|
13
13
|
import {Capability, type Target} from './Target.js';
|
|
14
|
-
import {TargetManager} from './TargetManager.js';
|
|
15
14
|
|
|
16
15
|
export class HeapProfilerModel extends SDKModel<EventTypes> {
|
|
17
|
-
#enabled
|
|
16
|
+
#enabled = false;
|
|
18
17
|
readonly #heapProfilerAgent: ProtocolProxyApi.HeapProfilerApi;
|
|
19
18
|
readonly #runtimeModel: RuntimeModel;
|
|
20
|
-
#samplingProfilerDepth
|
|
19
|
+
#samplingProfilerDepth = 0;
|
|
21
20
|
|
|
22
21
|
constructor(target: Target) {
|
|
23
22
|
super(target);
|
|
24
23
|
target.registerHeapProfilerDispatcher(new HeapProfilerDispatcher(this));
|
|
25
|
-
this.#enabled = false;
|
|
26
24
|
this.#heapProfilerAgent = target.heapProfilerAgent();
|
|
27
25
|
this.#runtimeModel = (target.model(RuntimeModel) as RuntimeModel);
|
|
28
|
-
this.#samplingProfilerDepth = 0;
|
|
29
26
|
}
|
|
30
27
|
|
|
31
28
|
debuggerModel(): DebuggerModel {
|
|
@@ -107,11 +104,11 @@ export class HeapProfilerModel extends SDKModel<EventTypes> {
|
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
async takeHeapSnapshot(heapSnapshotOptions: Protocol.HeapProfiler.TakeHeapSnapshotRequest): Promise<void> {
|
|
110
|
-
await
|
|
107
|
+
await this.target().targetManager().suspendAllTargets('heap-snapshot');
|
|
111
108
|
try {
|
|
112
109
|
await this.#heapProfilerAgent.invoke_takeHeapSnapshot(heapSnapshotOptions);
|
|
113
110
|
} finally {
|
|
114
|
-
await
|
|
111
|
+
await this.target().targetManager().resumeAllTargets();
|
|
115
112
|
}
|
|
116
113
|
}
|
|
117
114
|
|
|
@@ -129,13 +129,15 @@ const CONNECTION_TYPES = new Map([
|
|
|
129
129
|
* to in multiple places, and this ensures we don't have accidental typos which
|
|
130
130
|
* mean extra settings get mistakenly created.
|
|
131
131
|
*/
|
|
132
|
-
export function customUserNetworkConditionsSetting(
|
|
133
|
-
|
|
132
|
+
export function customUserNetworkConditionsSetting(
|
|
133
|
+
settings: Common.Settings.Settings = Common.Settings.Settings.instance()): Common.Settings.Setting<Conditions[]> {
|
|
134
|
+
return settings.moduleSetting<Conditions[]>('custom-network-conditions');
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
export function activeNetworkThrottlingKeySetting(
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
export function activeNetworkThrottlingKeySetting(
|
|
138
|
+
settings: Common.Settings.Settings =
|
|
139
|
+
Common.Settings.Settings.instance()): Common.Settings.Setting<ThrottlingConditionKey> {
|
|
140
|
+
return settings.createSetting('active-network-condition-key', PredefinedThrottlingConditionKey.NO_THROTTLING);
|
|
139
141
|
}
|
|
140
142
|
|
|
141
143
|
export class NetworkManager extends SDKModel<EventTypes> {
|
|
@@ -144,8 +146,7 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
|
144
146
|
readonly #networkAgent: ProtocolProxyApi.NetworkApi;
|
|
145
147
|
readonly #bypassServiceWorkerSetting: Common.Settings.Setting<boolean>;
|
|
146
148
|
|
|
147
|
-
readonly activeNetworkThrottlingKey: Common.Settings.Setting<ThrottlingConditionKey
|
|
148
|
-
activeNetworkThrottlingKeySetting();
|
|
149
|
+
readonly activeNetworkThrottlingKey: Common.Settings.Setting<ThrottlingConditionKey>;
|
|
149
150
|
|
|
150
151
|
constructor(target: Target) {
|
|
151
152
|
super(target);
|
|
@@ -154,7 +155,11 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
|
154
155
|
this.#networkAgent = target.networkAgent();
|
|
155
156
|
target.registerNetworkDispatcher(this.dispatcher);
|
|
156
157
|
target.registerFetchDispatcher(this.fetchDispatcher);
|
|
157
|
-
|
|
158
|
+
|
|
159
|
+
const settings = this.target().targetManager().settings;
|
|
160
|
+
this.activeNetworkThrottlingKey = activeNetworkThrottlingKeySetting(settings);
|
|
161
|
+
|
|
162
|
+
if (settings.moduleSetting('cache-disabled').get()) {
|
|
158
163
|
void this.#networkAgent.invoke_setCacheDisabled({cacheDisabled: true});
|
|
159
164
|
}
|
|
160
165
|
|
|
@@ -166,16 +171,13 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
|
166
171
|
});
|
|
167
172
|
void this.#networkAgent.invoke_setAttachDebugStack({enabled: true});
|
|
168
173
|
|
|
169
|
-
this.#bypassServiceWorkerSetting =
|
|
170
|
-
Common.Settings.Settings.instance().createSetting('bypass-service-worker', false);
|
|
174
|
+
this.#bypassServiceWorkerSetting = settings.createSetting('bypass-service-worker', false);
|
|
171
175
|
if (this.#bypassServiceWorkerSetting.get()) {
|
|
172
176
|
this.bypassServiceWorkerChanged();
|
|
173
177
|
}
|
|
174
178
|
this.#bypassServiceWorkerSetting.addChangeListener(this.bypassServiceWorkerChanged, this);
|
|
175
179
|
|
|
176
|
-
|
|
177
|
-
.moduleSetting('cache-disabled')
|
|
178
|
-
.addChangeListener(this.cacheDisabledSettingChanged, this);
|
|
180
|
+
settings.moduleSetting('cache-disabled').addChangeListener(this.cacheDisabledSettingChanged, this);
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
static forRequest(request: NetworkRequest): NetworkManager|null {
|
|
@@ -372,9 +374,8 @@ export class NetworkManager extends SDKModel<EventTypes> {
|
|
|
372
374
|
}
|
|
373
375
|
|
|
374
376
|
override dispose(): void {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
.removeChangeListener(this.cacheDisabledSettingChanged, this);
|
|
377
|
+
const settings = this.target().targetManager().settings;
|
|
378
|
+
settings.moduleSetting('cache-disabled').removeChangeListener(this.cacheDisabledSettingChanged, this);
|
|
378
379
|
}
|
|
379
380
|
|
|
380
381
|
private bypassServiceWorkerChanged(): void {
|
|
@@ -1212,7 +1213,8 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
|
1212
1213
|
this.#manager.dispatchEventToListeners(Events.RequestFinished, networkRequest);
|
|
1213
1214
|
MultitargetNetworkManager.instance().inflightMainResourceRequests.delete(networkRequest.requestId());
|
|
1214
1215
|
|
|
1215
|
-
|
|
1216
|
+
const settings = this.#manager.target().targetManager().settings;
|
|
1217
|
+
if (settings.moduleSetting('monitoring-xhr-enabled').get() &&
|
|
1216
1218
|
networkRequest.resourceType().category() === Common.ResourceType.resourceCategories.XHR) {
|
|
1217
1219
|
let message;
|
|
1218
1220
|
const failedToLoad = networkRequest.failed || networkRequest.hasErrorStatusCode();
|
|
@@ -1677,7 +1679,9 @@ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<Request
|
|
|
1677
1679
|
#conditions: ThrottlingConditions;
|
|
1678
1680
|
#ruleIds = new Set<string>();
|
|
1679
1681
|
|
|
1680
|
-
static createFromSetting(
|
|
1682
|
+
static createFromSetting(
|
|
1683
|
+
setting: RequestConditionsSetting,
|
|
1684
|
+
settings: Common.Settings.Settings = Common.Settings.Settings.instance()): RequestCondition {
|
|
1681
1685
|
if ('urlPattern' in setting) {
|
|
1682
1686
|
const pattern = RequestURLPattern.create(setting.urlPattern) ?? {
|
|
1683
1687
|
wildcardURL: setting.urlPattern,
|
|
@@ -1685,7 +1689,7 @@ export class RequestCondition extends Common.ObjectWrapper.ObjectWrapper<Request
|
|
|
1685
1689
|
};
|
|
1686
1690
|
|
|
1687
1691
|
const conditions = getPredefinedOrBlockingCondition(setting.conditions) ??
|
|
1688
|
-
customUserNetworkConditionsSetting().get().find(condition => condition.key === setting.conditions) ??
|
|
1692
|
+
customUserNetworkConditionsSetting(settings).get().find(condition => condition.key === setting.conditions) ??
|
|
1689
1693
|
NoThrottlingConditions;
|
|
1690
1694
|
|
|
1691
1695
|
return new this(pattern, setting.enabled, conditions);
|
|
@@ -1785,10 +1789,8 @@ export namespace RequestCondition {
|
|
|
1785
1789
|
}
|
|
1786
1790
|
|
|
1787
1791
|
export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<RequestConditions.EventTypes> {
|
|
1788
|
-
readonly #setting
|
|
1789
|
-
|
|
1790
|
-
readonly #conditionsEnabledSetting =
|
|
1791
|
-
Common.Settings.Settings.instance().moduleSetting<boolean>('request-blocking-enabled');
|
|
1792
|
+
readonly #setting: Common.Settings.Setting<RequestConditionsSetting[]>;
|
|
1793
|
+
readonly #conditionsEnabledSetting: Common.Settings.Setting<boolean>;
|
|
1792
1794
|
readonly #conditions: RequestCondition[] = [];
|
|
1793
1795
|
readonly #requestConditionsById = new Map<string, {
|
|
1794
1796
|
conditions: Conditions,
|
|
@@ -1796,11 +1798,13 @@ export class RequestConditions extends Common.ObjectWrapper.ObjectWrapper<Reques
|
|
|
1796
1798
|
}>();
|
|
1797
1799
|
#conditionsAppliedForTestPromise: Promise<unknown> = Promise.resolve();
|
|
1798
1800
|
|
|
1799
|
-
constructor() {
|
|
1801
|
+
constructor(settings: Common.Settings.Settings) {
|
|
1800
1802
|
super();
|
|
1803
|
+
this.#setting = settings.createSetting<RequestConditionsSetting[]>('network-blocked-patterns', []);
|
|
1804
|
+
this.#conditionsEnabledSetting = settings.moduleSetting<boolean>('request-blocking-enabled');
|
|
1801
1805
|
for (const condition of this.#setting.get()) {
|
|
1802
1806
|
try {
|
|
1803
|
-
this.#conditions.push(RequestCondition.createFromSetting(condition));
|
|
1807
|
+
this.#conditions.push(RequestCondition.createFromSetting(condition, settings));
|
|
1804
1808
|
} catch (e) {
|
|
1805
1809
|
console.error('Error loading throttling settings: ', e);
|
|
1806
1810
|
}
|
|
@@ -2003,7 +2007,7 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
2003
2007
|
readonly inflightMainResourceRequests = new Map<string, NetworkRequest>();
|
|
2004
2008
|
#networkConditions: Conditions = NoThrottlingConditions;
|
|
2005
2009
|
#updatingInterceptionPatternsPromise: Promise<void>|null = null;
|
|
2006
|
-
readonly #requestConditions
|
|
2010
|
+
readonly #requestConditions: RequestConditions;
|
|
2007
2011
|
readonly #urlsForRequestInterceptor:
|
|
2008
2012
|
Platform.MapUtilities.Multimap<(arg0: InterceptedRequest) => Promise<void>, InterceptionPattern> =
|
|
2009
2013
|
new Platform.MapUtilities.Multimap();
|
|
@@ -2014,6 +2018,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
2014
2018
|
constructor(targetManager: TargetManager) {
|
|
2015
2019
|
super();
|
|
2016
2020
|
this.#targetManager = targetManager;
|
|
2021
|
+
const settings = targetManager.settings;
|
|
2022
|
+
this.#requestConditions = new RequestConditions(settings);
|
|
2017
2023
|
|
|
2018
2024
|
// TODO(allada) Remove these and merge it with request interception.
|
|
2019
2025
|
const blockedPatternChanged: () => void = () => {
|
|
@@ -2264,8 +2270,9 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
|
|
|
2264
2270
|
}
|
|
2265
2271
|
|
|
2266
2272
|
private async updateInterceptionPatterns(): Promise<void> {
|
|
2267
|
-
|
|
2268
|
-
|
|
2273
|
+
const settings = this.#targetManager.settings;
|
|
2274
|
+
if (!settings.moduleSetting('cache-disabled').get()) {
|
|
2275
|
+
settings.moduleSetting('cache-disabled').set(true);
|
|
2269
2276
|
}
|
|
2270
2277
|
this.#updatingInterceptionPatternsPromise = null;
|
|
2271
2278
|
const promises = ([] as Array<Promise<unknown>>);
|
|
@@ -97,10 +97,10 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
97
97
|
target.registerOverlayDispatcher(this);
|
|
98
98
|
this.overlayAgent = target.overlayAgent();
|
|
99
99
|
|
|
100
|
+
const settings = this.target().targetManager().settings;
|
|
100
101
|
this.#debuggerModel = target.model(DebuggerModel);
|
|
101
102
|
if (this.#debuggerModel) {
|
|
102
|
-
|
|
103
|
-
.moduleSetting('disable-paused-state-overlay')
|
|
103
|
+
settings.moduleSetting('disable-paused-state-overlay')
|
|
104
104
|
.addChangeListener(this.updatePausedInDebuggerMessage, this);
|
|
105
105
|
this.#debuggerModel.addEventListener(
|
|
106
106
|
DebuggerModelEvents.DebuggerPaused, this.updatePausedInDebuggerMessage, this);
|
|
@@ -114,21 +114,19 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
114
114
|
this.#defaultHighlighter = new DefaultHighlighter(this);
|
|
115
115
|
this.#highlighter = this.#defaultHighlighter;
|
|
116
116
|
|
|
117
|
-
this.#showPaintRectsSetting =
|
|
118
|
-
this.#showLayoutShiftRegionsSetting =
|
|
119
|
-
|
|
120
|
-
this.#
|
|
121
|
-
this.#
|
|
122
|
-
this.#
|
|
123
|
-
this.#showScrollBottleneckRectsSetting =
|
|
124
|
-
Common.Settings.Settings.instance().moduleSetting<boolean>('show-scroll-bottleneck-rects');
|
|
117
|
+
this.#showPaintRectsSetting = settings.moduleSetting<boolean>('show-paint-rects');
|
|
118
|
+
this.#showLayoutShiftRegionsSetting = settings.moduleSetting<boolean>('show-layout-shift-regions');
|
|
119
|
+
this.#showAdHighlightsSetting = settings.moduleSetting<boolean>('show-ad-highlights');
|
|
120
|
+
this.#showDebugBordersSetting = settings.moduleSetting<boolean>('show-debug-borders');
|
|
121
|
+
this.#showFPSCounterSetting = settings.moduleSetting<boolean>('show-fps-counter');
|
|
122
|
+
this.#showScrollBottleneckRectsSetting = settings.moduleSetting<boolean>('show-scroll-bottleneck-rects');
|
|
125
123
|
|
|
126
124
|
if (!target.suspended()) {
|
|
127
125
|
void this.overlayAgent.invoke_enable();
|
|
128
126
|
void this.wireAgentToSettings();
|
|
129
127
|
}
|
|
130
128
|
|
|
131
|
-
this.#persistentHighlighter = new OverlayPersistentHighlighter(this, {
|
|
129
|
+
this.#persistentHighlighter = new OverlayPersistentHighlighter(this, settings, {
|
|
132
130
|
onGridOverlayStateChanged: ({nodeId, enabled}) => {
|
|
133
131
|
this.#domModel.nodeForId(nodeId)?.dispatchEventToListeners(DOMNodeEvents.GRID_OVERLAY_STATE_CHANGED, {enabled});
|
|
134
132
|
this.dispatchEventToListeners(Events.PERSISTENT_GRID_OVERLAY_STATE_CHANGED, {nodeId, enabled});
|
|
@@ -181,28 +179,28 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
181
179
|
}
|
|
182
180
|
}
|
|
183
181
|
|
|
184
|
-
static hideDOMNodeHighlight(): void {
|
|
185
|
-
for (const overlayModel of
|
|
182
|
+
static hideDOMNodeHighlight(targetManager: TargetManager = TargetManager.instance()): void {
|
|
183
|
+
for (const overlayModel of targetManager.models(OverlayModel)) {
|
|
186
184
|
overlayModel.delayedHideHighlight(0);
|
|
187
185
|
}
|
|
188
186
|
}
|
|
189
187
|
|
|
190
|
-
static async muteHighlight(): Promise<void[]> {
|
|
191
|
-
return await Promise.all(
|
|
188
|
+
static async muteHighlight(targetManager: TargetManager = TargetManager.instance()): Promise<void[]> {
|
|
189
|
+
return await Promise.all(targetManager.models(OverlayModel).map(model => model.suspendModel()));
|
|
192
190
|
}
|
|
193
191
|
|
|
194
|
-
static async unmuteHighlight(): Promise<void[]> {
|
|
195
|
-
return await Promise.all(
|
|
192
|
+
static async unmuteHighlight(targetManager: TargetManager = TargetManager.instance()): Promise<void[]> {
|
|
193
|
+
return await Promise.all(targetManager.models(OverlayModel).map(model => model.resumeModel()));
|
|
196
194
|
}
|
|
197
195
|
|
|
198
|
-
static highlightRect(rect: HighlightRect): void {
|
|
199
|
-
for (const overlayModel of
|
|
196
|
+
static highlightRect(rect: HighlightRect, targetManager: TargetManager = TargetManager.instance()): void {
|
|
197
|
+
for (const overlayModel of targetManager.models(OverlayModel)) {
|
|
200
198
|
void overlayModel.highlightRect(rect);
|
|
201
199
|
}
|
|
202
200
|
}
|
|
203
201
|
|
|
204
|
-
static clearHighlight(): void {
|
|
205
|
-
for (const overlayModel of
|
|
202
|
+
static clearHighlight(targetManager: TargetManager = TargetManager.instance()): void {
|
|
203
|
+
for (const overlayModel of targetManager.models(OverlayModel)) {
|
|
206
204
|
void overlayModel.clearHighlight();
|
|
207
205
|
}
|
|
208
206
|
}
|
|
@@ -291,8 +289,9 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
291
289
|
if (this.target().suspended()) {
|
|
292
290
|
return;
|
|
293
291
|
}
|
|
292
|
+
const settings = this.target().targetManager().settings;
|
|
294
293
|
const message = this.#debuggerModel && this.#debuggerModel.isPaused() &&
|
|
295
|
-
!
|
|
294
|
+
!settings.moduleSetting('disable-paused-state-overlay').get() ?
|
|
296
295
|
i18nString(UIStrings.pausedInDebugger) :
|
|
297
296
|
undefined;
|
|
298
297
|
void this.overlayAgent.invoke_setPausedInDebuggerMessage({message});
|
|
@@ -524,7 +523,8 @@ export class OverlayModel extends SDKModel<EventTypes> implements ProtocolProxyA
|
|
|
524
523
|
|
|
525
524
|
private buildHighlightConfig(mode: string|undefined = 'all', showDetailedToolip: boolean|undefined = false):
|
|
526
525
|
Protocol.Overlay.HighlightConfig {
|
|
527
|
-
const
|
|
526
|
+
const settings = this.target().targetManager().settings;
|
|
527
|
+
const showRulers = settings.moduleSetting('show-metrics-rulers').get();
|
|
528
528
|
const highlightConfig: Protocol.Overlay.HighlightConfig = {
|
|
529
529
|
showInfo: mode === 'all' || mode === 'container-outline',
|
|
530
530
|
showRulers,
|
|
@@ -33,9 +33,7 @@ export interface PersistentHighlighterCallbacks {
|
|
|
33
33
|
export class OverlayPersistentHighlighter {
|
|
34
34
|
readonly #model: OverlayModel;
|
|
35
35
|
readonly #colors = new Map<Protocol.DOM.NodeId, Common.Color.Color>();
|
|
36
|
-
readonly #persistentHighlightSetting
|
|
37
|
-
Common.Settings.Settings.instance().createLocalSetting<PersistentHighlightSettingItem[]>(
|
|
38
|
-
'persistent-highlight-setting', []);
|
|
36
|
+
readonly #persistentHighlightSetting: Common.Settings.Setting<PersistentHighlightSettingItem[]>;
|
|
39
37
|
#gridHighlights = new Map<Protocol.DOM.NodeId, Protocol.Overlay.GridHighlightConfig>();
|
|
40
38
|
#scrollSnapHighlights = new Map<Protocol.DOM.NodeId, Protocol.Overlay.ScrollSnapContainerHighlightConfig>();
|
|
41
39
|
#flexHighlights = new Map<Protocol.DOM.NodeId, Protocol.Overlay.FlexContainerHighlightConfig>();
|
|
@@ -47,18 +45,23 @@ export class OverlayPersistentHighlighter {
|
|
|
47
45
|
/**
|
|
48
46
|
* @see `front_end/core/sdk/sdk-meta.ts`
|
|
49
47
|
*/
|
|
50
|
-
readonly #showGridLineLabelsSetting
|
|
51
|
-
|
|
52
|
-
readonly #
|
|
53
|
-
readonly #
|
|
54
|
-
readonly #showGridTrackSizesSetting =
|
|
55
|
-
Common.Settings.Settings.instance().moduleSetting<boolean>('show-grid-track-sizes');
|
|
48
|
+
readonly #showGridLineLabelsSetting: Common.Settings.Setting<string>;
|
|
49
|
+
readonly #extendGridLinesSetting: Common.Settings.Setting<boolean>;
|
|
50
|
+
readonly #showGridAreasSetting: Common.Settings.Setting<boolean>;
|
|
51
|
+
readonly #showGridTrackSizesSetting: Common.Settings.Setting<boolean>;
|
|
56
52
|
|
|
57
53
|
readonly #callbacks: PersistentHighlighterCallbacks;
|
|
58
|
-
constructor(model: OverlayModel, callbacks: PersistentHighlighterCallbacks) {
|
|
54
|
+
constructor(model: OverlayModel, settings: Common.Settings.Settings, callbacks: PersistentHighlighterCallbacks) {
|
|
59
55
|
this.#model = model;
|
|
60
56
|
this.#callbacks = callbacks;
|
|
61
57
|
|
|
58
|
+
this.#persistentHighlightSetting =
|
|
59
|
+
settings.createLocalSetting<PersistentHighlightSettingItem[]>('persistent-highlight-setting', []);
|
|
60
|
+
this.#showGridLineLabelsSetting = settings.moduleSetting<string>('show-grid-line-labels');
|
|
61
|
+
this.#extendGridLinesSetting = settings.moduleSetting<boolean>('extend-grid-lines');
|
|
62
|
+
this.#showGridAreasSetting = settings.moduleSetting<boolean>('show-grid-areas');
|
|
63
|
+
this.#showGridTrackSizesSetting = settings.moduleSetting<boolean>('show-grid-track-sizes');
|
|
64
|
+
|
|
62
65
|
this.#showGridLineLabelsSetting.addChangeListener(this.onSettingChange, this);
|
|
63
66
|
this.#extendGridLinesSetting.addChangeListener(this.onSettingChange, this);
|
|
64
67
|
this.#showGridAreasSetting.addChangeListener(this.onSettingChange, this);
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
} from './ResourceTreeModel.js';
|
|
17
17
|
import {SDKModel} from './SDKModel.js';
|
|
18
18
|
import {Capability, type Target} from './Target.js';
|
|
19
|
-
import {TargetManager} from './TargetManager.js';
|
|
20
19
|
|
|
21
20
|
export interface WithId<I, V> {
|
|
22
21
|
id: I;
|
|
@@ -48,17 +47,17 @@ export class PreloadingModel extends SDKModel<EventTypes> {
|
|
|
48
47
|
|
|
49
48
|
const targetInfo = target.targetInfo();
|
|
50
49
|
if (targetInfo?.subtype === 'prerender') {
|
|
51
|
-
this.lastPrimaryPageModel =
|
|
50
|
+
this.lastPrimaryPageModel = target.targetManager().primaryPageTarget()?.model(PreloadingModel) || null;
|
|
52
51
|
}
|
|
53
52
|
|
|
54
|
-
|
|
53
|
+
target.targetManager().addModelListener(
|
|
55
54
|
ResourceTreeModel, ResourceTreeModelEvents.PrimaryPageChanged, this.onPrimaryPageChanged, this);
|
|
56
55
|
}
|
|
57
56
|
|
|
58
57
|
override dispose(): void {
|
|
59
58
|
super.dispose();
|
|
60
59
|
|
|
61
|
-
|
|
60
|
+
this.target().targetManager().removeModelListener(
|
|
62
61
|
ResourceTreeModel, ResourceTreeModelEvents.PrimaryPageChanged, this.onPrimaryPageChanged, this);
|
|
63
62
|
|
|
64
63
|
void this.agent.invoke_disable();
|
|
@@ -32,13 +32,12 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
32
32
|
this.target().registerRuntimeDispatcher(new RuntimeDispatcher(this));
|
|
33
33
|
void this.agent.invoke_enable();
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
const settings = this.target().targetManager().context.get(Common.Settings.Settings);
|
|
36
|
+
if (settings.moduleSetting('custom-formatters').get()) {
|
|
36
37
|
void this.agent.invoke_setCustomObjectFormatterEnabled({enabled: true});
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
.moduleSetting('custom-formatters')
|
|
41
|
-
.addChangeListener(this.customFormattersStateChanged.bind(this));
|
|
40
|
+
settings.moduleSetting('custom-formatters').addChangeListener(this.customFormattersStateChanged.bind(this));
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
static isSideEffectFailure(response: Protocol.Runtime.EvaluateResponse|EvaluationResult): boolean {
|
|
@@ -301,7 +300,8 @@ export class RuntimeModel extends SDKModel<EventTypes> {
|
|
|
301
300
|
return;
|
|
302
301
|
}
|
|
303
302
|
|
|
304
|
-
const indent =
|
|
303
|
+
const indent =
|
|
304
|
+
this.target().targetManager().context.get(Common.Settings.Settings).moduleSetting('text-editor-indent').get();
|
|
305
305
|
void object
|
|
306
306
|
.callFunctionJSON(toStringForClipboard, [{
|
|
307
307
|
value: {
|
|
@@ -11,7 +11,6 @@ import type * as Platform from '../platform/platform.js';
|
|
|
11
11
|
import {Events as RuntimeModelEvents, type ExecutionContext, RuntimeModel} from './RuntimeModel.js';
|
|
12
12
|
import {SDKModel} from './SDKModel.js';
|
|
13
13
|
import {Capability, type Target, Type} from './Target.js';
|
|
14
|
-
import {TargetManager} from './TargetManager.js';
|
|
15
14
|
|
|
16
15
|
const UIStrings = {
|
|
17
16
|
/**
|
|
@@ -77,8 +76,10 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
|
|
|
77
76
|
target.registerServiceWorkerDispatcher(new ServiceWorkerDispatcher(this));
|
|
78
77
|
this.#agent = target.serviceWorkerAgent();
|
|
79
78
|
void this.enable();
|
|
80
|
-
this.#forceUpdateSetting =
|
|
81
|
-
|
|
79
|
+
this.#forceUpdateSetting = this.target()
|
|
80
|
+
.targetManager()
|
|
81
|
+
.context.get(Common.Settings.Settings)
|
|
82
|
+
.createSetting('service-worker-update-on-reload', false);
|
|
82
83
|
if (this.#forceUpdateSetting.get()) {
|
|
83
84
|
this.forceUpdateSettingChanged();
|
|
84
85
|
}
|
|
@@ -542,7 +543,7 @@ class ServiceWorkerContextNamer {
|
|
|
542
543
|
this.#serviceWorkerManager = serviceWorkerManager;
|
|
543
544
|
serviceWorkerManager.addEventListener(Events.REGISTRATION_UPDATED, this.registrationsUpdated, this);
|
|
544
545
|
serviceWorkerManager.addEventListener(Events.REGISTRATION_DELETED, this.registrationsUpdated, this);
|
|
545
|
-
|
|
546
|
+
this.#target.targetManager().addModelListener(
|
|
546
547
|
RuntimeModel, RuntimeModelEvents.ExecutionContextCreated, this.executionContextCreated, this);
|
|
547
548
|
}
|
|
548
549
|
|
|
@@ -576,7 +577,7 @@ class ServiceWorkerContextNamer {
|
|
|
576
577
|
}
|
|
577
578
|
|
|
578
579
|
private updateAllContextLabels(): void {
|
|
579
|
-
for (const target of
|
|
580
|
+
for (const target of this.#target.targetManager().targets()) {
|
|
580
581
|
const serviceWorkerTargetId = this.serviceWorkerTargetId(target);
|
|
581
582
|
if (!serviceWorkerTargetId) {
|
|
582
583
|
continue;
|
|
@@ -49,70 +49,21 @@ export class SourceMapScopesInfo {
|
|
|
49
49
|
|
|
50
50
|
// Convert the entire scopeTree. Returns a root range that encompasses everything,
|
|
51
51
|
// and inserts scopes by sourceIndex into the above scopeBySourceUrl.
|
|
52
|
-
const {
|
|
53
|
-
|
|
52
|
+
const stack: Array<{
|
|
53
|
+
node: Formatter.FormatterWorkerPool.ScopeTreeNode,
|
|
54
|
+
parentRange?: ScopesCodec.GeneratedRange,
|
|
55
|
+
parentScopeHint?: ScopesCodec.OriginalScope,
|
|
56
|
+
}> = [{node: scopeTree}];
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
* Recursively finds the correct place in the tree to insert the new scope.
|
|
57
|
-
* Maintains the invariant that children are sorted and contained by their parent.
|
|
58
|
-
*/
|
|
59
|
-
function insertInScope(parent: ScopesCodec.OriginalScope, newScope: ScopesCodec.OriginalScope): void {
|
|
60
|
-
// Check if the newScope fits strictly inside any of the existing children.
|
|
61
|
-
for (const child of parent.children) {
|
|
62
|
-
if (contains(child, newScope)) {
|
|
63
|
-
insertInScope(child, newScope);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
58
|
+
let rootRange: ScopesCodec.GeneratedRange|undefined = undefined;
|
|
67
59
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const childrenToKeep: ScopesCodec.OriginalScope[] = [];
|
|
73
|
-
for (const child of parent.children) {
|
|
74
|
-
if (contains(newScope, child)) {
|
|
75
|
-
// child is actually inside newScope, so re-parent it.
|
|
76
|
-
newScope.children.push(child);
|
|
77
|
-
child.parent = newScope;
|
|
78
|
-
} else {
|
|
79
|
-
childrenToKeep.push(child);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Find the correct index in the remaining children to insert newScope.
|
|
84
|
-
// We look for the first child that starts after the new scope.
|
|
85
|
-
const insertIndex = childrenToKeep.findIndex(child => compareScopes(newScope, child) < 0);
|
|
86
|
-
if (insertIndex === -1) {
|
|
87
|
-
// If no child starts after, it goes at the end.
|
|
88
|
-
childrenToKeep.push(newScope);
|
|
89
|
-
} else {
|
|
90
|
-
childrenToKeep.splice(insertIndex, 0, newScope);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Update parent's children to only be the ones that don't belong to newScope.
|
|
94
|
-
parent.children = childrenToKeep;
|
|
95
|
-
newScope.parent = parent;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
function contains(outer: ScopesCodec.OriginalScope, inner: ScopesCodec.OriginalScope): boolean {
|
|
99
|
-
return comparePositions(outer.start, inner.start) <= 0 && comparePositions(outer.end, inner.end) >= 0;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function compareScopes(a: ScopesCodec.OriginalScope, b: ScopesCodec.OriginalScope): number {
|
|
103
|
-
return comparePositions(a.start, b.start);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function comparePositions(a: ScopesCodec.Position, b: ScopesCodec.Position): number {
|
|
107
|
-
if (a.line !== b.line) {
|
|
108
|
-
return a.line - b.line;
|
|
60
|
+
while (stack.length > 0) {
|
|
61
|
+
const popped = stack.pop();
|
|
62
|
+
if (!popped) {
|
|
63
|
+
break;
|
|
109
64
|
}
|
|
110
|
-
|
|
111
|
-
}
|
|
65
|
+
const {node, parentRange, parentScopeHint} = popped;
|
|
112
66
|
|
|
113
|
-
function convertScope(
|
|
114
|
-
node: Formatter.FormatterWorkerPool.ScopeTreeNode,
|
|
115
|
-
parentRange: ScopesCodec.GeneratedRange|undefined): {range: ScopesCodec.GeneratedRange} {
|
|
116
67
|
const start = positionFromOffset(node.start);
|
|
117
68
|
const end = positionFromOffset(node.end);
|
|
118
69
|
const startEntry = sourceMap.findEntry(start.line, start.column);
|
|
@@ -156,15 +107,94 @@ export class SourceMapScopesInfo {
|
|
|
156
107
|
children: [],
|
|
157
108
|
};
|
|
158
109
|
|
|
110
|
+
if (!rootRange) {
|
|
111
|
+
rootRange = range;
|
|
112
|
+
}
|
|
159
113
|
parentRange?.children.push(range);
|
|
114
|
+
|
|
115
|
+
let nextParentScopeHint = parentScopeHint;
|
|
160
116
|
if (canMapOriginalPosition && scope) {
|
|
161
117
|
const rootScope = scopeBySourceUrl[sourceIndex];
|
|
162
|
-
|
|
118
|
+
const startSearchFrom =
|
|
119
|
+
(parentScopeHint && containsOriginal(parentScopeHint, scope)) ? parentScopeHint : rootScope;
|
|
120
|
+
insertInScope(startSearchFrom, scope);
|
|
121
|
+
nextParentScopeHint = scope;
|
|
163
122
|
}
|
|
164
123
|
|
|
165
|
-
node.children.
|
|
124
|
+
for (let i = node.children.length - 1; i >= 0; --i) {
|
|
125
|
+
stack.push({node: node.children[i], parentRange: range, parentScopeHint: nextParentScopeHint});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
166
128
|
|
|
167
|
-
|
|
129
|
+
return new SourceMapScopesInfo(sourceMap, {scopes: scopeBySourceUrl, ranges: rootRange ? [rootRange] : []});
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Finds the correct place in the tree to insert the new scope.
|
|
133
|
+
* Maintains the invariant that children are sorted and contained by their parent.
|
|
134
|
+
*/
|
|
135
|
+
function insertInScope(rootScope: ScopesCodec.OriginalScope, newScope: ScopesCodec.OriginalScope): void {
|
|
136
|
+
let parent = rootScope;
|
|
137
|
+
// Check if the newScope fits strictly inside any of the existing children.
|
|
138
|
+
// We iterate to find the deepest parent to avoid Maximum Call Stack Size Exceeded
|
|
139
|
+
// errors on highly nested scripts.
|
|
140
|
+
while (true) {
|
|
141
|
+
let deeperParent: ScopesCodec.OriginalScope|null = null;
|
|
142
|
+
for (const child of parent.children) {
|
|
143
|
+
if (containsOriginal(child, newScope)) {
|
|
144
|
+
deeperParent = child;
|
|
145
|
+
break;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (deeperParent) {
|
|
149
|
+
parent = deeperParent;
|
|
150
|
+
} else {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// When here, newScope belongs directly in parent.
|
|
156
|
+
// However, newScope might encompass some of parent's existing children (due
|
|
157
|
+
// to compiler transform quirks or arbitrary insertion order). We must move
|
|
158
|
+
// those children inside newScope.
|
|
159
|
+
const childrenToKeep: ScopesCodec.OriginalScope[] = [];
|
|
160
|
+
for (const child of parent.children) {
|
|
161
|
+
if (containsOriginal(newScope, child)) {
|
|
162
|
+
// child is actually inside newScope, so re-parent it.
|
|
163
|
+
newScope.children.push(child);
|
|
164
|
+
child.parent = newScope;
|
|
165
|
+
} else {
|
|
166
|
+
childrenToKeep.push(child);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Find the correct index in the remaining children to insert newScope.
|
|
171
|
+
// We look for the first child that starts after the new scope.
|
|
172
|
+
const insertIndex = childrenToKeep.findIndex(child => compareScopes(newScope, child) < 0);
|
|
173
|
+
if (insertIndex === -1) {
|
|
174
|
+
// If no child starts after, it goes at the end.
|
|
175
|
+
childrenToKeep.push(newScope);
|
|
176
|
+
} else {
|
|
177
|
+
childrenToKeep.splice(insertIndex, 0, newScope);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Update parent's children to only be the ones that don't belong to newScope.
|
|
181
|
+
parent.children = childrenToKeep;
|
|
182
|
+
newScope.parent = parent;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function containsOriginal(outer: ScopesCodec.OriginalScope, inner: ScopesCodec.OriginalScope): boolean {
|
|
186
|
+
return comparePositions(outer.start, inner.start) <= 0 && comparePositions(outer.end, inner.end) >= 0;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function compareScopes(a: ScopesCodec.OriginalScope, b: ScopesCodec.OriginalScope): number {
|
|
190
|
+
return comparePositions(a.start, b.start);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function comparePositions(a: ScopesCodec.Position, b: ScopesCodec.Position): number {
|
|
194
|
+
if (a.line !== b.line) {
|
|
195
|
+
return a.line - b.line;
|
|
196
|
+
}
|
|
197
|
+
return a.column - b.column;
|
|
168
198
|
}
|
|
169
199
|
|
|
170
200
|
function positionFromOffset(offset: number): ScopesCodec.Position {
|
|
@@ -26,6 +26,11 @@ export class TargetManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
26
26
|
readonly context: Root.DevToolsContext.DevToolsContext;
|
|
27
27
|
#targets: Set<Target>;
|
|
28
28
|
readonly #observers: Set<Observer>;
|
|
29
|
+
|
|
30
|
+
get settings(): Common.Settings.Settings {
|
|
31
|
+
return this.context.get(Common.Settings.Settings);
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
30
35
|
#modelListeners: Platform.MapUtilities.Multimap<string|symbol|number, {
|
|
31
36
|
modelClass: SDKModelConstructor,
|
|
@@ -93,6 +93,12 @@ class WebMCPDispatcher implements ProtocolProxyApi.WebMCPDispatcher {
|
|
|
93
93
|
toolsRemoved(params: Protocol.WebMCP.ToolsRemovedEvent): void {
|
|
94
94
|
this.#model.onToolsRemoved(params.tools);
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
toolInvoked(): void {
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
toolResponded(): void {
|
|
101
|
+
}
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
SDKModel.register(WebMCPModel, {capabilities: Capability.WEB_MCP, autostart: true});
|