chrome-devtools-frontend 1.0.968254 → 1.0.970302
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 +64 -0
- package/front_end/core/i18n/locales/en-US.json +18 -0
- package/front_end/core/i18n/locales/en-XL.json +18 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +1 -1
- package/front_end/core/sdk/ChildTargetManager.ts +2 -2
- package/front_end/core/sdk/Connections.ts +6 -1
- package/front_end/core/sdk/NetworkManager.ts +4 -3
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +84 -13
- package/front_end/models/persistence/NetworkPersistenceManager.ts +205 -41
- package/front_end/models/timeline_model/TimelineFrameModel.ts +21 -7
- package/front_end/panels/animation/animationTimeline.css +0 -3
- package/front_end/panels/application/components/ReportsGrid.ts +19 -4
- package/front_end/panels/application/components/trustTokensViewDeleteButton.css +0 -1
- package/front_end/panels/console/consolePinPane.css +0 -17
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -1
- package/front_end/panels/elements/components/adornerSettingsPane.css +0 -1
- package/front_end/panels/elements/components/computedStyleTrace.css +1 -1
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +0 -1
- package/front_end/panels/elements/computedStyleWidgetTree.css +2 -2
- package/front_end/panels/elements/elementsTreeOutline.css +0 -2
- package/front_end/panels/emulation/deviceModeView.css +0 -1
- package/front_end/panels/event_listeners/eventListenersView.css +0 -1
- package/front_end/panels/issues/components/hideIssuesMenu.css +0 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +25 -1
- package/front_end/panels/lighthouse/LighthouseProtocolService.ts +37 -5
- package/front_end/panels/lighthouse/LighthouseStartView.ts +1 -0
- package/front_end/panels/lighthouse/LighthouseStatusView.ts +5 -5
- package/front_end/panels/media/playerListView.css +0 -1
- package/front_end/panels/network/networkLogView.css +0 -4
- package/front_end/panels/network/requestPayloadTree.css +0 -2
- package/front_end/panels/network/signedExchangeInfoTree.css +0 -1
- package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -4
- package/front_end/panels/settings/emulation/devicesSettingsTab.css +0 -1
- package/front_end/panels/sources/CSSPlugin.ts +2 -0
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +31 -0
- package/front_end/panels/sources/SourceMapNamesResolver.ts +15 -9
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -1
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +75 -3
- package/front_end/panels/webauthn/webauthnPane.css +0 -12
- package/front_end/services/puppeteer/PuppeteerConnection.ts +107 -0
- package/front_end/services/puppeteer/puppeteer.ts +9 -0
- package/front_end/third_party/codemirror/package/addon/fold/foldgutter.css +1 -5
- package/front_end/third_party/codemirror.next/README.chromium +10 -0
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +2 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +2 -2
- package/front_end/third_party/codemirror.next/chunk/python.js +2 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +574 -553
- package/front_end/third_party/codemirror.next/package.json +11 -11
- package/front_end/ui/components/adorners/adorner.css +0 -4
- package/front_end/ui/components/buttons/button.css +0 -4
- package/front_end/ui/components/data_grid/dataGrid.css +0 -4
- package/front_end/ui/components/icon_button/iconButton.css +0 -1
- package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
- package/front_end/ui/legacy/TabbedPane.ts +1 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -2
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +4 -2
- package/front_end/ui/legacy/tabbedPane.css +0 -4
- package/front_end/ui/legacy/textButton.css +0 -1
- package/front_end/ui/legacy/toolbar.css +0 -1
- package/package.json +2 -2
- package/scripts/build/devtools_plugin.js +32 -1
- package/scripts/build/esbuild.js +1 -24
- package/scripts/build/tests/plugins_test.js +60 -1
- package/scripts/hosted_mode/server.js +5 -0
@@ -447,6 +447,7 @@ grd_files_release_sources = [
|
|
447
447
|
"front_end/panels/web_audio/web_audio.js",
|
448
448
|
"front_end/panels/webauthn/webauthn-meta.js",
|
449
449
|
"front_end/panels/webauthn/webauthn.js",
|
450
|
+
"front_end/services/puppeteer/puppeteer.js",
|
450
451
|
"front_end/services/window_bounds/window_bounds.js",
|
451
452
|
"front_end/third_party/acorn-loose/acorn-loose.js",
|
452
453
|
"front_end/third_party/acorn/acorn.js",
|
@@ -470,6 +471,7 @@ grd_files_release_sources = [
|
|
470
471
|
"front_end/third_party/lighthouse/report/report.js",
|
471
472
|
"front_end/third_party/lit-html/lit-html.js",
|
472
473
|
"front_end/third_party/marked/marked.js",
|
474
|
+
"front_end/third_party/puppeteer/puppeteer.js",
|
473
475
|
"front_end/third_party/wasmparser/wasmparser.js",
|
474
476
|
"front_end/ui/components/adorners/adorners.js",
|
475
477
|
"front_end/ui/components/buttons/buttons.js",
|
@@ -1278,6 +1280,7 @@ grd_files_debug_sources = [
|
|
1278
1280
|
"front_end/panels/web_audio/webAudio.css.js",
|
1279
1281
|
"front_end/panels/webauthn/WebauthnPane.js",
|
1280
1282
|
"front_end/panels/webauthn/webauthnPane.css.js",
|
1283
|
+
"front_end/services/puppeteer/PuppeteerConnection.js",
|
1281
1284
|
"front_end/services/window_bounds/WindowBoundsService.js",
|
1282
1285
|
"front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs",
|
1283
1286
|
"front_end/third_party/acorn/package/dist/acorn.mjs",
|
@@ -1318,6 +1321,67 @@ grd_files_debug_sources = [
|
|
1318
1321
|
"front_end/third_party/lit-html/package/lib/template.js",
|
1319
1322
|
"front_end/third_party/lit-html/package/lit-html.js",
|
1320
1323
|
"front_end/third_party/marked/package/lib/marked.esm.js",
|
1324
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js",
|
1325
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js",
|
1326
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js",
|
1327
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js",
|
1328
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js",
|
1329
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js",
|
1330
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js",
|
1331
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.js",
|
1332
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js",
|
1333
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js",
|
1334
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js",
|
1335
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js",
|
1336
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js",
|
1337
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.js",
|
1338
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.js",
|
1339
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js",
|
1340
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.js",
|
1341
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js",
|
1342
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.js",
|
1343
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.js",
|
1344
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.js",
|
1345
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js",
|
1346
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js",
|
1347
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js",
|
1348
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js",
|
1349
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js",
|
1350
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js",
|
1351
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.js",
|
1352
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js",
|
1353
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js",
|
1354
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js",
|
1355
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Product.js",
|
1356
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js",
|
1357
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PuppeteerViewport.js",
|
1358
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js",
|
1359
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.js",
|
1360
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.js",
|
1361
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TaskQueue.js",
|
1362
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js",
|
1363
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js",
|
1364
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js",
|
1365
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js",
|
1366
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js",
|
1367
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js",
|
1368
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js",
|
1369
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js",
|
1370
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js",
|
1371
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js",
|
1372
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js",
|
1373
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js",
|
1374
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js",
|
1375
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js",
|
1376
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.js",
|
1377
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js",
|
1378
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js",
|
1379
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js",
|
1380
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js",
|
1381
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js",
|
1382
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js",
|
1383
|
+
"front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js",
|
1384
|
+
"front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js",
|
1321
1385
|
"front_end/third_party/wasmparser/package/dist/esm/WasmDis.js",
|
1322
1386
|
"front_end/third_party/wasmparser/package/dist/esm/WasmParser.js",
|
1323
1387
|
"front_end/ui/components/adorners/Adorner.js",
|
@@ -3029,9 +3029,18 @@
|
|
3029
3029
|
"panels/application/components/PermissionsPolicySection.ts | showDetails": {
|
3030
3030
|
"message": "Show details"
|
3031
3031
|
},
|
3032
|
+
"panels/application/components/ReportsGrid.ts | destination": {
|
3033
|
+
"message": "Destination"
|
3034
|
+
},
|
3035
|
+
"panels/application/components/ReportsGrid.ts | generatedAt": {
|
3036
|
+
"message": "Generated at"
|
3037
|
+
},
|
3032
3038
|
"panels/application/components/ReportsGrid.ts | noReportsToDisplay": {
|
3033
3039
|
"message": "No reports to display"
|
3034
3040
|
},
|
3041
|
+
"panels/application/components/ReportsGrid.ts | status": {
|
3042
|
+
"message": "Status"
|
3043
|
+
},
|
3035
3044
|
"panels/application/components/StackTrace.ts | cannotRenderStackTrace": {
|
3036
3045
|
"message": "Cannot render stack trace"
|
3037
3046
|
},
|
@@ -5756,6 +5765,9 @@
|
|
5756
5765
|
"panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
|
5757
5766
|
"message": "Is this page usable by people with disabilities or impairments"
|
5758
5767
|
},
|
5768
|
+
"panels/lighthouse/LighthouseController.ts | legacyNavigation": {
|
5769
|
+
"message": "Legacy navigation"
|
5770
|
+
},
|
5759
5771
|
"panels/lighthouse/LighthouseController.ts | localStorage": {
|
5760
5772
|
"message": "Local Storage"
|
5761
5773
|
},
|
@@ -5792,6 +5804,9 @@
|
|
5792
5804
|
"panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
|
5793
5805
|
"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."
|
5794
5806
|
},
|
5807
|
+
"panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
|
5808
|
+
"message": "Audit the page using classic Lighthouse when in navigation mode."
|
5809
|
+
},
|
5795
5810
|
"panels/lighthouse/LighthouseController.ts | webSql": {
|
5796
5811
|
"message": "Web SQL"
|
5797
5812
|
},
|
@@ -10139,6 +10154,9 @@
|
|
10139
10154
|
"panels/timeline/TimelineFlameChartDataProvider.ts | onIgnoreList": {
|
10140
10155
|
"message": "On ignore list"
|
10141
10156
|
},
|
10157
|
+
"panels/timeline/TimelineFlameChartDataProvider.ts | partiallyPresentedFrame": {
|
10158
|
+
"message": "Partially Presented Frame"
|
10159
|
+
},
|
10142
10160
|
"panels/timeline/TimelineFlameChartDataProvider.ts | raster": {
|
10143
10161
|
"message": "Raster"
|
10144
10162
|
},
|
@@ -3029,9 +3029,18 @@
|
|
3029
3029
|
"panels/application/components/PermissionsPolicySection.ts | showDetails": {
|
3030
3030
|
"message": "Ŝh́ôẃ d̂ét̂áîĺŝ"
|
3031
3031
|
},
|
3032
|
+
"panels/application/components/ReportsGrid.ts | destination": {
|
3033
|
+
"message": "D̂éŝt́îńât́îón̂"
|
3034
|
+
},
|
3035
|
+
"panels/application/components/ReportsGrid.ts | generatedAt": {
|
3036
|
+
"message": "Ĝén̂ér̂át̂éd̂ át̂"
|
3037
|
+
},
|
3032
3038
|
"panels/application/components/ReportsGrid.ts | noReportsToDisplay": {
|
3033
3039
|
"message": "N̂ó r̂ép̂ór̂t́ŝ t́ô d́îśp̂ĺâý"
|
3034
3040
|
},
|
3041
|
+
"panels/application/components/ReportsGrid.ts | status": {
|
3042
|
+
"message": "Ŝt́ât́ûś"
|
3043
|
+
},
|
3035
3044
|
"panels/application/components/StackTrace.ts | cannotRenderStackTrace": {
|
3036
3045
|
"message": "Ĉán̂ńôt́ r̂én̂d́êŕ ŝt́âćk̂ t́r̂áĉé"
|
3037
3046
|
},
|
@@ -5756,6 +5765,9 @@
|
|
5756
5765
|
"panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
|
5757
5766
|
"message": "Îś t̂h́îś p̂áĝé ûśâb́l̂é b̂ý p̂éôṕl̂é ŵít̂h́ d̂íŝáb̂íl̂ít̂íêś ôŕ îḿp̂áîŕm̂én̂t́ŝ"
|
5758
5767
|
},
|
5768
|
+
"panels/lighthouse/LighthouseController.ts | legacyNavigation": {
|
5769
|
+
"message": "L̂éĝáĉý n̂áv̂íĝát̂íôń"
|
5770
|
+
},
|
5759
5771
|
"panels/lighthouse/LighthouseController.ts | localStorage": {
|
5760
5772
|
"message": "L̂óĉál̂ Śt̂ór̂áĝé"
|
5761
5773
|
},
|
@@ -5792,6 +5804,9 @@
|
|
5792
5804
|
"panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
|
5793
5805
|
"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̂éŝ."
|
5794
5806
|
},
|
5807
|
+
"panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
|
5808
|
+
"message": "Âúd̂ít̂ t́ĥé p̂áĝé ûśîńĝ ćl̂áŝśîć L̂íĝh́t̂h́ôúŝé ŵh́êń îń n̂áv̂íĝát̂íôń m̂ód̂é."
|
5809
|
+
},
|
5795
5810
|
"panels/lighthouse/LighthouseController.ts | webSql": {
|
5796
5811
|
"message": "Ŵéb̂ ŚQ̂Ĺ"
|
5797
5812
|
},
|
@@ -10139,6 +10154,9 @@
|
|
10139
10154
|
"panels/timeline/TimelineFlameChartDataProvider.ts | onIgnoreList": {
|
10140
10155
|
"message": "Ôń îǵn̂ór̂é l̂íŝt́"
|
10141
10156
|
},
|
10157
|
+
"panels/timeline/TimelineFlameChartDataProvider.ts | partiallyPresentedFrame": {
|
10158
|
+
"message": "P̂ár̂t́îál̂ĺŷ Ṕr̂éŝén̂t́êd́ F̂ŕâḿê"
|
10159
|
+
},
|
10142
10160
|
"panels/timeline/TimelineFlameChartDataProvider.ts | raster": {
|
10143
10161
|
"message": "R̂áŝt́êŕ"
|
10144
10162
|
},
|
@@ -273,7 +273,7 @@ export class CSSMatchedStyles {
|
|
273
273
|
async recomputeMatchingSelectors(rule: CSSStyleRule): Promise<void> {
|
274
274
|
const node = this.nodeForStyle(rule.style);
|
275
275
|
if (!node) {
|
276
|
-
return
|
276
|
+
return;
|
277
277
|
}
|
278
278
|
const promises = [];
|
279
279
|
for (const selector of rule.selectors) {
|
@@ -171,7 +171,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
171
171
|
}
|
172
172
|
|
173
173
|
async createParallelConnection(onMessage: (arg0: (Object|string)) => void):
|
174
|
-
Promise<ProtocolClient.InspectorBackend.Connection> {
|
174
|
+
Promise<{connection: ProtocolClient.InspectorBackend.Connection, sessionId: string}> {
|
175
175
|
// The main Target id is actually just `main`, instead of the real targetId.
|
176
176
|
// Get the real id (requires an async operation) so that it can be used synchronously later.
|
177
177
|
const targetId = await this.getParentTargetId();
|
@@ -179,7 +179,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
179
179
|
await this.createParallelConnectionAndSessionForTarget(this.#parentTarget, targetId);
|
180
180
|
connection.setOnMessage(onMessage);
|
181
181
|
this.#parallelConnections.set(sessionId, connection);
|
182
|
-
return connection;
|
182
|
+
return {connection, sessionId};
|
183
183
|
}
|
184
184
|
|
185
185
|
private async createParallelConnectionAndSessionForTarget(target: Target, targetId: Protocol.Target.TargetID):
|
@@ -213,7 +213,12 @@ export class StubConnection implements ProtocolClient.InspectorBackend.Connectio
|
|
213
213
|
}
|
214
214
|
}
|
215
215
|
|
216
|
-
export
|
216
|
+
export interface ParallelConnectionInterface extends ProtocolClient.InspectorBackend.Connection {
|
217
|
+
getSessionId: () => string;
|
218
|
+
getOnDisconnect: () => ((arg0: string) => void) | null;
|
219
|
+
}
|
220
|
+
|
221
|
+
export class ParallelConnection implements ParallelConnectionInterface {
|
217
222
|
readonly #connection: ProtocolClient.InspectorBackend.Connection;
|
218
223
|
#sessionId: string;
|
219
224
|
onMessage: ((arg0: Object) => void)|null;
|
@@ -1508,11 +1508,12 @@ export class InterceptedRequest {
|
|
1508
1508
|
return this.#hasRespondedInternal;
|
1509
1509
|
}
|
1510
1510
|
|
1511
|
-
async continueRequestWithContent(contentBlob: Blob
|
1511
|
+
async continueRequestWithContent(contentBlob: Blob, encoded: boolean, responseHeaders: Protocol.Fetch.HeaderEntry[]):
|
1512
|
+
Promise<void> {
|
1512
1513
|
this.#hasRespondedInternal = true;
|
1513
|
-
const body = await blobToBase64(contentBlob);
|
1514
|
+
const body = encoded ? await contentBlob.text() : await blobToBase64(contentBlob);
|
1514
1515
|
void this.#fetchAgent.invoke_fulfillRequest(
|
1515
|
-
{requestId: this.requestId, responseCode: this.responseStatusCode || 200, body});
|
1516
|
+
{requestId: this.requestId, responseCode: this.responseStatusCode || 200, body, responseHeaders});
|
1516
1517
|
|
1517
1518
|
async function blobToBase64(blob: Blob): Promise<string> {
|
1518
1519
|
const reader = new FileReader();
|
@@ -3,6 +3,8 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import * as Root from '../../core/root/root.js';
|
6
|
+
import * as Puppeteer from '../../services/puppeteer/puppeteer.js';
|
7
|
+
import type * as SDK from '../../core/sdk/sdk.js';
|
6
8
|
|
7
9
|
function disableLoggingForTest(): void {
|
8
10
|
console.log = (): void => undefined; // eslint-disable-line no-console
|
@@ -33,10 +35,49 @@ class LighthousePort {
|
|
33
35
|
}
|
34
36
|
}
|
35
37
|
|
38
|
+
class ConnectionProxy implements SDK.Connections.ParallelConnectionInterface {
|
39
|
+
sessionId: string;
|
40
|
+
onMessage: ((arg0: Object) => void)|null;
|
41
|
+
onDisconnect: ((arg0: string) => void)|null;
|
42
|
+
|
43
|
+
constructor(sessionId: string) {
|
44
|
+
this.sessionId = sessionId;
|
45
|
+
this.onMessage = null;
|
46
|
+
this.onDisconnect = null;
|
47
|
+
}
|
48
|
+
|
49
|
+
setOnMessage(onMessage: (arg0: (Object|string)) => void): void {
|
50
|
+
this.onMessage = onMessage;
|
51
|
+
}
|
52
|
+
|
53
|
+
setOnDisconnect(onDisconnect: (arg0: string) => void): void {
|
54
|
+
this.onDisconnect = onDisconnect;
|
55
|
+
}
|
56
|
+
|
57
|
+
getOnDisconnect(): (((arg0: string) => void)|null) {
|
58
|
+
return this.onDisconnect;
|
59
|
+
}
|
60
|
+
|
61
|
+
getSessionId(): string {
|
62
|
+
return this.sessionId;
|
63
|
+
}
|
64
|
+
|
65
|
+
sendRawMessage(message: string): void {
|
66
|
+
notifyFrontendViaWorkerMessage('sendProtocolMessage', {message});
|
67
|
+
}
|
68
|
+
|
69
|
+
async disconnect(): Promise<void> {
|
70
|
+
this.onDisconnect?.('force disconnect');
|
71
|
+
this.onDisconnect = null;
|
72
|
+
this.onMessage = null;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
36
76
|
const port = new LighthousePort();
|
77
|
+
let rawConnection: ConnectionProxy|undefined;
|
37
78
|
|
38
79
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
39
|
-
async function start(params: any): Promise<unknown> {
|
80
|
+
async function start(method: string, params: any): Promise<unknown> {
|
40
81
|
if (Root.Runtime.Runtime.queryParam('isUnderTest')) {
|
41
82
|
disableLoggingForTest();
|
42
83
|
params.flags.maxWaitForLoad = 2 * 1000;
|
@@ -47,6 +88,9 @@ async function start(params: any): Promise<unknown> {
|
|
47
88
|
notifyFrontendViaWorkerMessage('statusUpdate', {message: message[1]});
|
48
89
|
});
|
49
90
|
|
91
|
+
let puppeteerConnection: Awaited<ReturnType<typeof Puppeteer.PuppeteerConnection['getPuppeteerConnection']>>|
|
92
|
+
undefined;
|
93
|
+
|
50
94
|
try {
|
51
95
|
const locale = await fetchLocaleData(params.locales);
|
52
96
|
const flags = params.flags;
|
@@ -54,20 +98,39 @@ async function start(params: any): Promise<unknown> {
|
|
54
98
|
flags.channel = 'devtools';
|
55
99
|
flags.locale = locale;
|
56
100
|
|
57
|
-
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
58
|
-
const connection = self.setUpWorkerConnection(port);
|
59
101
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
60
102
|
const config = self.createConfig(params.categoryIDs, flags.emulatedFormFactor);
|
61
103
|
const url = params.url;
|
62
104
|
|
105
|
+
// Handle legacy Lighthouse runner path.
|
106
|
+
if (method === 'start') {
|
107
|
+
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
108
|
+
const connection = self.setUpWorkerConnection(port);
|
109
|
+
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
110
|
+
return await self.runLighthouse(url, flags, config, connection);
|
111
|
+
}
|
112
|
+
|
113
|
+
const {mainTargetId, mainFrameId, mainSessionId} = params.target;
|
114
|
+
rawConnection = new ConnectionProxy(mainSessionId);
|
115
|
+
puppeteerConnection =
|
116
|
+
await Puppeteer.PuppeteerConnection.getPuppeteerConnection(rawConnection, mainFrameId, mainTargetId);
|
117
|
+
|
63
118
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
64
|
-
|
119
|
+
const result = await self.runLighthouseNavigation({
|
120
|
+
url,
|
121
|
+
config,
|
122
|
+
page: puppeteerConnection.page,
|
123
|
+
});
|
124
|
+
|
125
|
+
return result;
|
65
126
|
} catch (err) {
|
66
127
|
return ({
|
67
128
|
fatal: true,
|
68
129
|
message: err.message,
|
69
130
|
stack: err.stack,
|
70
131
|
});
|
132
|
+
} finally {
|
133
|
+
puppeteerConnection?.browser.disconnect();
|
71
134
|
}
|
72
135
|
}
|
73
136
|
|
@@ -115,20 +178,28 @@ function notifyFrontendViaWorkerMessage(method: string, params: any): void {
|
|
115
178
|
|
116
179
|
self.onmessage = async(event: MessageEvent): Promise<void> => {
|
117
180
|
const messageFromFrontend = JSON.parse(event.data);
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
181
|
+
switch (messageFromFrontend.method) {
|
182
|
+
case 'navigate':
|
183
|
+
case 'start': {
|
184
|
+
const result = await start(messageFromFrontend.method, messageFromFrontend.params);
|
185
|
+
self.postMessage(JSON.stringify({id: messageFromFrontend.id, result}));
|
186
|
+
break;
|
187
|
+
}
|
188
|
+
case 'dispatchProtocolMessage': {
|
189
|
+
rawConnection?.onMessage?.(
|
190
|
+
JSON.parse(messageFromFrontend.params.message),
|
191
|
+
);
|
192
|
+
port.onMessage?.(messageFromFrontend.params.message);
|
193
|
+
break;
|
194
|
+
}
|
195
|
+
default: {
|
196
|
+
throw new Error(`Unknown event: ${event.data}`);
|
124
197
|
}
|
125
|
-
} else {
|
126
|
-
throw new Error(`Unknown event: ${event.data}`);
|
127
198
|
}
|
128
199
|
};
|
129
200
|
|
130
201
|
// Make lighthouse and traceviewer happy.
|
131
|
-
// @ts-
|
202
|
+
// @ts-ignore https://github.com/GoogleChrome/lighthouse/issues/11628
|
132
203
|
globalThis.global = self;
|
133
204
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
134
205
|
globalThis.global.isVinn = true;
|