chrome-devtools-frontend 1.0.969882 → 1.0.971140

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 (70) hide show
  1. package/config/gni/devtools_grd_files.gni +3 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/ic_changes.svg +5 -0
  4. package/front_end/core/common/ParsedURL.ts +27 -4
  5. package/front_end/core/host/UserMetrics.ts +3 -1
  6. package/front_end/core/i18n/locales/en-US.json +21 -3
  7. package/front_end/core/i18n/locales/en-XL.json +21 -3
  8. package/front_end/core/platform/UserVisibleError.ts +28 -0
  9. package/front_end/core/platform/platform.ts +2 -0
  10. package/front_end/core/sdk/ChildTargetManager.ts +0 -1
  11. package/front_end/core/sdk/DebuggerModel.ts +4 -0
  12. package/front_end/core/sdk/NetworkManager.ts +15 -1
  13. package/front_end/core/sdk/NetworkRequest.ts +11 -0
  14. package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +15 -6
  15. package/front_end/entrypoints/main/MainImpl.ts +3 -0
  16. package/front_end/models/bindings/CSSWorkspaceBinding.ts +21 -0
  17. package/front_end/models/persistence/Automapping.ts +3 -33
  18. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +11 -9
  19. package/front_end/models/persistence/IsolatedFileSystem.ts +20 -14
  20. package/front_end/models/persistence/NetworkPersistenceManager.ts +8 -4
  21. package/front_end/models/persistence/PlatformFileSystem.ts +3 -2
  22. package/front_end/models/workspace/UISourceCode.ts +11 -14
  23. package/front_end/models/workspace/WorkspaceImpl.ts +5 -1
  24. package/front_end/panels/animation/animationTimeline.css +0 -3
  25. package/front_end/panels/application/components/trustTokensViewDeleteButton.css +0 -1
  26. package/front_end/panels/browser_debugger/categorizedBreakpointsSidebarPane.css +0 -1
  27. package/front_end/panels/console/consolePinPane.css +0 -17
  28. package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -1
  29. package/front_end/panels/elements/ElementsPanel.ts +25 -11
  30. package/front_end/panels/elements/StylesSidebarPane.ts +198 -23
  31. package/front_end/panels/elements/components/adornerSettingsPane.css +0 -1
  32. package/front_end/panels/elements/components/computedStyleTrace.css +1 -1
  33. package/front_end/panels/elements/components/elementsBreadcrumbs.css +0 -1
  34. package/front_end/panels/elements/computedStyleWidgetTree.css +2 -2
  35. package/front_end/panels/elements/elementsTreeOutline.css +0 -3
  36. package/front_end/panels/emulation/deviceModeView.css +0 -1
  37. package/front_end/panels/event_listeners/eventListenersView.css +0 -1
  38. package/front_end/panels/issues/components/hideIssuesMenu.css +0 -1
  39. package/front_end/panels/lighthouse/LighthouseController.ts +30 -0
  40. package/front_end/panels/lighthouse/LighthousePanel.ts +7 -1
  41. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +6 -1
  42. package/front_end/panels/lighthouse/LighthouseStartView.ts +2 -2
  43. package/front_end/panels/lighthouse/LighthouseStartViewFR.ts +39 -0
  44. package/front_end/panels/media/playerListView.css +0 -1
  45. package/front_end/panels/network/networkLogView.css +0 -4
  46. package/front_end/panels/network/requestPayloadTree.css +0 -2
  47. package/front_end/panels/network/signedExchangeInfoTree.css +0 -1
  48. package/front_end/panels/sensors/sensors.css +0 -1
  49. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -4
  50. package/front_end/panels/settings/emulation/devicesSettingsTab.css +0 -1
  51. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +4 -4
  52. package/front_end/panels/snippets/SnippetsQuickOpen.ts +1 -1
  53. package/front_end/panels/sources/NavigatorView.ts +9 -5
  54. package/front_end/panels/sources/TabbedEditorContainer.ts +9 -0
  55. package/front_end/panels/sources/sources-legacy.ts +0 -13
  56. package/front_end/panels/sources/sourcesView.css +0 -4
  57. package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -1
  58. package/front_end/panels/webauthn/webauthnPane.css +0 -12
  59. package/front_end/third_party/codemirror/package/addon/fold/foldgutter.css +1 -5
  60. package/front_end/ui/components/adorners/adorner.css +0 -4
  61. package/front_end/ui/components/buttons/button.css +0 -4
  62. package/front_end/ui/components/data_grid/dataGrid.css +0 -4
  63. package/front_end/ui/components/icon_button/iconButton.css +0 -1
  64. package/front_end/ui/legacy/TabbedPane.ts +1 -1
  65. package/front_end/ui/legacy/closeButton.css +0 -1
  66. package/front_end/ui/legacy/tabbedPane.css +0 -7
  67. package/front_end/ui/legacy/textButton.css +0 -1
  68. package/front_end/ui/legacy/toolbar.css +28 -4
  69. package/package.json +1 -1
  70. package/scripts/npm_test.js +1 -1
