chrome-devtools-frontend 1.0.972361 → 1.0.972865
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +1 -0
- package/front_end/core/i18n/locales/en-US.json +24 -0
- package/front_end/core/i18n/locales/en-XL.json +24 -0
- package/front_end/core/sdk/NetworkManager.ts +15 -7
- package/front_end/core/sdk/NetworkRequest.ts +16 -14
- package/front_end/core/sdk/ResourceTreeModel.ts +8 -10
- package/front_end/core/sdk/SourceMap.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +30 -14
- package/front_end/models/bindings/SASSSourceMapping.ts +4 -3
- package/front_end/models/har/HARFormat.ts +4 -2
- package/front_end/models/har/Importer.ts +0 -1
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +4 -4
- package/front_end/models/persistence/IsolatedFileSystem.ts +0 -1
- package/front_end/models/text_utils/StaticContentProvider.ts +5 -4
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +2 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +13 -2
- package/front_end/panels/lighthouse/LighthousePanel.ts +57 -8
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +28 -5
- package/front_end/panels/lighthouse/LighthouseStartView.ts +6 -2
- package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +61 -0
- package/front_end/panels/lighthouse/LighthouseTimespanView.ts +99 -0
- package/front_end/panels/sources/NavigatorView.ts +1 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/json.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +3 -1
- package/front_end/third_party/codemirror.next/package.json +9 -9
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +7 -4
- package/package.json +1 -1
@@ -113,11 +113,15 @@ const UIStrings = {
|
|
113
113
|
*/
|
114
114
|
runLighthouseInMode: 'Run Lighthouse in navigation, timespan, or snapshot mode',
|
115
115
|
/**
|
116
|
-
* @description
|
116
|
+
* @description Label of a radio option for a Lighthouse mode that audits a page navigation.
|
117
117
|
*/
|
118
118
|
navigation: 'Navigation',
|
119
119
|
/**
|
120
|
-
* @description
|
120
|
+
* @description Label of a radio option for a Lighthouse mode that audits user interactions over a period of time.
|
121
|
+
*/
|
122
|
+
timespan: 'Timespan',
|
123
|
+
/**
|
124
|
+
* @description Label of a radio option for a Lighthouse mode that audits the current page state.
|
121
125
|
*/
|
122
126
|
snapshot: 'Snapshot',
|
123
127
|
/**
|
@@ -305,6 +309,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
305
309
|
internalDisableDeviceScreenEmulation: boolean,
|
306
310
|
emulatedFormFactor: (string|undefined),
|
307
311
|
legacyNavigation: boolean,
|
312
|
+
mode: string,
|
308
313
|
} {
|
309
314
|
const flags = {
|
310
315
|
// DevTools handles all the emulation. This tells Lighthouse to not bother with emulation.
|
@@ -317,6 +322,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
317
322
|
internalDisableDeviceScreenEmulation: boolean,
|
318
323
|
emulatedFormFactor: (string | undefined),
|
319
324
|
legacyNavigation: boolean,
|
325
|
+
mode: string,
|
320
326
|
};
|
321
327
|
}
|
322
328
|
|
@@ -447,6 +453,7 @@ export const RuntimeSettings: RuntimeSetting[] = [
|
|
447
453
|
},
|
448
454
|
options: [
|
449
455
|
{label: i18nLazyString(UIStrings.navigation), value: 'navigation'},
|
456
|
+
{label: i18nLazyString(UIStrings.timespan), value: 'timespan'},
|
450
457
|
{label: i18nLazyString(UIStrings.snapshot), value: 'snapshot'},
|
451
458
|
],
|
452
459
|
learnMore: undefined,
|
@@ -495,6 +502,8 @@ export enum Events {
|
|
495
502
|
PageAuditabilityChanged = 'PageAuditabilityChanged',
|
496
503
|
PageWarningsChanged = 'PageWarningsChanged',
|
497
504
|
AuditProgressChanged = 'AuditProgressChanged',
|
505
|
+
RequestLighthouseTimespanStart = 'RequestLighthouseTimespanStart',
|
506
|
+
RequestLighthouseTimespanEnd = 'RequestLighthouseTimespanEnd',
|
498
507
|
RequestLighthouseStart = 'RequestLighthouseStart',
|
499
508
|
RequestLighthouseCancel = 'RequestLighthouseCancel',
|
500
509
|
}
|
@@ -515,6 +524,8 @@ export type EventTypes = {
|
|
515
524
|
[Events.PageAuditabilityChanged]: PageAuditabilityChangedEvent,
|
516
525
|
[Events.PageWarningsChanged]: PageWarningsChangedEvent,
|
517
526
|
[Events.AuditProgressChanged]: AuditProgressChangedEvent,
|
527
|
+
[Events.RequestLighthouseTimespanStart]: boolean,
|
528
|
+
[Events.RequestLighthouseTimespanEnd]: boolean,
|
518
529
|
[Events.RequestLighthouseStart]: boolean,
|
519
530
|
[Events.RequestLighthouseCancel]: void,
|
520
531
|
};
|
@@ -14,6 +14,7 @@ import * as Emulation from '../emulation/emulation.js';
|
|
14
14
|
import type {AuditProgressChangedEvent, PageAuditabilityChangedEvent, PageWarningsChangedEvent} from './LighthouseController.js';
|
15
15
|
import {Events, LighthouseController} from './LighthouseController.js';
|
16
16
|
import lighthousePanelStyles from './lighthousePanel.css.js';
|
17
|
+
import type {LighthouseRun} from './LighthouseProtocolService.js';
|
17
18
|
import {ProtocolService} from './LighthouseProtocolService.js';
|
18
19
|
|
19
20
|
import type {ReportJSON, RunnerResultArtifacts} from './LighthouseReporterTypes.js';
|
@@ -23,6 +24,7 @@ import {Item, ReportSelector} from './LighthouseReportSelector.js';
|
|
23
24
|
import {StartView} from './LighthouseStartView.js';
|
24
25
|
import {StartViewFR} from './LighthouseStartViewFR.js';
|
25
26
|
import {StatusView} from './LighthouseStatusView.js';
|
27
|
+
import {TimespanView} from './LighthouseTimespanView.js';
|
26
28
|
|
27
29
|
const UIStrings = {
|
28
30
|
/**
|
@@ -65,6 +67,7 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
65
67
|
private readonly controller: LighthouseController;
|
66
68
|
private readonly startView: StartView;
|
67
69
|
private readonly statusView: StatusView;
|
70
|
+
private readonly timespanView: TimespanView|null;
|
68
71
|
private warningText: Nullable<string>;
|
69
72
|
private unauditableExplanation: Nullable<string>;
|
70
73
|
private readonly cachedRenderedReports: Map<ReportJSON, HTMLElement>;
|
@@ -81,6 +84,7 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
81
84
|
network: {conditions: SDK.NetworkManager.Conditions},
|
82
85
|
};
|
83
86
|
private isLHAttached?: boolean;
|
87
|
+
private currentLighthouseRun?: LighthouseRun;
|
84
88
|
|
85
89
|
private constructor() {
|
86
90
|
super('lighthouse');
|
@@ -89,8 +93,10 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
89
93
|
this.controller = new LighthouseController(this.protocolService);
|
90
94
|
if (Root.Runtime.experiments.isEnabled('lighthousePanelFR')) {
|
91
95
|
this.startView = new StartViewFR(this.controller);
|
96
|
+
this.timespanView = new TimespanView(this.controller);
|
92
97
|
} else {
|
93
98
|
this.startView = new StartView(this.controller);
|
99
|
+
this.timespanView = null;
|
94
100
|
}
|
95
101
|
this.statusView = new StatusView(this.controller);
|
96
102
|
|
@@ -105,12 +111,10 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
105
111
|
this.controller.addEventListener(Events.PageAuditabilityChanged, this.refreshStartAuditUI.bind(this));
|
106
112
|
this.controller.addEventListener(Events.PageWarningsChanged, this.refreshWarningsUI.bind(this));
|
107
113
|
this.controller.addEventListener(Events.AuditProgressChanged, this.refreshStatusUI.bind(this));
|
108
|
-
this.controller.addEventListener(Events.
|
109
|
-
|
110
|
-
|
111
|
-
this.controller.addEventListener(Events.RequestLighthouseCancel,
|
112
|
-
void this.cancelLighthouse();
|
113
|
-
});
|
114
|
+
this.controller.addEventListener(Events.RequestLighthouseTimespanStart, this.onLighthouseTimespanStart.bind(this));
|
115
|
+
this.controller.addEventListener(Events.RequestLighthouseTimespanEnd, this.onLighthouseTimespanEnd.bind(this));
|
116
|
+
this.controller.addEventListener(Events.RequestLighthouseStart, this.onLighthouseStart.bind(this));
|
117
|
+
this.controller.addEventListener(Events.RequestLighthouseCancel, this.onLighthouseCancel.bind(this));
|
114
118
|
|
115
119
|
this.renderToolbar();
|
116
120
|
this.auditResultsElement = this.contentElement.createChild('div', 'lighthouse-results-container');
|
@@ -132,6 +136,27 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
132
136
|
return Events;
|
133
137
|
}
|
134
138
|
|
139
|
+
private async onLighthouseTimespanStart(): Promise<void> {
|
140
|
+
this.timespanView?.show(this.contentElement);
|
141
|
+
await this.startLighthouse();
|
142
|
+
this.timespanView?.ready();
|
143
|
+
}
|
144
|
+
|
145
|
+
private async onLighthouseTimespanEnd(): Promise<void> {
|
146
|
+
this.timespanView?.hide();
|
147
|
+
await this.collectLighthouseResults();
|
148
|
+
}
|
149
|
+
|
150
|
+
private async onLighthouseStart(): Promise<void> {
|
151
|
+
await this.startLighthouse();
|
152
|
+
await this.collectLighthouseResults();
|
153
|
+
}
|
154
|
+
|
155
|
+
private async onLighthouseCancel(): Promise<void> {
|
156
|
+
this.timespanView?.hide();
|
157
|
+
void this.cancelLighthouse();
|
158
|
+
}
|
159
|
+
|
135
160
|
private refreshWarningsUI(evt: Common.EventTarget.EventTargetEvent<PageWarningsChangedEvent>): void {
|
136
161
|
// PageWarningsChanged fires multiple times during an audit, which we want to ignore.
|
137
162
|
if (this.isLHAttached) {
|
@@ -148,6 +173,8 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
148
173
|
return;
|
149
174
|
}
|
150
175
|
|
176
|
+
this.startView.updateStartButton();
|
177
|
+
|
151
178
|
this.unauditableExplanation = evt.data.helpText;
|
152
179
|
this.startView.setUnauditableExplanation(evt.data.helpText);
|
153
180
|
this.startView.setStartButtonEnabled(!evt.data.helpText);
|
@@ -348,11 +375,30 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
348
375
|
const categoryIDs = this.controller.getCategoryIDs();
|
349
376
|
const flags = this.controller.getFlags();
|
350
377
|
|
378
|
+
this.currentLighthouseRun = {inspectedURL, categoryIDs, flags};
|
379
|
+
|
351
380
|
await this.setupEmulationAndProtocolConnection();
|
352
381
|
|
353
|
-
|
382
|
+
if (flags.mode === 'timespan') {
|
383
|
+
await this.protocolService.startTimespan(this.currentLighthouseRun);
|
384
|
+
}
|
385
|
+
|
386
|
+
} catch (err) {
|
387
|
+
await this.resetEmulationAndProtocolConnection();
|
388
|
+
if (err instanceof Error) {
|
389
|
+
this.statusView.renderBugReport(err);
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}
|
393
|
+
|
394
|
+
private async collectLighthouseResults(): Promise<void> {
|
395
|
+
try {
|
396
|
+
if (!this.currentLighthouseRun) {
|
397
|
+
throw new Error('Lighthouse is not started');
|
398
|
+
}
|
399
|
+
this.renderStatusView(this.currentLighthouseRun.inspectedURL);
|
354
400
|
|
355
|
-
const lighthouseResponse = await this.protocolService.
|
401
|
+
const lighthouseResponse = await this.protocolService.collectLighthouseResults(this.currentLighthouseRun);
|
356
402
|
|
357
403
|
if (lighthouseResponse && lighthouseResponse.fatal) {
|
358
404
|
const error = new Error(lighthouseResponse.message);
|
@@ -375,10 +421,13 @@ export class LighthousePanel extends UI.Panel.Panel {
|
|
375
421
|
if (err instanceof Error) {
|
376
422
|
this.statusView.renderBugReport(err);
|
377
423
|
}
|
424
|
+
} finally {
|
425
|
+
this.currentLighthouseRun = undefined;
|
378
426
|
}
|
379
427
|
}
|
380
428
|
|
381
429
|
private async cancelLighthouse(): Promise<void> {
|
430
|
+
this.currentLighthouseRun = undefined;
|
382
431
|
this.statusView.updateStatus(i18nString(UIStrings.cancelling));
|
383
432
|
await this.resetEmulationAndProtocolConnection();
|
384
433
|
this.renderStartView();
|
@@ -10,6 +10,12 @@ import type * as ReportRenderer from './LighthouseReporterTypes.js';
|
|
10
10
|
|
11
11
|
let lastId = 1;
|
12
12
|
|
13
|
+
export interface LighthouseRun {
|
14
|
+
inspectedURL: string;
|
15
|
+
categoryIDs: string[];
|
16
|
+
flags: Record<string, Object|undefined>;
|
17
|
+
}
|
18
|
+
|
13
19
|
export class ProtocolService {
|
14
20
|
private targetInfo?: {
|
15
21
|
mainSessionId: string,
|
@@ -58,19 +64,36 @@ export class ProtocolService {
|
|
58
64
|
return [i18n.DevToolsLocale.DevToolsLocale.instance().locale];
|
59
65
|
}
|
60
66
|
|
61
|
-
async
|
62
|
-
|
67
|
+
async startTimespan(currentLighthouseRun: LighthouseRun): Promise<void> {
|
68
|
+
const {inspectedURL, categoryIDs, flags} = currentLighthouseRun;
|
69
|
+
|
70
|
+
if (!this.targetInfo) {
|
71
|
+
throw new Error('Unable to get target info required for Lighthouse');
|
72
|
+
}
|
73
|
+
|
74
|
+
await this.sendWithResponse('startTimespan', {
|
75
|
+
url: inspectedURL,
|
76
|
+
categoryIDs,
|
77
|
+
flags,
|
78
|
+
locales: this.getLocales(),
|
79
|
+
target: this.targetInfo,
|
80
|
+
});
|
81
|
+
}
|
82
|
+
|
83
|
+
async collectLighthouseResults(currentLighthouseRun: LighthouseRun): Promise<ReportRenderer.RunnerResult> {
|
84
|
+
const {inspectedURL, categoryIDs, flags} = currentLighthouseRun;
|
85
|
+
|
63
86
|
if (!this.targetInfo) {
|
64
87
|
throw new Error('Unable to get target info required for Lighthouse');
|
65
88
|
}
|
66
89
|
|
67
90
|
let mode = flags.mode as string;
|
68
|
-
if (mode === '
|
69
|
-
mode = '
|
91
|
+
if (mode === 'timespan') {
|
92
|
+
mode = 'endTimespan';
|
70
93
|
}
|
71
94
|
|
72
95
|
return this.sendWithResponse(mode, {
|
73
|
-
url:
|
96
|
+
url: inspectedURL,
|
74
97
|
categoryIDs,
|
75
98
|
flags,
|
76
99
|
locales: this.getLocales(),
|
@@ -41,9 +41,9 @@ const UIStrings = {
|
|
41
41
|
const str_ = i18n.i18n.registerUIStrings('panels/lighthouse/LighthouseStartView.ts', UIStrings);
|
42
42
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
43
43
|
export class StartView extends UI.Widget.Widget {
|
44
|
-
|
44
|
+
protected controller: LighthouseController;
|
45
45
|
private readonly settingsToolbarInternal: UI.Toolbar.Toolbar;
|
46
|
-
|
46
|
+
protected startButton!: HTMLButtonElement;
|
47
47
|
private helpText?: Element;
|
48
48
|
private warningText?: Element;
|
49
49
|
private shouldConfirm?: boolean;
|
@@ -173,6 +173,10 @@ export class StartView extends UI.Widget.Widget {
|
|
173
173
|
this.contentElement.style.overflow = 'auto';
|
174
174
|
}
|
175
175
|
|
176
|
+
updateStartButton(): void {
|
177
|
+
// Do nothing in default case.
|
178
|
+
}
|
179
|
+
|
176
180
|
onResize(): void {
|
177
181
|
const useNarrowLayout = this.contentElement.offsetWidth < 560;
|
178
182
|
const startViewEl = this.contentElement.querySelector('.lighthouse-start-view');
|
@@ -4,14 +4,28 @@
|
|
4
4
|
|
5
5
|
import * as i18n from '../../core/i18n/i18n.js';
|
6
6
|
import * as UI from '../../ui/legacy/legacy.js';
|
7
|
+
import type * as Platform from '../../core/platform/platform.js';
|
7
8
|
|
8
9
|
import {StartView} from './LighthouseStartView.js';
|
10
|
+
import {Events} from './LighthouseController.js';
|
9
11
|
|
10
12
|
const UIStrings = {
|
11
13
|
/**
|
12
14
|
* @description Text that refers to the Lighthouse mode
|
13
15
|
*/
|
14
16
|
mode: 'Mode',
|
17
|
+
/**
|
18
|
+
* @description Label for a button to start analyzing a page navigation with Lighthouse
|
19
|
+
*/
|
20
|
+
analyzeNavigation: 'Analyze navigation',
|
21
|
+
/**
|
22
|
+
* @description Label for a button to start analyzing the current page state with Lighthouse
|
23
|
+
*/
|
24
|
+
analyzeSnapshot: 'Analyze snapshot',
|
25
|
+
/**
|
26
|
+
* @description Label for a button that ends a Lighthouse timespan
|
27
|
+
*/
|
28
|
+
startTimespan: 'Start timespan',
|
15
29
|
};
|
16
30
|
|
17
31
|
const str_ = i18n.i18n.registerUIStrings('panels/lighthouse/LighthouseStartViewFR.ts', UIStrings);
|
@@ -35,5 +49,52 @@ export class StartViewFR extends StartView {
|
|
35
49
|
|
36
50
|
const form = this.contentElement.querySelector('form');
|
37
51
|
form?.appendChild(fragment.element());
|
52
|
+
this.updateStartButton();
|
53
|
+
}
|
54
|
+
|
55
|
+
updateStartButton(): void {
|
56
|
+
const {mode} = this.controller.getFlags();
|
57
|
+
|
58
|
+
let label: Platform.UIString.LocalizedString;
|
59
|
+
let callback: () => void;
|
60
|
+
|
61
|
+
if (mode === 'timespan') {
|
62
|
+
label = i18nString(UIStrings.startTimespan);
|
63
|
+
callback = (): void => {
|
64
|
+
this.controller.dispatchEventToListeners(
|
65
|
+
Events.RequestLighthouseTimespanStart,
|
66
|
+
/* keyboardInitiated */ this.startButton.matches(':focus-visible'),
|
67
|
+
);
|
68
|
+
};
|
69
|
+
} else if (mode === 'snapshot') {
|
70
|
+
label = i18nString(UIStrings.analyzeSnapshot);
|
71
|
+
callback = (): void => {
|
72
|
+
this.controller.dispatchEventToListeners(
|
73
|
+
Events.RequestLighthouseStart,
|
74
|
+
/* keyboardInitiated */ this.startButton.matches(':focus-visible'),
|
75
|
+
);
|
76
|
+
};
|
77
|
+
} else {
|
78
|
+
label = i18nString(UIStrings.analyzeNavigation);
|
79
|
+
callback = (): void => {
|
80
|
+
this.controller.dispatchEventToListeners(
|
81
|
+
Events.RequestLighthouseStart,
|
82
|
+
/* keyboardInitiated */ this.startButton.matches(':focus-visible'),
|
83
|
+
);
|
84
|
+
};
|
85
|
+
}
|
86
|
+
|
87
|
+
this.startButton = UI.UIUtils.createTextButton(
|
88
|
+
label,
|
89
|
+
callback,
|
90
|
+
/* className */ '',
|
91
|
+
/* primary */ true,
|
92
|
+
);
|
93
|
+
|
94
|
+
const startButtonContainer = this.contentElement.querySelector('.lighthouse-start-button-container');
|
95
|
+
if (startButtonContainer) {
|
96
|
+
startButtonContainer.textContent = '';
|
97
|
+
startButtonContainer.appendChild(this.startButton);
|
98
|
+
}
|
38
99
|
}
|
39
100
|
}
|
@@ -0,0 +1,99 @@
|
|
1
|
+
// Copyright 2022 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
import * as i18n from '../../core/i18n/i18n.js';
|
6
|
+
import * as UI from '../../ui/legacy/legacy.js';
|
7
|
+
|
8
|
+
import type {LighthouseController} from './LighthouseController.js';
|
9
|
+
import {Events} from './LighthouseController.js';
|
10
|
+
import lighthouseDialogStyles from './lighthouseDialog.css.js';
|
11
|
+
|
12
|
+
const UIStrings = {
|
13
|
+
/**
|
14
|
+
* @description Header indicating that a Lighthouse timespan is starting.
|
15
|
+
*/
|
16
|
+
timespanStarting: 'Timespan starting…',
|
17
|
+
/**
|
18
|
+
* @description Header indicating that a Lighthouse timespan has started.
|
19
|
+
*/
|
20
|
+
timespanStarted: 'Timespan started, interact with the page',
|
21
|
+
/**
|
22
|
+
* @description Label for a button that ends a Lighthouse timespan.
|
23
|
+
*/
|
24
|
+
endTimespan: 'End timespan',
|
25
|
+
/**
|
26
|
+
* @description Label for a button that cancels a Lighthouse timespan.
|
27
|
+
*/
|
28
|
+
cancel: 'Cancel',
|
29
|
+
};
|
30
|
+
|
31
|
+
const str_ = i18n.i18n.registerUIStrings('panels/lighthouse/LighthouseTimespanView.ts', UIStrings);
|
32
|
+
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
33
|
+
|
34
|
+
export class TimespanView extends UI.Dialog.Dialog {
|
35
|
+
private controller: LighthouseController;
|
36
|
+
private statusHeader: Element|null;
|
37
|
+
private endButton: HTMLButtonElement|null;
|
38
|
+
|
39
|
+
constructor(controller: LighthouseController) {
|
40
|
+
super();
|
41
|
+
this.controller = controller;
|
42
|
+
this.statusHeader = null;
|
43
|
+
this.endButton = null;
|
44
|
+
this.setDimmed(true);
|
45
|
+
this.setCloseOnEscape(false);
|
46
|
+
this.setOutsideClickCallback(event => event.consume(true));
|
47
|
+
this.render();
|
48
|
+
}
|
49
|
+
|
50
|
+
show(dialogRenderElement: Element): void {
|
51
|
+
this.reset();
|
52
|
+
super.show(dialogRenderElement);
|
53
|
+
}
|
54
|
+
|
55
|
+
reset(): void {
|
56
|
+
if (this.statusHeader && this.endButton) {
|
57
|
+
this.statusHeader.textContent = i18nString(UIStrings.timespanStarting);
|
58
|
+
this.endButton.disabled = true;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
ready(): void {
|
63
|
+
if (this.statusHeader && this.endButton) {
|
64
|
+
this.statusHeader.textContent = i18nString(UIStrings.timespanStarted);
|
65
|
+
this.endButton.disabled = false;
|
66
|
+
this.endButton.focus();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
render(): void {
|
71
|
+
const dialogRoot = UI.Utils.createShadowRootWithCoreStyles(
|
72
|
+
this.contentElement, {cssFile: [lighthouseDialogStyles], delegatesFocus: undefined});
|
73
|
+
|
74
|
+
this.endButton = UI.UIUtils.createTextButton(i18nString(UIStrings.endTimespan), this.endTimespan.bind(this));
|
75
|
+
const cancelButton = UI.UIUtils.createTextButton(i18nString(UIStrings.cancel), this.cancel.bind(this));
|
76
|
+
const fragment = UI.Fragment.Fragment.build`
|
77
|
+
<div class="lighthouse-view vbox">
|
78
|
+
<h2 $="status-header"></h2>
|
79
|
+
${this.endButton}
|
80
|
+
${cancelButton}
|
81
|
+
</div>
|
82
|
+
`;
|
83
|
+
|
84
|
+
this.statusHeader = fragment.$('status-header');
|
85
|
+
dialogRoot.appendChild(fragment.element());
|
86
|
+
|
87
|
+
this.setSizeBehavior(UI.GlassPane.SizeBehavior.SetExactWidthMaxHeight);
|
88
|
+
this.setMaxContentSize(new UI.Geometry.Size(500, 400));
|
89
|
+
this.reset();
|
90
|
+
}
|
91
|
+
|
92
|
+
private endTimespan(): void {
|
93
|
+
this.controller.dispatchEventToListeners(Events.RequestLighthouseTimespanEnd, false);
|
94
|
+
}
|
95
|
+
|
96
|
+
private cancel(): void {
|
97
|
+
this.controller.dispatchEventToListeners(Events.RequestLighthouseCancel);
|
98
|
+
}
|
99
|
+
}
|
@@ -854,10 +854,8 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
|
|
854
854
|
}
|
855
855
|
|
856
856
|
if (project.type() === Workspace.Workspace.projectTypes.FileSystem) {
|
857
|
-
// TODO(crbug.com/1253323): Cast to RawPathString will be removed when migration to branded types is complete.
|
858
857
|
const folderPath = Common.ParsedURL.ParsedURL.urlToRawPathString(
|
859
|
-
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.completeURL(project, path)
|
860
|
-
Platform.DevToolsPath.UrlString,
|
858
|
+
Persistence.FileSystemWorkspaceBinding.FileSystemWorkspaceBinding.completeURL(project, path),
|
861
859
|
Host.Platform.isWin());
|
862
860
|
contextMenu.revealSection().appendItem(
|
863
861
|
i18nString(UIStrings.openFolder),
|