Skip to content

Commit 5729804

Browse files
kenossDevtools-frontend LUCI CQ
authored andcommitted
Prerender2Fallback: Add pipelineId to PreloadingAttempt
This CL adds `pipelineId` to `PreloadingAttmept`. UI change follows in the next CL. Bug: 364509578 Change-Id: I2536dc7bc7cfe8c4a8159735e5ac2fc78f05f526 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6068789 Auto-Submit: Ken Okada <[email protected]> Commit-Queue: Danil Somsikov <[email protected]> Commit-Queue: Ken Okada <[email protected]> Reviewed-by: Danil Somsikov <[email protected]>
1 parent eae1d40 commit 5729804

File tree

7 files changed

+68
-9
lines changed

7 files changed

+68
-9
lines changed

front_end/core/sdk/PreloadingModel.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describeWithMockConnection('PreloadingModel', () => {
5959
action: Protocol.Preload.SpeculationAction.Prefetch,
6060
url: 'https://example.com/subresource.js',
6161
},
62+
pipelineId: 'pipelineId:1',
6263
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
6364
requestId: 'requestId:1',
6465
});
@@ -92,6 +93,7 @@ describeWithMockConnection('PreloadingModel', () => {
9293
action: Protocol.Preload.SpeculationAction.Prefetch,
9394
url: 'https://example.com/subresource.js' as Platform.DevToolsPath.UrlString,
9495
},
96+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
9597
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
9698
prefetchStatus: null,
9799
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -146,6 +148,7 @@ describeWithMockConnection('PreloadingModel', () => {
146148
action: Protocol.Preload.SpeculationAction.Prerender,
147149
url: 'https://example.com/page.html',
148150
},
151+
pipelineId: 'pipelineId:2',
149152
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
150153
});
151154

