chrome-devtools-frontend 1.0.980332 → 1.0.981537

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 (41) hide show
  1. package/front_end/core/common/ParsedURL.ts +37 -4
  2. package/front_end/core/i18n/locales/en-US.json +3 -0
  3. package/front_end/core/i18n/locales/en-XL.json +3 -0
  4. package/front_end/core/platform/DevToolsPath.ts +3 -0
  5. package/front_end/core/sdk/CSSRule.ts +2 -2
  6. package/front_end/core/sdk/DOMDebuggerModel.ts +2 -2
  7. package/front_end/core/sdk/NetworkRequest.ts +1 -1
  8. package/front_end/core/sdk/SourceMap.ts +14 -5
  9. package/front_end/core/sdk/Target.ts +2 -2
  10. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +26 -17
  11. package/front_end/generated/InspectorBackendCommands.js +6 -2
  12. package/front_end/generated/protocol.ts +16 -0
  13. package/front_end/legacy_test_runner/bindings_test_runner/BindingsTestRunner.js +5 -0
  14. package/front_end/models/bindings/BreakpointManager.ts +0 -2
  15. package/front_end/models/bindings/ContentProviderBasedProject.ts +6 -4
  16. package/front_end/models/persistence/EditFileSystemView.ts +3 -1
  17. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +14 -9
  18. package/front_end/models/persistence/IsolatedFileSystem.ts +66 -40
  19. package/front_end/models/persistence/IsolatedFileSystemManager.ts +4 -3
  20. package/front_end/models/persistence/NetworkPersistenceManager.ts +6 -5
  21. package/front_end/models/persistence/PlatformFileSystem.ts +15 -10
  22. package/front_end/models/timeline_model/TimelineModel.ts +1 -0
  23. package/front_end/models/workspace/UISourceCode.ts +4 -2
  24. package/front_end/models/workspace/WorkspaceImpl.ts +9 -5
  25. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  26. package/front_end/panels/console/ConsoleFormat.ts +23 -0
  27. package/front_end/panels/console/ConsoleViewMessage.ts +3 -19
  28. package/front_end/panels/emulation/AdvancedApp.ts +6 -2
  29. package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -2
  30. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +25 -19
  31. package/front_end/panels/sources/NavigatorView.ts +9 -5
  32. package/front_end/panels/sources/SourcesNavigator.ts +2 -2
  33. package/front_end/panels/timeline/TimelineUIUtils.ts +7 -0
  34. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +963 -886
  35. package/front_end/third_party/lighthouse/report/bundle.js +3 -2
  36. package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
  37. package/front_end/ui/components/buttons/Button.ts +11 -1
  38. package/front_end/ui/components/buttons/button.css +31 -10
  39. package/front_end/ui/components/docs/button/basic.ts +47 -1
  40. package/front_end/ui/legacy/themeColors.css +4 -0
  41. package/package.json +1 -1
@@ -13,8 +13,6 @@ import type * as TextUtils from '../../models/text_utils/text_utils.js';
13
13
  import * as UI from '../../ui/legacy/legacy.js';
14
14
  import * as Workspace from '../../models/workspace/workspace.js';
15
15
 
