chrome-devtools-frontend 1.0.952284 → 1.0.952865
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/config/gni/devtools_grd_files.gni +3 -0
- package/front_end/.eslintrc.js +1 -1
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/af.json +158 -176
- package/front_end/core/i18n/locales/am.json +163 -181
- package/front_end/core/i18n/locales/ar.json +162 -180
- package/front_end/core/i18n/locales/as.json +163 -181
- package/front_end/core/i18n/locales/az.json +161 -179
- package/front_end/core/i18n/locales/be.json +160 -178
- package/front_end/core/i18n/locales/bg.json +159 -177
- package/front_end/core/i18n/locales/bn.json +166 -184
- package/front_end/core/i18n/locales/bs.json +161 -179
- package/front_end/core/i18n/locales/ca.json +159 -177
- package/front_end/core/i18n/locales/cs.json +159 -177
- package/front_end/core/i18n/locales/cy.json +164 -182
- package/front_end/core/i18n/locales/da.json +158 -176
- package/front_end/core/i18n/locales/de.json +160 -178
- package/front_end/core/i18n/locales/el.json +158 -176
- package/front_end/core/i18n/locales/en-GB.json +158 -176
- package/front_end/core/i18n/locales/en-US.json +3 -0
- package/front_end/core/i18n/locales/en-XL.json +3 -0
- package/front_end/core/i18n/locales/es-419.json +160 -178
- package/front_end/core/i18n/locales/es.json +156 -174
- package/front_end/core/i18n/locales/et.json +161 -179
- package/front_end/core/i18n/locales/eu.json +159 -177
- package/front_end/core/i18n/locales/fa.json +166 -184
- package/front_end/core/i18n/locales/fi.json +161 -179
- package/front_end/core/i18n/locales/fil.json +162 -180
- package/front_end/core/i18n/locales/fr-CA.json +159 -177
- package/front_end/core/i18n/locales/fr.json +158 -176
- package/front_end/core/i18n/locales/gl.json +160 -178
- package/front_end/core/i18n/locales/gu.json +179 -197
- package/front_end/core/i18n/locales/he.json +160 -178
- package/front_end/core/i18n/locales/hi.json +166 -184
- package/front_end/core/i18n/locales/hr.json +161 -179
- package/front_end/core/i18n/locales/hu.json +161 -179
- package/front_end/core/i18n/locales/hy.json +157 -175
- package/front_end/core/i18n/locales/id.json +160 -178
- package/front_end/core/i18n/locales/is.json +163 -181
- package/front_end/core/i18n/locales/it.json +162 -180
- package/front_end/core/i18n/locales/ja.json +160 -178
- package/front_end/core/i18n/locales/ka.json +161 -179
- package/front_end/core/i18n/locales/kk.json +164 -182
- package/front_end/core/i18n/locales/km.json +160 -178
- package/front_end/core/i18n/locales/kn.json +162 -180
- package/front_end/core/i18n/locales/ko.json +162 -180
- package/front_end/core/i18n/locales/ky.json +160 -178
- package/front_end/core/i18n/locales/lo.json +159 -177
- package/front_end/core/i18n/locales/lt.json +159 -177
- package/front_end/core/i18n/locales/lv.json +162 -180
- package/front_end/core/i18n/locales/mk.json +162 -180
- package/front_end/core/i18n/locales/ml.json +160 -178
- package/front_end/core/i18n/locales/mn.json +164 -182
- package/front_end/core/i18n/locales/mr.json +163 -181
- package/front_end/core/i18n/locales/ms.json +163 -181
- package/front_end/core/i18n/locales/my.json +164 -182
- package/front_end/core/i18n/locales/ne.json +160 -178
- package/front_end/core/i18n/locales/nl.json +160 -178
- package/front_end/core/i18n/locales/no.json +281 -299
- package/front_end/core/i18n/locales/or.json +165 -183
- package/front_end/core/i18n/locales/pa.json +159 -177
- package/front_end/core/i18n/locales/pl.json +163 -181
- package/front_end/core/i18n/locales/pt-PT.json +160 -178
- package/front_end/core/i18n/locales/pt.json +159 -177
- package/front_end/core/i18n/locales/ro.json +161 -179
- package/front_end/core/i18n/locales/ru.json +159 -177
- package/front_end/core/i18n/locales/si.json +161 -179
- package/front_end/core/i18n/locales/sk.json +158 -176
- package/front_end/core/i18n/locales/sl.json +160 -178
- package/front_end/core/i18n/locales/sq.json +279 -297
- package/front_end/core/i18n/locales/sr-Latn.json +160 -178
- package/front_end/core/i18n/locales/sr.json +160 -178
- package/front_end/core/i18n/locales/sv.json +159 -177
- package/front_end/core/i18n/locales/sw.json +164 -182
- package/front_end/core/i18n/locales/ta.json +160 -178
- package/front_end/core/i18n/locales/te.json +165 -183
- package/front_end/core/i18n/locales/th.json +158 -176
- package/front_end/core/i18n/locales/tr.json +162 -180
- package/front_end/core/i18n/locales/uk.json +160 -178
- package/front_end/core/i18n/locales/ur.json +160 -178
- package/front_end/core/i18n/locales/uz.json +160 -178
- package/front_end/core/i18n/locales/vi.json +162 -180
- package/front_end/core/i18n/locales/zh-HK.json +160 -178
- package/front_end/core/i18n/locales/zh-TW.json +161 -179
- package/front_end/core/i18n/locales/zh.json +162 -180
- package/front_end/core/i18n/locales/zu.json +164 -182
- package/front_end/core/root/Runtime.ts +4 -12
- package/front_end/core/sdk/PageResourceLoader.ts +2 -1
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +3 -3
- package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +2 -2
- package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +9 -9
- package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +11 -11
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +40 -40
- package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +14 -14
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +15 -15
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -0
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +29 -29
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +2 -2
- package/front_end/entrypoints/inspector_main/InspectorMain.ts +12 -12
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
- package/front_end/entrypoints/main/ExecutionContextSelector.ts +26 -29
- package/front_end/entrypoints/main/MainImpl.ts +38 -38
- package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +10 -10
- package/front_end/entrypoints/node_app/NodeMain.ts +3 -3
- package/front_end/legacy/legacy-defs.d.ts +0 -21
- package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
- package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
- package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +86 -25
- package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
- package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
- package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
- package/front_end/third_party/diff/DiffWrapper.ts +7 -0
- package/front_end/ui/components/data_grid/DataGrid.ts +2 -2
- package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
- package/front_end/ui/legacy/SearchableView.ts +13 -4
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +22 -7
- package/package.json +1 -1
- package/config/gni/all_devtools_files.gni +0 -255
- package/scripts/build/devtools_file_hashes.py +0 -82
- package/scripts/devtools_run/devtools_run_cli +0 -49
- package/scripts/devtools_run/package.json +0 -13
- package/scripts/unzip.py +0 -20
- package/scripts/visualize_deps/jquery_svg.html +0 -57
- package/scripts/visualize_deps/run_visualize.js +0 -119
|
@@ -50,19 +50,19 @@ export class HeapSnapshotLoader {
|
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
51
|
#jsonTokenizer?: any;
|
|
52
52
|
constructor(dispatcher: HeapSnapshotWorkerDispatcher) {
|
|
53
|
-
this
|
|
53
|
+
this.#reset();
|
|
54
54
|
this.#progress = new HeapSnapshotProgress(dispatcher);
|
|
55
55
|
this.#buffer = '';
|
|
56
56
|
this.#dataCallback = null;
|
|
57
57
|
this.#done = false;
|
|
58
|
-
this
|
|
58
|
+
this.#parseInput();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
dispose(): void {
|
|
62
|
-
this
|
|
62
|
+
this.#reset();
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
#reset(): void {
|
|
66
66
|
this.#json = '';
|
|
67
67
|
this.#snapshot = undefined;
|
|
68
68
|
}
|
|
@@ -79,11 +79,11 @@ export class HeapSnapshotLoader {
|
|
|
79
79
|
|
|
80
80
|
this.#progress.updateStatus('Processing snapshot…');
|
|
81
81
|
const result = new JSHeapSnapshot((this.#snapshot as Profile), this.#progress);
|
|
82
|
-
this
|
|
82
|
+
this.#reset();
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
#parseUintArray(): boolean {
|
|
87
87
|
let index = 0;
|
|
88
88
|
const char0 = '0'.charCodeAt(0);
|
|
89
89
|
const char9 = '9'.charCodeAt(0);
|
|
@@ -126,7 +126,7 @@ export class HeapSnapshotLoader {
|
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
#parseStringsArray(): void {
|
|
130
130
|
this.#progress.updateStatus('Parsing strings…');
|
|
131
131
|
const closingBracketIndex = this.#json.lastIndexOf(']');
|
|
132
132
|
if (closingBracketIndex === -1) {
|
|
@@ -150,45 +150,45 @@ export class HeapSnapshotLoader {
|
|
|
150
150
|
this.#buffer = '';
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
#fetchChunk(): Promise<string> {
|
|
154
154
|
return this.#done ? Promise.resolve(this.#buffer) : new Promise(r => {
|
|
155
155
|
this.#dataCallback = r;
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
async #findToken(token: string, startIndex?: number): Promise<number> {
|
|
160
160
|
while (true) {
|
|
161
161
|
const pos = this.#json.indexOf(token, startIndex || 0);
|
|
162
162
|
if (pos !== -1) {
|
|
163
163
|
return pos;
|
|
164
164
|
}
|
|
165
165
|
startIndex = this.#json.length - token.length + 1;
|
|
166
|
-
this.#json += await this
|
|
166
|
+
this.#json += await this.#fetchChunk();
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
-
|
|
171
|
-
const nameIndex = await this
|
|
172
|
-
const bracketIndex = await this
|
|
170
|
+
async #parseArray(name: string, title: string, length?: number): Promise<number[]|Uint32Array> {
|
|
171
|
+
const nameIndex = await this.#findToken(name);
|
|
172
|
+
const bracketIndex = await this.#findToken('[', nameIndex);
|
|
173
173
|
this.#json = this.#json.slice(bracketIndex + 1);
|
|
174
174
|
this.#array = length ? new Uint32Array(length) : [];
|
|
175
175
|
this.#arrayIndex = 0;
|
|
176
|
-
while (this
|
|
176
|
+
while (this.#parseUintArray()) {
|
|
177
177
|
if (length) {
|
|
178
178
|
this.#progress.updateProgress(title, this.#arrayIndex, this.#array.length);
|
|
179
179
|
} else {
|
|
180
180
|
this.#progress.updateStatus(title);
|
|
181
181
|
}
|
|
182
|
-
this.#json += await this
|
|
182
|
+
this.#json += await this.#fetchChunk();
|
|
183
183
|
}
|
|
184
184
|
const result = this.#array;
|
|
185
185
|
this.#array = null;
|
|
186
186
|
return result;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
189
|
+
async #parseInput(): Promise<void> {
|
|
190
190
|
const snapshotToken = '"snapshot"';
|
|
191
|
-
const snapshotTokenIndex = await this
|
|
191
|
+
const snapshotTokenIndex = await this.#findToken(snapshotToken);
|
|
192
192
|
if (snapshotTokenIndex === -1) {
|
|
193
193
|
throw new Error('Snapshot token not found');
|
|
194
194
|
}
|
|
@@ -204,29 +204,29 @@ export class HeapSnapshotLoader {
|
|
|
204
204
|
});
|
|
205
205
|
this.#jsonTokenizer.write(json);
|
|
206
206
|
while (this.#jsonTokenizer) {
|
|
207
|
-
this.#jsonTokenizer.write(await this
|
|
207
|
+
this.#jsonTokenizer.write(await this.#fetchChunk());
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
this.#snapshot = this.#snapshot || {};
|
|
211
|
-
const nodes = await this
|
|
211
|
+
const nodes = await this.#parseArray(
|
|
212
212
|
'"nodes"', 'Loading nodes… {PH1}%',
|
|
213
213
|
this.#snapshot.snapshot.meta.node_fields.length * this.#snapshot.snapshot.node_count);
|
|
214
214
|
this.#snapshot.nodes = (nodes as Uint32Array);
|
|
215
215
|
|
|
216
|
-
const edges = await this
|
|
216
|
+
const edges = await this.#parseArray(
|
|
217
217
|
'"edges"', 'Loading edges… {PH1}%',
|
|
218
218
|
this.#snapshot.snapshot.meta.edge_fields.length * this.#snapshot.snapshot.edge_count);
|
|
219
219
|
this.#snapshot.edges = (edges as Uint32Array);
|
|
220
220
|
|
|
221
221
|
if (this.#snapshot.snapshot.trace_function_count) {
|
|
222
|
-
const traceFunctionInfos = await this
|
|
222
|
+
const traceFunctionInfos = await this.#parseArray(
|
|
223
223
|
'"trace_function_infos"', 'Loading allocation traces… {PH1}%',
|
|
224
224
|
this.#snapshot.snapshot.meta.trace_function_info_fields.length *
|
|
225
225
|
this.#snapshot.snapshot.trace_function_count);
|
|
226
226
|
this.#snapshot.trace_function_infos = (traceFunctionInfos as Uint32Array);
|
|
227
227
|
|
|
228
|
-
const thisTokenEndIndex = await this
|
|
229
|
-
const nextTokenIndex = await this
|
|
228
|
+
const thisTokenEndIndex = await this.#findToken(':');
|
|
229
|
+
const nextTokenIndex = await this.#findToken('"', thisTokenEndIndex);
|
|
230
230
|
const openBracketIndex = this.#json.indexOf('[');
|
|
231
231
|
const closeBracketIndex = this.#json.lastIndexOf(']', nextTokenIndex);
|
|
232
232
|
this.#snapshot.trace_tree = JSON.parse(this.#json.substring(openBracketIndex, closeBracketIndex + 1));
|
|
@@ -234,24 +234,24 @@ export class HeapSnapshotLoader {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
if (this.#snapshot.snapshot.meta.sample_fields) {
|
|
237
|
-
const samples = await this
|
|
237
|
+
const samples = await this.#parseArray('"samples"', 'Loading samples…');
|
|
238
238
|
this.#snapshot.samples = (samples as number[]);
|
|
239
239
|
}
|
|
240
240
|
|
|
241
241
|
if (this.#snapshot.snapshot.meta['location_fields']) {
|
|
242
|
-
const locations = await this
|
|
242
|
+
const locations = await this.#parseArray('"locations"', 'Loading locations…');
|
|
243
243
|
this.#snapshot.locations = (locations as number[]);
|
|
244
244
|
} else {
|
|
245
245
|
this.#snapshot.locations = [];
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
this.#progress.updateStatus('Loading strings…');
|
|
249
|
-
const stringsTokenIndex = await this
|
|
250
|
-
const bracketIndex = await this
|
|
249
|
+
const stringsTokenIndex = await this.#findToken('"strings"');
|
|
250
|
+
const bracketIndex = await this.#findToken('[', stringsTokenIndex);
|
|
251
251
|
this.#json = this.#json.slice(bracketIndex);
|
|
252
252
|
while (!this.#done) {
|
|
253
|
-
this.#json += await this
|
|
253
|
+
this.#json += await this.#fetchChunk();
|
|
254
254
|
}
|
|
255
|
-
this
|
|
255
|
+
this.#parseStringsArray();
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -50,7 +50,7 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
50
50
|
this.#postMessage = postMessage;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
#findFunction(name: string): Function {
|
|
54
54
|
const path = name.split('.');
|
|
55
55
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
|
|
56
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -73,7 +73,7 @@ export class HeapSnapshotWorkerDispatcher {
|
|
|
73
73
|
try {
|
|
74
74
|
switch (data.disposition) {
|
|
75
75
|
case 'create': {
|
|
76
|
-
const constructorFunction = this
|
|
76
|
+
const constructorFunction = this.#findFunction(data.methodName);
|
|
77
77
|
// @ts-ignore
|
|
78
78
|
this.#objects[data.objectId] = new constructorFunction(this);
|
|
79
79
|
break;
|
|
@@ -157,9 +157,9 @@ export class NodeIndicator implements UI.Toolbar.Provider {
|
|
|
157
157
|
this.#button = new UI.Toolbar.ToolbarItem(element);
|
|
158
158
|
this.#button.setTitle(i18nString(UIStrings.openDedicatedTools));
|
|
159
159
|
SDK.TargetManager.TargetManager.instance().addEventListener(
|
|
160
|
-
SDK.TargetManager.Events.AvailableTargetsChanged, event => this
|
|
160
|
+
SDK.TargetManager.Events.AvailableTargetsChanged, event => this.#update(event.data));
|
|
161
161
|
this.#button.setVisible(false);
|
|
162
|
-
this
|
|
162
|
+
this.#update([]);
|
|
163
163
|
}
|
|
164
164
|
static instance(opts: {
|
|
165
165
|
forceNew: boolean|null,
|
|
@@ -172,7 +172,7 @@ export class NodeIndicator implements UI.Toolbar.Provider {
|
|
|
172
172
|
return nodeIndicatorInstance;
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
#update(targetInfos: Protocol.Target.TargetInfo[]): void {
|
|
176
176
|
const hasNode = Boolean(targetInfos.find(target => target.type === 'node' && !target.attached));
|
|
177
177
|
this.#element.classList.toggle('inactive', !hasNode);
|
|
178
178
|
if (hasNode) {
|
|
@@ -211,19 +211,19 @@ export class BackendSettingsSync implements SDK.TargetManager.Observer {
|
|
|
211
211
|
|
|
212
212
|
constructor() {
|
|
213
213
|
this.#autoAttachSetting = Common.Settings.Settings.instance().moduleSetting('autoAttachToCreatedPages');
|
|
214
|
-
this.#autoAttachSetting.addChangeListener(this
|
|
215
|
-
this
|
|
214
|
+
this.#autoAttachSetting.addChangeListener(this.#updateAutoAttach, this);
|
|
215
|
+
this.#updateAutoAttach();
|
|
216
216
|
|
|
217
217
|
this.#adBlockEnabledSetting = Common.Settings.Settings.instance().moduleSetting('network.adBlockingEnabled');
|
|
218
|
-
this.#adBlockEnabledSetting.addChangeListener(this
|
|
218
|
+
this.#adBlockEnabledSetting.addChangeListener(this.#update, this);
|
|
219
219
|
|
|
220
220
|
this.#emulatePageFocusSetting = Common.Settings.Settings.instance().moduleSetting('emulatePageFocus');
|
|
221
|
-
this.#emulatePageFocusSetting.addChangeListener(this
|
|
221
|
+
this.#emulatePageFocusSetting.addChangeListener(this.#update, this);
|
|
222
222
|
|
|
223
223
|
SDK.TargetManager.TargetManager.instance().observeTargets(this);
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
|
|
226
|
+
#updateTarget(target: SDK.Target.Target): void {
|
|
227
227
|
if (target.type() !== SDK.Target.Type.Frame || target.parentTarget()) {
|
|
228
228
|
return;
|
|
229
229
|
}
|
|
@@ -231,18 +231,18 @@ export class BackendSettingsSync implements SDK.TargetManager.Observer {
|
|
|
231
231
|
target.emulationAgent().invoke_setFocusEmulationEnabled({enabled: this.#emulatePageFocusSetting.get()});
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
#updateAutoAttach(): void {
|
|
235
235
|
Host.InspectorFrontendHost.InspectorFrontendHostInstance.setOpenNewWindowForPopups(this.#autoAttachSetting.get());
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
#update(): void {
|
|
239
239
|
for (const target of SDK.TargetManager.TargetManager.instance().targets()) {
|
|
240
|
-
this
|
|
240
|
+
this.#updateTarget(target);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
targetAdded(target: SDK.Target.Target): void {
|
|
245
|
-
this
|
|
245
|
+
this.#updateTarget(target);
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
targetRemoved(_target: SDK.Target.Target): void {
|
|
@@ -218,77 +218,77 @@ export class RenderingOptionsView extends UI.Widget.VBox {
|
|
|
218
218
|
private constructor() {
|
|
219
219
|
super(true);
|
|
220
220
|
|
|
221
|
-
this
|
|
221
|
+
this.#appendCheckbox(
|
|
222
222
|
i18nString(UIStrings.paintFlashing), i18nString(UIStrings.highlightsAreasOfThePageGreen),
|
|
223
223
|
Common.Settings.Settings.instance().moduleSetting('showPaintRects'));
|
|
224
|
-
this
|
|
224
|
+
this.#appendCheckbox(
|
|
225
225
|
i18nString(UIStrings.layoutShiftRegions), i18nString(UIStrings.highlightsAreasOfThePageBlueThat),
|
|
226
226
|
Common.Settings.Settings.instance().moduleSetting('showLayoutShiftRegions'));
|
|
227
|
-
this
|
|
227
|
+
this.#appendCheckbox(
|
|
228
228
|
i18nString(UIStrings.layerBorders), i18nString(UIStrings.showsLayerBordersOrangeoliveAnd),
|
|
229
229
|
Common.Settings.Settings.instance().moduleSetting('showDebugBorders'));
|
|
230
|
-
this
|
|
230
|
+
this.#appendCheckbox(
|
|
231
231
|
i18nString(UIStrings.frameRenderingStats), i18nString(UIStrings.plotsFrameThroughputDropped),
|
|
232
232
|
Common.Settings.Settings.instance().moduleSetting('showFPSCounter'));
|
|
233
|
-
this
|
|
233
|
+
this.#appendCheckbox(
|
|
234
234
|
i18nString(UIStrings.scrollingPerformanceIssues), i18nString(UIStrings.highlightsElementsTealThatCan),
|
|
235
235
|
Common.Settings.Settings.instance().moduleSetting('showScrollBottleneckRects'));
|
|
236
|
-
this
|
|
236
|
+
this.#appendCheckbox(
|
|
237
237
|
i18nString(UIStrings.highlightAdFrames), i18nString(UIStrings.highlightsFramesRedDetectedToBe),
|
|
238
238
|
Common.Settings.Settings.instance().moduleSetting('showAdHighlights'));
|
|
239
|
-
this
|
|
239
|
+
this.#appendCheckbox(
|
|
240
240
|
i18nString(UIStrings.coreWebVitals), i18nString(UIStrings.showsAnOverlayWithCoreWebVitals),
|
|
241
241
|
Common.Settings.Settings.instance().moduleSetting('showWebVitals'));
|
|
242
|
-
this
|
|
242
|
+
this.#appendCheckbox(
|
|
243
243
|
i18nString(UIStrings.disableLocalFonts), i18nString(UIStrings.disablesLocalSourcesInFontface),
|
|
244
244
|
Common.Settings.Settings.instance().moduleSetting('localFontsDisabled'));
|
|
245
|
-
this
|
|
245
|
+
this.#appendCheckbox(
|
|
246
246
|
i18nString(UIStrings.emulateAFocusedPage), i18nString(UIStrings.emulatesAFocusedPage),
|
|
247
247
|
Common.Settings.Settings.instance().moduleSetting('emulatePageFocus'));
|
|
248
248
|
this.contentElement.createChild('div').classList.add('panel-section-separator');
|
|
249
249
|
|
|
250
|
-
this
|
|
250
|
+
this.#appendSelect(
|
|
251
251
|
i18nString(UIStrings.forcesMediaTypeForTestingPrint),
|
|
252
252
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMedia'));
|
|
253
|
-
this
|
|
253
|
+
this.#appendSelect(
|
|
254
254
|
i18nString(UIStrings.forcesCssPreferscolorschemeMedia),
|
|
255
255
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme'));
|
|
256
|
-
this
|
|
256
|
+
this.#appendSelect(
|
|
257
257
|
i18nString(UIStrings.forcesCssForcedColors),
|
|
258
258
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeatureForcedColors'));
|
|
259
259
|
if (supportsPrefersContrast()) {
|
|
260
|
-
this
|
|
260
|
+
this.#appendSelect(
|
|
261
261
|
i18nString(UIStrings.forcesCssPreferscontrastMedia),
|
|
262
262
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersContrast'));
|
|
263
263
|
}
|
|
264
|
-
this
|
|
264
|
+
this.#appendSelect(
|
|
265
265
|
i18nString(UIStrings.forcesCssPrefersreducedmotion),
|
|
266
266
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion'));
|
|
267
267
|
if (supportsPrefersReducedData()) {
|
|
268
|
-
this
|
|
268
|
+
this.#appendSelect(
|
|
269
269
|
i18nString(UIStrings.forcesCssPrefersreduceddataMedia),
|
|
270
270
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersReducedData'));
|
|
271
271
|
}
|
|
272
|
-
this
|
|
272
|
+
this.#appendSelect(
|
|
273
273
|
i18nString(UIStrings.forcesCssColorgamutMediaFeature),
|
|
274
274
|
Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeatureColorGamut'));
|
|
275
275
|
this.contentElement.createChild('div').classList.add('panel-section-separator');
|
|
276
276
|
|
|
277
|
-
this
|
|
277
|
+
this.#appendSelect(
|
|
278
278
|
i18nString(UIStrings.forcesVisionDeficiencyEmulation),
|
|
279
279
|
Common.Settings.Settings.instance().moduleSetting('emulatedVisionDeficiency'));
|
|
280
280
|
|
|
281
281
|
this.contentElement.createChild('div').classList.add('panel-section-separator');
|
|
282
|
-
this
|
|
282
|
+
this.#appendSelect(
|
|
283
283
|
i18nString(UIStrings.emulatesAutoDarkMode),
|
|
284
284
|
Common.Settings.Settings.instance().moduleSetting('emulateAutoDarkMode'));
|
|
285
285
|
this.contentElement.createChild('div').classList.add('panel-section-separator');
|
|
286
286
|
|
|
287
|
-
this
|
|
287
|
+
this.#appendCheckbox(
|
|
288
288
|
i18nString(UIStrings.disableAvifImageFormat), i18nString(UIStrings.requiresAPageReloadToApplyAnd),
|
|
289
289
|
Common.Settings.Settings.instance().moduleSetting('avifFormatDisabled'));
|
|
290
290
|
|
|
291
|
-
const webpCheckbox = this
|
|
291
|
+
const webpCheckbox = this.#appendCheckbox(
|
|
292
292
|
i18nString(UIStrings.disableWebpImageFormat), i18nString(UIStrings.requiresAPageReloadToApplyAnd),
|
|
293
293
|
Common.Settings.Settings.instance().moduleSetting('webpFormatDisabled'));
|
|
294
294
|
|
|
@@ -298,7 +298,7 @@ export class RenderingOptionsView extends UI.Widget.VBox {
|
|
|
298
298
|
if (!hasSupport) {
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
|
-
webpCheckbox.before(this
|
|
301
|
+
webpCheckbox.before(this.#createCheckbox(
|
|
302
302
|
i18nString(UIStrings.disableJpegXlImageFormat), i18nString(UIStrings.requiresAPageReloadToApplyAnd),
|
|
303
303
|
Common.Settings.Settings.instance().moduleSetting('jpegXlFormatDisabled')));
|
|
304
304
|
});
|
|
@@ -315,23 +315,23 @@ export class RenderingOptionsView extends UI.Widget.VBox {
|
|
|
315
315
|
return renderingOptionsViewInstance;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
|
|
318
|
+
#createCheckbox(label: string, subtitle: string, setting: Common.Settings.Setting<boolean>):
|
|
319
319
|
UI.UIUtils.CheckboxLabel {
|
|
320
320
|
const checkboxLabel = UI.UIUtils.CheckboxLabel.create(label, false, subtitle);
|
|
321
321
|
UI.SettingsUI.bindCheckbox(checkboxLabel.checkboxElement, setting);
|
|
322
322
|
return checkboxLabel;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
|
|
325
|
+
#appendCheckbox(label: string, subtitle: string, setting: Common.Settings.Setting<boolean>):
|
|
326
326
|
UI.UIUtils.CheckboxLabel {
|
|
327
|
-
const checkbox = this
|
|
327
|
+
const checkbox = this.#createCheckbox(label, subtitle, setting);
|
|
328
328
|
this.contentElement.appendChild(checkbox);
|
|
329
329
|
return checkbox;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
333
333
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
334
|
-
|
|
334
|
+
#appendSelect(label: string, setting: Common.Settings.Setting<any>): void {
|
|
335
335
|
const control = UI.SettingsUI.createControlForSetting(setting, label);
|
|
336
336
|
if (control) {
|
|
337
337
|
this.contentElement.appendChild(control);
|
|
@@ -13,18 +13,18 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
13
13
|
#ignoreContextChanged?: boolean;
|
|
14
14
|
|
|
15
15
|
constructor(targetManager: SDK.TargetManager.TargetManager, context: UI.Context.Context) {
|
|
16
|
-
context.addFlavorChangeListener(SDK.RuntimeModel.ExecutionContext, this
|
|
17
|
-
context.addFlavorChangeListener(SDK.Target.Target, this
|
|
16
|
+
context.addFlavorChangeListener(SDK.RuntimeModel.ExecutionContext, this.#executionContextChanged, this);
|
|
17
|
+
context.addFlavorChangeListener(SDK.Target.Target, this.#targetChanged, this);
|
|
18
18
|
|
|
19
19
|
targetManager.addModelListener(
|
|
20
|
-
SDK.RuntimeModel.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextCreated, this
|
|
20
|
+
SDK.RuntimeModel.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextCreated, this.#onExecutionContextCreated,
|
|
21
21
|
this);
|
|
22
22
|
targetManager.addModelListener(
|
|
23
23
|
SDK.RuntimeModel.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextDestroyed,
|
|
24
|
-
this
|
|
24
|
+
this.#onExecutionContextDestroyed, this);
|
|
25
25
|
targetManager.addModelListener(
|
|
26
26
|
SDK.RuntimeModel.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextOrderChanged,
|
|
27
|
-
this
|
|
27
|
+
this.#onExecutionContextOrderChanged, this);
|
|
28
28
|
this.#targetManager = targetManager;
|
|
29
29
|
this.#context = context;
|
|
30
30
|
targetManager.observeModels(SDK.RuntimeModel.RuntimeModel, this);
|
|
@@ -46,7 +46,7 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
46
46
|
modelRemoved(runtimeModel: SDK.RuntimeModel.RuntimeModel): void {
|
|
47
47
|
const currentExecutionContext = this.#context.flavor(SDK.RuntimeModel.ExecutionContext);
|
|
48
48
|
if (currentExecutionContext && currentExecutionContext.runtimeModel === runtimeModel) {
|
|
49
|
-
this
|
|
49
|
+
this.#currentExecutionContextGone();
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
const models = this.#targetManager.models(SDK.RuntimeModel.RuntimeModel);
|
|
@@ -55,22 +55,22 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
#executionContextChanged({
|
|
59
59
|
data: newContext,
|
|
60
60
|
}: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.ExecutionContext|null>): void {
|
|
61
61
|
if (newContext) {
|
|
62
62
|
this.#context.setFlavor(SDK.Target.Target, newContext.target());
|
|
63
63
|
if (!this.#ignoreContextChanged) {
|
|
64
|
-
this.#lastSelectedContextId = this
|
|
64
|
+
this.#lastSelectedContextId = this.#contextPersistentId(newContext);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
#contextPersistentId(executionContext: SDK.RuntimeModel.ExecutionContext): string {
|
|
70
70
|
return executionContext.isDefault ? executionContext.target().name() + ':' + executionContext.frameId : '';
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
#targetChanged({data: newTarget}: Common.EventTarget.EventTargetEvent<SDK.Target.Target|null>): void {
|
|
74
74
|
const currentContext = this.#context.flavor(SDK.RuntimeModel.ExecutionContext);
|
|
75
75
|
|
|
76
76
|
if (!newTarget || (currentContext && currentContext.target() === newTarget)) {
|
|
@@ -85,12 +85,12 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
85
85
|
|
|
86
86
|
let newContext: SDK.RuntimeModel.ExecutionContext|null = null;
|
|
87
87
|
for (let i = 0; i < executionContexts.length && !newContext; ++i) {
|
|
88
|
-
if (this
|
|
88
|
+
if (this.#shouldSwitchToContext(executionContexts[i])) {
|
|
89
89
|
newContext = executionContexts[i];
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
for (let i = 0; i < executionContexts.length && !newContext; ++i) {
|
|
93
|
-
if (this
|
|
93
|
+
if (this.#isDefaultContext(executionContexts[i])) {
|
|
94
94
|
newContext = executionContexts[i];
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -99,14 +99,14 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
99
99
|
this.#ignoreContextChanged = false;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
if (this.#lastSelectedContextId && this.#lastSelectedContextId === this
|
|
102
|
+
#shouldSwitchToContext(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
103
|
+
if (this.#lastSelectedContextId && this.#lastSelectedContextId === this.#contextPersistentId(executionContext)) {
|
|
104
104
|
return true;
|
|
105
105
|
}
|
|
106
|
-
return !this.#lastSelectedContextId && this
|
|
106
|
+
return !this.#lastSelectedContextId && this.#isDefaultContext(executionContext);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
#isDefaultContext(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
110
110
|
if (!executionContext.isDefault || !executionContext.frameId) {
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
@@ -118,32 +118,29 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
118
118
|
return Boolean(frame?.isTopFrame());
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.switchContextIfNecessary(event.data);
|
|
121
|
+
#onExecutionContextCreated(event: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.ExecutionContext>): void {
|
|
122
|
+
this.#switchContextIfNecessary(event.data);
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
void {
|
|
125
|
+
#onExecutionContextDestroyed(event: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.ExecutionContext>): void {
|
|
128
126
|
const executionContext = event.data;
|
|
129
127
|
if (this.#context.flavor(SDK.RuntimeModel.ExecutionContext) === executionContext) {
|
|
130
|
-
this
|
|
128
|
+
this.#currentExecutionContextGone();
|
|
131
129
|
}
|
|
132
130
|
}
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
void {
|
|
132
|
+
#onExecutionContextOrderChanged(event: Common.EventTarget.EventTargetEvent<SDK.RuntimeModel.RuntimeModel>): void {
|
|
136
133
|
const runtimeModel = event.data;
|
|
137
134
|
const executionContexts = runtimeModel.executionContexts();
|
|
138
135
|
for (let i = 0; i < executionContexts.length; i++) {
|
|
139
|
-
if (this
|
|
136
|
+
if (this.#switchContextIfNecessary(executionContexts[i])) {
|
|
140
137
|
break;
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
140
|
}
|
|
144
141
|
|
|
145
|
-
|
|
146
|
-
if (!this.#context.flavor(SDK.RuntimeModel.ExecutionContext) || this
|
|
142
|
+
#switchContextIfNecessary(executionContext: SDK.RuntimeModel.ExecutionContext): boolean {
|
|
143
|
+
if (!this.#context.flavor(SDK.RuntimeModel.ExecutionContext) || this.#shouldSwitchToContext(executionContext)) {
|
|
147
144
|
this.#ignoreContextChanged = true;
|
|
148
145
|
this.#context.setFlavor(SDK.RuntimeModel.ExecutionContext, executionContext);
|
|
149
146
|
this.#ignoreContextChanged = false;
|
|
@@ -152,13 +149,13 @@ export class ExecutionContextSelector implements SDK.TargetManager.SDKModelObser
|
|
|
152
149
|
return false;
|
|
153
150
|
}
|
|
154
151
|
|
|
155
|
-
|
|
152
|
+
#currentExecutionContextGone(): void {
|
|
156
153
|
const runtimeModels = this.#targetManager.models(SDK.RuntimeModel.RuntimeModel);
|
|
157
154
|
let newContext: SDK.RuntimeModel.ExecutionContext|null = null;
|
|
158
155
|
for (let i = 0; i < runtimeModels.length && !newContext; ++i) {
|
|
159
156
|
const executionContexts = runtimeModels[i].executionContexts();
|
|
160
157
|
for (const executionContext of executionContexts) {
|
|
161
|
-
if (this
|
|
158
|
+
if (this.#isDefaultContext(executionContext)) {
|
|
162
159
|
newContext = executionContext;
|
|
163
160
|
break;
|
|
164
161
|
}
|