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
|
@@ -13,19 +13,19 @@ let isolateManagerInstance: IsolateManager;
|
|
|
13
13
|
|
|
14
14
|
export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements
|
|
15
15
|
SDKModelObserver<RuntimeModel> {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
readonly #isolatesInternal: Map<string, Isolate>;
|
|
17
|
+
#isolateIdByModel: Map<RuntimeModel, string|null>;
|
|
18
|
+
#observers: Set<Observer>;
|
|
19
|
+
#pollId: number;
|
|
20
20
|
|
|
21
21
|
constructor() {
|
|
22
22
|
super();
|
|
23
|
-
this
|
|
24
|
-
// isolateIdByModel contains null while the isolateId is being retrieved.
|
|
25
|
-
this
|
|
26
|
-
this
|
|
23
|
+
this.#isolatesInternal = new Map();
|
|
24
|
+
// #isolateIdByModel contains null while the isolateId is being retrieved.
|
|
25
|
+
this.#isolateIdByModel = new Map();
|
|
26
|
+
this.#observers = new Set();
|
|
27
27
|
TargetManager.instance().observeModels(RuntimeModel, this);
|
|
28
|
-
this
|
|
28
|
+
this.#pollId = 0;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
static instance({forceNew}: {
|
|
@@ -39,22 +39,22 @@ export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
observeIsolates(observer: Observer): void {
|
|
42
|
-
if (this
|
|
42
|
+
if (this.#observers.has(observer)) {
|
|
43
43
|
throw new Error('Observer can only be registered once');
|
|
44
44
|
}
|
|
45
|
-
if (!this
|
|
45
|
+
if (!this.#observers.size) {
|
|
46
46
|
this.poll();
|
|
47
47
|
}
|
|
48
|
-
this
|
|
49
|
-
for (const isolate of this
|
|
48
|
+
this.#observers.add(observer);
|
|
49
|
+
for (const isolate of this.#isolatesInternal.values()) {
|
|
50
50
|
observer.isolateAdded(isolate);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
unobserveIsolates(observer: Observer): void {
|
|
55
|
-
this
|
|
56
|
-
if (!this
|
|
57
|
-
++this
|
|
55
|
+
this.#observers.delete(observer);
|
|
56
|
+
if (!this.#observers.size) {
|
|
57
|
+
++this.#pollId;
|
|
58
58
|
} // Stops the current polling loop.
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -63,68 +63,68 @@ export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
private async modelAddedInternal(model: RuntimeModel): Promise<void> {
|
|
66
|
-
this
|
|
66
|
+
this.#isolateIdByModel.set(model, null);
|
|
67
67
|
const isolateId = await model.isolateId();
|
|
68
|
-
if (!this
|
|
68
|
+
if (!this.#isolateIdByModel.has(model)) {
|
|
69
69
|
// The model has been removed during await.
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
if (!isolateId) {
|
|
73
|
-
this
|
|
73
|
+
this.#isolateIdByModel.delete(model);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
this
|
|
77
|
-
let isolate = this
|
|
76
|
+
this.#isolateIdByModel.set(model, isolateId);
|
|
77
|
+
let isolate = this.#isolatesInternal.get(isolateId);
|
|
78
78
|
if (!isolate) {
|
|
79
79
|
isolate = new Isolate(isolateId);
|
|
80
|
-
this
|
|
80
|
+
this.#isolatesInternal.set(isolateId, isolate);
|
|
81
81
|
}
|
|
82
82
|
isolate.modelsInternal.add(model);
|
|
83
83
|
if (isolate.modelsInternal.size === 1) {
|
|
84
|
-
for (const observer of this
|
|
84
|
+
for (const observer of this.#observers) {
|
|
85
85
|
observer.isolateAdded(isolate);
|
|
86
86
|
}
|
|
87
87
|
} else {
|
|
88
|
-
for (const observer of this
|
|
88
|
+
for (const observer of this.#observers) {
|
|
89
89
|
observer.isolateChanged(isolate);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
modelRemoved(model: RuntimeModel): void {
|
|
95
|
-
const isolateId = this
|
|
96
|
-
this
|
|
95
|
+
const isolateId = this.#isolateIdByModel.get(model);
|
|
96
|
+
this.#isolateIdByModel.delete(model);
|
|
97
97
|
if (!isolateId) {
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
|
-
const isolate = this
|
|
100
|
+
const isolate = this.#isolatesInternal.get(isolateId);
|
|
101
101
|
if (!isolate) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
isolate.modelsInternal.delete(model);
|
|
105
105
|
if (isolate.modelsInternal.size) {
|
|
106
|
-
for (const observer of this
|
|
106
|
+
for (const observer of this.#observers) {
|
|
107
107
|
observer.isolateChanged(isolate);
|
|
108
108
|
}
|
|
109
109
|
return;
|
|
110
110
|
}
|
|
111
|
-
for (const observer of this
|
|
111
|
+
for (const observer of this.#observers) {
|
|
112
112
|
observer.isolateRemoved(isolate);
|
|
113
113
|
}
|
|
114
|
-
this
|
|
114
|
+
this.#isolatesInternal.delete(isolateId);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
isolateByModel(model: RuntimeModel): Isolate|null {
|
|
118
|
-
return this
|
|
118
|
+
return this.#isolatesInternal.get(this.#isolateIdByModel.get(model) || '') || null;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
isolates(): Iterable<Isolate> {
|
|
122
|
-
return this
|
|
122
|
+
return this.#isolatesInternal.values();
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
private async poll(): Promise<void> {
|
|
126
|
-
const pollId = this
|
|
127
|
-
while (pollId === this
|
|
126
|
+
const pollId = this.#pollId;
|
|
127
|
+
while (pollId === this.#pollId) {
|
|
128
128
|
await Promise.all(Array.from(this.isolates(), isolate => isolate.update()));
|
|
129
129
|
await new Promise(r => setTimeout(r, PollIntervalMs));
|
|
130
130
|
}
|
|
@@ -152,21 +152,21 @@ export const MemoryTrendWindowMs = 120e3;
|
|
|
152
152
|
const PollIntervalMs = 2e3;
|
|
153
153
|
|
|
154
154
|
export class Isolate {
|
|
155
|
-
|
|
155
|
+
readonly #idInternal: string;
|
|
156
156
|
readonly modelsInternal: Set<RuntimeModel>;
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
#usedHeapSizeInternal: number;
|
|
158
|
+
readonly #memoryTrend: MemoryTrend;
|
|
159
159
|
|
|
160
160
|
constructor(id: string) {
|
|
161
|
-
this
|
|
161
|
+
this.#idInternal = id;
|
|
162
162
|
this.modelsInternal = new Set();
|
|
163
|
-
this
|
|
163
|
+
this.#usedHeapSizeInternal = 0;
|
|
164
164
|
const count = MemoryTrendWindowMs / PollIntervalMs;
|
|
165
|
-
this
|
|
165
|
+
this.#memoryTrend = new MemoryTrend(count);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
id(): string {
|
|
169
|
-
return this
|
|
169
|
+
return this.#idInternal;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
models(): Set<RuntimeModel> {
|
|
@@ -188,24 +188,24 @@ export class Isolate {
|
|
|
188
188
|
if (!usage) {
|
|
189
189
|
return;
|
|
190
190
|
}
|
|
191
|
-
this
|
|
192
|
-
this
|
|
191
|
+
this.#usedHeapSizeInternal = usage.usedSize;
|
|
192
|
+
this.#memoryTrend.add(this.#usedHeapSizeInternal);
|
|
193
193
|
IsolateManager.instance().dispatchEventToListeners(Events.MemoryChanged, this);
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
samplesCount(): number {
|
|
197
|
-
return this
|
|
197
|
+
return this.#memoryTrend.count();
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
usedHeapSize(): number {
|
|
201
|
-
return this
|
|
201
|
+
return this.#usedHeapSizeInternal;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
/**
|
|
205
205
|
* bytes per millisecond
|
|
206
206
|
*/
|
|
207
207
|
usedHeapSizeGrowRate(): number {
|
|
208
|
-
return this
|
|
208
|
+
return this.#memoryTrend.fitSlope();
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
isMainThread(): boolean {
|
|
@@ -215,59 +215,59 @@ export class Isolate {
|
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
export class MemoryTrend {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
218
|
+
#maxCount: number;
|
|
219
|
+
#base!: number;
|
|
220
|
+
#index!: number;
|
|
221
|
+
#x!: number[];
|
|
222
|
+
#y!: number[];
|
|
223
|
+
#sx!: number;
|
|
224
|
+
#sy!: number;
|
|
225
|
+
#sxx!: number;
|
|
226
|
+
#sxy!: number;
|
|
227
227
|
constructor(maxCount: number) {
|
|
228
|
-
this
|
|
228
|
+
this.#maxCount = maxCount | 0;
|
|
229
229
|
this.reset();
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
reset(): void {
|
|
233
|
-
this
|
|
234
|
-
this
|
|
235
|
-
this
|
|
236
|
-
this
|
|
237
|
-
this
|
|
238
|
-
this
|
|
239
|
-
this
|
|
240
|
-
this
|
|
233
|
+
this.#base = Date.now();
|
|
234
|
+
this.#index = 0;
|
|
235
|
+
this.#x = [];
|
|
236
|
+
this.#y = [];
|
|
237
|
+
this.#sx = 0;
|
|
238
|
+
this.#sy = 0;
|
|
239
|
+
this.#sxx = 0;
|
|
240
|
+
this.#sxy = 0;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
count(): number {
|
|
244
|
-
return this
|
|
244
|
+
return this.#x.length;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
add(heapSize: number, timestamp?: number): void {
|
|
248
|
-
const x = typeof timestamp === 'number' ? timestamp : Date.now() - this
|
|
248
|
+
const x = typeof timestamp === 'number' ? timestamp : Date.now() - this.#base;
|
|
249
249
|
const y = heapSize;
|
|
250
|
-
if (this
|
|
251
|
-
// Turns into a cyclic buffer once it reaches the
|
|
252
|
-
const x0 = this
|
|
253
|
-
const y0 = this
|
|
254
|
-
this
|
|
255
|
-
this
|
|
256
|
-
this
|
|
257
|
-
this
|
|
250
|
+
if (this.#x.length === this.#maxCount) {
|
|
251
|
+
// Turns into a cyclic buffer once it reaches the |#maxCount|.
|
|
252
|
+
const x0 = this.#x[this.#index];
|
|
253
|
+
const y0 = this.#y[this.#index];
|
|
254
|
+
this.#sx -= x0;
|
|
255
|
+
this.#sy -= y0;
|
|
256
|
+
this.#sxx -= x0 * x0;
|
|
257
|
+
this.#sxy -= x0 * y0;
|
|
258
258
|
}
|
|
259
|
-
this
|
|
260
|
-
this
|
|
261
|
-
this
|
|
262
|
-
this
|
|
263
|
-
this
|
|
264
|
-
this
|
|
265
|
-
this
|
|
259
|
+
this.#sx += x;
|
|
260
|
+
this.#sy += y;
|
|
261
|
+
this.#sxx += x * x;
|
|
262
|
+
this.#sxy += x * y;
|
|
263
|
+
this.#x[this.#index] = x;
|
|
264
|
+
this.#y[this.#index] = y;
|
|
265
|
+
this.#index = (this.#index + 1) % this.#maxCount;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
fitSlope(): number {
|
|
269
269
|
// We use the linear regression model to find the slope.
|
|
270
270
|
const n = this.count();
|
|
271
|
-
return n < 2 ? 0 : (this
|
|
271
|
+
return n < 2 ? 0 : (this.#sxy - this.#sx * this.#sy / n) / (this.#sxx - this.#sx * this.#sx / n);
|
|
272
272
|
}
|
|
273
273
|
}
|
|
@@ -16,8 +16,8 @@ import {SDKModel} from './SDKModel.js';
|
|
|
16
16
|
* wants to preserve issues for targets (e.g. iframes) that are already gone as well.
|
|
17
17
|
*/
|
|
18
18
|
export class IssuesModel extends SDKModel<EventTypes> implements ProtocolProxyApi.AuditsDispatcher {
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
#disposed = false;
|
|
20
|
+
#enabled = false;
|
|
21
21
|
|
|
22
22
|
constructor(target: Target) {
|
|
23
23
|
super(target);
|
|
@@ -25,11 +25,11 @@ export class IssuesModel extends SDKModel<EventTypes> implements ProtocolProxyAp
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
private async ensureEnabled(): Promise<void> {
|
|
28
|
-
if (this
|
|
28
|
+
if (this.#enabled) {
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
this
|
|
32
|
+
this.#enabled = true;
|
|
33
33
|
this.target().registerAuditsDispatcher(this);
|
|
34
34
|
const auditsAgent = this.target().auditsAgent();
|
|
35
35
|
await auditsAgent.invoke_enable();
|
|
@@ -41,11 +41,11 @@ export class IssuesModel extends SDKModel<EventTypes> implements ProtocolProxyAp
|
|
|
41
41
|
|
|
42
42
|
dispose(): void {
|
|
43
43
|
super.dispose();
|
|
44
|
-
this
|
|
44
|
+
this.#disposed = true;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
getTargetIfNotDisposed(): Target|null {
|
|
48
|
-
if (!this
|
|
48
|
+
if (!this.#disposed) {
|
|
49
49
|
return this.target();
|
|
50
50
|
}
|
|
51
51
|
return null;
|
|
@@ -49,82 +49,82 @@ export namespace Layer {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
export class StickyPositionConstraint {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
readonly #stickyBoxRectInternal: Protocol.DOM.Rect;
|
|
53
|
+
readonly #containingBlockRectInternal: Protocol.DOM.Rect;
|
|
54
|
+
readonly #nearestLayerShiftingStickyBoxInternal: Layer|null;
|
|
55
|
+
readonly #nearestLayerShiftingContainingBlockInternal: Layer|null;
|
|
56
56
|
|
|
57
57
|
constructor(layerTree: LayerTreeBase|null, constraint: Protocol.LayerTree.StickyPositionConstraint) {
|
|
58
|
-
this
|
|
59
|
-
this
|
|
60
|
-
this
|
|
58
|
+
this.#stickyBoxRectInternal = constraint.stickyBoxRect;
|
|
59
|
+
this.#containingBlockRectInternal = constraint.containingBlockRect;
|
|
60
|
+
this.#nearestLayerShiftingStickyBoxInternal = null;
|
|
61
61
|
if (layerTree && constraint.nearestLayerShiftingStickyBox) {
|
|
62
|
-
this
|
|
62
|
+
this.#nearestLayerShiftingStickyBoxInternal = layerTree.layerById(constraint.nearestLayerShiftingStickyBox);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
this
|
|
65
|
+
this.#nearestLayerShiftingContainingBlockInternal = null;
|
|
66
66
|
if (layerTree && constraint.nearestLayerShiftingContainingBlock) {
|
|
67
|
-
this
|
|
67
|
+
this.#nearestLayerShiftingContainingBlockInternal =
|
|
68
68
|
layerTree.layerById(constraint.nearestLayerShiftingContainingBlock);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
stickyBoxRect(): Protocol.DOM.Rect {
|
|
73
|
-
return this
|
|
73
|
+
return this.#stickyBoxRectInternal;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
containingBlockRect(): Protocol.DOM.Rect {
|
|
77
|
-
return this
|
|
77
|
+
return this.#containingBlockRectInternal;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
nearestLayerShiftingStickyBox(): Layer|null {
|
|
81
|
-
return this
|
|
81
|
+
return this.#nearestLayerShiftingStickyBoxInternal;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
nearestLayerShiftingContainingBlock(): Layer|null {
|
|
85
|
-
return this
|
|
85
|
+
return this.#nearestLayerShiftingContainingBlockInternal;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export class LayerTreeBase {
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
readonly #targetInternal: Target|null;
|
|
91
|
+
#domModel: DOMModel|null;
|
|
92
92
|
layersById: Map<string|number, Layer>;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
#rootInternal: Layer|null;
|
|
94
|
+
#contentRootInternal: Layer|null;
|
|
95
|
+
readonly #backendNodeIdToNodeInternal: Map<Protocol.DOM.BackendNodeId, DOMNode|null>;
|
|
96
|
+
#viewportSizeInternal?: {
|
|
97
97
|
width: number,
|
|
98
98
|
height: number,
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
constructor(target: Target|null) {
|
|
102
|
-
this
|
|
103
|
-
this
|
|
102
|
+
this.#targetInternal = target;
|
|
103
|
+
this.#domModel = target ? target.model(DOMModel) : null;
|
|
104
104
|
this.layersById = new Map();
|
|
105
|
-
this
|
|
106
|
-
this
|
|
107
|
-
this
|
|
105
|
+
this.#rootInternal = null;
|
|
106
|
+
this.#contentRootInternal = null;
|
|
107
|
+
this.#backendNodeIdToNodeInternal = new Map();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
target(): Target|null {
|
|
111
|
-
return this
|
|
111
|
+
return this.#targetInternal;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
root(): Layer|null {
|
|
115
|
-
return this
|
|
115
|
+
return this.#rootInternal;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
setRoot(root: Layer|null): void {
|
|
119
|
-
this
|
|
119
|
+
this.#rootInternal = root;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
contentRoot(): Layer|null {
|
|
123
|
-
return this
|
|
123
|
+
return this.#contentRootInternal;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
setContentRoot(contentRoot: Layer|null): void {
|
|
127
|
-
this
|
|
127
|
+
this.#contentRootInternal = contentRoot;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
forEachLayer<T>(callback: (arg0: Layer) => T, root?: Layer|null): T|boolean {
|
|
@@ -142,39 +142,39 @@ export class LayerTreeBase {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
async resolveBackendNodeIds(requestedNodeIds: Set<Protocol.DOM.BackendNodeId>): Promise<void> {
|
|
145
|
-
if (!requestedNodeIds.size || !this
|
|
145
|
+
if (!requestedNodeIds.size || !this.#domModel) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
const nodesMap = await this
|
|
149
|
+
const nodesMap = await this.#domModel.pushNodesByBackendIdsToFrontend(requestedNodeIds);
|
|
150
150
|
|
|
151
151
|
if (!nodesMap) {
|
|
152
152
|
return;
|
|
153
153
|
}
|
|
154
154
|
for (const nodeId of nodesMap.keys()) {
|
|
155
|
-
this
|
|
155
|
+
this.#backendNodeIdToNodeInternal.set(nodeId, nodesMap.get(nodeId) || null);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
backendNodeIdToNode(): Map<Protocol.DOM.BackendNodeId, DOMNode|null> {
|
|
160
|
-
return this
|
|
160
|
+
return this.#backendNodeIdToNodeInternal;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
setViewportSize(viewportSize: {
|
|
164
164
|
width: number,
|
|
165
165
|
height: number,
|
|
166
166
|
}): void {
|
|
167
|
-
this
|
|
167
|
+
this.#viewportSizeInternal = viewportSize;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
viewportSize(): {
|
|
171
171
|
width: number,
|
|
172
172
|
height: number,
|
|
173
173
|
}|undefined {
|
|
174
|
-
return this
|
|
174
|
+
return this.#viewportSizeInternal;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
private nodeForId(id: Protocol.DOM.NodeId): DOMNode|null {
|
|
178
|
-
return this
|
|
178
|
+
return this.#domModel ? this.#domModel.nodeForId(id) : null;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -11,14 +11,14 @@ import {Capability} from './Target.js';
|
|
|
11
11
|
import {SDKModel} from './SDKModel.js';
|
|
12
12
|
|
|
13
13
|
export class LogModel extends SDKModel<EventTypes> implements ProtocolProxyApi.LogDispatcher {
|
|
14
|
-
|
|
14
|
+
readonly #logAgent: ProtocolProxyApi.LogApi;
|
|
15
15
|
constructor(target: Target) {
|
|
16
16
|
super(target);
|
|
17
17
|
target.registerLogDispatcher(this);
|
|
18
|
-
this
|
|
19
|
-
this
|
|
18
|
+
this.#logAgent = target.logAgent();
|
|
19
|
+
this.#logAgent.invoke_enable();
|
|
20
20
|
if (!Host.InspectorFrontendHost.isUnderTest()) {
|
|
21
|
-
this
|
|
21
|
+
this.#logAgent.invoke_startViolationsReport({
|
|
22
22
|
config: [
|
|
23
23
|
{name: Protocol.Log.ViolationSettingName.LongTask, threshold: 200},
|
|
24
24
|
{name: Protocol.Log.ViolationSettingName.LongLayout, threshold: 30},
|
|
@@ -37,7 +37,7 @@ export class LogModel extends SDKModel<EventTypes> implements ProtocolProxyApi.L
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
requestClear(): void {
|
|
40
|
-
this
|
|
40
|
+
this.#logAgent.invoke_clear();
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|