chrome-devtools-frontend 1.0.927127 → 1.0.928589
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 +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -11,35 +11,35 @@ type IgnoreListArgs = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export class TracingModel {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
#backingStorageInternal: BackingStorage;
|
|
15
|
+
#firstWritePending: boolean;
|
|
16
|
+
readonly #processById: Map<string|number, Process>;
|
|
17
|
+
readonly #processByName: Map<string, Process>;
|
|
18
|
+
#minimumRecordTimeInternal: number;
|
|
19
|
+
#maximumRecordTimeInternal: number;
|
|
20
|
+
readonly #devToolsMetadataEventsInternal: Event[];
|
|
21
|
+
#asyncEvents: AsyncEvent[];
|
|
22
|
+
readonly #openAsyncEvents: Map<string, AsyncEvent>;
|
|
23
|
+
readonly #openNestableAsyncEvents: Map<string, AsyncEvent[]>;
|
|
24
|
+
readonly #profileGroups: Map<string, ProfileEventsGroup>;
|
|
25
|
+
readonly #parsedCategories: Map<string, Set<string>>;
|
|
26
|
+
readonly #mainFrameNavStartTimes: Map<string, Event>;
|
|
27
27
|
|
|
28
28
|
constructor(backingStorage: BackingStorage) {
|
|
29
|
-
this
|
|
29
|
+
this.#backingStorageInternal = backingStorage;
|
|
30
30
|
// Avoid extra reset of the storage as it's expensive.
|
|
31
|
-
this
|
|
32
|
-
this
|
|
33
|
-
this
|
|
34
|
-
this
|
|
35
|
-
this
|
|
36
|
-
this
|
|
37
|
-
this
|
|
38
|
-
this
|
|
39
|
-
this
|
|
40
|
-
this
|
|
41
|
-
this
|
|
42
|
-
this
|
|
31
|
+
this.#firstWritePending = true;
|
|
32
|
+
this.#processById = new Map();
|
|
33
|
+
this.#processByName = new Map();
|
|
34
|
+
this.#minimumRecordTimeInternal = Number(Infinity);
|
|
35
|
+
this.#maximumRecordTimeInternal = Number(-Infinity);
|
|
36
|
+
this.#devToolsMetadataEventsInternal = [];
|
|
37
|
+
this.#asyncEvents = [];
|
|
38
|
+
this.#openAsyncEvents = new Map();
|
|
39
|
+
this.#openNestableAsyncEvents = new Map();
|
|
40
|
+
this.#profileGroups = new Map();
|
|
41
|
+
this.#parsedCategories = new Map();
|
|
42
|
+
this.#mainFrameNavStartTimes = new Map();
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
static isNestableAsyncPhase(phase: string): boolean {
|
|
@@ -86,7 +86,7 @@ export class TracingModel {
|
|
|
86
86
|
|
|
87
87
|
static browserMainThread(tracingModel: TracingModel): Thread|null {
|
|
88
88
|
const processes = tracingModel.sortedProcesses();
|
|
89
|
-
// Avoid warning for an empty model.
|
|
89
|
+
// Avoid warning for an empty #model.
|
|
90
90
|
if (!processes.length) {
|
|
91
91
|
return null;
|
|
92
92
|
}
|
|
@@ -116,7 +116,7 @@ export class TracingModel {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
devToolsMetadataEvents(): Event[] {
|
|
119
|
-
return this
|
|
119
|
+
return this.#devToolsMetadataEventsInternal;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
addEvents(events: EventPayload[]): void {
|
|
@@ -127,10 +127,10 @@ export class TracingModel {
|
|
|
127
127
|
|
|
128
128
|
tracingComplete(): void {
|
|
129
129
|
this.processPendingAsyncEvents();
|
|
130
|
-
this
|
|
131
|
-
this
|
|
132
|
-
this
|
|
133
|
-
for (const process of this
|
|
130
|
+
this.#backingStorageInternal.appendString(this.#firstWritePending ? '[]' : ']');
|
|
131
|
+
this.#backingStorageInternal.finishWriting();
|
|
132
|
+
this.#firstWritePending = false;
|
|
133
|
+
for (const process of this.#processById.values()) {
|
|
134
134
|
for (const thread of process.threads.values()) {
|
|
135
135
|
thread.tracingComplete();
|
|
136
136
|
}
|
|
@@ -138,15 +138,15 @@ export class TracingModel {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
dispose(): void {
|
|
141
|
-
if (!this
|
|
142
|
-
this
|
|
141
|
+
if (!this.#firstWritePending) {
|
|
142
|
+
this.#backingStorageInternal.reset();
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
adjustTime(offset: number): void {
|
|
147
|
-
this
|
|
148
|
-
this
|
|
149
|
-
for (const process of this
|
|
147
|
+
this.#minimumRecordTimeInternal += offset;
|
|
148
|
+
this.#maximumRecordTimeInternal += offset;
|
|
149
|
+
for (const process of this.#processById.values()) {
|
|
150
150
|
for (const thread of process.threads.values()) {
|
|
151
151
|
for (const event of thread.events()) {
|
|
152
152
|
event.startTime += offset;
|
|
@@ -165,42 +165,42 @@ export class TracingModel {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
private addEvent(payload: EventPayload): void {
|
|
168
|
-
let process = this
|
|
168
|
+
let process = this.#processById.get(payload.pid);
|
|
169
169
|
if (!process) {
|
|
170
170
|
process = new Process(this, payload.pid);
|
|
171
|
-
this
|
|
171
|
+
this.#processById.set(payload.pid, process);
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
const phase = Phase;
|
|
175
175
|
const eventsDelimiter = ',\n';
|
|
176
|
-
this
|
|
177
|
-
this
|
|
176
|
+
this.#backingStorageInternal.appendString(this.#firstWritePending ? '[' : eventsDelimiter);
|
|
177
|
+
this.#firstWritePending = false;
|
|
178
178
|
const stringPayload = JSON.stringify(payload);
|
|
179
179
|
const isAccessible = payload.ph === phase.SnapshotObject;
|
|
180
180
|
let backingStorage: (() => Promise<string|null>)|null = null;
|
|
181
181
|
const keepStringsLessThan = 10000;
|
|
182
182
|
if (isAccessible && stringPayload.length > keepStringsLessThan) {
|
|
183
|
-
backingStorage = this
|
|
183
|
+
backingStorage = this.#backingStorageInternal.appendAccessibleString(stringPayload);
|
|
184
184
|
} else {
|
|
185
|
-
this
|
|
185
|
+
this.#backingStorageInternal.appendString(stringPayload);
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
const timestamp = payload.ts / 1000;
|
|
189
189
|
// We do allow records for unrelated threads to arrive out-of-order,
|
|
190
190
|
// so there's a chance we're getting records from the past.
|
|
191
|
-
if (timestamp && timestamp < this
|
|
191
|
+
if (timestamp && timestamp < this.#minimumRecordTimeInternal &&
|
|
192
192
|
(payload.ph === phase.Begin || payload.ph === phase.Complete || payload.ph === phase.Instant) &&
|
|
193
193
|
// UMA related events are ignored when calculating the minimumRecordTime because they might
|
|
194
194
|
// be related to previous navigations that happened before the current trace started and
|
|
195
195
|
// will currently not be displayed anyways.
|
|
196
196
|
// See crbug.com/1201198
|
|
197
197
|
(!payload.name.endsWith('::UMA'))) {
|
|
198
|
-
this
|
|
198
|
+
this.#minimumRecordTimeInternal = timestamp;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
201
|
if (payload.name === 'TracingStartedInBrowser') {
|
|
202
202
|
// If we received a timestamp for tracing start, use that for minimumRecordTime.
|
|
203
|
-
this
|
|
203
|
+
this.#minimumRecordTimeInternal = timestamp;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
// Track only main thread navigation start items. This is done by tracking isLoadingMainFrame,
|
|
@@ -216,13 +216,13 @@ export class TracingModel {
|
|
|
216
216
|
if (isLoadingMainFrame && documentLoaderURL !== '') {
|
|
217
217
|
const thread = process.threadById(payload.tid);
|
|
218
218
|
const navStartEvent = Event.fromPayload(payload, thread);
|
|
219
|
-
this
|
|
219
|
+
this.#mainFrameNavStartTimes.set(navigationId, navStartEvent);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
const endTimeStamp = (payload.ts + (payload.dur || 0)) / 1000;
|
|
225
|
-
this
|
|
225
|
+
this.#maximumRecordTimeInternal = Math.max(this.#maximumRecordTimeInternal, endTimeStamp);
|
|
226
226
|
const event = process.addEvent(payload);
|
|
227
227
|
if (!event) {
|
|
228
228
|
return;
|
|
@@ -235,11 +235,11 @@ export class TracingModel {
|
|
|
235
235
|
// chronological order. However, also add individual async events to the thread flow (above), so we can easily
|
|
236
236
|
// display them on the same chart as other events, should we choose so.
|
|
237
237
|
if (TracingModel.isAsyncPhase(payload.ph)) {
|
|
238
|
-
this
|
|
238
|
+
this.#asyncEvents.push((event as AsyncEvent));
|
|
239
239
|
}
|
|
240
240
|
event.setBackingStorage(backingStorage);
|
|
241
241
|
if (event.hasCategory(DevToolsMetadataEventCategory)) {
|
|
242
|
-
this
|
|
242
|
+
this.#devToolsMetadataEventsInternal.push(event);
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
if (payload.ph !== phase.Metadata) {
|
|
@@ -254,7 +254,7 @@ export class TracingModel {
|
|
|
254
254
|
case MetadataEvent.ProcessName: {
|
|
255
255
|
const processName = payload.args['name'];
|
|
256
256
|
process.setName(processName);
|
|
257
|
-
this
|
|
257
|
+
this.#processByName.set(processName, process);
|
|
258
258
|
break;
|
|
259
259
|
}
|
|
260
260
|
case MetadataEvent.ThreadSortIndex: {
|
|
@@ -270,40 +270,40 @@ export class TracingModel {
|
|
|
270
270
|
|
|
271
271
|
private addSampleEvent(event: Event): void {
|
|
272
272
|
const id = `${event.thread.process().id()}:${event.id}`;
|
|
273
|
-
const group = this
|
|
273
|
+
const group = this.#profileGroups.get(id);
|
|
274
274
|
if (group) {
|
|
275
275
|
group.addChild(event);
|
|
276
276
|
} else {
|
|
277
|
-
this
|
|
277
|
+
this.#profileGroups.set(id, new ProfileEventsGroup(event));
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
281
|
profileGroup(event: Event): ProfileEventsGroup|null {
|
|
282
|
-
return this
|
|
282
|
+
return this.#profileGroups.get(`${event.thread.process().id()}:${event.id}`) || null;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
minimumRecordTime(): number {
|
|
286
|
-
return this
|
|
286
|
+
return this.#minimumRecordTimeInternal;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
maximumRecordTime(): number {
|
|
290
|
-
return this
|
|
290
|
+
return this.#maximumRecordTimeInternal;
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
navStartTimes(): Map<string, Event> {
|
|
294
|
-
return this
|
|
294
|
+
return this.#mainFrameNavStartTimes;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
sortedProcesses(): Process[] {
|
|
298
|
-
return Sorter.sort([...this
|
|
298
|
+
return Sorter.sort([...this.#processById.values()]);
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
getProcessByName(name: string): Process|null {
|
|
302
|
-
return this
|
|
302
|
+
return this.#processByName.get(name) ?? null;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
305
|
getProcessById(pid: number): Process|null {
|
|
306
|
-
return this
|
|
306
|
+
return this.#processById.get(pid) || null;
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
getThreadByName(processName: string, threadName: string): Thread|null {
|
|
@@ -321,50 +321,50 @@ export class TracingModel {
|
|
|
321
321
|
}
|
|
322
322
|
|
|
323
323
|
private processPendingAsyncEvents(): void {
|
|
324
|
-
this
|
|
325
|
-
for (let i = 0; i < this
|
|
326
|
-
const event = this
|
|
324
|
+
this.#asyncEvents.sort(Event.compareStartTime);
|
|
325
|
+
for (let i = 0; i < this.#asyncEvents.length; ++i) {
|
|
326
|
+
const event = this.#asyncEvents[i];
|
|
327
327
|
if (TracingModel.isNestableAsyncPhase(event.phase)) {
|
|
328
328
|
this.addNestableAsyncEvent(event);
|
|
329
329
|
} else {
|
|
330
330
|
this.addAsyncEvent(event);
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
|
-
this
|
|
333
|
+
this.#asyncEvents = [];
|
|
334
334
|
this.closeOpenAsyncEvents();
|
|
335
335
|
}
|
|
336
336
|
|
|
337
337
|
private closeOpenAsyncEvents(): void {
|
|
338
|
-
for (const event of this
|
|
339
|
-
event.setEndTime(this
|
|
338
|
+
for (const event of this.#openAsyncEvents.values()) {
|
|
339
|
+
event.setEndTime(this.#maximumRecordTimeInternal);
|
|
340
340
|
// FIXME: remove this once we figure a better way to convert async console
|
|
341
341
|
// events to sync [waterfall] timeline records.
|
|
342
|
-
event.steps[0].setEndTime(this
|
|
342
|
+
event.steps[0].setEndTime(this.#maximumRecordTimeInternal);
|
|
343
343
|
}
|
|
344
|
-
this
|
|
344
|
+
this.#openAsyncEvents.clear();
|
|
345
345
|
|
|
346
|
-
for (const eventStack of this
|
|
346
|
+
for (const eventStack of this.#openNestableAsyncEvents.values()) {
|
|
347
347
|
while (eventStack.length) {
|
|
348
348
|
const event = eventStack.pop();
|
|
349
349
|
if (!event) {
|
|
350
350
|
continue;
|
|
351
351
|
}
|
|
352
|
-
event.setEndTime(this
|
|
352
|
+
event.setEndTime(this.#maximumRecordTimeInternal);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
this
|
|
355
|
+
this.#openNestableAsyncEvents.clear();
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
private addNestableAsyncEvent(event: Event): void {
|
|
359
359
|
const phase = Phase;
|
|
360
360
|
const key = event.categoriesString + '.' + event.id;
|
|
361
|
-
let openEventsStack = this
|
|
361
|
+
let openEventsStack = this.#openNestableAsyncEvents.get(key);
|
|
362
362
|
|
|
363
363
|
switch (event.phase) {
|
|
364
364
|
case phase.NestableAsyncBegin: {
|
|
365
365
|
if (!openEventsStack) {
|
|
366
366
|
openEventsStack = [];
|
|
367
|
-
this
|
|
367
|
+
this.#openNestableAsyncEvents.set(key, openEventsStack);
|
|
368
368
|
}
|
|
369
369
|
const asyncEvent = new AsyncEvent(event);
|
|
370
370
|
openEventsStack.push(asyncEvent);
|
|
@@ -403,7 +403,7 @@ export class TracingModel {
|
|
|
403
403
|
private addAsyncEvent(event: Event): void {
|
|
404
404
|
const phase = Phase;
|
|
405
405
|
const key = event.categoriesString + '.' + event.name + '.' + event.id;
|
|
406
|
-
let asyncEvent = this
|
|
406
|
+
let asyncEvent = this.#openAsyncEvents.get(key);
|
|
407
407
|
|
|
408
408
|
if (event.phase === phase.AsyncBegin) {
|
|
409
409
|
if (asyncEvent) {
|
|
@@ -411,7 +411,7 @@ export class TracingModel {
|
|
|
411
411
|
return;
|
|
412
412
|
}
|
|
413
413
|
asyncEvent = new AsyncEvent(event);
|
|
414
|
-
this
|
|
414
|
+
this.#openAsyncEvents.set(key, asyncEvent);
|
|
415
415
|
event.thread.addAsyncEvent(asyncEvent);
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
@@ -421,7 +421,7 @@ export class TracingModel {
|
|
|
421
421
|
}
|
|
422
422
|
if (event.phase === phase.AsyncEnd) {
|
|
423
423
|
asyncEvent.addStep(event);
|
|
424
|
-
this
|
|
424
|
+
this.#openAsyncEvents.delete(key);
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
427
|
if (event.phase === phase.AsyncStepInto || event.phase === phase.AsyncStepPast) {
|
|
@@ -440,14 +440,14 @@ export class TracingModel {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
backingStorage(): BackingStorage {
|
|
443
|
-
return this
|
|
443
|
+
return this.#backingStorageInternal;
|
|
444
444
|
}
|
|
445
445
|
|
|
446
446
|
parsedCategoriesForString(str: string): Set<string> {
|
|
447
|
-
let parsedCategories = this
|
|
447
|
+
let parsedCategories = this.#parsedCategories.get(str);
|
|
448
448
|
if (!parsedCategories) {
|
|
449
449
|
parsedCategories = new Set(str ? str.split(',') : []);
|
|
450
|
-
this
|
|
450
|
+
this.#parsedCategories.set(str, parsedCategories);
|
|
451
451
|
}
|
|
452
452
|
return parsedCategories;
|
|
453
453
|
}
|
|
@@ -507,7 +507,7 @@ export abstract class BackingStorage {
|
|
|
507
507
|
|
|
508
508
|
export class Event {
|
|
509
509
|
categoriesString: string;
|
|
510
|
-
|
|
510
|
+
readonly #parsedCategories: Set<string>;
|
|
511
511
|
name: string;
|
|
512
512
|
phase: Phase;
|
|
513
513
|
startTime: number;
|
|
@@ -526,7 +526,7 @@ export class Event {
|
|
|
526
526
|
|
|
527
527
|
constructor(categories: string|undefined, name: string, phase: Phase, startTime: number, thread: Thread) {
|
|
528
528
|
this.categoriesString = categories || '';
|
|
529
|
-
this
|
|
529
|
+
this.#parsedCategories = thread.getModel().parsedCategoriesForString(this.categoriesString);
|
|
530
530
|
this.name = name;
|
|
531
531
|
this.phase = phase;
|
|
532
532
|
this.startTime = startTime;
|
|
@@ -572,7 +572,7 @@ export class Event {
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
hasCategory(categoryName: string): boolean {
|
|
575
|
-
return this
|
|
575
|
+
return this.#parsedCategories.has(categoryName);
|
|
576
576
|
}
|
|
577
577
|
|
|
578
578
|
setEndTime(endTime: number): void {
|
|
@@ -587,7 +587,7 @@ export class Event {
|
|
|
587
587
|
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
|
|
588
588
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
589
589
|
addArgs(args: any): void {
|
|
590
|
-
// Shallow copy args to avoid modifying original payload which may be saved to file.
|
|
590
|
+
// Shallow copy args to avoid modifying original #payload which may be saved to file.
|
|
591
591
|
for (const name in args) {
|
|
592
592
|
if (name in this.args) {
|
|
593
593
|
console.error('Same argument name (' + name + ') is used for begin and end phases of ' + this.name);
|
|
@@ -612,13 +612,13 @@ export class Event {
|
|
|
612
612
|
|
|
613
613
|
// eslint-disable-next-line rulesdir/enforce_custom_event_names, rulesdir/static_custom_event_names
|
|
614
614
|
export class ObjectSnapshot extends Event {
|
|
615
|
-
|
|
616
|
-
|
|
615
|
+
#backingStorage: (() => Promise<string|null>)|null;
|
|
616
|
+
#objectPromiseInternal: Promise<ObjectSnapshot|null>|null;
|
|
617
617
|
|
|
618
618
|
constructor(category: string|undefined, name: string, startTime: number, thread: Thread) {
|
|
619
619
|
super(category, name, Phase.SnapshotObject, startTime, thread);
|
|
620
|
-
this
|
|
621
|
-
this
|
|
620
|
+
this.#backingStorage = null;
|
|
621
|
+
this.#objectPromiseInternal = null;
|
|
622
622
|
}
|
|
623
623
|
|
|
624
624
|
static fromPayload(payload: EventPayload, thread: Thread): ObjectSnapshot {
|
|
@@ -643,7 +643,7 @@ export class ObjectSnapshot extends Event {
|
|
|
643
643
|
callback((snapshot as ObjectSnapshot));
|
|
644
644
|
return;
|
|
645
645
|
}
|
|
646
|
-
const storage = this
|
|
646
|
+
const storage = this.#backingStorage;
|
|
647
647
|
if (storage) {
|
|
648
648
|
storage().then(onRead, callback.bind(null, null));
|
|
649
649
|
}
|
|
@@ -664,17 +664,17 @@ export class ObjectSnapshot extends Event {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
objectPromise(): Promise<ObjectSnapshot|null> {
|
|
667
|
-
if (!this
|
|
668
|
-
this
|
|
667
|
+
if (!this.#objectPromiseInternal) {
|
|
668
|
+
this.#objectPromiseInternal = new Promise(this.requestObject.bind(this));
|
|
669
669
|
}
|
|
670
|
-
return this
|
|
670
|
+
return this.#objectPromiseInternal;
|
|
671
671
|
}
|
|
672
672
|
|
|
673
673
|
setBackingStorage(backingStorage: (() => Promise<string|null>)|null): void {
|
|
674
674
|
if (!backingStorage) {
|
|
675
675
|
return;
|
|
676
676
|
}
|
|
677
|
-
this
|
|
677
|
+
this.#backingStorage = backingStorage;
|
|
678
678
|
this.args = {};
|
|
679
679
|
}
|
|
680
680
|
}
|
|
@@ -731,21 +731,21 @@ class Sorter {
|
|
|
731
731
|
class NamedObject {
|
|
732
732
|
model: TracingModel;
|
|
733
733
|
readonly idInternal: number;
|
|
734
|
-
|
|
735
|
-
|
|
734
|
+
#nameInternal: string;
|
|
735
|
+
#sortIndex: number;
|
|
736
736
|
constructor(model: TracingModel, id: number) {
|
|
737
737
|
this.model = model;
|
|
738
738
|
this.idInternal = id;
|
|
739
|
-
this
|
|
740
|
-
this
|
|
739
|
+
this.#nameInternal = '';
|
|
740
|
+
this.#sortIndex = 0;
|
|
741
741
|
}
|
|
742
742
|
|
|
743
743
|
setName(name: string): void {
|
|
744
|
-
this
|
|
744
|
+
this.#nameInternal = name;
|
|
745
745
|
}
|
|
746
746
|
|
|
747
747
|
name(): string {
|
|
748
|
-
return this
|
|
748
|
+
return this.#nameInternal;
|
|
749
749
|
}
|
|
750
750
|
|
|
751
751
|
id(): number {
|
|
@@ -753,7 +753,7 @@ class NamedObject {
|
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
setSortIndex(sortIndex: number): void {
|
|
756
|
-
this
|
|
756
|
+
this.#sortIndex = sortIndex;
|
|
757
757
|
}
|
|
758
758
|
|
|
759
759
|
getModel(): TracingModel {
|
|
@@ -763,11 +763,11 @@ class NamedObject {
|
|
|
763
763
|
|
|
764
764
|
export class Process extends NamedObject {
|
|
765
765
|
readonly threads: Map<number, Thread>;
|
|
766
|
-
|
|
766
|
+
readonly #threadByNameInternal: Map<string, Thread|null>;
|
|
767
767
|
constructor(model: TracingModel, id: number) {
|
|
768
768
|
super(model, id);
|
|
769
769
|
this.threads = new Map();
|
|
770
|
-
this
|
|
770
|
+
this.#threadByNameInternal = new Map();
|
|
771
771
|
}
|
|
772
772
|
|
|
773
773
|
threadById(id: number): Thread {
|
|
@@ -780,11 +780,11 @@ export class Process extends NamedObject {
|
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
threadByName(name: string): Thread|null {
|
|
783
|
-
return this
|
|
783
|
+
return this.#threadByNameInternal.get(name) || null;
|
|
784
784
|
}
|
|
785
785
|
|
|
786
786
|
setThreadByName(name: string, thread: Thread): void {
|
|
787
|
-
this
|
|
787
|
+
this.#threadByNameInternal.set(name, thread);
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
addEvent(payload: EventPayload): Event|null {
|
|
@@ -797,27 +797,27 @@ export class Process extends NamedObject {
|
|
|
797
797
|
}
|
|
798
798
|
|
|
799
799
|
export class Thread extends NamedObject {
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
800
|
+
readonly #processInternal: Process;
|
|
801
|
+
#eventsInternal: Event[];
|
|
802
|
+
readonly #asyncEventsInternal: AsyncEvent[];
|
|
803
|
+
#lastTopLevelEvent: Event|null;
|
|
804
804
|
constructor(process: Process, id: number) {
|
|
805
805
|
super(process.getModel(), id);
|
|
806
|
-
this
|
|
806
|
+
this.#processInternal = process;
|
|
807
807
|
|
|
808
|
-
this
|
|
809
|
-
this
|
|
810
|
-
this
|
|
808
|
+
this.#eventsInternal = [];
|
|
809
|
+
this.#asyncEventsInternal = [];
|
|
810
|
+
this.#lastTopLevelEvent = null;
|
|
811
811
|
}
|
|
812
812
|
|
|
813
813
|
tracingComplete(): void {
|
|
814
|
-
this
|
|
815
|
-
this
|
|
814
|
+
this.#asyncEventsInternal.sort(Event.compareStartTime);
|
|
815
|
+
this.#eventsInternal.sort(Event.compareStartTime);
|
|
816
816
|
const phases = Phase;
|
|
817
817
|
const stack: Event[] = [];
|
|
818
818
|
const toDelete = new Set<number>();
|
|
819
|
-
for (let i = 0; i < this
|
|
820
|
-
const e = this
|
|
819
|
+
for (let i = 0; i < this.#eventsInternal.length; ++i) {
|
|
820
|
+
const e = this.#eventsInternal[i];
|
|
821
821
|
e.ordinal = i;
|
|
822
822
|
switch (e.phase) {
|
|
823
823
|
case phases.End: {
|
|
@@ -856,7 +856,7 @@ export class Thread extends NamedObject {
|
|
|
856
856
|
event.phase = phases.Instant;
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
this
|
|
859
|
+
this.#eventsInternal = this.#eventsInternal.filter((_, idx) => !toDelete.has(idx));
|
|
860
860
|
}
|
|
861
861
|
|
|
862
862
|
addEvent(payload: EventPayload): Event|null {
|
|
@@ -864,40 +864,40 @@ export class Thread extends NamedObject {
|
|
|
864
864
|
Event.fromPayload(payload, this);
|
|
865
865
|
if (TracingModel.isTopLevelEvent(event)) {
|
|
866
866
|
// Discard nested "top-level" events.
|
|
867
|
-
const lastTopLevelEvent = this
|
|
867
|
+
const lastTopLevelEvent = this.#lastTopLevelEvent;
|
|
868
868
|
if (lastTopLevelEvent && (lastTopLevelEvent.endTime || 0) > event.startTime) {
|
|
869
869
|
return null;
|
|
870
870
|
}
|
|
871
|
-
this
|
|
871
|
+
this.#lastTopLevelEvent = event;
|
|
872
872
|
}
|
|
873
|
-
this
|
|
873
|
+
this.#eventsInternal.push(event);
|
|
874
874
|
return event;
|
|
875
875
|
}
|
|
876
876
|
|
|
877
877
|
addAsyncEvent(asyncEvent: AsyncEvent): void {
|
|
878
|
-
this
|
|
878
|
+
this.#asyncEventsInternal.push(asyncEvent);
|
|
879
879
|
}
|
|
880
880
|
|
|
881
881
|
setName(name: string): void {
|
|
882
882
|
super.setName(name);
|
|
883
|
-
this
|
|
883
|
+
this.#processInternal.setThreadByName(name, this);
|
|
884
884
|
}
|
|
885
885
|
|
|
886
886
|
process(): Process {
|
|
887
|
-
return this
|
|
887
|
+
return this.#processInternal;
|
|
888
888
|
}
|
|
889
889
|
|
|
890
890
|
events(): Event[] {
|
|
891
|
-
return this
|
|
891
|
+
return this.#eventsInternal;
|
|
892
892
|
}
|
|
893
893
|
|
|
894
894
|
asyncEvents(): AsyncEvent[] {
|
|
895
|
-
return this
|
|
895
|
+
return this.#asyncEventsInternal;
|
|
896
896
|
}
|
|
897
897
|
|
|
898
898
|
removeEventsByName(name: string): Event[] {
|
|
899
899
|
const extracted: Event[] = [];
|
|
900
|
-
this
|
|
900
|
+
this.#eventsInternal = this.#eventsInternal.filter(e => {
|
|
901
901
|
if (!e) {
|
|
902
902
|
return false;
|
|
903
903
|
}
|
|
@@ -10,41 +10,41 @@ import {Capability} from './Target.js';
|
|
|
10
10
|
import {SDKModel} from './SDKModel.js';
|
|
11
11
|
|
|
12
12
|
export class WebAuthnModel extends SDKModel {
|
|
13
|
-
|
|
13
|
+
readonly #agent: ProtocolProxyApi.WebAuthnApi;
|
|
14
14
|
constructor(target: Target) {
|
|
15
15
|
super(target);
|
|
16
|
-
this
|
|
16
|
+
this.#agent = target.webAuthnAgent();
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
setVirtualAuthEnvEnabled(enable: boolean): Promise<Object> {
|
|
20
20
|
if (enable) {
|
|
21
|
-
return this
|
|
21
|
+
return this.#agent.invoke_enable();
|
|
22
22
|
}
|
|
23
|
-
return this
|
|
23
|
+
return this.#agent.invoke_disable();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async addAuthenticator(options: Protocol.WebAuthn.VirtualAuthenticatorOptions):
|
|
27
27
|
Promise<Protocol.WebAuthn.AuthenticatorId> {
|
|
28
|
-
const response = await this
|
|
28
|
+
const response = await this.#agent.invoke_addVirtualAuthenticator({options});
|
|
29
29
|
return response.authenticatorId;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
async removeAuthenticator(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<void> {
|
|
33
|
-
await this
|
|
33
|
+
await this.#agent.invoke_removeVirtualAuthenticator({authenticatorId});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
async setAutomaticPresenceSimulation(authenticatorId: Protocol.WebAuthn.AuthenticatorId, enabled: boolean):
|
|
37
37
|
Promise<void> {
|
|
38
|
-
await this
|
|
38
|
+
await this.#agent.invoke_setAutomaticPresenceSimulation({authenticatorId, enabled});
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async getCredentials(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<Protocol.WebAuthn.Credential[]> {
|
|
42
|
-
const response = await this
|
|
42
|
+
const response = await this.#agent.invoke_getCredentials({authenticatorId});
|
|
43
43
|
return response.credentials;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async removeCredential(authenticatorId: Protocol.WebAuthn.AuthenticatorId, credentialId: string): Promise<void> {
|
|
47
|
-
await this
|
|
47
|
+
await this.#agent.invoke_removeCredential({authenticatorId, credentialId});
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|