16
- // TODO(crbug.com/1253323): Cast to EncodedPathString will be removed from this file when migration to branded types is complete.
17
-
18
16
  const UIStrings = {
19
17
  /**
20
18
  *@description Default snippet name when a new snippet is created in the Sources panel
@@ -30,12 +28,12 @@ const UIStrings = {
30
28
  const str_ = i18n.i18n.registerUIStrings('panels/snippets/ScriptSnippetFileSystem.ts', UIStrings);
31
29
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
32
30
 
33
- function escapeSnippetName(name: string): Platform.DevToolsPath.EncodedPathString {
34
- return Common.ParsedURL.ParsedURL.rawPathToEncodedPathString(name as Platform.DevToolsPath.RawPathString);
31
+ function escapeSnippetName(name: Platform.DevToolsPath.RawPathString): Platform.DevToolsPath.EncodedPathString {
32
+ return Common.ParsedURL.ParsedURL.rawPathToEncodedPathString(name);
35
33
  }
36
34
 
37
- function unescapeSnippetName(name: string): string {
38
- return Common.ParsedURL.ParsedURL.encodedPathToRawPathString(name as Platform.DevToolsPath.EncodedPathString);
35
+ function unescapeSnippetName(name: Platform.DevToolsPath.EncodedPathString): string {
36
+ return Common.ParsedURL.ParsedURL.encodedPathToRawPathString(name);
39
37
  }
40
38
 
41
39
  export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFileSystem {
@@ -53,11 +51,13 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
53
51
  return savedSnippets.map(snippet => escapeSnippetName(snippet.name));
54
52
  }
55
53
 
56
- async createFile(_path: string, _name: string|null): Promise<string|null> {
54
+ async createFile(_path: Platform.DevToolsPath.EncodedPathString, _name: Platform.DevToolsPath.RawPathString|null):
55
+ Promise<Platform.DevToolsPath.EncodedPathString|null> {
57
56
  const nextId = this.lastSnippetIdentifierSetting.get() + 1;
58
57
  this.lastSnippetIdentifierSetting.set(nextId);
59
58
 
60
- const snippetName = i18nString(UIStrings.scriptSnippet, {PH1: nextId});
59
+ const snippetName =
60
+ i18nString(UIStrings.scriptSnippet, {PH1: nextId}) as string as Platform.DevToolsPath.RawPathString;
61
61
  const snippets = this.snippetsSetting.get();
62
62
  snippets.push({name: snippetName, content: ''});
63
63
  this.snippetsSetting.set(snippets);
@@ -65,8 +65,8 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
65
65
  return escapeSnippetName(snippetName);
66
66
  }
67
67
 
68
- async deleteFile(path: string): Promise<boolean> {
69
- const name = unescapeSnippetName(path.substring(1));
68
+ async deleteFile(path: Platform.DevToolsPath.EncodedPathString): Promise<boolean> {
69
+ const name = unescapeSnippetName(Common.ParsedURL.ParsedURL.substring(path, 1));
70
70
  const allSnippets: Snippet[] = this.snippetsSetting.get();
71
71
  const snippets = allSnippets.filter(snippet => snippet.name !== name);
72
72
  if (allSnippets.length !== snippets.length) {
@@ -76,8 +76,9 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
76
76
  return false;
77
77
  }
78
78
 
79
- async requestFileContent(path: string): Promise<TextUtils.ContentProvider.DeferredContent> {
80
- const name = unescapeSnippetName(path.substring(1));
79
+ async requestFileContent(path: Platform.DevToolsPath.EncodedPathString):
80
+ Promise<TextUtils.ContentProvider.DeferredContent> {
81
+ const name = unescapeSnippetName(Common.ParsedURL.ParsedURL.substring(path, 1));
81
82
  const snippets: Snippet[] = this.snippetsSetting.get();
82
83
  const snippet = snippets.find(snippet => snippet.name === name);
83
84
  if (snippet) {
@@ -86,8 +87,9 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
86
87
  return {content: null, isEncoded: false, error: `A snippet with name '${name}' was not found`};
87
88
  }
88
89
 
89
- async setFileContent(path: string, content: string, _isBase64: boolean): Promise<boolean> {
90
- const name = unescapeSnippetName(path.substring(1));
90
+ async setFileContent(path: Platform.DevToolsPath.EncodedPathString, content: string, _isBase64: boolean):
91
+ Promise<boolean> {
92
+ const name = unescapeSnippetName(Common.ParsedURL.ParsedURL.substring(path, 1));
91
93
  const snippets: Snippet[] = this.snippetsSetting.get();
92
94
  const snippet = snippets.find(snippet => snippet.name === name);
93
95
  if (snippet) {
@@ -98,11 +100,13 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
98
100
  return false;
99
101
  }
100
102
 
101
- renameFile(path: string, newName: string, callback: (arg0: boolean, arg1?: string|undefined) => void): void {
102
- const name = unescapeSnippetName(path.substring(1));
103
+ renameFile(
104
+ path: Platform.DevToolsPath.EncodedPathString, newName: Platform.DevToolsPath.RawPathString,
105
+ callback: (arg0: boolean, arg1?: string|undefined) => void): void {
106
+ const name = unescapeSnippetName(Common.ParsedURL.ParsedURL.substring(path, 1));
103
107
  const snippets: Snippet[] = this.snippetsSetting.get();
104
108
  const snippet = snippets.find(snippet => snippet.name === name);
105
- newName = newName.trim();
109
+ newName = Common.ParsedURL.ParsedURL.trim(newName);
106
110
  if (!snippet || newName.length === 0 || snippets.find(snippet => snippet.name === newName)) {
107
111
  callback(false);
108
112
  return;
@@ -128,7 +132,9 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
128
132
  }
129
133
 
130
134
  tooltipForURL(url: Platform.DevToolsPath.UrlString): string {
131
- return i18nString(UIStrings.linkedTo, {PH1: unescapeSnippetName(url.substring(this.path().length))});
135
+ return i18nString(
136
+ UIStrings.linkedTo,
137
+ {PH1: unescapeSnippetName(Common.ParsedURL.ParsedURL.sliceUrlToEncodedPathString(url, this.path().length))});
132
138
  }
133
139
 
134
140
  supportsAutomapping(): boolean {
@@ -215,6 +221,6 @@ export function findSnippetsProject(): Workspace.Workspace.Project {
215
221
  return workspaceProject;
216
222
  }
217
223
  export interface Snippet {
218
- name: string;
224
+ name: Platform.DevToolsPath.RawPathString;
219
225
  content: string;
220
226
  }
@@ -28,6 +28,8 @@
28
28
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
  */
30
30
 
31
+ // TODO(crbug.com/1253323): Casts to Branded Types will be removed from this file when migration to branded types is complete.
32
+
31
33
  import * as Common from '../../core/common/common.js';
32
34
  import * as Host from '../../core/host/host.js';
33
35
  import * as i18n from '../../core/i18n/i18n.js';
@@ -843,7 +845,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
843
845
  }
