chrome-devtools-frontend 1.0.972361 → 1.0.973446
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 +2 -1
- 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 → LighthouseWorkerService.ts} +69 -36
- package/front_end/entrypoints/lighthouse_worker/lighthouse_worker.ts +1 -1
- 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/elements/components/LayoutPane.ts +1 -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 +94 -30
- 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/bundle.ts +1 -1
- 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 +28 -2
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +10 -10
- package/front_end/ui/components/expandable_list/expandableList.css +1 -1
- package/front_end/ui/components/text_editor/config.ts +1 -0
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +7 -4
- package/package.json +1 -1
@@ -672,7 +672,7 @@ grd_files_debug_sources = [
|
|
672
672
|
"front_end/entrypoints/inspector_main/RenderingOptions.js",
|
673
673
|
"front_end/entrypoints/inspector_main/nodeIcon.css.js",
|
674
674
|
"front_end/entrypoints/inspector_main/renderingOptions.css.js",
|
675
|
-
"front_end/entrypoints/lighthouse_worker/
|
675
|
+
"front_end/entrypoints/lighthouse_worker/LighthouseWorkerService.js",
|
676
676
|
"front_end/entrypoints/main/ExecutionContextSelector.js",
|
677
677
|
"front_end/entrypoints/main/MainImpl.js",
|
678
678
|
"front_end/entrypoints/main/SimpleApp.js",
|
@@ -1050,6 +1050,7 @@ grd_files_debug_sources = [
|
|
1050
1050
|
"front_end/panels/lighthouse/LighthouseStartView.js",
|
1051
1051
|
"front_end/panels/lighthouse/LighthouseStartViewFR.js",
|
1052
1052
|
"front_end/panels/lighthouse/LighthouseStatusView.js",
|
1053
|
+
"front_end/panels/lighthouse/LighthouseTimespanView.js",
|
1053
1054
|
"front_end/panels/lighthouse/RadioSetting.js",
|
1054
1055
|
"front_end/panels/lighthouse/lighthouseDialog.css.js",
|
1055
1056
|
"front_end/panels/lighthouse/lighthousePanel.css.js",
|
@@ -5819,6 +5819,9 @@
|
|
5819
5819
|
"panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
|
5820
5820
|
"message": "There may be stored data affecting loading performance in this location: {PH1}. Audit this page in an incognito window to prevent those resources from affecting your scores."
|
5821
5821
|
},
|
5822
|
+
"panels/lighthouse/LighthouseController.ts | timespan": {
|
5823
|
+
"message": "Timespan"
|
5824
|
+
},
|
5822
5825
|
"panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
|
5823
5826
|
"message": "Audit the page using classic Lighthouse when in navigation mode."
|
5824
5827
|
},
|
@@ -5879,9 +5882,18 @@
|
|
5879
5882
|
"panels/lighthouse/LighthouseStartView.ts | learnMore": {
|
5880
5883
|
"message": "Learn more"
|
5881
5884
|
},
|
5885
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | analyzeNavigation": {
|
5886
|
+
"message": "Analyze navigation"
|
5887
|
+
},
|
5888
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | analyzeSnapshot": {
|
5889
|
+
"message": "Analyze snapshot"
|
5890
|
+
},
|
5882
5891
|
"panels/lighthouse/LighthouseStartViewFR.ts | mode": {
|
5883
5892
|
"message": "Mode"
|
5884
5893
|
},
|
5894
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | startTimespan": {
|
5895
|
+
"message": "Start timespan"
|
5896
|
+
},
|
5885
5897
|
"panels/lighthouse/LighthouseStatusView.ts | ahSorryWeRanIntoAnError": {
|
5886
5898
|
"message": "Ah, sorry! We ran into an error."
|
5887
5899
|
},
|
@@ -5969,6 +5981,18 @@
|
|
5969
5981
|
"panels/lighthouse/LighthouseStatusView.ts | walmartSawAIncreaseInRevenueFor": {
|
5970
5982
|
"message": "Walmart saw a 1% increase in revenue for every 100ms improvement in page load [Source: WPO Stats]"
|
5971
5983
|
},
|
5984
|
+
"panels/lighthouse/LighthouseTimespanView.ts | cancel": {
|
5985
|
+
"message": "Cancel"
|
5986
|
+
},
|
5987
|
+
"panels/lighthouse/LighthouseTimespanView.ts | endTimespan": {
|
5988
|
+
"message": "End timespan"
|
5989
|
+
},
|
5990
|
+
"panels/lighthouse/LighthouseTimespanView.ts | timespanStarted": {
|
5991
|
+
"message": "Timespan started, interact with the page"
|
5992
|
+
},
|
5993
|
+
"panels/lighthouse/LighthouseTimespanView.ts | timespanStarting": {
|
5994
|
+
"message": "Timespan starting…"
|
5995
|
+
},
|
5972
5996
|
"panels/media/EventDisplayTable.ts | eventDisplay": {
|
5973
5997
|
"message": "Event display"
|
5974
5998
|
},
|
@@ -5819,6 +5819,9 @@
|
|
5819
5819
|
"panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
|
5820
5820
|
"message": "T̂h́êŕê ḿâý b̂é ŝt́ôŕêd́ d̂át̂á âf́f̂éĉt́îńĝ ĺôád̂ín̂ǵ p̂ér̂f́ôŕm̂án̂ćê ín̂ t́ĥíŝ ĺôćât́îón̂: {PH1}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ôśê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ."
|
5821
5821
|
},
|
5822
|
+
"panels/lighthouse/LighthouseController.ts | timespan": {
|
5823
|
+
"message": "T̂ím̂éŝṕâń"
|
5824
|
+
},
|
5822
5825
|
"panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
|
5823
5826
|
"message": "Âúd̂ít̂ t́ĥé p̂áĝé ûśîńĝ ćl̂áŝśîć L̂íĝh́t̂h́ôúŝé ŵh́êń îń n̂áv̂íĝát̂íôń m̂ód̂é."
|
5824
5827
|
},
|
@@ -5879,9 +5882,18 @@
|
|
5879
5882
|
"panels/lighthouse/LighthouseStartView.ts | learnMore": {
|
5880
5883
|
"message": "L̂éâŕn̂ ḿôŕê"
|
5881
5884
|
},
|
5885
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | analyzeNavigation": {
|
5886
|
+
"message": "Âńâĺŷźê ńâv́îǵât́îón̂"
|
5887
|
+
},
|
5888
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | analyzeSnapshot": {
|
5889
|
+
"message": "Âńâĺŷźê śn̂áp̂śĥót̂"
|
5890
|
+
},
|
5882
5891
|
"panels/lighthouse/LighthouseStartViewFR.ts | mode": {
|
5883
5892
|
"message": "M̂ód̂é"
|
5884
5893
|
},
|
5894
|
+
"panels/lighthouse/LighthouseStartViewFR.ts | startTimespan": {
|
5895
|
+
"message": "Ŝt́âŕt̂ t́îḿêśp̂án̂"
|
5896
|
+
},
|
5885
5897
|
"panels/lighthouse/LighthouseStatusView.ts | ahSorryWeRanIntoAnError": {
|
5886
5898
|
"message": "Âh́, ŝór̂ŕŷ! Ẃê ŕâń îńt̂ó âń êŕr̂ór̂."
|
5887
5899
|
},
|
@@ -5969,6 +5981,18 @@
|
|
5969
5981
|
"panels/lighthouse/LighthouseStatusView.ts | walmartSawAIncreaseInRevenueFor": {
|
5970
5982
|
"message": "Ŵál̂ḿâŕt̂ śâẃ â 1% ín̂ćr̂éâśê ín̂ ŕêv́êńûé f̂ór̂ év̂ér̂ý 100m̂ś îḿp̂ŕôv́êḿêńt̂ ín̂ ṕâǵê ĺôád̂ [Śôúr̂ćê: WPO Stats]"
|
5971
5983
|
},
|
5984
|
+
"panels/lighthouse/LighthouseTimespanView.ts | cancel": {
|
5985
|
+
"message": "Ĉán̂ćêĺ"
|
5986
|
+
},
|
5987
|
+
"panels/lighthouse/LighthouseTimespanView.ts | endTimespan": {
|
5988
|
+
"message": "Êńd̂ t́îḿêśp̂án̂"
|
5989
|
+
},
|
5990
|
+
"panels/lighthouse/LighthouseTimespanView.ts | timespanStarted": {
|
5991
|
+
"message": "T̂ím̂éŝṕâń ŝt́âŕt̂éd̂, ín̂t́êŕâćt̂ ẃît́ĥ t́ĥé p̂áĝé"
|
5992
|
+
},
|
5993
|
+
"panels/lighthouse/LighthouseTimespanView.ts | timespanStarting": {
|
5994
|
+
"message": "T̂ím̂éŝṕâń ŝt́âŕt̂ín̂ǵ…"
|
5995
|
+
},
|
5972
5996
|
"panels/media/EventDisplayTable.ts | eventDisplay": {
|
5973
5997
|
"message": "Êv́êńt̂ d́îśp̂ĺâý"
|
5974
5998
|
},
|
@@ -447,7 +447,7 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
447
447
|
|
448
448
|
private updateNetworkRequestWithResponse(networkRequest: NetworkRequest, response: Protocol.Network.Response): void {
|
449
449
|
if (response.url && networkRequest.url() !== response.url) {
|
450
|
-
networkRequest.setUrl(response.url);
|
450
|
+
networkRequest.setUrl(response.url as Platform.DevToolsPath.UrlString);
|
451
451
|
}
|
452
452
|
networkRequest.mimeType = (response.mimeType as MIME_TYPE);
|
453
453
|
if (!networkRequest.statusCode) {
|
@@ -588,10 +588,12 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
588
588
|
frameId,
|
589
589
|
});
|
590
590
|
}
|
591
|
-
networkRequest = this.appendRedirect(requestId, timestamp, request.url);
|
591
|
+
networkRequest = this.appendRedirect(requestId, timestamp, request.url as Platform.DevToolsPath.UrlString);
|
592
592
|
this.#manager.dispatchEventToListeners(Events.RequestRedirected, networkRequest);
|
593
593
|
} else {
|
594
|
-
networkRequest = NetworkRequest.create(
|
594
|
+
networkRequest = NetworkRequest.create(
|
595
|
+
requestId, request.url as Platform.DevToolsPath.UrlString, documentURL as Platform.DevToolsPath.UrlString,
|
596
|
+
frameId ?? null, loaderId, initiator);
|
595
597
|
requestToManagerMap.set(networkRequest, this.#manager);
|
596
598
|
}
|
597
599
|
networkRequest.hasNetworkData = true;
|
@@ -716,7 +718,8 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
716
718
|
}
|
717
719
|
|
718
720
|
webSocketCreated({requestId, url: requestURL, initiator}: Protocol.Network.WebSocketCreatedEvent): void {
|
719
|
-
const networkRequest =
|
721
|
+
const networkRequest =
|
722
|
+
NetworkRequest.createForWebSocket(requestId, requestURL as Platform.DevToolsPath.UrlString, initiator);
|
720
723
|
requestToManagerMap.set(networkRequest, this.#manager);
|
721
724
|
networkRequest.setResourceType(Common.ResourceType.resourceTypes.WebSocket);
|
722
725
|
this.startNetworkRequest(networkRequest, null);
|
@@ -865,7 +868,9 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
865
868
|
return builder;
|
866
869
|
}
|
867
870
|
|
868
|
-
private appendRedirect(
|
871
|
+
private appendRedirect(
|
872
|
+
requestId: Protocol.Network.RequestId, time: number,
|
873
|
+
redirectURL: Platform.DevToolsPath.UrlString): NetworkRequest {
|
869
874
|
const originalNetworkRequest = this.#requestsById.get(requestId);
|
870
875
|
if (!originalNetworkRequest) {
|
871
876
|
throw new Error(`Could not find original network request for ${requestId}`);
|
@@ -968,7 +973,8 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
968
973
|
|
969
974
|
webTransportCreated({transportId, url: requestURL, timestamp: time, initiator}:
|
970
975
|
Protocol.Network.WebTransportCreatedEvent): void {
|
971
|
-
const networkRequest =
|
976
|
+
const networkRequest =
|
977
|
+
NetworkRequest.createForWebSocket(transportId, requestURL as Platform.DevToolsPath.UrlString, initiator);
|
972
978
|
networkRequest.hasNetworkData = true;
|
973
979
|
requestToManagerMap.set(networkRequest, this.#manager);
|
974
980
|
networkRequest.setResourceType(Common.ResourceType.resourceTypes.WebTransport);
|
@@ -1071,7 +1077,9 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
|
|
1071
1077
|
private createNetworkRequest(
|
1072
1078
|
requestId: Protocol.Network.RequestId, frameId: Protocol.Page.FrameId, loaderId: Protocol.Network.LoaderId,
|
1073
1079
|
url: string, documentURL: string, initiator: Protocol.Network.Initiator|null): NetworkRequest {
|
1074
|
-
const request = NetworkRequest.create(
|
1080
|
+
const request = NetworkRequest.create(
|
1081
|
+
requestId, url as Platform.DevToolsPath.UrlString, documentURL as Platform.DevToolsPath.UrlString, frameId,
|
1082
|
+
loaderId, initiator);
|
1075
1083
|
requestToManagerMap.set(request, this.#manager);
|
1076
1084
|
return request;
|
1077
1085
|
}
|
@@ -204,7 +204,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
204
204
|
TextUtils.ContentProvider.ContentProvider {
|
205
205
|
#requestIdInternal: string;
|
206
206
|
#backendRequestIdInternal?: Protocol.Network.RequestId;
|
207
|
-
readonly #documentURLInternal:
|
207
|
+
readonly #documentURLInternal: Platform.DevToolsPath.UrlString;
|
208
208
|
readonly #frameIdInternal: Protocol.Page.FrameId|null;
|
209
209
|
readonly #loaderIdInternal: Protocol.Network.LoaderId|null;
|
210
210
|
readonly #initiatorInternal: Protocol.Network.Initiator|null|undefined;
|
@@ -293,9 +293,9 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
293
293
|
#wasIntercepted: boolean;
|
294
294
|
|
295
295
|
private constructor(
|
296
|
-
requestId: string, backendRequestId: Protocol.Network.RequestId|undefined, url:
|
297
|
-
|
298
|
-
initiator: Protocol.Network.Initiator|null) {
|
296
|
+
requestId: string, backendRequestId: Protocol.Network.RequestId|undefined, url: Platform.DevToolsPath.UrlString,
|
297
|
+
documentURL: Platform.DevToolsPath.UrlString, frameId: Protocol.Page.FrameId|null,
|
298
|
+
loaderId: Protocol.Network.LoaderId|null, initiator: Protocol.Network.Initiator|null) {
|
299
299
|
super();
|
300
300
|
|
301
301
|
this.#requestIdInternal = requestId;
|
@@ -369,20 +369,23 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
369
369
|
}
|
370
370
|
|
371
371
|
static create(
|
372
|
-
backendRequestId: Protocol.Network.RequestId, url:
|
373
|
-
|
374
|
-
initiator: Protocol.Network.Initiator|null): NetworkRequest {
|
372
|
+
backendRequestId: Protocol.Network.RequestId, url: Platform.DevToolsPath.UrlString,
|
373
|
+
documentURL: Platform.DevToolsPath.UrlString, frameId: Protocol.Page.FrameId|null,
|
374
|
+
loaderId: Protocol.Network.LoaderId|null, initiator: Protocol.Network.Initiator|null): NetworkRequest {
|
375
375
|
return new NetworkRequest(backendRequestId, backendRequestId, url, documentURL, frameId, loaderId, initiator);
|
376
376
|
}
|
377
377
|
|
378
378
|
static createForWebSocket(
|
379
|
-
backendRequestId: Protocol.Network.RequestId, requestURL:
|
379
|
+
backendRequestId: Protocol.Network.RequestId, requestURL: Platform.DevToolsPath.UrlString,
|
380
380
|
initiator?: Protocol.Network.Initiator): NetworkRequest {
|
381
|
-
return new NetworkRequest(
|
381
|
+
return new NetworkRequest(
|
382
|
+
backendRequestId, backendRequestId, requestURL, '' as Platform.DevToolsPath.UrlString, null, null,
|
383
|
+
initiator || null);
|
382
384
|
}
|
383
385
|
|
384
386
|
static createWithoutBackendRequest(
|
385
|
-
requestId: string, url:
|
387
|
+
requestId: string, url: Platform.DevToolsPath.UrlString, documentURL: Platform.DevToolsPath.UrlString,
|
388
|
+
initiator: Protocol.Network.Initiator|null): NetworkRequest {
|
386
389
|
return new NetworkRequest(requestId, undefined, url, documentURL, null, null, initiator);
|
387
390
|
}
|
388
391
|
|
@@ -414,13 +417,12 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
414
417
|
return this.#urlInternal.startsWith('blob:');
|
415
418
|
}
|
416
419
|
|
417
|
-
|
418
|
-
setUrl(x: string): void {
|
420
|
+
setUrl(x: Platform.DevToolsPath.UrlString): void {
|
419
421
|
if (this.#urlInternal === x) {
|
420
422
|
return;
|
421
423
|
}
|
422
424
|
|
423
|
-
this.#urlInternal = x
|
425
|
+
this.#urlInternal = x;
|
424
426
|
this.#parsedURLInternal = new Common.ParsedURL.ParsedURL(x);
|
425
427
|
this.#queryStringInternal = undefined;
|
426
428
|
this.#parsedQueryParameters = undefined;
|
@@ -428,7 +430,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
428
430
|
this.#pathInternal = undefined;
|
429
431
|
}
|
430
432
|
|
431
|
-
get documentURL():
|
433
|
+
get documentURL(): Platform.DevToolsPath.UrlString {
|
432
434
|
return this.#documentURLInternal;
|
433
435
|
}
|
434
436
|
|
@@ -51,8 +51,6 @@ import {SDKModel} from './SDKModel.js';
|
|
51
51
|
import {TargetManager} from './TargetManager.js';
|
52
52
|
import {SecurityOriginManager} from './SecurityOriginManager.js';
|
53
53
|
|
54
|
-
// TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
|
55
|
-
|
56
54
|
export class ResourceTreeModel extends SDKModel<EventTypes> {
|
57
55
|
readonly agent: ProtocolProxyApi.PageApi;
|
58
56
|
readonly #securityOriginManager: SecurityOriginManager;
|
@@ -304,8 +302,8 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
|
|
304
302
|
}
|
305
303
|
|
306
304
|
const resource = new Resource(
|
307
|
-
this, null, url, frame.url
|
308
|
-
|
305
|
+
this, null, url, frame.url, frameId, data.loaderId, Common.ResourceType.resourceTypes[data.resourceType],
|
306
|
+
data.mimeType, data.lastModified, null);
|
309
307
|
frame.addResource(resource);
|
310
308
|
}
|
311
309
|
|
@@ -606,7 +604,7 @@ export class ResourceTreeFrame {
|
|
606
604
|
crossTargetParentFrameId: string|null;
|
607
605
|
#loaderIdInternal: string;
|
608
606
|
#nameInternal: string|null|undefined;
|
609
|
-
#urlInternal:
|
607
|
+
#urlInternal: Platform.DevToolsPath.UrlString;
|
610
608
|
#domainAndRegistryInternal: string;
|
611
609
|
#securityOriginInternal: string|null;
|
612
610
|
#unreachableUrlInternal: string;
|
@@ -638,7 +636,7 @@ export class ResourceTreeFrame {
|
|
638
636
|
|
639
637
|
this.#loaderIdInternal = (payload && payload.loaderId) || '';
|
640
638
|
this.#nameInternal = payload && payload.name;
|
641
|
-
this.#urlInternal = (payload && payload.url) || '';
|
639
|
+
this.#urlInternal = ((payload && payload.url) || '') as Platform.DevToolsPath.UrlString;
|
642
640
|
this.#domainAndRegistryInternal = (payload && payload.domainAndRegistry) || '';
|
643
641
|
this.#securityOriginInternal = payload && payload.securityOrigin;
|
644
642
|
this.#unreachableUrlInternal = (payload && payload.unreachableUrl) || '';
|
@@ -690,7 +688,7 @@ export class ResourceTreeFrame {
|
|
690
688
|
navigate(framePayload: Protocol.Page.Frame): void {
|
691
689
|
this.#loaderIdInternal = framePayload.loaderId;
|
692
690
|
this.#nameInternal = framePayload.name;
|
693
|
-
this.#urlInternal = framePayload.url;
|
691
|
+
this.#urlInternal = framePayload.url as Platform.DevToolsPath.UrlString;
|
694
692
|
this.#domainAndRegistryInternal = framePayload.domainAndRegistry;
|
695
693
|
this.#securityOriginInternal = framePayload.securityOrigin;
|
696
694
|
this.#unreachableUrlInternal = framePayload.unreachableUrl || '';
|
@@ -724,7 +722,7 @@ export class ResourceTreeFrame {
|
|
724
722
|
return this.#nameInternal || '';
|
725
723
|
}
|
726
724
|
|
727
|
-
get url():
|
725
|
+
get url(): Platform.DevToolsPath.UrlString {
|
728
726
|
return this.#urlInternal;
|
729
727
|
}
|
730
728
|
|
@@ -847,8 +845,8 @@ export class ResourceTreeFrame {
|
|
847
845
|
return;
|
848
846
|
}
|
849
847
|
resource = new Resource(
|
850
|
-
this.#model, request, request.url(), request.documentURL
|
851
|
-
request.
|
848
|
+
this.#model, request, request.url(), request.documentURL, request.frameId, request.loaderId,
|
849
|
+
request.resourceType(), request.mimeType, null, null);
|
852
850
|
this.resourcesMap.set(resource.url, resource);
|
853
851
|
this.#model.dispatchEventToListeners(Events.ResourceAdded, resource);
|
854
852
|
}
|
@@ -32,6 +32,8 @@
|
|
32
32
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
33
|
*/
|
34
34
|
|
35
|
+
// TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
|
36
|
+
|
35
37
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
36
38
|
import * as Common from '../common/common.js';
|
37
39
|
import * as i18n from '../i18n/i18n.js';
|
@@ -143,7 +145,7 @@ export class TextSourceMap implements SourceMap {
|
|
143
145
|
readonly #sourceMappingURL: string;
|
144
146
|
readonly #baseURL: string;
|
145
147
|
#mappingsInternal: SourceMapEntry[]|null;
|
146
|
-
readonly #sourceInfos: Map<
|
148
|
+
readonly #sourceInfos: Map<Platform.DevToolsPath.UrlString, TextSourceMap.SourceInfo>;
|
147
149
|
|
148
150
|
/**
|
149
151
|
* Implements Source Map V3 model. See https://github.com/google/closure-compiler/wiki/Source-Maps
|
@@ -201,23 +203,21 @@ export class TextSourceMap implements SourceMap {
|
|
201
203
|
return this.#sourceMappingURL;
|
202
204
|
}
|
203
205
|
|
204
|
-
sourceURLs():
|
206
|
+
sourceURLs(): Platform.DevToolsPath.UrlString[] {
|
205
207
|
return [...this.#sourceInfos.keys()];
|
206
208
|
}
|
207
209
|
|
208
|
-
sourceContentProvider(sourceURL:
|
210
|
+
sourceContentProvider(sourceURL: Platform.DevToolsPath.UrlString, contentType: Common.ResourceType.ResourceType):
|
209
211
|
TextUtils.ContentProvider.ContentProvider {
|
210
212
|
const info = this.#sourceInfos.get(sourceURL);
|
211
213
|
if (info && info.content) {
|
212
214
|
return TextUtils.StaticContentProvider.StaticContentProvider.fromString(sourceURL, contentType, info.content);
|
213
215
|
}
|
214
|
-
|
215
|
-
return new CompilerSourceMappingContentProvider(
|
216
|
-
sourceURL as Platform.DevToolsPath.UrlString, contentType, this.#initiator);
|
216
|
+
return new CompilerSourceMappingContentProvider(sourceURL, contentType, this.#initiator);
|
217
217
|
}
|
218
218
|
|
219
219
|
embeddedContentByURL(sourceURL: string): string|null {
|
220
|
-
const entry = this.#sourceInfos.get(sourceURL);
|
220
|
+
const entry = this.#sourceInfos.get(sourceURL as Platform.DevToolsPath.UrlString);
|
221
221
|
if (!entry) {
|
222
222
|
return null;
|
223
223
|
}
|
@@ -309,7 +309,7 @@ export class TextSourceMap implements SourceMap {
|
|
309
309
|
}
|
310
310
|
|
311
311
|
private reversedMappings(sourceURL: string): number[] {
|
312
|
-
const info = this.#sourceInfos.get(sourceURL);
|
312
|
+
const info = this.#sourceInfos.get(sourceURL as Platform.DevToolsPath.UrlString);
|
313
313
|
if (!info) {
|
314
314
|
return [];
|
315
315
|
}
|
@@ -373,7 +373,7 @@ export class TextSourceMap implements SourceMap {
|
|
373
373
|
if (url === this.#compiledURLInternal && source) {
|
374
374
|
url += '? [sm]';
|
375
375
|
}
|
376
|
-
this.#sourceInfos.set(url, new TextSourceMap.SourceInfo(source || null, null));
|
376
|
+
this.#sourceInfos.set(url as Platform.DevToolsPath.UrlString, new TextSourceMap.SourceInfo(source || null, null));
|
377
377
|
sourcesList.push(url);
|
378
378
|
}
|
379
379
|
sourceMapToSourceList.set(sourceMap, sourcesList);
|
package/front_end/entrypoints/lighthouse_worker/{LighthouseService.ts → LighthouseWorkerService.ts}
RENAMED
@@ -11,13 +11,17 @@ function disableLoggingForTest(): void {
|
|
11
11
|
}
|
12
12
|
|
13
13
|
/**
|
14
|
+
* LegacyPort is provided to Lighthouse as the CDP connection in legacyNavigation mode.
|
15
|
+
* Its complement is https://github.com/GoogleChrome/lighthouse/blob/v9.3.1/lighthouse-core/gather/connections/raw.js
|
16
|
+
* It speaks pure CDP via notifyFrontendViaWorkerMessage
|
17
|
+
*
|
14
18
|
* Any message that comes back from Lighthouse has to go via a so-called "port".
|
15
19
|
* This class holds the relevant callbacks that Lighthouse provides and that
|
16
20
|
* can be called in the onmessage callback of the worker, so that the frontend
|
17
21
|
* can communicate to Lighthouse. Lighthouse itself communicates to the frontend
|
18
22
|
* via status updates defined below.
|
19
23
|
*/
|
20
|
-
class
|
24
|
+
class LegacyPort {
|
21
25
|
onMessage?: (message: string) => void;
|
22
26
|
onClose?: () => void;
|
23
27
|
on(eventName: string, callback: (arg?: string) => void): void {
|
@@ -35,6 +39,10 @@ class LighthousePort {
|
|
35
39
|
}
|
36
40
|
}
|
37
41
|
|
42
|
+
/**
|
43
|
+
* ConnectionProxy is a SDK interface, but the implementation has no knowledge it's a parallelConnection.
|
44
|
+
* The CDP traffic is smuggled back and forth by the system described in LighthouseProtocolService
|
45
|
+
*/
|
38
46
|
class ConnectionProxy implements SDK.Connections.ParallelConnectionInterface {
|
39
47
|
sessionId: string;
|
40
48
|
onMessage: ((arg0: Object) => void)|null;
|
@@ -73,14 +81,15 @@ class ConnectionProxy implements SDK.Connections.ParallelConnectionInterface {
|
|
73
81
|
}
|
74
82
|
}
|
75
83
|
|
76
|
-
const
|
77
|
-
let
|
84
|
+
const legacyPort = new LegacyPort();
|
85
|
+
let cdpConnection: ConnectionProxy|undefined;
|
86
|
+
let endTimespan: (() => unknown)|undefined;
|
78
87
|
|
79
88
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
80
|
-
async function
|
89
|
+
async function invokeLH(action: string, args: any): Promise<unknown> {
|
81
90
|
if (Root.Runtime.Runtime.queryParam('isUnderTest')) {
|
82
91
|
disableLoggingForTest();
|
83
|
-
|
92
|
+
args.flags.maxWaitForLoad = 2 * 1000;
|
84
93
|
}
|
85
94
|
|
86
95
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
@@ -92,42 +101,55 @@ async function start(method: string, params: any): Promise<unknown> {
|
|
92
101
|
undefined;
|
93
102
|
|
94
103
|
try {
|
95
|
-
|
96
|
-
|
104
|
+
// For timespan we only need to perform setup on startTimespan.
|
105
|
+
// Config, flags, locale, etc. should be stored in the closure of endTimespan.
|
106
|
+
if (action === 'endTimespan') {
|
107
|
+
if (!endTimespan) {
|
108
|
+
throw new Error('Cannot end a timespan before starting one');
|
109
|
+
}
|
110
|
+
const result = await endTimespan();
|
111
|
+
endTimespan = undefined;
|
112
|
+
return result;
|
113
|
+
}
|
114
|
+
|
115
|
+
const locale = await fetchLocaleData(args.locales);
|
116
|
+
const flags = args.flags;
|
97
117
|
flags.logLevel = flags.logLevel || 'info';
|
98
118
|
flags.channel = 'devtools';
|
99
119
|
flags.locale = locale;
|
100
120
|
|
101
121
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
102
|
-
const config = self.createConfig(
|
103
|
-
const url =
|
122
|
+
const config = self.createConfig(args.categoryIDs, flags.emulatedFormFactor);
|
123
|
+
const url = args.url;
|
104
124
|
|
105
125
|
// Handle legacy Lighthouse runner path.
|
106
|
-
if (
|
126
|
+
if (action === 'navigation' && flags.legacyNavigation) {
|
107
127
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
108
|
-
const connection = self.setUpWorkerConnection(
|
128
|
+
const connection = self.setUpWorkerConnection(legacyPort);
|
109
129
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
110
130
|
return await self.runLighthouse(url, flags, config, connection);
|
111
131
|
}
|
112
132
|
|
113
|
-
const {mainTargetId, mainFrameId, mainSessionId} =
|
114
|
-
|
133
|
+
const {mainTargetId, mainFrameId, mainSessionId} = args.target;
|
134
|
+
cdpConnection = new ConnectionProxy(mainSessionId);
|
115
135
|
puppeteerConnection =
|
116
|
-
await Puppeteer.PuppeteerConnection.getPuppeteerConnection(
|
136
|
+
await Puppeteer.PuppeteerConnection.getPuppeteerConnection(cdpConnection, mainFrameId, mainTargetId);
|
137
|
+
const {page} = puppeteerConnection;
|
117
138
|
|
118
|
-
if (
|
139
|
+
if (action === 'snapshot') {
|
119
140
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
120
|
-
return await self.runLighthouseSnapshot({
|
121
|
-
|
122
|
-
|
123
|
-
|
141
|
+
return await self.runLighthouseSnapshot({config, page});
|
142
|
+
}
|
143
|
+
|
144
|
+
if (action === 'startTimespan') {
|
145
|
+
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
146
|
+
const timespan = await self.startLighthouseTimespan({config, page});
|
147
|
+
endTimespan = timespan.endTimespan;
|
148
|
+
return;
|
124
149
|
}
|
125
150
|
|
126
151
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
127
|
-
return await self.runLighthouseNavigation(url, {
|
128
|
-
config,
|
129
|
-
page: puppeteerConnection.page,
|
130
|
-
});
|
152
|
+
return await self.runLighthouseNavigation(url, {config, page});
|
131
153
|
} catch (err) {
|
132
154
|
return ({
|
133
155
|
fatal: true,
|
@@ -135,7 +157,10 @@ async function start(method: string, params: any): Promise<unknown> {
|
|
135
157
|
stack: err.stack,
|
136
158
|
});
|
137
159
|
} finally {
|
138
|
-
|
160
|
+
// endTimespan will need to use the same connection as startTimespan.
|
161
|
+
if (action !== 'startTimespan') {
|
162
|
+
puppeteerConnection?.browser.disconnect();
|
163
|
+
}
|
139
164
|
}
|
140
165
|
}
|
141
166
|
|
@@ -176,34 +201,42 @@ async function fetchLocaleData(locales: string[]): Promise<string|void> {
|
|
176
201
|
return;
|
177
202
|
}
|
178
203
|
|
204
|
+
/**
|
205
|
+
* `notifyFrontendViaWorkerMessage` and `onFrontendMessage` work with the FE's ProtocolService.
|
206
|
+
*
|
207
|
+
* onFrontendMessage takes action-wrapped messages and either invoking lighthouse or delivering it CDP traffic.
|
208
|
+
* notifyFrontendViaWorkerMessage posts action-wrapped messages to the FE.
|
209
|
+
*/
|
179
210
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
180
|
-
function notifyFrontendViaWorkerMessage(
|
181
|
-
self.postMessage(JSON.stringify({
|
211
|
+
function notifyFrontendViaWorkerMessage(action: string, args: any): void {
|
212
|
+
self.postMessage(JSON.stringify({action, args}));
|
182
213
|
}
|
183
214
|
|
184
|
-
|
215
|
+
async function onFrontendMessage(event: MessageEvent): Promise<void> {
|
185
216
|
const messageFromFrontend = JSON.parse(event.data);
|
186
|
-
switch (messageFromFrontend.
|
187
|
-
case '
|
188
|
-
case '
|
217
|
+
switch (messageFromFrontend.action) {
|
218
|
+
case 'startTimespan':
|
219
|
+
case 'endTimespan':
|
189
220
|
case 'snapshot':
|
190
|
-
case '
|
191
|
-
const result = await
|
221
|
+
case 'navigation': {
|
222
|
+
const result = await invokeLH(messageFromFrontend.action, messageFromFrontend.args);
|
192
223
|
self.postMessage(JSON.stringify({id: messageFromFrontend.id, result}));
|
193
224
|
break;
|
194
225
|
}
|
195
226
|
case 'dispatchProtocolMessage': {
|
196
|
-
|
197
|
-
JSON.parse(messageFromFrontend.
|
227
|
+
cdpConnection?.onMessage?.(
|
228
|
+
JSON.parse(messageFromFrontend.args.message),
|
198
229
|
);
|
199
|
-
|
230
|
+
legacyPort.onMessage?.(messageFromFrontend.args.message);
|
200
231
|
break;
|
201
232
|
}
|
202
233
|
default: {
|
203
234
|
throw new Error(`Unknown event: ${event.data}`);
|
204
235
|
}
|
205
236
|
}
|
206
|
-
}
|
237
|
+
}
|
238
|
+
|
239
|
+
self.onmessage = onFrontendMessage;
|
207
240
|
|
208
241
|
// Make lighthouse and traceviewer happy.
|
209
242
|
// @ts-ignore https://github.com/GoogleChrome/lighthouse/issues/11628
|
@@ -2,7 +2,7 @@
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
|
-
import './
|
5
|
+
import './LighthouseWorkerService.js';
|
6
6
|
import '../../third_party/lighthouse/lighthouse-dt-bundle.js';
|
7
7
|
|
8
8
|
self.postMessage('workerReady');
|
@@ -31,6 +31,7 @@
|
|
31
31
|
import * as Common from '../../core/common/common.js';
|
32
32
|
import * as SDK from '../../core/sdk/sdk.js';
|
33
33
|
import type * as Protocol from '../../generated/protocol.js';
|
34
|
+
import type * as Platform from '../../core/platform/platform.js';
|
34
35
|
import * as Workspace from '../workspace/workspace.js';
|
35
36
|
|
36
37
|
import {ContentProviderBasedProject} from './ContentProviderBasedProject.js';
|
@@ -78,7 +79,7 @@ export class SASSSourceMapping implements SourceMapping {
|
|
78
79
|
for (const sourceURL of sourceMap.sourceURLs()) {
|
79
80
|
let binding = bindings.get(sourceURL);
|
80
81
|
if (!binding) {
|
81
|
-
binding = new Binding(project, sourceURL);
|
82
|
+
binding = new Binding(project, sourceURL as Platform.DevToolsPath.UrlString);
|
82
83
|
bindings.set(sourceURL, binding);
|
83
84
|
}
|
84
85
|
binding.addSourceMap(sourceMap, header.frameId);
|
@@ -163,11 +164,11 @@ const uiSourceCodeToBinding = new WeakMap<Workspace.UISourceCode.UISourceCode, B
|
|
163
164
|
|
164
165
|
class Binding {
|
165
166
|
readonly #project: ContentProviderBasedProject;
|
166
|
-
readonly #url:
|
167
|
+
readonly #url: Platform.DevToolsPath.UrlString;
|
167
168
|
referringSourceMaps: SDK.SourceMap.TextSourceMap[];
|
168
169
|
uiSourceCode: Workspace.UISourceCode.UISourceCode|null;
|
169
170
|
|
170
|
-
constructor(project: ContentProviderBasedProject, url:
|
171
|
+
constructor(project: ContentProviderBasedProject, url: Platform.DevToolsPath.UrlString) {
|
171
172
|
this.#project = project;
|
172
173
|
this.#url = url;
|
173
174
|
|
@@ -2,6 +2,8 @@
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
|
+
import type * as Platform from '../../core/platform/platform.js';
|
6
|
+
|
5
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
6
8
|
|
7
9
|
class HARBase {
|
@@ -197,7 +199,7 @@ export class HAREntry extends HARBase {
|
|
197
199
|
|
198
200
|
class HARRequest extends HARBase {
|
199
201
|
method: string;
|
200
|
-
url:
|
202
|
+
url: Platform.DevToolsPath.UrlString;
|
201
203
|
httpVersion: string;
|
202
204
|
cookies: HARCookie[];
|
203
205
|
headers: HARHeader[];
|
@@ -209,7 +211,7 @@ class HARRequest extends HARBase {
|
|
209
211
|
constructor(data: any) {
|
210
212
|
super(data);
|
211
213
|
this.method = String(data['method']);
|
212
|
-
this.url = String(data['url']);
|
214
|
+
this.url = String(data['url']) as Platform.DevToolsPath.UrlString;
|
213
215
|
this.httpVersion = String(data['httpVersion']);
|
214
216
|
this.cookies = Array.isArray(data['cookies']) ? data['cookies'].map(cookie => new HARCookie(cookie)) : [];
|
215
217
|
this.headers = Array.isArray(data['headers']) ? data['headers'].map(header => new HARHeader(header)) : [];
|
@@ -38,7 +38,6 @@ export class Importer {
|
|
38
38
|
lineNumber: initiatorEntry.lineNumber,
|
39
39
|
};
|
40
40
|
}
|
41
|
-
|
42
41
|
const request = SDK.NetworkRequest.NetworkRequest.createWithoutBackendRequest(
|
43
42
|
'har-' + requests.length, entry.request.url, documentURL, initiator);
|
44
43
|
const page = pageref ? pages.get(pageref) : undefined;
|