chrome-devtools-frontend 1.0.969345 → 1.0.970539

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.
Files changed (60) hide show
  1. package/config/gni/devtools_grd_files.gni +64 -0
  2. package/front_end/core/common/ParsedURL.ts +25 -2
  3. package/front_end/core/i18n/locales/en-US.json +18 -3
  4. package/front_end/core/i18n/locales/en-XL.json +18 -3
  5. package/front_end/core/sdk/ChildTargetManager.ts +2 -2
  6. package/front_end/core/sdk/Connections.ts +6 -1
  7. package/front_end/core/sdk/DebuggerModel.ts +4 -0
  8. package/front_end/core/sdk/NetworkManager.ts +4 -3
  9. package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +84 -13
  10. package/front_end/models/persistence/Automapping.ts +2 -32
  11. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +9 -7
  12. package/front_end/models/persistence/IsolatedFileSystem.ts +20 -14
  13. package/front_end/models/persistence/NetworkPersistenceManager.ts +213 -45
  14. package/front_end/models/persistence/PlatformFileSystem.ts +3 -2
  15. package/front_end/models/timeline_model/TimelineFrameModel.ts +21 -7
  16. package/front_end/models/workspace/UISourceCode.ts +11 -14
  17. package/front_end/models/workspace/WorkspaceImpl.ts +5 -1
  18. package/front_end/panels/animation/animationTimeline.css +0 -3
  19. package/front_end/panels/application/components/ReportsGrid.ts +19 -4
  20. package/front_end/panels/application/components/trustTokensViewDeleteButton.css +0 -1
  21. package/front_end/panels/console/consolePinPane.css +0 -17
  22. package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -1
  23. package/front_end/panels/elements/components/adornerSettingsPane.css +0 -1
  24. package/front_end/panels/elements/components/computedStyleTrace.css +1 -1
  25. package/front_end/panels/elements/components/elementsBreadcrumbs.css +0 -1
  26. package/front_end/panels/elements/computedStyleWidgetTree.css +2 -2
  27. package/front_end/panels/elements/elementsTreeOutline.css +0 -2
  28. package/front_end/panels/emulation/deviceModeView.css +0 -1
  29. package/front_end/panels/event_listeners/eventListenersView.css +0 -1
  30. package/front_end/panels/issues/components/hideIssuesMenu.css +0 -1
  31. package/front_end/panels/lighthouse/LighthouseController.ts +25 -1
  32. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +37 -5
  33. package/front_end/panels/lighthouse/LighthouseStartView.ts +1 -0
  34. package/front_end/panels/lighthouse/LighthouseStatusView.ts +5 -5
  35. package/front_end/panels/media/playerListView.css +0 -1
  36. package/front_end/panels/network/networkLogView.css +0 -4
  37. package/front_end/panels/network/requestPayloadTree.css +0 -2
  38. package/front_end/panels/network/signedExchangeInfoTree.css +0 -1
  39. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -4
  40. package/front_end/panels/settings/emulation/devicesSettingsTab.css +0 -1
  41. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +4 -4
  42. package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
  43. package/front_end/panels/sources/TabbedEditorContainer.ts +9 -0
  44. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -1
  45. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +75 -3
  46. package/front_end/panels/webauthn/webauthnPane.css +0 -12
  47. package/front_end/services/puppeteer/PuppeteerConnection.ts +107 -0
  48. package/front_end/services/puppeteer/puppeteer.ts +9 -0
  49. package/front_end/third_party/codemirror/package/addon/fold/foldgutter.css +1 -5
  50. package/front_end/ui/components/adorners/adorner.css +0 -4
  51. package/front_end/ui/components/buttons/button.css +0 -4
  52. package/front_end/ui/components/data_grid/dataGrid.css +0 -4
  53. package/front_end/ui/components/icon_button/iconButton.css +0 -1
  54. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +2 -2
  55. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  56. package/front_end/ui/legacy/tabbedPane.css +0 -4
  57. package/front_end/ui/legacy/textButton.css +0 -1
  58. package/front_end/ui/legacy/toolbar.css +0 -1
  59. package/package.json +2 -2
  60. 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",
@@ -162,6 +162,22 @@ export class ParsedURL {
162
162
  return new URL('/' + partiallyEncoded, 'file:///').pathname.substr(1) as Platform.DevToolsPath.EncodedPathString;
163
163
  }