@@ -59,6 +59,7 @@ grd_files_release_sources = [
59
59
  "front_end/Images/flex-nowrap-icon.svg",
60
60
  "front_end/Images/flex-wrap-icon.svg",
61
61
  "front_end/Images/help_outline.svg",
62
+ "front_end/Images/ic_changes.svg",
62
63
  "front_end/Images/ic_checkmark_16x16.svg",
63
64
  "front_end/Images/ic_command_go_to_line.svg",
64
65
  "front_end/Images/ic_command_go_to_symbol.svg",
@@ -569,6 +570,7 @@ grd_files_debug_sources = [
569
570
  "front_end/core/i18n/time-utilities.js",
570
571
  "front_end/core/platform/DevToolsPath.js",
571
572
  "front_end/core/platform/UIString.js",
573
+ "front_end/core/platform/UserVisibleError.js",
572
574
  "front_end/core/platform/array-utilities.js",
573
575
  "front_end/core/platform/date-utilities.js",
574
576
  "front_end/core/platform/dcheck.js",
@@ -1044,6 +1046,7 @@ grd_files_debug_sources = [
1044
1046
  "front_end/panels/lighthouse/LighthouseReportSelector.js",
1045
1047
  "front_end/panels/lighthouse/LighthouseReporterTypes.js",
1046
1048
  "front_end/panels/lighthouse/LighthouseStartView.js",
1049
+ "front_end/panels/lighthouse/LighthouseStartViewFR.js",
1047
1050
  "front_end/panels/lighthouse/LighthouseStatusView.js",
1048
1051
  "front_end/panels/lighthouse/RadioSetting.js",
1049
1052
  "front_end/panels/lighthouse/lighthouseDialog.css.js",
@@ -69,6 +69,7 @@ devtools_svg_sources = [
69
69
  "flex-nowrap-icon.svg",
70
70
  "flex-wrap-icon.svg",
71
71
  "help_outline.svg",
72
+ "ic_changes.svg",
72
73
  "ic_checkmark_16x16.svg",
73
74
  "ic_command_go_to_line.svg",
74
75
  "ic_command_go_to_symbol.svg",
@@ -0,0 +1,5 @@
1
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M15.75 16.75V6.74572L12.4599 3.25H5.25V16.75H15.75ZM13 2L17 6.25V17C17 17.5523 16.5523 18 16 18H5C4.44772 18 4 17.5523 4 17V3C4 2.44772 4.44772 2 5 2H13Z" fill="black"/>
3
+ <path d="M11 6H10V8H8V9H10V11H11V9H13V8H11V6Z" fill="black"/>
4
+ <path d="M13 13L13 14L8 14L8 13L13 13Z" fill="black"/>
5
+ </svg>
@@ -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) {
@@ -233,9 +256,9 @@ export class ParsedURL {
233
256
  return ParsedURL.urlRegexInstance;
234
257
  }
235
258
 
236
- static extractPath(url: string): string {
259
+ static extractPath(url: string): Platform.DevToolsPath.EncodedPathString {
237
260
  const parsedURL = this.fromString(url);
238
- return parsedURL ? parsedURL.path : '';
261
+ return (parsedURL ? parsedURL.path : '') as Platform.DevToolsPath.EncodedPathString;
239
262
  }
240
263
 
241
264
  static extractOrigin(url: string): string {
@@ -586,7 +586,9 @@ export enum DevtoolsExperiments {
586
586
  'bfcacheDisplayTree' = 54,
587
587
  'stylesPaneCSSChanges' = 55,
588
588
  'headerOverrides' = 56,
589
- 'MaxValue' = 57,
589
+ 'lighthousePanelFR' = 57,
590
+ // Increment this when new experiments are added.
591
+ 'MaxValue' = 58,
590
592
  }
591
593
  /* eslint-enable @typescript-eslint/naming-convention */
592
594
 
@@ -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
  },
@@ -4838,6 +4835,12 @@
4838
4835
  "panels/elements/StylesSidebarPane.ts | constructedStylesheet": {
4839
4836
  "message": "constructed stylesheet"
4840
4837
  },
4838
+ "panels/elements/StylesSidebarPane.ts | copiedToClipboard": {
4839
+ "message": "Copied to clipboard"
4840
+ },
4841
+ "panels/elements/StylesSidebarPane.ts | copyAllCSSChanges": {
4842
+ "message": "Copy all the CSS changes"
4843
+ },
4841
4844
  "panels/elements/StylesSidebarPane.ts | copyAllDeclarations": {
4842
4845
  "message": "Copy all declarations"
4843
4846
  },
@@ -5768,6 +5771,9 @@
5768
5771
  "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5769
5772
  "message": "Legacy navigation"
5770
5773
  },
5774
+ "panels/lighthouse/LighthouseController.ts | lighthouseMode": {
5775
+ "message": "Lighthouse mode"
5776
+ },
5771
5777
  "panels/lighthouse/LighthouseController.ts | localStorage": {
5772
5778
  "message": "Local Storage"
5773
5779
  },
@@ -5777,6 +5783,9 @@
5777
5783
  "panels/lighthouse/LighthouseController.ts | multipleTabsAreBeingControlledBy": {
5778
5784
  "message": "Multiple tabs are being controlled by the same service worker. Close your other tabs on the same origin to audit this page."
5779
5785
  },
5786
+ "panels/lighthouse/LighthouseController.ts | navigation": {
5787
+ "message": "Navigation"
5788
+ },
5780
5789
  "panels/lighthouse/LighthouseController.ts | performance": {
5781
5790
  "message": "Performance"
5782
5791
  },
@@ -5789,6 +5798,9 @@
5789
5798
  "panels/lighthouse/LighthouseController.ts | resetStorageLocalstorage": {
5790
5799
  "message": "Reset storage (cache, service workers, etc) before auditing. (Good for performance & PWA testing)"
5791
5800
  },
5801
+ "panels/lighthouse/LighthouseController.ts | runLighthouseInMode": {
5802
+ "message": "Run Lighthouse in navigation, timespan, or snapshot mode"
5803
+ },
5792
5804
  "panels/lighthouse/LighthouseController.ts | seo": {
5793
5805
  "message": "SEO"
5794
5806
  },
@@ -5798,6 +5810,9 @@
5798
5810
  "panels/lighthouse/LighthouseController.ts | simulatedThrottling": {
5799
5811
  "message": "Simulated throttling"
5800
5812
  },
5813
+ "panels/lighthouse/LighthouseController.ts | snapshot": {
5814
+ "message": "Snapshot"
5815
+ },
5801
5816
  "panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingLoadingPlural": {
5802
5817
  "message": "There may be stored data affecting loading performance in these locations: {PH1}. Audit this page in an incognito window to prevent those resources from affecting your scores."
5803
5818
  },
@@ -5864,6 +5879,9 @@
5864
5879
  "panels/lighthouse/LighthouseStartView.ts | learnMore": {
5865
5880
  "message": "Learn more"
5866
5881
  },
5882
+ "panels/lighthouse/LighthouseStartViewFR.ts | mode": {
5883
+ "message": "Mode"
5884
+ },
5867
5885
  "panels/lighthouse/LighthouseStatusView.ts | ahSorryWeRanIntoAnError": {
5868
5886
  "message": "Ah, sorry! We ran into an error."
5869
5887
  },
@@ -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
  },
@@ -4838,6 +4835,12 @@
4838
4835
  "panels/elements/StylesSidebarPane.ts | constructedStylesheet": {
4839
4836
  "message": "ĉón̂śt̂ŕûćt̂éd̂ śt̂ýl̂éŝh́êét̂"
4840
4837
  },
4838
+ "panels/elements/StylesSidebarPane.ts | copiedToClipboard": {
4839
+ "message": "Ĉóp̂íêd́ t̂ó ĉĺîṕb̂óâŕd̂"
4840
+ },
4841
+ "panels/elements/StylesSidebarPane.ts | copyAllCSSChanges": {
4842
+ "message": "Ĉóp̂ý âĺl̂ t́ĥé ĈŚŜ ćĥán̂ǵêś"
4843
+ },
4841
4844
  "panels/elements/StylesSidebarPane.ts | copyAllDeclarations": {
4842
4845
  "message": "Ĉóp̂ý âĺl̂ d́êćl̂ár̂át̂íôńŝ"
4843
4846
  },
@@ -5768,6 +5771,9 @@
5768
5771
  "panels/lighthouse/LighthouseController.ts | legacyNavigation": {
5769
5772
  "message": "L̂éĝáĉý n̂áv̂íĝát̂íôń"
5770
5773
  },
5774
+ "panels/lighthouse/LighthouseController.ts | lighthouseMode": {
5775
+ "message": "L̂íĝh́t̂h́ôúŝé m̂ód̂é"
5776
+ },
5771
5777
  "panels/lighthouse/LighthouseController.ts | localStorage": {
5772
5778
  "message": "L̂óĉál̂ Śt̂ór̂áĝé"
5773
5779
  },
@@ -5777,6 +5783,9 @@
5777
5783
  "panels/lighthouse/LighthouseController.ts | multipleTabsAreBeingControlledBy": {
5778
5784
  "message": "M̂úl̂t́îṕl̂é t̂áb̂ś âŕê b́êín̂ǵ ĉón̂t́r̂ól̂ĺêd́ b̂ý t̂h́ê śâḿê service worker. Ćl̂óŝé ŷóûŕ ôt́ĥér̂ t́âb́ŝ ón̂ t́ĥé ŝám̂é ôŕîǵîń t̂ó âúd̂ít̂ t́ĥíŝ ṕâǵê."
5779
5785
  },
5786
+ "panels/lighthouse/LighthouseController.ts | navigation": {
5787
+ "message": "N̂áv̂íĝát̂íôń"
5788
+ },
5780
5789
  "panels/lighthouse/LighthouseController.ts | performance": {
5781
5790
  "message": "P̂ér̂f́ôŕm̂án̂ćê"
5782
5791
  },
@@ -5789,6 +5798,9 @@
5789
5798
  "panels/lighthouse/LighthouseController.ts | resetStorageLocalstorage": {
5790
5799
  "message": "R̂éŝét̂ śt̂ór̂áĝé (cache, service workers, êt́ĉ) b́êf́ôŕê áûd́ît́îńĝ. (Ǵôód̂ f́ôŕ p̂ér̂f́ôŕm̂án̂ćê & PWA t́êśt̂ín̂ǵ)"
5791
5800
  },
5801
+ "panels/lighthouse/LighthouseController.ts | runLighthouseInMode": {
5802
+ "message": "R̂ún̂ Ĺîǵĥt́ĥóûśê ín̂ ńâv́îǵât́îón̂, t́îḿêśp̂án̂, ór̂ śn̂áp̂śĥót̂ ḿôd́ê"
5803
+ },
5792
5804
  "panels/lighthouse/LighthouseController.ts | seo": {
5793
5805
  "message": "ŜÉÔ"
5794
5806
  },
@@ -5798,6 +5810,9 @@
5798
5810
  "panels/lighthouse/LighthouseController.ts | simulatedThrottling": {
5799
5811
  "message": "Ŝím̂úl̂át̂éd̂ t́ĥŕôt́t̂ĺîńĝ"
5800
5812
  },
5813
+ "panels/lighthouse/LighthouseController.ts | snapshot": {
5814
+ "message": "Ŝńâṕŝh́ôt́"
5815
+ },
5801
5816
  "panels/lighthouse/LighthouseController.ts | thereMayBeStoredDataAffectingLoadingPlural": {
5802
5817
  "message": "T̂h́êŕê ḿâý b̂é ŝt́ôŕêd́ d̂át̂á âf́f̂éĉt́îńĝ ĺôád̂ín̂ǵ p̂ér̂f́ôŕm̂án̂ćê ín̂ t́ĥéŝé l̂óĉát̂íôńŝ: {PH1}. Áûd́ît́ t̂h́îś p̂áĝé îń âń îńĉóĝńît́ô ẃîńd̂óŵ t́ô ṕr̂év̂én̂t́ t̂h́ôśê ŕêśôúr̂ćêś f̂ŕôḿ âf́f̂éĉt́îńĝ ýôúr̂ śĉór̂éŝ."
5803
5818
  },
@@ -5864,6 +5879,9 @@
5864
5879
  "panels/lighthouse/LighthouseStartView.ts | learnMore": {
5865
5880
  "message": "L̂éâŕn̂ ḿôŕê"
5866
5881
  },
5882
+ "panels/lighthouse/LighthouseStartViewFR.ts | mode": {
5883
+ "message": "M̂ód̂é"
5884
+ },
5867
5885
  "panels/lighthouse/LighthouseStatusView.ts | ahSorryWeRanIntoAnError": {
5868
5886
  "message": "Âh́, ŝór̂ŕŷ! Ẃê ŕâń îńt̂ó âń êŕr̂ór̂."
5869
5887
  },
@@ -0,0 +1,28 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import type {LocalizedString} from './UIString.js';
6
+
7
+ /**
8
+ * Represents an error that might become visible to the user. Where errors
9
+ * might be surfaced to the user (such as by displaying the message to the
10
+ * console), this class should be used to enforce that the message is
11
+ * localized on the way in.
12
+ */
13
+ export class UserVisibleError extends Error {
14
+ readonly message: LocalizedString;
15
+
16
+ constructor(message: LocalizedString) {
17
+ super(message);
18
+ this.message = message;
19
+ }
20
+ }
21
+
22
+ export function isUserVisibleError(error: unknown): error is UserVisibleError {
23
+ if (typeof error === 'object' && error !== null) {
24
+ return error instanceof UserVisibleError;
25
+ }
26
+
27
+ return false;
28
+ }
@@ -38,6 +38,7 @@ import * as SetUtilities from './set-utilities.js';
38
38
  import * as StringUtilities from './string-utilities.js';
39
39
  import * as TypeScriptUtilities from './typescript-utilities.js';
40
40
  import * as UIString from './UIString.js';
41
+ import * as UserVisibleError from './UserVisibleError.js';
41
42
 
42
43
  export {DCHECK} from './dcheck.js';
43
44
  /* `assertNotNull` also need to be exposed, as TypeScript does not
@@ -57,4 +58,5 @@ export {
57
58
  StringUtilities,
58
59
  TypeScriptUtilities,
59
60
  UIString,
61
+ UserVisibleError,
60
62
  };
@@ -140,7 +140,6 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
140
140
  } else if (targetInfo.type === 'auction_worklet') {
141
141
  type = Type.AuctionWorklet;
142
142
  }
143
-
144
143
  const target = this.#targetManager.createTarget(
145
144
  targetInfo.targetId, targetName, type, this.#parentTarget, sessionId, undefined, undefined, targetInfo);
146
145
  target.setInspectedURL(this.#parentTarget.inspectedURL());
@@ -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;
@@ -412,6 +412,16 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
412
412
  * once it is created in `requestWillBeSent`.
413
413
  */
414
414
  this.#requestIdToTrustTokenEvent = new Map();
415
+
416
+ MultitargetNetworkManager.instance().addEventListener(
417
+ MultitargetNetworkManager.Events.RequestIntercepted, this.#markAsIntercepted.bind(this));
418
+ }
419
+
420
+ #markAsIntercepted(event: Common.EventTarget.EventTargetEvent<string>): void {
421
+ const request = this.requestForURL(event.data);
422
+ if (request) {
423
+ request.setWasIntercepted(true);
424
+ }
415
425
  }
416
426
 
417
427
  private headersMapToHeadersArray(headersMap: Protocol.Network.Headers): NameValue[] {
@@ -446,7 +456,7 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
446
456
  if (!networkRequest.statusText) {
447
457
  networkRequest.statusText = response.statusText;
448
458
  }
449
- if (!networkRequest.hasExtraResponseInfo()) {
459
+ if (!networkRequest.hasExtraResponseInfo() || networkRequest.wasIntercepted()) {
450
460
  networkRequest.responseHeaders = this.headersMapToHeadersArray(response.headers);
451
461
  }
452
462
 
@@ -1401,6 +1411,8 @@ export class MultitargetNetworkManager extends Common.ObjectWrapper.ObjectWrappe
1401
1411
  for (const requestInterceptor of this.#urlsForRequestInterceptor.keysArray()) {
1402
1412
  await requestInterceptor(interceptedRequest);
1403
1413
  if (interceptedRequest.hasResponded()) {
1414
+ this.dispatchEventToListeners(
1415
+ MultitargetNetworkManager.Events.RequestIntercepted, interceptedRequest.request.url);
1404
1416
  return;
1405
1417
  }
1406
1418
  }
@@ -1467,6 +1479,7 @@ export namespace MultitargetNetworkManager {
1467
1479
  UserAgentChanged = 'UserAgentChanged',
1468
1480
  InterceptorsChanged = 'InterceptorsChanged',
1469
1481
  AcceptedEncodingsChanged = 'AcceptedEncodingsChanged',
1482
+ RequestIntercepted = 'RequestIntercepted',
1470
1483
  }
1471
1484
 
1472
1485
  export type EventTypes = {
@@ -1475,6 +1488,7 @@ export namespace MultitargetNetworkManager {
1475
1488
  [Events.UserAgentChanged]: void,
1476
1489
  [Events.InterceptorsChanged]: void,
1477
1490
  [Events.AcceptedEncodingsChanged]: void,
1491
+ [Events.RequestIntercepted]: string,
1478
1492
  };
1479
1493
  }
1480
1494
 
@@ -290,6 +290,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
290
290
  #parsedQueryParameters?: NameValue[];
291
291
  #contentDataProvider?: (() => Promise<ContentData>);
292
292
  #isSameSiteInternal: boolean|null;
293
+ #wasIntercepted: boolean;
293
294
 
294
295
  private constructor(
295
296
  requestId: string, backendRequestId: Protocol.Network.RequestId|undefined, url: string, documentURL: string,
@@ -363,6 +364,8 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
363
364
 
364
365
  this.localizedFailDescription = null;
365
366
  this.#isSameSiteInternal = null;
367
+
368
+ this.#wasIntercepted = false;
366
369
  }
367
370
 
368
371
  static create(
@@ -964,6 +967,14 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
964
967
  return this.#responseHeaderValues[headerName];
965
968
  }
966
969
 
970
+ wasIntercepted(): boolean {
971
+ return this.#wasIntercepted;
972
+ }
973
+
974
+ setWasIntercepted(wasIntercepted: boolean): void {
975
+ this.#wasIntercepted = wasIntercepted;
976
+ }
977
+
967
978
  get responseCookies(): Cookie[] {
968
979
  if (!this.#responseCookiesInternal) {
969
980
  this.#responseCookiesInternal =
@@ -103,7 +103,7 @@ async function start(method: string, params: any): Promise<unknown> {
103
103
  const url = params.url;
104
104
 
105
105
  // Handle legacy Lighthouse runner path.
106
- if (method === 'start') {
106
+ if (method === 'legacyNavigation') {
107
107
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
108
108
  const connection = self.setUpWorkerConnection(port);
109
109
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
@@ -115,14 +115,21 @@ async function start(method: string, params: any): Promise<unknown> {
115
115
  puppeteerConnection =
116
116
  await Puppeteer.PuppeteerConnection.getPuppeteerConnection(rawConnection, mainFrameId, mainTargetId);
117
117
 
118
+ if (method === 'snapshot') {
119
+ // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
120
+ return await self.runLighthouseSnapshot({
121
+ url,
122
+ config,
123
+ page: puppeteerConnection.page,
124
+ });
125
+ }
126
+
118
127
  // @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
119
- const result = await self.runLighthouseNavigation({
128
+ return await self.runLighthouseNavigation({
120
129
  url,
121
130
  config,
122
131
  page: puppeteerConnection.page,
123
132
  });
124
-
125
- return result;
126
133
  } catch (err) {
127
134
  return ({
128
135
  fatal: true,
@@ -179,8 +186,10 @@ function notifyFrontendViaWorkerMessage(method: string, params: any): void {
179
186
  self.onmessage = async(event: MessageEvent): Promise<void> => {
180
187
  const messageFromFrontend = JSON.parse(event.data);
181
188
  switch (messageFromFrontend.method) {
182
- case 'navigate':
183
- case 'start': {
189
+ case 'navigation':
190
+ case 'timespan':
191
+ case 'snapshot':
192
+ case 'legacyNavigation': {
184
193
  const result = await start(messageFromFrontend.method, messageFromFrontend.params);
185
194
  self.postMessage(JSON.stringify({id: messageFromFrontend.id, result}));
186
195
  break;
@@ -376,6 +376,9 @@ export class MainImpl {
376
376
  Root.Runtime.experiments.register(
377
377
  Root.Runtime.ExperimentName.HEADER_OVERRIDES, 'Local overrides for response headers');
378
378
 
379
+ // New Lighthouse panel with timespan and snapshot mode
380
+ Root.Runtime.experiments.register('lighthousePanelFR', 'Use Lighthouse panel with timespan and snapshot modes');
381
+
379
382
  Root.Runtime.experiments.enableExperimentsByDefault([
380
383
  'sourceOrderViewer',
381
384
  'hideIssuesFeature',
@@ -100,6 +100,27 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
100
100
  return locationPromise;
101
101
  }
102
102
 
103
+ propertyRawLocation(cssProperty: SDK.CSSProperty.CSSProperty, forName: boolean): SDK.CSSModel.CSSLocation|null {
104
+ const style = cssProperty.ownerStyle;
105
+ if (!style || style.type !== SDK.CSSStyleDeclaration.Type.Regular || !style.styleSheetId) {
106
+ return null;
107
+ }
108
+ const header = style.cssModel().styleSheetHeaderForId(style.styleSheetId);
109
+ if (!header) {
110
+ return null;
111
+ }
112
+
113
+ const range = forName ? cssProperty.nameRange() : cssProperty.valueRange();
114
+ if (!range) {
115
+ return null;
116
+ }
117
+
118
+ const lineNumber = range.startLine;
119
+ const columnNumber = range.startColumn;
120
+ return new SDK.CSSModel.CSSLocation(
121
+ header, header.lineNumberInSource(lineNumber), header.columnNumberInSource(lineNumber, columnNumber));
122
+ }
123
+
103
124
  propertyUILocation(cssProperty: SDK.CSSProperty.CSSProperty, forName: boolean): Workspace.UISourceCode.UILocation
104
125
  |null {
105
126
  const style = cssProperty.ownerStyle;
@@ -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
  }
@@ -338,16 +323,11 @@ export class Automapping {
338
323
  }
339
324
 
340
325
  if (networkPath.endsWith('/')) {
341
- networkPath += 'index.html';
342
- }
343
-
344
- const urlDecodedNetworkPath = sanitizeSourceUrl(networkPath);
345
- if (!urlDecodedNetworkPath) {
346
- return Promise.resolve(null as AutomappingStatus | null);
326
+ networkPath = networkPath + 'index.html' as Platform.DevToolsPath.EncodedPathString;
347
327
  }
348
328
 
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(
@@ -59,9 +59,9 @@ export class FileSystemWorkspaceBinding {
59
59
  return fileSystemPath;
60
60
  }
61
61
 
62
- static relativePath(uiSourceCode: Workspace.UISourceCode.UISourceCode): string[] {
62
+ static relativePath(uiSourceCode: Workspace.UISourceCode.UISourceCode): Platform.DevToolsPath.EncodedPathString[] {
63
63
  const baseURL = (uiSourceCode.project() as FileSystem).fileSystemBaseURL;
64
- return uiSourceCode.url().substring(baseURL.length).split('/');
64
+ return uiSourceCode.url().substring(baseURL.length).split('/') as Platform.DevToolsPath.EncodedPathString[];
65
65
  }
66
66
 
67
67
  static tooltipForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): string {
@@ -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);