@@ -196,6 +199,7 @@ describeWithMockConnection('PreloadingModel', () => {
196199
action: Protocol.Preload.SpeculationAction.Prefetch,
197200
url: 'https://example.com/subresource.js' as Platform.DevToolsPath.UrlString,
198201
},
202+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
199203
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
200204
prefetchStatus: null,
201205
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -212,6 +216,7 @@ describeWithMockConnection('PreloadingModel', () => {
212216
action: Protocol.Preload.SpeculationAction.Prerender,
213217
url: 'https://example.com/page.html' as Platform.DevToolsPath.UrlString,
214218
},
219+
pipelineId: 'pipelineId:2' as Protocol.Preload.PreloadPipelineId,
215220
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
216221
prerenderStatus: null,
217222
disallowedMojoInterface: null,
@@ -245,6 +250,7 @@ describeWithMockConnection('PreloadingModel', () => {
245250
action: Protocol.Preload.SpeculationAction.Prefetch,
246251
url: 'https://example.com/subresource.js',
247252
},
253+
pipelineId: 'pipelineId:1',
248254
status: SDK.PreloadingModel.PreloadingStatus.FAILURE,
249255
prefetchStatus: Protocol.Preload.PrefetchStatus.PrefetchEvictedAfterCandidateRemoved,
250256
requestId: 'requestId:1',
@@ -279,6 +285,7 @@ describeWithMockConnection('PreloadingModel', () => {
279285
action: Protocol.Preload.SpeculationAction.Prerender,
280286
url: 'https://example.com/page.html' as Platform.DevToolsPath.UrlString,
281287
},
288+
pipelineId: 'pipelineId:2' as Protocol.Preload.PreloadPipelineId,
282289
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
283290
prerenderStatus: null,
284291
disallowedMojoInterface: null,
@@ -339,6 +346,7 @@ describeWithMockConnection('PreloadingModel', () => {
339346
action: Protocol.Preload.SpeculationAction.Prefetch,
340347
url: 'https://example.com/subresource.js' as Platform.DevToolsPath.UrlString,
341348
},
349+
pipelineId: null,
342350
status: SDK.PreloadingModel.PreloadingStatus.NOT_TRIGGERED,
343351
prefetchStatus: null,
344352
// Invalid request id
@@ -396,6 +404,7 @@ describeWithMockConnection('PreloadingModel', () => {
396404
action: Protocol.Preload.SpeculationAction.Prefetch,
397405
url: 'https://example.com/subresource1.js',
398406
},
407+
pipelineId: 'pipelineId:1',
399408
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
400409
});
401410

@@ -438,6 +447,7 @@ describeWithMockConnection('PreloadingModel', () => {
438447
action: Protocol.Preload.SpeculationAction.Prefetch,
439448
url: 'https://example.com/subresource2.js',
440449
},
450+
pipelineId: 'pipelineId:1',
441451
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
442452
requestId: 'requestId:1',
443453
});
@@ -471,6 +481,7 @@ describeWithMockConnection('PreloadingModel', () => {
471481
action: Protocol.Preload.SpeculationAction.Prefetch,
472482
url: 'https://example.com/subresource2.js' as Platform.DevToolsPath.UrlString,
473483
},
484+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
474485
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
475486
prefetchStatus: null,
476487
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -554,6 +565,7 @@ describeWithMockConnection('PreloadingModel', () => {
554565
action: Protocol.Preload.SpeculationAction.Prefetch,
555566
url: 'https://example.com/subresource12.js',
556567
},
568+
pipelineId: 'pipelineId:1',
557569
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
558570
requestId: 'requestId:1',
559571
});
@@ -563,6 +575,7 @@ describeWithMockConnection('PreloadingModel', () => {
563575
action: Protocol.Preload.SpeculationAction.Prefetch,
564576
url: 'https://example.com/subresource2.js',
565577
},
578+
pipelineId: 'pipelineId:2',
566579
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
567580
requestId: 'requestId:2',
568581
});
@@ -577,6 +590,7 @@ describeWithMockConnection('PreloadingModel', () => {
577590
action: Protocol.Preload.SpeculationAction.Prefetch,
578591
url: 'https://example.com/subresource12.js' as Platform.DevToolsPath.UrlString,
579592
},
593+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
580594
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
581595
prefetchStatus: null,
582596
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -593,6 +607,7 @@ describeWithMockConnection('PreloadingModel', () => {
593607
action: Protocol.Preload.SpeculationAction.Prefetch,
594608
url: 'https://example.com/subresource2.js' as Platform.DevToolsPath.UrlString,
595609
},
610+
pipelineId: 'pipelineId:2' as Protocol.Preload.PreloadPipelineId,
596611
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
597612
prefetchStatus: null,
598613
requestId: 'requestId:2' as Protocol.Network.RequestId,
@@ -612,6 +627,7 @@ describeWithMockConnection('PreloadingModel', () => {
612627
action: Protocol.Preload.SpeculationAction.Prefetch,
613628
url: 'https://example.com/subresource12.js' as Platform.DevToolsPath.UrlString,
614629
},
630+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
615631
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
616632
prefetchStatus: null,
617633
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -631,6 +647,7 @@ describeWithMockConnection('PreloadingModel', () => {
631647
action: Protocol.Preload.SpeculationAction.Prefetch,
632648
url: 'https://example.com/subresource12.js' as Platform.DevToolsPath.UrlString,
633649
},
650+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
634651
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
635652
prefetchStatus: null,
636653
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -647,6 +664,7 @@ describeWithMockConnection('PreloadingModel', () => {
647664
action: Protocol.Preload.SpeculationAction.Prefetch,
648665
url: 'https://example.com/subresource2.js' as Platform.DevToolsPath.UrlString,
649666
},
667+
pipelineId: 'pipelineId:2' as Protocol.Preload.PreloadPipelineId,
650668
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
651669
prefetchStatus: null,
652670
requestId: 'requestId:2' as Protocol.Network.RequestId,

front_end/core/sdk/PreloadingModel.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
import type * as Common from '../common/common.js';
65
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
7-
8-
import {assertNotNullOrUndefined} from '../platform/platform.js';
96
import * as Protocol from '../../generated/protocol.js';
10-
import {SDKModel} from './SDKModel.js';
11-
import {Capability, type Target} from './Target.js';
12-
import {TargetManager} from './TargetManager.js';
7+
import type * as Common from '../common/common.js';
8+
import {assertNotNullOrUndefined} from '../platform/platform.js';
9+
1310
import {
1411
Events as ResourceTreeModelEvents,
1512
PrimaryPageChangeType,
16-
ResourceTreeModel,
1713
type ResourceTreeFrame,
14+
ResourceTreeModel,
1815
} from './ResourceTreeModel.js';
16+
import {SDKModel} from './SDKModel.js';
17+
import {Capability, type Target} from './Target.js';
18+
import {TargetManager} from './TargetManager.js';
1919

2020
export interface WithId<I, V> {
2121
id: I;
@@ -258,6 +258,7 @@ export class PreloadingModel extends SDKModel<EventTypes> {
258258
const attempt: PrefetchAttemptInternal = {
259259
action: Protocol.Preload.SpeculationAction.Prefetch,
260260
key: event.key,
261+
pipelineId: event.pipelineId,
261262
status: convertPreloadingStatus(event.status),
262263
prefetchStatus: event.prefetchStatus || null,
263264
requestId: event.requestId,
@@ -272,6 +273,7 @@ export class PreloadingModel extends SDKModel<EventTypes> {
272273
const attempt: PrerenderAttemptInternal = {
273274
action: Protocol.Preload.SpeculationAction.Prerender,
274275
key: event.key,
276+
pipelineId: event.pipelineId,
275277
status: convertPreloadingStatus(event.status),
276278
prerenderStatus: event.prerenderStatus || null,
277279
disallowedMojoInterface: event.disallowedMojoInterface || null,
@@ -429,6 +431,7 @@ export type PreloadingAttempt = PrefetchAttempt|PrerenderAttempt;
429431
export interface PrefetchAttempt {
430432
action: Protocol.Preload.SpeculationAction.Prefetch;
431433
key: Protocol.Preload.PreloadingAttemptKey;
434+
pipelineId: Protocol.Preload.PreloadPipelineId|null;
432435
status: PreloadingStatus;
433436
prefetchStatus: Protocol.Preload.PrefetchStatus|null;
434437
requestId: Protocol.Network.RequestId;
@@ -439,6 +442,7 @@ export interface PrefetchAttempt {
439442
export interface PrerenderAttempt {
440443
action: Protocol.Preload.SpeculationAction.Prerender;
441444
key: Protocol.Preload.PreloadingAttemptKey;
445+
pipelineId: Protocol.Preload.PreloadPipelineId|null;
442446
status: PreloadingStatus;
443447
prerenderStatus: Protocol.Preload.PrerenderFinalStatus|null;
444448
disallowedMojoInterface: string|null;
@@ -452,6 +456,7 @@ export type PreloadingAttemptInternal = PrefetchAttemptInternal|PrerenderAttempt
452456
export interface PrefetchAttemptInternal {
453457
action: Protocol.Preload.SpeculationAction.Prefetch;
454458
key: Protocol.Preload.PreloadingAttemptKey;
459+
pipelineId: Protocol.Preload.PreloadPipelineId|null;
455460
status: PreloadingStatus;
456461
prefetchStatus: Protocol.Preload.PrefetchStatus|null;
457462
requestId: Protocol.Network.RequestId;
@@ -460,6 +465,7 @@ export interface PrefetchAttemptInternal {
460465
export interface PrerenderAttemptInternal {
461466
action: Protocol.Preload.SpeculationAction.Prerender;
462467
key: Protocol.Preload.PreloadingAttemptKey;
468+
pipelineId: Protocol.Preload.PreloadPipelineId|null;
463469
status: PreloadingStatus;
464470
prerenderStatus: Protocol.Preload.PrerenderFinalStatus|null;
465471
disallowedMojoInterface: string|null;
@@ -524,7 +530,7 @@ class PreloadingAttemptRegistry {
524530
return this.enrich(attempt, sources.getById(id));
525531
}
526532

527-
// Returs preloading attempts that triggered by the rule set with `ruleSetId`.
533+
// Returns preloading attempts that triggered by the rule set with `ruleSetId`.
528534
// `ruleSetId === null` means "do not filter".
529535
//
530536
// Returns reference. Don't save returned values.
@@ -560,6 +566,7 @@ class PreloadingAttemptRegistry {
560566
attempt = {
561567
action: Protocol.Preload.SpeculationAction.Prefetch,
562568
key,
569+
pipelineId: null,
563570
status: PreloadingStatus.NOT_TRIGGERED,
564571
prefetchStatus: null,
565572
// Fill invalid request id.
@@ -570,6 +577,7 @@ class PreloadingAttemptRegistry {
570577
attempt = {
571578
action: Protocol.Preload.SpeculationAction.Prerender,
572579
key,
580+
pipelineId: null,
573581
status: PreloadingStatus.NOT_TRIGGERED,
574582
prerenderStatus: null,
575583
disallowedMojoInterface: null,

front_end/panels/application/preloading/PreloadingView.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,12 @@ class NavigationEmulator {
201201
const prerenderUrl = 'https://example.com' + json['prerender'][0]['urls'][0];
202202

203203
this.prerenderStatusUpdatedEvent = {
204-
pipelineId: 'test-pipeline-id' as Protocol.Preload.PreloadPipelineId,
205204
key: {
206205
loaderId: this.loaderId,
207206
action: Protocol.Preload.SpeculationAction.Prerender,
208207
url: prerenderUrl,
209208
},
209+
pipelineId: `pipelineId:0.${this.seq}` as Protocol.Preload.PreloadPipelineId,
210210
status: Protocol.Preload.PreloadingStatus.Running,
211211
};
212212
dispatchEvent(this.primaryTarget, 'Preload.prerenderStatusUpdated', this.prerenderStatusUpdatedEvent);

front_end/panels/application/preloading/components/PreloadingDetailsReportView.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ describeWithEnvironment('PreloadingDetailsReportView', () => {
6060
url,
6161
targetHint: undefined,
6262
},
63+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
6364
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
6465
prerenderStatus: null,
6566
disallowedMojoInterface: null,
@@ -112,6 +113,7 @@ describeWithEnvironment('PreloadingDetailsReportView', () => {
112113
url,
113114
targetHint: undefined,
114115
},
116+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
115117
status: SDK.PreloadingModel.PreloadingStatus.FAILURE,
116118
prerenderStatus: Protocol.Preload.PrerenderFinalStatus.MojoBinderPolicy,
117119
disallowedMojoInterface: 'device.mojom.GamepadMonitor',
@@ -172,6 +174,7 @@ describeWithEnvironment('PreloadingDetailsReportView', () => {
172174
url,
173175
targetHint: undefined,
174176
},
177+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
175178
status: SDK.PreloadingModel.PreloadingStatus.FAILURE,
176179
prefetchStatus: Protocol.Preload.PrefetchStatus.PrefetchFailedNon2XX,
177180
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -232,6 +235,7 @@ describeWithEnvironment('PreloadingDetailsReportView', () => {
232235
url,
233236
targetHint: undefined,
234237
},
238+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
235239
status: SDK.PreloadingModel.PreloadingStatus.READY,
236240
prefetchStatus: null,
237241
requestId: 'requestId:1' as Protocol.Network.RequestId,

front_end/panels/application/preloading/components/PreloadingGrid.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ describeWithEnvironment('PreloadingGrid', () => {
4343
action: Protocol.Preload.SpeculationAction.Prefetch,
4444
url: 'https://example.com/prefetched.html' as Platform.DevToolsPath.UrlString,
4545
},
46+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
4647
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
4748
prefetchStatus: null,
4849
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -87,6 +88,7 @@ describeWithEnvironment('PreloadingGrid', () => {
8788
action: Protocol.Preload.SpeculationAction.Prefetch,
8889
url: 'https://cross-origin.example.com/prefetched.html' as Platform.DevToolsPath.UrlString,
8990
},
91+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
9092
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
9193
prefetchStatus: null,
9294
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -131,6 +133,7 @@ describeWithEnvironment('PreloadingGrid', () => {
131133
action: Protocol.Preload.SpeculationAction.Prefetch,
132134
url: 'https://example.com/prefetched.html' as Platform.DevToolsPath.UrlString,
133135
},
136+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
134137
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
135138
prefetchStatus: null,
136139
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -177,6 +180,7 @@ describeWithEnvironment('PreloadingGrid', () => {
177180
action: Protocol.Preload.SpeculationAction.Prefetch,
178181
url: 'https://example.com/rule-set-missing.html' as Platform.DevToolsPath.UrlString,
179182
},
183+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
180184
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
181185
prefetchStatus: null,
182186
requestId: 'requestId:1' as Protocol.Network.RequestId,
@@ -194,6 +198,7 @@ describeWithEnvironment('PreloadingGrid', () => {
194198
action: Protocol.Preload.SpeculationAction.Prefetch,
195199
url: 'https://example.com/multiple-rule-sets.html' as Platform.DevToolsPath.UrlString,
196200
},
201+
pipelineId: 'pipelineId:2' as Protocol.Preload.PreloadPipelineId,
197202
status: SDK.PreloadingModel.PreloadingStatus.RUNNING,
198203
prefetchStatus: null,
199204
requestId: 'requestId:2' as Protocol.Network.RequestId,
@@ -255,6 +260,7 @@ describeWithEnvironment('PreloadingGrid', () => {
255260
action: Protocol.Preload.SpeculationAction.Prerender,
256261
url: 'https://example.com/prerendered.html' as Platform.DevToolsPath.UrlString,
257262
},
263+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
258264
status: SDK.PreloadingModel.PreloadingStatus.FAILURE,
259265
prerenderStatus: Protocol.Preload.PrerenderFinalStatus.MojoBinderPolicy,
260266
disallowedMojoInterface: 'device.mojom.GamepadMonitor',

front_end/panels/application/preloading/components/PreloadingMismatchedHeadersGrid.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ async function testPreloadingMismatchedHeadersGrid(
3535
action: Protocol.Preload.SpeculationAction.Prerender,
3636
url: 'https://example.com/prerendered.html' as Platform.DevToolsPath.UrlString,
3737
},
38+
pipelineId: 'pipelineId:1' as Protocol.Preload.PreloadPipelineId,
3839
status: SDK.PreloadingModel.PreloadingStatus.FAILURE,
3940
prerenderStatus: Protocol.Preload.PrerenderFinalStatus.ActivationNavigationParameterMismatch,
4041
disallowedMojoInterface: null,

0 commit comments

Comments
 (0)