164
164
 
165
+ /**
166
+ * @param name Must not be encoded
167
+ */
168
+ static encodedFromParentPathAndName(parentPath: Platform.DevToolsPath.EncodedPathString, name: string):
169
+ Platform.DevToolsPath.EncodedPathString {
170
+ return parentPath + '/' + encodeURIComponent(name) as Platform.DevToolsPath.EncodedPathString;
171
+ }
172
+
173
+ /**
174
+ * @param name Must not be encoded
175
+ */
176
+ static urlFromParentUrlAndName(parentUrl: Platform.DevToolsPath.UrlString, name: string):
177
+ Platform.DevToolsPath.UrlString {
178
+ return parentUrl + '/' + encodeURIComponent(name) as Platform.DevToolsPath.UrlString;
179
+ }
180
+
165
181
  static encodedPathToRawPathString(encPath: Platform.DevToolsPath.EncodedPathString):
166
182
  Platform.DevToolsPath.RawPathString {
167
183
  return decodeURIComponent(encPath) as Platform.DevToolsPath.RawPathString;
@@ -181,8 +197,9 @@ export class ParsedURL {
181
197
  return new URL(preEncodedPath).toString() as Platform.DevToolsPath.UrlString;
182
198
  }
183
199
 
184
- static relativePathToUrlString(relativePath: string, baseURL: Platform.DevToolsPath.UrlString):
185
- Platform.DevToolsPath.UrlString {
200
+ static relativePathToUrlString(
201
+ relativePath: Platform.DevToolsPath.RawPathString,
202
+ baseURL: Platform.DevToolsPath.UrlString): Platform.DevToolsPath.UrlString {
186
203
  const preEncodedPath: string = ParsedURL.preEncodeSpecialCharactersInPath(
187
204
  relativePath.replace(/\\/g, '/') as Platform.DevToolsPath.RawPathString);
188
205
  return new URL(preEncodedPath, baseURL).toString() as Platform.DevToolsPath.UrlString;
@@ -198,6 +215,12 @@ export class ParsedURL {
198
215
  return decodedFileURL.substr('file://'.length) as Platform.DevToolsPath.RawPathString;
199
216
  }
200
217
 
218
+ static substr<DevToolsPathType extends Platform.DevToolsPath.UrlString|Platform.DevToolsPath.RawPathString|
219
+ Platform.DevToolsPath.EncodedPathString>(
220
+ devToolsPath: DevToolsPathType, from: number, length?: number): DevToolsPathType {
221
+ return devToolsPath.substr(from, length) as typeof devToolsPath;
222
+ }
223
+
201
224
  static urlWithoutHash(url: string): string {
202
225
  const hashIndex = url.indexOf('#');
203
226
  if (hashIndex !== -1) {
@@ -1421,9 +1421,6 @@
1421
1421
  "models/logs/NetworkLog.ts | anonymous": {
1422
1422
  "message": "<anonymous>"
1423
1423
  },
1424
- "models/persistence/Automapping.ts | theAttemptToBindSInTheWorkspace": {
1425
- "message": "The attempt to bind \"{PH1}\" in the workspace failed as this URI is malformed."
1426
- },
1427
1424
  "models/persistence/EditFileSystemView.ts | add": {
1428
1425
  "message": "Add"
1429
1426
  },
@@ -3029,9 +3026,18 @@
3029
3026
  "panels/application/components/PermissionsPolicySection.ts | showDetails": {
3030
3027
  "message": "Show details"
3031
3028
  },
3029
+ "panels/application/components/ReportsGrid.ts | destination": {
3030
+ "message": "Destination"
3031
+ },
3032
+ "panels/application/components/ReportsGrid.ts | generatedAt": {
3033
+ "message": "Generated at"
3034
+ },
3032
3035
  "panels/application/components/ReportsGrid.ts | noReportsToDisplay": {
3033
3036
  "message": "No reports to display"
3034
3037
  },
3038
+ "panels/application/components/ReportsGrid.ts | status": {
3039
+ "message": "Status"
3040
+ },
3035
3041
  "panels/application/components/StackTrace.ts | cannotRenderStackTrace": {
3036
3042
  "message": "Cannot render stack trace"
3037
3043
  },
@@ -5756,6 +5762,9 @@
5756
5762
  "panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
5757
5763
  "message": "Is this page usable by people with disabilities or impairments"
5758
5764
  },
5765
+ "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5766
+ "message": "Legacy navigation"
5767
+ },
5759
5768
  "panels/lighthouse/LighthouseController.ts | localStorage": {
5760
5769
  "message": "Local Storage"
5761
5770
  },
@@ -5792,6 +5801,9 @@
5792
5801
  "panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
5793
5802
  "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
5803
  },
5804
+ "panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
5805
+ "message": "Audit the page using classic Lighthouse when in navigation mode."
5806
+ },
5795
5807
  "panels/lighthouse/LighthouseController.ts | webSql": {
5796
5808
  "message": "Web SQL"
5797
5809
  },
@@ -10139,6 +10151,9 @@
10139
10151
  "panels/timeline/TimelineFlameChartDataProvider.ts | onIgnoreList": {
10140
10152
  "message": "On ignore list"
10141
10153
  },
10154
+ "panels/timeline/TimelineFlameChartDataProvider.ts | partiallyPresentedFrame": {
10155
+ "message": "Partially Presented Frame"
10156
+ },
10142
10157
  "panels/timeline/TimelineFlameChartDataProvider.ts | raster": {
10143
10158
  "message": "Raster"
10144
10159
  },
@@ -1421,9 +1421,6 @@
1421
1421
  "models/logs/NetworkLog.ts | anonymous": {
1422
1422
  "message": "<âńôńŷḿôúŝ>"
1423
1423
  },
1424
- "models/persistence/Automapping.ts | theAttemptToBindSInTheWorkspace": {
1425
- "message": "T̂h́ê át̂t́êḿp̂t́ t̂ó b̂ín̂d́ \"{PH1}\" îń t̂h́ê ẃôŕk̂śp̂áĉé f̂áîĺêd́ âś t̂h́îś ÛŔÎ íŝ ḿâĺf̂ór̂ḿêd́."
1426
- },
1427
1424
  "models/persistence/EditFileSystemView.ts | add": {
1428
1425
  "message": "Âd́d̂"
1429
1426
  },
@@ -3029,9 +3026,18 @@
3029
3026
  "panels/application/components/PermissionsPolicySection.ts | showDetails": {
3030
3027
  "message": "Ŝh́ôẃ d̂ét̂áîĺŝ"
3031
3028
  },
3029
+ "panels/application/components/ReportsGrid.ts | destination": {
3030
+ "message": "D̂éŝt́îńât́îón̂"
3031
+ },
3032
+ "panels/application/components/ReportsGrid.ts | generatedAt": {
3033
+ "message": "Ĝén̂ér̂át̂éd̂ át̂"
3034
+ },
3032
3035
  "panels/application/components/ReportsGrid.ts | noReportsToDisplay": {
3033
3036
  "message": "N̂ó r̂ép̂ór̂t́ŝ t́ô d́îśp̂ĺâý"
3034
3037
  },
3038
+ "panels/application/components/ReportsGrid.ts | status": {
3039
+ "message": "Ŝt́ât́ûś"
3040
+ },
3035
3041
  "panels/application/components/StackTrace.ts | cannotRenderStackTrace": {
3036
3042
  "message": "Ĉán̂ńôt́ r̂én̂d́êŕ ŝt́âćk̂ t́r̂áĉé"
3037
3043
  },
@@ -5756,6 +5762,9 @@
5756
5762
  "panels/lighthouse/LighthouseController.ts | isThisPageUsableByPeopleWith": {
5757
5763
  "message": "Îś t̂h́îś p̂áĝé ûśâb́l̂é b̂ý p̂éôṕl̂é ŵít̂h́ d̂íŝáb̂íl̂ít̂íêś ôŕ îḿp̂áîŕm̂én̂t́ŝ"
5758
5764
  },
5765
+ "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5766
+ "message": "L̂éĝáĉý n̂áv̂íĝát̂íôń"
5767
+ },
5759
5768
  "panels/lighthouse/LighthouseController.ts | localStorage": {
5760
5769
  "message": "L̂óĉál̂ Śt̂ór̂áĝé"
5761
5770
  },
