chrome-devtools-frontend 1.0.1555174 → 1.0.1555430
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/front_end/core/protocol_client/InspectorBackend.ts +1 -1
- package/front_end/core/root/Runtime.ts +0 -4
- package/front_end/core/sdk/DOMModel.ts +101 -7
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -1
- package/front_end/{ui/components → models}/annotations/AnnotationRepository.ts +3 -3
- package/front_end/models/annotations/README.md +7 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
- package/front_end/models/stack_trace/StackTrace.ts +13 -2
- package/front_end/models/stack_trace/StackTraceImpl.ts +81 -6
- package/front_end/models/stack_trace/StackTraceModel.ts +35 -3
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +45 -4
- package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +57 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +1 -0
- package/front_end/panels/ai_assistance/components/artifactsViewer.css +10 -0
- package/front_end/panels/application/preloading/PreloadingView.ts +12 -6
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +230 -237
- package/front_end/panels/application/preloading/components/PreloadingGrid.ts +96 -79
- package/front_end/panels/application/preloading/components/preloadingGrid.css +26 -29
- package/front_end/panels/application/preloading/preloadingView.css +6 -0
- package/front_end/panels/common/Annotation.ts +1 -1
- package/front_end/panels/common/AnnotationManager.ts +1 -1
- package/front_end/panels/common/ExtensionView.ts +1 -0
- package/front_end/panels/console/ConsoleContextSelector.ts +74 -9
- package/front_end/panels/console/consoleContextSelector.css +31 -29
- package/front_end/panels/coverage/coverageListView.css +59 -57
- package/front_end/panels/elements/ElementsPanel.ts +1 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +39 -1
- package/front_end/panels/elements/ElementsTreeOutline.ts +23 -21
- package/front_end/panels/elements/TopLayerContainer.ts +26 -91
- package/front_end/panels/explain/components/ConsoleInsight.ts +3 -3
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/network/NetworkPanel.ts +1 -1
- package/front_end/panels/recorder/RecorderController.ts +0 -1
- package/front_end/panels/security/SecurityPanelSidebar.ts +5 -0
- package/front_end/panels/timeline/TimelineUIUtils.ts +5 -8
- package/front_end/panels/timeline/components/TimelineSummary.ts +75 -54
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +16 -25
- package/front_end/panels/timeline/components/insights/Cache.ts +12 -8
- package/front_end/panels/timeline/components/insights/DOMSize.ts +25 -21
- package/front_end/panels/timeline/components/insights/DuplicatedJavaScript.ts +7 -7
- package/front_end/panels/timeline/components/insights/FontDisplay.ts +7 -5
- package/front_end/panels/timeline/components/insights/ForcedReflow.ts +11 -9
- package/front_end/panels/timeline/components/insights/INPBreakdown.ts +7 -6
- package/front_end/panels/timeline/components/insights/ImageDelivery.ts +7 -5
- package/front_end/panels/timeline/components/insights/InsightRenderer.ts +20 -18
- package/front_end/panels/timeline/components/insights/LCPBreakdown.ts +12 -12
- package/front_end/panels/timeline/components/insights/LegacyJavaScript.ts +7 -7
- package/front_end/panels/timeline/components/insights/ModernHTTP.ts +7 -5
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +15 -13
- package/front_end/panels/timeline/components/insights/RenderBlocking.ts +2 -2
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +15 -14
- package/front_end/panels/timeline/components/insights/Table.ts +152 -130
- package/front_end/panels/timeline/components/insights/ThirdParties.ts +11 -9
- package/front_end/panels/timeline/components/timelineSummary.css +58 -57
- package/front_end/panels/timeline/thirdPartyTreeView.css +109 -0
- package/front_end/panels/timeline/timelineDetailsView.css +2 -4
- package/front_end/panels/timeline/timelinePanel.css +0 -110
- package/front_end/ui/legacy/TabbedPane.ts +1 -1
- package/front_end/ui/legacy/ViewManager.ts +2 -32
- package/package.json +1 -1
- /package/front_end/{ui/components → models}/annotations/AnnotationType.ts +0 -0
- /package/front_end/{ui/components → models}/annotations/annotations.ts +0 -0
|
@@ -265,6 +265,7 @@ export interface Props {
|
|
|
265
265
|
inputPlaceholder: Platform.UIString.LocalizedString;
|
|
266
266
|
disclaimerText: Platform.UIString.LocalizedString;
|
|
267
267
|
isTextInputEmpty: boolean;
|
|
268
|
+
isArtifactsSidebarOpen: boolean;
|
|
268
269
|
uploadImageInputEnabled?: boolean;
|
|
269
270
|
markdownRenderer: MarkdownLitRenderer;
|
|
270
271
|
additionalFloatyContext: UI.Floaty.FloatyContextSelection[];
|
|
@@ -417,7 +417,13 @@ export class PreloadingAttemptView extends UI.Widget.VBox {
|
|
|
417
417
|
this.ruleSetSelector = new PreloadingRuleSetSelector(() => this.render());
|
|
418
418
|
toolbar.appendToolbarItem(this.ruleSetSelector.item());
|
|
419
419
|
|
|
420
|
-
this.preloadingGrid.
|
|
420
|
+
this.preloadingGrid.onSelect = this.onPreloadingGridCellFocused.bind(this);
|
|
421
|
+
|
|
422
|
+
const preloadingGridContainer = document.createElement('div');
|
|
423
|
+
preloadingGridContainer.className = 'preloading-grid-widget-container';
|
|
424
|
+
preloadingGridContainer.style = 'height: 100%';
|
|
425
|
+
this.preloadingGrid.show(preloadingGridContainer, null, true);
|
|
426
|
+
|
|
421
427
|
render(
|
|
422
428
|
html`
|
|
423
429
|
<div class="empty-state">
|
|
@@ -433,7 +439,7 @@ export class PreloadingAttemptView extends UI.Widget.VBox {
|
|
|
433
439
|
</div>
|
|
434
440
|
<devtools-split-view sidebar-position="second">
|
|
435
441
|
<div slot="main" class="overflow-auto" style="height: 100%">
|
|
436
|
-
${
|
|
442
|
+
${preloadingGridContainer}
|
|
437
443
|
</div>
|
|
438
444
|
<div slot="sidebar" class="overflow-auto" style="height: 100%">
|
|
439
445
|
${this.preloadingDetails}
|
|
@@ -500,15 +506,15 @@ export class PreloadingAttemptView extends UI.Widget.VBox {
|
|
|
500
506
|
ruleSets,
|
|
501
507
|
};
|
|
502
508
|
});
|
|
503
|
-
this.preloadingGrid.
|
|
509
|
+
this.preloadingGrid.rows = rows;
|
|
510
|
+
this.preloadingGrid.pageURL = pageURL();
|
|
504
511
|
this.contentElement.classList.toggle('empty', rows.length === 0);
|
|
505
512
|
|
|
506
513
|
this.updatePreloadingDetails();
|
|
507
514
|
}
|
|
508
515
|
|
|
509
|
-
private onPreloadingGridCellFocused(
|
|
510
|
-
|
|
511
|
-
this.focusedPreloadingAttemptId = focusedEvent.detail;
|
|
516
|
+
private onPreloadingGridCellFocused({rowId}: {rowId: string}): void {
|
|
517
|
+
this.focusedPreloadingAttemptId = rowId;
|
|
512
518
|
this.render();
|
|
513
519
|
}
|
|
514
520
|
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import '../../../../ui/components/report_view/report_view.js';
|
|
7
7
|
import '../../../../ui/components/request_link_icon/request_link_icon.js';
|
|
8
|
+
import '../../../../ui/legacy/components/utils/utils.js';
|
|
8
9
|
|
|
9
10
|
import * as Common from '../../../../core/common/common.js';
|
|
10
11
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
@@ -14,8 +15,6 @@ import * as SDK from '../../../../core/sdk/sdk.js';
|
|
|
14
15
|
import * as Protocol from '../../../../generated/protocol.js';
|
|
15
16
|
import * as Logs from '../../../../models/logs/logs.js';
|
|
16
17
|
import * as Buttons from '../../../../ui/components/buttons/buttons.js';
|
|
17
|
-
import * as LegacyWrapper from '../../../../ui/components/legacy_wrapper/legacy_wrapper.js';
|
|
18
|
-
import * as RenderCoordinator from '../../../../ui/components/render_coordinator/render_coordinator.js';
|
|
19
18
|
import * as UI from '../../../../ui/legacy/legacy.js';
|
|
20
19
|
import * as Lit from '../../../../ui/lit/lit.js';
|
|
21
20
|
import * as VisualLogging from '../../../../ui/visual_logging/visual_logging.js';
|
|
@@ -156,284 +155,278 @@ interface PreloadingDetailsReportViewDataInternal {
|
|
|
156
155
|
requestResolver?: Logs.RequestResolver.RequestResolver;
|
|
157
156
|
}
|
|
158
157
|
|
|
159
|
-
export
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
void this.#render();
|
|
166
|
-
}
|
|
158
|
+
export interface ViewInput {
|
|
159
|
+
data: PreloadingDetailsReportViewData;
|
|
160
|
+
onRevealRuleSet: (ruleSet: Protocol.Preload.RuleSet) => void;
|
|
161
|
+
}
|
|
162
|
+
export type ViewOutput = unknown;
|
|
163
|
+
export type View = (input: ViewInput, output: ViewOutput, target: HTMLElement) => void;
|
|
167
164
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
if (this.#data === null) {
|
|
171
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
172
|
-
// clang-format off
|
|
173
|
-
Lit.render(html`
|
|
174
|
-
<style>${preloadingDetailsReportViewStyles}</style>
|
|
175
|
-
<style>${UI.inspectorCommonStyles}</style>
|
|
176
|
-
<div class="empty-state">
|
|
177
|
-
<span class="empty-state-header">${i18nString(UIStrings.noElementSelected)}</span>
|
|
178
|
-
<span class="empty-state-description">${i18nString(UIStrings.selectAnElementForMoreDetails)}</span>
|
|
179
|
-
</div>
|
|
180
|
-
`, this.#shadow, {host: this});
|
|
181
|
-
// clang-format on
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
165
|
+
function url(data: PreloadingDetailsReportViewDataInternal): Lit.LitTemplate {
|
|
166
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
184
167
|
|
|
185
|
-
|
|
186
|
-
const pageURL = this.#data.pageURL;
|
|
187
|
-
const isFallbackToPrefetch = pipeline.getPrerender()?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
|
|
188
|
-
(pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.READY ||
|
|
189
|
-
pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS);
|
|
190
|
-
|
|
191
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
192
|
-
// clang-format off
|
|
193
|
-
Lit.render(html`
|
|
194
|
-
<style>${preloadingDetailsReportViewStyles}</style>
|
|
195
|
-
<style>${UI.inspectorCommonStyles}</style>
|
|
196
|
-
<devtools-report
|
|
197
|
-
.data=${{reportTitle: 'Speculative Loading Attempt'}}
|
|
198
|
-
jslog=${VisualLogging.section('preloading-details')}>
|
|
199
|
-
<devtools-report-section-header>${i18nString(UIStrings.detailsDetailedInformation)}</devtools-report-section-header>
|
|
200
|
-
|
|
201
|
-
${this.#url()}
|
|
202
|
-
${this.#action(isFallbackToPrefetch)}
|
|
203
|
-
${this.#status(isFallbackToPrefetch)}
|
|
204
|
-
${this.#targetHint()}
|
|
205
|
-
${this.#maybePrefetchFailureReason()}
|
|
206
|
-
${this.#maybePrerenderFailureReason()}
|
|
207
|
-
|
|
208
|
-
${this.#data.ruleSets.map(ruleSet => this.#renderRuleSet(ruleSet, pageURL))}
|
|
209
|
-
</devtools-report>
|
|
210
|
-
`, this.#shadow, {host: this});
|
|
211
|
-
// clang-format on
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
#url(): Lit.LitTemplate {
|
|
216
|
-
assertNotNullOrUndefined(this.#data);
|
|
217
|
-
const attempt = this.#data.pipeline.getOriginallyTriggered();
|
|
218
|
-
|
|
219
|
-
const prefetchStatus = this.#data.pipeline.getPrefetch()?.status;
|
|
220
|
-
|
|
221
|
-
let value;
|
|
222
|
-
if (attempt.action === Protocol.Preload.SpeculationAction.Prefetch && attempt.requestId !== undefined &&
|
|
223
|
-
prefetchStatus !== SDK.PreloadingModel.PreloadingStatus.NOT_TRIGGERED) {
|
|
224
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
225
|
-
// clang-format off
|
|
226
|
-
const {requestId, key: {url}} = attempt;
|
|
227
|
-
const affectedRequest: {requestId?: Protocol.Network.RequestId, url?: string} = {requestId, url};
|
|
228
|
-
value = html`
|
|
229
|
-
<devtools-request-link-icon
|
|
230
|
-
.data=${
|
|
231
|
-
{
|
|
232
|
-
affectedRequest,
|
|
233
|
-
requestResolver: this.#data.requestResolver || new Logs.RequestResolver.RequestResolver(),
|
|
234
|
-
displayURL: true,
|
|
235
|
-
urlToDisplay: url,
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
>
|
|
239
|
-
</devtools-request-link-icon>
|
|
240
|
-
`;
|
|
241
|
-
} else {
|
|
242
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
243
|
-
// clang-format off
|
|
244
|
-
value = html`
|
|
245
|
-
<div class="text-ellipsis" title=${attempt.key.url}>${attempt.key.url}</div>
|
|
246
|
-
`;
|
|
247
|
-
// clang-format on
|
|
248
|
-
}
|
|
168
|
+
const prefetchStatus = data.pipeline.getPrefetch()?.status;
|
|
249
169
|
|
|
170
|
+
let value;
|
|
171
|
+
if (attempt.action === Protocol.Preload.SpeculationAction.Prefetch && attempt.requestId !== undefined &&
|
|
172
|
+
prefetchStatus !== SDK.PreloadingModel.PreloadingStatus.NOT_TRIGGERED) {
|
|
250
173
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
251
174
|
// clang-format off
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
175
|
+
const {requestId, key: {url}} = attempt;
|
|
176
|
+
const affectedRequest: {requestId?: Protocol.Network.RequestId, url?: string} = {requestId, url};
|
|
177
|
+
value = html`
|
|
178
|
+
<devtools-request-link-icon
|
|
179
|
+
.data=${
|
|
180
|
+
{
|
|
181
|
+
affectedRequest,
|
|
182
|
+
requestResolver: data.requestResolver || new Logs.RequestResolver.RequestResolver(),
|
|
183
|
+
displayURL: true,
|
|
184
|
+
urlToDisplay: url,
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
>
|
|
188
|
+
</devtools-request-link-icon>
|
|
257
189
|
`;
|
|
258
|
-
|
|
190
|
+
} else {
|
|
191
|
+
value = html`<div class="text-ellipsis" title=${attempt.key.url}>${attempt.key.url}</div>`;
|
|
259
192
|
}
|
|
260
193
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
194
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
195
|
+
// clang-format off
|
|
196
|
+
return html`
|
|
197
|
+
<devtools-report-key>${i18n.i18n.lockedString('URL')}</devtools-report-key>
|
|
198
|
+
<devtools-report-value>
|
|
199
|
+
${value}
|
|
200
|
+
</devtools-report-value>
|
|
201
|
+
`;
|
|
202
|
+
// clang-format on
|
|
203
|
+
}
|
|
266
204
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
205
|
+
function isPrerenderLike(speculationAction: Protocol.Preload.SpeculationAction): boolean {
|
|
206
|
+
return [
|
|
207
|
+
Protocol.Preload.SpeculationAction.Prerender, Protocol.Preload.SpeculationAction.PrerenderUntilScript
|
|
208
|
+
].includes(speculationAction);
|
|
209
|
+
}
|
|
270
210
|
|
|
271
|
-
|
|
211
|
+
function action(data: PreloadingDetailsReportViewDataInternal, isFallbackToPrefetch: boolean): Lit.LitTemplate {
|
|
212
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
272
213
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
214
|
+
const action = PreloadingString.capitalizedAction(attempt.action);
|
|
215
|
+
|
|
216
|
+
let maybeFallback: Lit.LitTemplate = Lit.nothing;
|
|
217
|
+
if (isFallbackToPrefetch) {
|
|
218
|
+
maybeFallback = html`${i18nString(UIStrings.automaticallyFellBackToPrefetch)}`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let maybeInspectButton: Lit.LitTemplate = Lit.nothing;
|
|
222
|
+
(() => {
|
|
223
|
+
if (!isPrerenderLike(attempt.action)) {
|
|
224
|
+
return;
|
|
276
225
|
}
|
|
277
226
|
|
|
278
|
-
|
|
279
|
-
(
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
227
|
+
const target = SDK.TargetManager.TargetManager.instance().primaryPageTarget();
|
|
228
|
+
if (target === null) {
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const prerenderTarget = SDK.TargetManager.TargetManager.instance().targets().find(
|
|
233
|
+
child => child.targetInfo()?.subtype === 'prerender' && child.inspectedURL() === attempt.key.url);
|
|
283
234
|
|
|
284
|
-
|
|
285
|
-
|
|
235
|
+
const disabled = (prerenderTarget === undefined);
|
|
236
|
+
const inspect = (): void => {
|
|
237
|
+
if (prerenderTarget === undefined) {
|
|
286
238
|
return;
|
|
287
239
|
}
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
child => child.targetInfo()?.subtype === 'prerender' && child.inspectedURL() === attempt.key.url);
|
|
291
|
-
|
|
292
|
-
const disabled = (prerenderTarget === undefined);
|
|
293
|
-
const inspect = (): void => {
|
|
294
|
-
if (prerenderTarget === undefined) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
UI.Context.Context.instance().setFlavor(SDK.Target.Target, prerenderTarget);
|
|
298
|
-
};
|
|
299
|
-
// Disabled until https://crbug.com/1079231 is fixed.
|
|
300
|
-
// clang-format off
|
|
301
|
-
maybeInspectButton = html`
|
|
302
|
-
<devtools-button
|
|
303
|
-
@click=${inspect}
|
|
304
|
-
.title=${i18nString(UIStrings.buttonClickToInspect)}
|
|
305
|
-
.size=${Buttons.Button.Size.SMALL}
|
|
306
|
-
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
307
|
-
.disabled=${disabled}
|
|
308
|
-
jslog=${VisualLogging.action('inspect-prerendered-page').track({click: true})}
|
|
309
|
-
>
|
|
310
|
-
${i18nString(UIStrings.buttonInspect)}
|
|
311
|
-
</devtools-button>
|
|
312
|
-
`;
|
|
313
|
-
// clang-format on
|
|
314
|
-
})();
|
|
315
|
-
|
|
240
|
+
UI.Context.Context.instance().setFlavor(SDK.Target.Target, prerenderTarget);
|
|
241
|
+
};
|
|
316
242
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
317
243
|
// clang-format off
|
|
318
|
-
|
|
319
|
-
<devtools-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
244
|
+
maybeInspectButton = html`
|
|
245
|
+
<devtools-button
|
|
246
|
+
@click=${inspect}
|
|
247
|
+
.title=${i18nString(UIStrings.buttonClickToInspect)}
|
|
248
|
+
.size=${Buttons.Button.Size.SMALL}
|
|
249
|
+
.variant=${Buttons.Button.Variant.OUTLINED}
|
|
250
|
+
.disabled=${disabled}
|
|
251
|
+
jslog=${VisualLogging.action('inspect-prerendered-page').track({click: true})}
|
|
252
|
+
>
|
|
253
|
+
${i18nString(UIStrings.buttonInspect)}
|
|
254
|
+
</devtools-button>
|
|
325
255
|
`;
|
|
326
256
|
// clang-format on
|
|
327
|
-
}
|
|
257
|
+
})();
|
|
328
258
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
259
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
260
|
+
// clang-format off
|
|
261
|
+
return html`
|
|
262
|
+
<devtools-report-key>${i18nString(UIStrings.detailsAction)}</devtools-report-key>
|
|
263
|
+
<devtools-report-value>
|
|
264
|
+
<div class="text-ellipsis" title="">
|
|
265
|
+
${action} ${maybeFallback} ${maybeInspectButton}
|
|
266
|
+
</div>
|
|
267
|
+
</devtools-report-value>
|
|
268
|
+
`;
|
|
269
|
+
// clang-format on
|
|
270
|
+
}
|
|
332
271
|
|
|
333
|
-
|
|
334
|
-
|
|
272
|
+
function status(data: PreloadingDetailsReportViewDataInternal, isFallbackToPrefetch: boolean): Lit.LitTemplate {
|
|
273
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
335
274
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
<devtools-report-value>
|
|
339
|
-
${detailedStatus}
|
|
340
|
-
</devtools-report-value>
|
|
341
|
-
`;
|
|
342
|
-
}
|
|
275
|
+
const detailedStatus = isFallbackToPrefetch ? i18nString(UIStrings.detailedStatusFallbackToPrefetch) :
|
|
276
|
+
PreloadingUIUtils.detailedStatus(attempt);
|
|
343
277
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
278
|
+
return html`
|
|
279
|
+
<devtools-report-key>${i18nString(UIStrings.detailsStatus)}</devtools-report-key>
|
|
280
|
+
<devtools-report-value>
|
|
281
|
+
${detailedStatus}
|
|
282
|
+
</devtools-report-value>
|
|
283
|
+
`;
|
|
284
|
+
}
|
|
347
285
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
286
|
+
function maybePrefetchFailureReason(data: PreloadingDetailsReportViewDataInternal): Lit.LitTemplate {
|
|
287
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
351
288
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
289
|
+
if (attempt.action !== Protocol.Preload.SpeculationAction.Prefetch) {
|
|
290
|
+
return Lit.nothing;
|
|
291
|
+
}
|
|
356
292
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
${failureDescription}
|
|
361
|
-
</devtools-report-value>
|
|
362
|
-
`;
|
|
293
|
+
const failureDescription = prefetchFailureReason(attempt);
|
|
294
|
+
if (failureDescription === null) {
|
|
295
|
+
return Lit.nothing;
|
|
363
296
|
}
|
|
364
297
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
298
|
+
return html`
|
|
299
|
+
<devtools-report-key>${i18nString(UIStrings.detailsFailureReason)}</devtools-report-key>
|
|
300
|
+
<devtools-report-value>
|
|
301
|
+
${failureDescription}
|
|
302
|
+
</devtools-report-value>
|
|
303
|
+
`;
|
|
304
|
+
}
|
|
372
305
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
`;
|
|
306
|
+
function targetHint(data: PreloadingDetailsReportViewDataInternal): Lit.LitTemplate {
|
|
307
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
308
|
+
const hasTargetHint = isPrerenderLike(attempt.action) && attempt.key.targetHint !== undefined;
|
|
309
|
+
if (!hasTargetHint) {
|
|
310
|
+
return Lit.nothing;
|
|
379
311
|
}
|
|
380
312
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
313
|
+
return html`
|
|
314
|
+
<devtools-report-key>${i18nString(UIStrings.detailsTargetHint)}</devtools-report-key>
|
|
315
|
+
<devtools-report-value>
|
|
316
|
+
${PreloadingUIUtils.detailedTargetHint(attempt.key)}
|
|
317
|
+
</devtools-report-value>
|
|
318
|
+
`;
|
|
319
|
+
}
|
|
384
320
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
321
|
+
function maybePrerenderFailureReason(data: PreloadingDetailsReportViewDataInternal): Lit.LitTemplate {
|
|
322
|
+
const attempt = data.pipeline.getOriginallyTriggered();
|
|
388
323
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
return Lit.nothing;
|
|
393
|
-
}
|
|
324
|
+
if (!isPrerenderLike(attempt.action)) {
|
|
325
|
+
return Lit.nothing;
|
|
326
|
+
}
|
|
394
327
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
</devtools-report-value>
|
|
400
|
-
`;
|
|
328
|
+
const failureReason = prerenderFailureReason(
|
|
329
|
+
attempt as SDK.PreloadingModel.PrerenderAttempt | SDK.PreloadingModel.PrerenderUntilScriptAttempt);
|
|
330
|
+
if (failureReason === null) {
|
|
331
|
+
return Lit.nothing;
|
|
401
332
|
}
|
|
402
333
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
334
|
+
return html`
|
|
335
|
+
<devtools-report-key>${i18nString(UIStrings.detailsFailureReason)}</devtools-report-key>
|
|
336
|
+
<devtools-report-value>
|
|
337
|
+
${failureReason}
|
|
338
|
+
</devtools-report-value>
|
|
339
|
+
`;
|
|
340
|
+
}
|
|
408
341
|
|
|
342
|
+
const DEFAULT_VIEW: View = ({data, onRevealRuleSet}, _, target) => {
|
|
343
|
+
if (data === null) {
|
|
409
344
|
// Disabled until https://crbug.com/1079231 is fixed.
|
|
410
345
|
// clang-format off
|
|
411
|
-
|
|
412
|
-
<
|
|
413
|
-
<
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
color: 'var(--sys-color-primary)',
|
|
420
|
-
'text-decoration': 'underline',
|
|
421
|
-
})}
|
|
422
|
-
jslog=${VisualLogging.action('reveal-rule-set').track({click: true})}
|
|
423
|
-
>
|
|
424
|
-
${location}
|
|
425
|
-
</button>
|
|
426
|
-
</div>
|
|
427
|
-
</devtools-report-value>
|
|
428
|
-
`;
|
|
346
|
+
Lit.render(html`
|
|
347
|
+
<style>${preloadingDetailsReportViewStyles}</style>
|
|
348
|
+
<style>${UI.inspectorCommonStyles}</style>
|
|
349
|
+
<div class="empty-state">
|
|
350
|
+
<span class="empty-state-header">${i18nString(UIStrings.noElementSelected)}</span>
|
|
351
|
+
<span class="empty-state-description">${i18nString(UIStrings.selectAnElementForMoreDetails)}</span>
|
|
352
|
+
</div>
|
|
353
|
+
`, target, {host: target});
|
|
429
354
|
// clang-format on
|
|
355
|
+
return;
|
|
430
356
|
}
|
|
431
|
-
}
|
|
432
357
|
|
|
433
|
-
|
|
358
|
+
const pipeline = data.pipeline;
|
|
359
|
+
const pageURL = data.pageURL;
|
|
360
|
+
const isFallbackToPrefetch = pipeline.getPrerender()?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
|
|
361
|
+
(pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.READY ||
|
|
362
|
+
pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS);
|
|
363
|
+
|
|
364
|
+
// Disabled until https://crbug.com/1079231 is fixed.
|
|
365
|
+
// clang-format off
|
|
366
|
+
Lit.render(html`
|
|
367
|
+
<style>${preloadingDetailsReportViewStyles}</style>
|
|
368
|
+
<style>${UI.inspectorCommonStyles}</style>
|
|
369
|
+
<devtools-report
|
|
370
|
+
.data=${{reportTitle: 'Speculative Loading Attempt'}}
|
|
371
|
+
jslog=${VisualLogging.section('preloading-details')}>
|
|
372
|
+
<devtools-report-section-header>${i18nString(UIStrings.detailsDetailedInformation)}</devtools-report-section-header>
|
|
373
|
+
|
|
374
|
+
${url(data)}
|
|
375
|
+
${action(data, isFallbackToPrefetch)}
|
|
376
|
+
${status(data, isFallbackToPrefetch)}
|
|
377
|
+
${targetHint(data)}
|
|
378
|
+
${maybePrefetchFailureReason(data)}
|
|
379
|
+
${maybePrerenderFailureReason(data)}
|
|
380
|
+
|
|
381
|
+
${data.ruleSets.map(ruleSet => {
|
|
382
|
+
const location = ruleSetLocationShort(ruleSet, pageURL);
|
|
383
|
+
return html`
|
|
384
|
+
<devtools-report-key>${i18nString(UIStrings.detailsRuleSet)}</devtools-report-key>
|
|
385
|
+
<devtools-report-value>
|
|
386
|
+
<div class="text-ellipsis" title="">
|
|
387
|
+
<button class="link" role="link"
|
|
388
|
+
@click=${() => onRevealRuleSet(ruleSet)}
|
|
389
|
+
title=${i18nString(UIStrings.buttonClickToRevealRuleSet)}
|
|
390
|
+
style=${Lit.Directives.styleMap({
|
|
391
|
+
color: 'var(--sys-color-primary)',
|
|
392
|
+
'text-decoration': 'underline',
|
|
393
|
+
})}
|
|
394
|
+
jslog=${VisualLogging.action('reveal-rule-set').track({click: true})}
|
|
395
|
+
>
|
|
396
|
+
${location}
|
|
397
|
+
</button>
|
|
398
|
+
</div>
|
|
399
|
+
</devtools-report-value>
|
|
400
|
+
`;
|
|
401
|
+
})}
|
|
402
|
+
</devtools-report>
|
|
403
|
+
`, target, {host: target});
|
|
404
|
+
// clang-format on
|
|
405
|
+
};
|
|
406
|
+
export class PreloadingDetailsReportView extends UI.Widget.VBox {
|
|
407
|
+
#view: View;
|
|
408
|
+
#data: PreloadingDetailsReportViewData = null;
|
|
409
|
+
|
|
410
|
+
constructor(view: View = DEFAULT_VIEW) {
|
|
411
|
+
super();
|
|
412
|
+
this.#view = view;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
set data(data: PreloadingDetailsReportViewData) {
|
|
416
|
+
this.#data = data;
|
|
417
|
+
this.requestUpdate();
|
|
418
|
+
}
|
|
434
419
|
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
420
|
+
override performUpdate(): void {
|
|
421
|
+
this.#view(
|
|
422
|
+
{
|
|
423
|
+
data: this.#data,
|
|
424
|
+
onRevealRuleSet: (ruleSet: Protocol.Preload.RuleSet) => {
|
|
425
|
+
void Common.Revealer.reveal(new PreloadingHelper.PreloadingForward.RuleSetView(ruleSet.id));
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
undefined,
|
|
429
|
+
this.contentElement,
|
|
430
|
+
);
|
|
438
431
|
}
|
|
439
432
|
}
|