844
846
 
845
847
  handleFolderContextMenu(event: Event, node: NavigatorTreeNode): void {
846
- const path = (node as NavigatorFolderTreeNode).folderPath || '';
848
+ const path = (node as NavigatorFolderTreeNode).folderPath || Platform.DevToolsPath.EmptyEncodedPathString;
847
849
  const project = (node as NavigatorFolderTreeNode).project || null;
848
850
 
849
851
  const contextMenu = new UI.ContextMenu.ContextMenu(event);
@@ -914,7 +916,7 @@ export class NavigatorView extends UI.Widget.VBox implements SDK.TargetManager.O
914
916
  if (uiSourceCodeToCopy) {
915
917
  content = (await uiSourceCodeToCopy.requestContent()).content || '';
916
918
  }
917
- const uiSourceCode = await project.createFile(path, null, content);
919
+ const uiSourceCode = await project.createFile(path as Platform.DevToolsPath.EncodedPathString, null, content);
918
920
  if (!uiSourceCode) {
919
921
  return;
920
922
  }
@@ -1413,7 +1415,9 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
1413
1415
  if (this.treeElement) {
1414
1416
  this.treeElement.title = newTitle;
1415
1417
  }
1416
- void this.uiSourceCodeInternal.rename(newTitle).then(renameCallback.bind(this));
1418
+ // necessary cast to RawPathString as alternative would be altering type of Config<T>
1419
+ void this.uiSourceCodeInternal.rename(newTitle as Platform.DevToolsPath.RawPathString)
1420
+ .then(renameCallback.bind(this));
1417
1421
  return;
1418
1422
  }