@@ -5792,6 +5801,9 @@
5792
5801
  "panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingSingular": {
5793
5802
  "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
5803
  },
5804
+ "panels/lighthouse/LighthouseController.ts | useLegacyNavigation": {
5805
+ "message": "Âúd̂ít̂ t́ĥé p̂áĝé ûśîńĝ ćl̂áŝśîć L̂íĝh́t̂h́ôúŝé ŵh́êń îń n̂áv̂íĝát̂íôń m̂ód̂é."
5806
+ },
5795
5807
  "panels/lighthouse/LighthouseController.ts | webSql": {
5796
5808
  "message": "Ŵéb̂ ŚQ̂Ĺ"
5797
5809
  },
@@ -10139,6 +10151,9 @@
10139
10151
  "panels/timeline/TimelineFlameChartDataProvider.ts | onIgnoreList": {
10140
10152
  "message": "Ôń îǵn̂ór̂é l̂íŝt́"
10141
10153
  },
10154
+ "panels/timeline/TimelineFlameChartDataProvider.ts | partiallyPresentedFrame": {
10155
+ "message": "P̂ár̂t́îál̂ĺŷ Ṕr̂éŝén̂t́êd́ F̂ŕâḿê"
10156
+ },
10142
10157
  "panels/timeline/TimelineFlameChartDataProvider.ts | raster": {
10143
10158
  "message": "R̂áŝt́êŕ"
10144
10159
  },
@@ -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 class ParallelConnection implements ProtocolClient.InspectorBackend.Connection {
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;
@@ -428,6 +428,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
428
428
  Common.ParsedURL.ParsedURL.urlToRawPathString(url as Platform.DevToolsPath.UrlString, Host.Platform.isWin());
429
429
  urlRegex =
430
430
  `${Platform.StringUtilities.escapeForRegExp(platformPath)}|${Platform.StringUtilities.escapeForRegExp(url)}`;
431
+ if (Host.Platform.isWin() && platformPath.match(/^.:\\/)) {
432
+ // Match upper or lower case drive letter
433
+ urlRegex = `[${platformPath[0].toUpperCase()}${platformPath[0].toLowerCase()}]` + urlRegex.substr(1);
434
+ }
431
435
  }
432
436
  // Adjust column if needed.
433
437
  let minColumnNumber = 0;
@@ -1508,11 +1508,12 @@ export class InterceptedRequest {
1508
1508
  return this.#hasRespondedInternal;
1509
1509
  }
1510
1510
 
1511
- async continueRequestWithContent(contentBlob: Blob): Promise<void> {
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
- return await self.runLighthouse(url, flags, config, connection);
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
- if (messageFromFrontend.method === 'start') {
119
- const result = await start(messageFromFrontend.params);
120
- self.postMessage(JSON.stringify({id: messageFromFrontend.id, result}));
121
- } else if (messageFromFrontend.method === 'dispatchProtocolMessage') {
122
- if (port.onMessage) {
123
- port.onMessage(messageFromFrontend.params.message);
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-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
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;
@@ -4,7 +4,6 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
- import * as i18n from '../../core/i18n/i18n.js';
8
7
  import * as Platform from '../../core/platform/platform.js';
9
8
  import * as SDK from '../../core/sdk/sdk.js';
10
9
  import * as Bindings from '../bindings/bindings.js';
@@ -14,16 +13,6 @@ import type {FileSystem} from './FileSystemWorkspaceBinding.js';
14
13
  import {FileSystemWorkspaceBinding} from './FileSystemWorkspaceBinding.js';
15
14
  import {PathEncoder, PersistenceImpl} from './PersistenceImpl.js';
16
15
 
17
- const UIStrings = {
18
- /**
19
- *@description Error message when attempting to create a binding from a malformed URI.
20
- *@example {file://%E0%A4%A} PH1
21
- */
22
- theAttemptToBindSInTheWorkspace: 'The attempt to bind "{PH1}" in the workspace failed as this URI is malformed.',
23
- };
24
- const str_ = i18n.i18n.registerUIStrings('models/persistence/Automapping.ts', UIStrings);
25
- const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
26
-
27
16
  export class Automapping {
28
17
  private readonly workspace: Workspace.Workspace.WorkspaceImpl;
29
18
  private readonly onStatusAdded: (arg0: AutomappingStatus) => Promise<void>;
@@ -323,11 +312,7 @@ export class Automapping {
323
312
  private createBinding(networkSourceCode: Workspace.UISourceCode.UISourceCode): Promise<AutomappingStatus|null> {
324
313
  const url = networkSourceCode.url();
325
314
  if (url.startsWith('file://') || url.startsWith('snippet://')) {
326
- const decodedUrl = sanitizeSourceUrl(url);
327
- if (!decodedUrl) {
328
- return Promise.resolve(null as AutomappingStatus | null);
329
- }
330
- const fileSourceCode = this.fileSystemUISourceCodes.get(decodedUrl);
315
+ const fileSourceCode = this.fileSystemUISourceCodes.get(url);
331
316
  const status = fileSourceCode ? new AutomappingStatus(networkSourceCode, fileSourceCode, false) : null;
332
317
  return Promise.resolve(status);
333
318
  }
@@ -341,13 +326,8 @@ export class Automapping {
341
326
  networkPath += 'index.html';
342
327
  }
343
328
 
344
- const urlDecodedNetworkPath = sanitizeSourceUrl(networkPath);
345
- if (!urlDecodedNetworkPath) {
346
- return Promise.resolve(null as AutomappingStatus | null);
347
- }
348
-
349
329
  const similarFiles =
350
- this.filesIndex.similarFiles(urlDecodedNetworkPath).map(path => this.fileSystemUISourceCodes.get(path)) as
330
+ this.filesIndex.similarFiles(networkPath).map(path => this.fileSystemUISourceCodes.get(path)) as
351
331
  Workspace.UISourceCode.UISourceCode[];
352
332
  if (!similarFiles.length) {
353
333
  return Promise.resolve(null as AutomappingStatus | null);
@@ -355,16 +335,6 @@ export class Automapping {
355
335
 
356
336
  return this.pullMetadatas(similarFiles.concat(networkSourceCode)).then(onMetadatas.bind(this));
357
337
 
358
- function sanitizeSourceUrl(url: string): string|null {
359
- try {
360
- const decodedUrl = decodeURI(url);
361
- return decodedUrl;
362
- } catch (error) {
363
- Common.Console.Console.instance().error(i18nString(UIStrings.theAttemptToBindSInTheWorkspace, {PH1: url}));
364
- return null;
365
- }
366
- }
367
-
368
338
  function onMetadatas(this: Automapping): AutomappingStatus|null {
369
339
  const activeFiles =
370
340
  similarFiles.filter(
@@ -193,12 +193,14 @@ export class FileSystem extends Workspace.Workspace.ProjectStore {
193
193
  return this.fileSystemInternal.mimeFromPath(uiSourceCode.url());
194
194
  }
195
195
 
196
- initialGitFolders(): string[] {
197
- return this.fileSystemInternal.initialGitFolders().map(folder => this.fileSystemPathInternal + '/' + folder);
196
+ initialGitFolders(): Platform.DevToolsPath.EncodedPathString[] {
197
+ return this.fileSystemInternal.initialGitFolders().map(folder => this.fileSystemPathInternal + '/' + folder) as
198
+ Platform.DevToolsPath.EncodedPathString[];
198
199
  }
199
200
 
200
- private filePathForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): string {
201
- return uiSourceCode.url().substring(this.fileSystemPathInternal.length);
201
+ private filePathForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode):
202
+ Platform.DevToolsPath.EncodedPathString {
203
+ return uiSourceCode.url().substring(this.fileSystemPathInternal.length) as Platform.DevToolsPath.EncodedPathString;
202
204
  }
203
205
 
204
206
  isServiceProject(): boolean {
@@ -274,9 +276,9 @@ export class FileSystem extends Workspace.Workspace.ProjectStore {
274
276
  }
275
277
  console.assert(Boolean(newName));
276
278
  const slash = filePath.lastIndexOf('/');
277
- const parentPath = filePath.substring(0, slash);
278
- filePath = parentPath + '/' + newName;
279
- filePath = filePath.substr(1);
279
+ const parentPath = Common.ParsedURL.ParsedURL.substr(filePath, 0, slash);
280
+ filePath = Common.ParsedURL.ParsedURL.encodedFromParentPathAndName(parentPath, newName);
281
+ filePath = Common.ParsedURL.ParsedURL.substr(filePath, 1);
280
282
  const newURL = this.fileSystemBaseURL + filePath;
281
283
  const newContentType = this.fileSystemInternal.contentType(newName);
282
284
  this.renameUISourceCode(uiSourceCode, newName);