1419
1423
  afterEditing.call(this, true);
@@ -1453,7 +1457,7 @@ export class NavigatorUISourceCodeTreeNode extends NavigatorTreeNode {
1453
1457
 
1454
1458
  export class NavigatorFolderTreeNode extends NavigatorTreeNode {
1455
1459
  project: Workspace.Workspace.Project|null;
1456
- readonly folderPath: string;
1460
+ readonly folderPath: Platform.DevToolsPath.EncodedPathString;
1457
1461
  title: string;
1458
1462
  treeElement!: NavigatorFolderTreeElement|null;
1459
1463
  constructor(
@@ -1461,7 +1465,7 @@ export class NavigatorFolderTreeNode extends NavigatorTreeNode {
1461
1465
  folderPath: string, title: string) {
1462
1466
  super(navigatorView, id, type);
1463
1467
  this.project = project;
1464
- this.folderPath = folderPath;
1468
+ this.folderPath = folderPath as Platform.DevToolsPath.EncodedPathString;
1465
1469
  this.title = title;
1466
1470
  }
1467
1471
 
@@ -31,9 +31,9 @@
31
31
  import * as Common from '../../core/common/common.js';
32
32
  import * as Host from '../../core/host/host.js';
33
33
  import * as i18n from '../../core/i18n/i18n.js';
34
+ import * as Platform from '../../core/platform/platform.js';
34
35
  import * as SDK from '../../core/sdk/sdk.js';
35
36
  import * as Persistence from '../../models/persistence/persistence.js';
36
- import type * as Platform from '../../core/platform/platform.js';
37
37
  import * as Workspace from '../../models/workspace/workspace.js';
38
38
  import * as UI from '../../ui/legacy/legacy.js';
39
39
  import * as Snippets from '../snippets/snippets.js';
@@ -406,7 +406,7 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
406
406
  switch (actionId) {
407
407
  case 'sources.create-snippet':
408
408
  void Snippets.ScriptSnippetFileSystem.findSnippetsProject()
409
- .createFile('', null, '')
409
+ .createFile(Platform.DevToolsPath.EmptyEncodedPathString, null, '')
410
410
  .then(uiSourceCode => Common.Revealer.reveal(uiSourceCode));
411
411
  return true;
412
412
  case 'sources.add-folder-to-workspace':
@@ -132,6 +132,12 @@ const UIStrings = {
132
132
  */
133
133
  paintImage: 'Paint Image',
134
134
  /**
135
+ *@description Noun for an event in the Performance panel. Pre-paint is a
136
+ *step before the 'Paint' event. A paint event is when the browser records the
137
+ *instructions for drawing the page. This step is the setup beforehand.
138
+ */
139
+ prePaint: 'Pre-Paint',
140
+ /**
135
141
  *@description Text in Timeline UIUtils of the Performance panel
136
142
  */
137
143
  updateLayer: 'Update Layer',
@@ -1283,6 +1289,7 @@ export class TimelineUIUtils {
1283
1289
  eventStyles[type.UpdateLayer] = new TimelineRecordStyle(i18nString(UIStrings.updateLayer), painting, true);
1284
1290
  eventStyles[type.UpdateLayerTree] = new TimelineRecordStyle(i18nString(UIStrings.updateLayerTree), rendering);
1285
1291
  eventStyles[type.Paint] = new TimelineRecordStyle(i18nString(UIStrings.paint), painting);
1292
+ eventStyles[type.PrePaint] = new TimelineRecordStyle(i18nString(UIStrings.prePaint), rendering);
1286
1293
  eventStyles[type.RasterTask] = new TimelineRecordStyle(i18nString(UIStrings.rasterizePaint), painting);
1287
1294
  eventStyles[type.ScrollLayer] = new TimelineRecordStyle(i18nString(UIStrings.scroll), rendering);
1288
1295
  eventStyles[type.CompositeLayers] = new TimelineRecordStyle(i18nString(UIStrings.compositeLayers), painting);