chrome-devtools-frontend 1.0.952713 → 1.0.953446

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 (107) hide show
  1. package/config/gni/devtools_grd_files.gni +1 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/.eslintrc.js +1 -0
  4. package/front_end/Images/src/info-icon.svg +1 -0
  5. package/front_end/core/common/ParsedURL.ts +31 -0
  6. package/front_end/core/host/UserMetrics.ts +515 -481
  7. package/front_end/core/i18n/locales/af.json +158 -176
  8. package/front_end/core/i18n/locales/am.json +163 -181
  9. package/front_end/core/i18n/locales/ar.json +162 -180
  10. package/front_end/core/i18n/locales/as.json +163 -181
  11. package/front_end/core/i18n/locales/az.json +161 -179
  12. package/front_end/core/i18n/locales/be.json +160 -178
  13. package/front_end/core/i18n/locales/bg.json +159 -177
  14. package/front_end/core/i18n/locales/bn.json +166 -184
  15. package/front_end/core/i18n/locales/bs.json +161 -179
  16. package/front_end/core/i18n/locales/ca.json +159 -177
  17. package/front_end/core/i18n/locales/cs.json +159 -177
  18. package/front_end/core/i18n/locales/cy.json +164 -182
  19. package/front_end/core/i18n/locales/da.json +158 -176
  20. package/front_end/core/i18n/locales/de.json +160 -178
  21. package/front_end/core/i18n/locales/el.json +158 -176
  22. package/front_end/core/i18n/locales/en-GB.json +158 -176
  23. package/front_end/core/i18n/locales/en-US.json +45 -0
  24. package/front_end/core/i18n/locales/en-XL.json +45 -0
  25. package/front_end/core/i18n/locales/es-419.json +160 -178
  26. package/front_end/core/i18n/locales/es.json +156 -174
  27. package/front_end/core/i18n/locales/et.json +161 -179
  28. package/front_end/core/i18n/locales/eu.json +159 -177
  29. package/front_end/core/i18n/locales/fa.json +166 -184
  30. package/front_end/core/i18n/locales/fi.json +161 -179
  31. package/front_end/core/i18n/locales/fil.json +162 -180
  32. package/front_end/core/i18n/locales/fr-CA.json +159 -177
  33. package/front_end/core/i18n/locales/fr.json +158 -176
  34. package/front_end/core/i18n/locales/gl.json +160 -178
  35. package/front_end/core/i18n/locales/gu.json +179 -197
  36. package/front_end/core/i18n/locales/he.json +160 -178
  37. package/front_end/core/i18n/locales/hi.json +166 -184
  38. package/front_end/core/i18n/locales/hr.json +161 -179
  39. package/front_end/core/i18n/locales/hu.json +161 -179
  40. package/front_end/core/i18n/locales/hy.json +157 -175
  41. package/front_end/core/i18n/locales/id.json +160 -178
  42. package/front_end/core/i18n/locales/is.json +163 -181
  43. package/front_end/core/i18n/locales/it.json +162 -180
  44. package/front_end/core/i18n/locales/ja.json +160 -178
  45. package/front_end/core/i18n/locales/ka.json +161 -179
  46. package/front_end/core/i18n/locales/kk.json +164 -182
  47. package/front_end/core/i18n/locales/km.json +160 -178
  48. package/front_end/core/i18n/locales/kn.json +162 -180
  49. package/front_end/core/i18n/locales/ko.json +162 -180
  50. package/front_end/core/i18n/locales/ky.json +160 -178
  51. package/front_end/core/i18n/locales/lo.json +159 -177
  52. package/front_end/core/i18n/locales/lt.json +159 -177
  53. package/front_end/core/i18n/locales/lv.json +162 -180
  54. package/front_end/core/i18n/locales/mk.json +162 -180
  55. package/front_end/core/i18n/locales/ml.json +160 -178
  56. package/front_end/core/i18n/locales/mn.json +164 -182
  57. package/front_end/core/i18n/locales/mr.json +163 -181
  58. package/front_end/core/i18n/locales/ms.json +163 -181
  59. package/front_end/core/i18n/locales/my.json +164 -182
  60. package/front_end/core/i18n/locales/ne.json +160 -178
  61. package/front_end/core/i18n/locales/nl.json +160 -178
  62. package/front_end/core/i18n/locales/no.json +281 -299
  63. package/front_end/core/i18n/locales/or.json +165 -183
  64. package/front_end/core/i18n/locales/pa.json +159 -177
  65. package/front_end/core/i18n/locales/pl.json +163 -181
  66. package/front_end/core/i18n/locales/pt-PT.json +160 -178
  67. package/front_end/core/i18n/locales/pt.json +159 -177
  68. package/front_end/core/i18n/locales/ro.json +161 -179
  69. package/front_end/core/i18n/locales/ru.json +159 -177
  70. package/front_end/core/i18n/locales/si.json +161 -179
  71. package/front_end/core/i18n/locales/sk.json +158 -176
  72. package/front_end/core/i18n/locales/sl.json +160 -178
  73. package/front_end/core/i18n/locales/sq.json +279 -297
  74. package/front_end/core/i18n/locales/sr-Latn.json +160 -178
  75. package/front_end/core/i18n/locales/sr.json +160 -178
  76. package/front_end/core/i18n/locales/sv.json +159 -177
  77. package/front_end/core/i18n/locales/sw.json +164 -182
  78. package/front_end/core/i18n/locales/ta.json +160 -178
  79. package/front_end/core/i18n/locales/te.json +165 -183
  80. package/front_end/core/i18n/locales/th.json +158 -176
  81. package/front_end/core/i18n/locales/tr.json +162 -180
  82. package/front_end/core/i18n/locales/uk.json +160 -178
  83. package/front_end/core/i18n/locales/ur.json +160 -178
  84. package/front_end/core/i18n/locales/uz.json +160 -178
  85. package/front_end/core/i18n/locales/vi.json +162 -180
  86. package/front_end/core/i18n/locales/zh-HK.json +160 -178
  87. package/front_end/core/i18n/locales/zh-TW.json +161 -179
  88. package/front_end/core/i18n/locales/zh.json +162 -180
  89. package/front_end/core/i18n/locales/zu.json +164 -182
  90. package/front_end/core/sdk/ChildTargetManager.ts +1 -0
  91. package/front_end/core/sdk/PageResourceLoader.ts +1 -2
  92. package/front_end/panels/application/components/BackForwardCacheStrings.ts +93 -15
  93. package/front_end/panels/elements/components/elementsBreadcrumbs.css +2 -0
  94. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +2 -0
  95. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +188 -185
  96. package/front_end/third_party/lighthouse/locales/en-US.json +1 -1
  97. package/front_end/third_party/lighthouse/locales/en-XL.json +1 -1
  98. package/front_end/third_party/lighthouse/report/bundle.js +3 -3
  99. package/front_end/third_party/lighthouse/report-assets/report-generator.js +1 -1
  100. package/front_end/ui/components/docs/component_docs.ts +4 -4
  101. package/front_end/ui/components/docs/component_docs_styles.css +51 -0
  102. package/inspector_overlay/main.ts +2 -16
  103. package/package.json +1 -1
  104. package/scripts/check_experiments.js +3 -6
  105. package/scripts/component_server/server.js +4 -12
  106. package/scripts/eslint_rules/lib/check_enumerated_histograms.js +32 -0
  107. package/scripts/eslint_rules/tests/check_enumerated_histograms_test.js +32 -0
@@ -16,13 +16,13 @@ ToggleFonts.init();
16
16
  // This can be used by tests to hide the UI elements that are part of the component docs interface.
17
17
  // E.g., this is useful for screenshot tests.
18
18
  window.addEventListener('hidecomponentdocsui', () => {
19
- for (const node of document.querySelectorAll('.component-docs-ui')) {
20
- (node as HTMLElement).style.display = 'none';
19
+ for (const node of document.querySelectorAll<HTMLElement>('.component-docs-ui')) {
20
+ node.style.display = 'none';
21
21
  }
22
22
  });
23
23
 
24
24
  window.addEventListener('showcomponentdocsui', () => {
25
- for (const node of document.querySelectorAll('.component-docs-ui')) {
26
- (node as HTMLElement).style.display = '';
25
+ for (const node of document.querySelectorAll<HTMLElement>('.component-docs-ui')) {
26
+ node.style.display = '';
27
27
  }
28
28
  });
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2021 The Chromium Authors. All rights reserved.
3
+ * Use of this source code is governed by a BSD-style license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ body {
8
+ margin: 0;
9
+ padding: 0;
10
+ font-family: ".SFNSDisplay-Regular", "Helvetica Neue", "Lucida Grande", sans-serif;
11
+ }
12
+
13
+ #index-page h1 {
14
+ text-align: left;
15
+ border-bottom: 1px solid var(--color-details-hairline);
16
+ padding: 10px;
17
+ width: 100%;
18
+ margin-bottom: 10px;
19
+ }
20
+
21
+ .components-list {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ list-style: none;
25
+ margin: 0;
26
+ padding: 10px;
27
+ }
28
+
29
+ .components-list li {
30
+ width: 20%;
31
+ min-width: 150px;
32
+ max-width: 300px;
33
+ margin: 0 12px 12px 0;
34
+ }
35
+
36
+ .components-list a {
37
+ display: block;
38
+ padding: 10px;
39
+ }
40
+
41
+ .components-list a:link,
42
+ .components-list a:visited {
43
+ text-transform: capitalize;
44
+ color: var(--color-primary);
45
+ text-decoration: none;
46
+ box-shadow: var(--drop-shadow);
47
+ }
48
+
49
+ .components-list a:hover {
50
+ box-shadow: var(--drop-shadow-depth-3);
51
+ }
@@ -80,17 +80,10 @@ type MessageLookup = {
80
80
  drawingFinished: '',
81
81
  };
82
82
 
83
- let queue: unknown[][] = [];
84
- let prevQueue: string = '';
85
-
86
83
  const dispatch = <K extends keyof MessageLookup>(message: [a: K, b: MessageLookup[K]]) => {
87
84
  const functionName = message[0];
88
85
  if (functionName === 'setOverlay') {
89
86
  const overlayName = message[1] as keyof Overlays;
90
- // No need to swap overlays if it's the same overlay.
91
- if (overlays[overlayName] === currentOverlay) {
92
- return;
93
- }
94
87
  if (currentOverlay) {
95
88
  currentOverlay.uninstall();
96
89
  }
@@ -104,16 +97,9 @@ const dispatch = <K extends keyof MessageLookup>(message: [a: K, b: MessageLooku
104
97
  } else if (functionName === 'setPlatform') {
105
98
  platformName = message[1];
106
99
  } else if (functionName === 'drawingFinished') {
107
- const currentQueue = JSON.stringify(queue);
108
- if (currentQueue !== prevQueue) {
109
- for (const message of queue) {
110
- currentOverlay.dispatch(message);
111
- }
112
- }
113
- prevQueue = currentQueue;
114
- queue = [];
100
+ // TODO The logic needs to be added here once the backend starts sending this event.
115
101
  } else {
116
- queue.push(message);
102
+ currentOverlay.dispatch(message);
117
103
  }
118
104
  };
119
105
 
package/package.json CHANGED
@@ -53,5 +53,5 @@
53
53
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
54
54
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
55
55
  },
56
- "version": "1.0.952713"
56
+ "version": "1.0.953446"
57
57
  }
@@ -15,7 +15,7 @@ const parseOptions = {
15
15
  range: true,
16
16
  };
17
17
 
18
- const USER_METRICS_ENUM_ENDPOINT = '__lastValidEnumPosition';
18
+ const USER_METRICS_ENUM_ENDPOINT = 'MaxValue';
19
19
 
20
20
  /**
21
21
  * Determines if a node is a class declaration.
@@ -162,8 +162,7 @@ function getMainImplExperimentList(mainImplFile, experimentNames) {
162
162
  * Determines if AST Node is the DevtoolsExperiments Enum declaration
163
163
  */
164
164
  function isExperimentEnumDeclaration(node) {
165
- return node.type === 'ExportNamedDeclaration' && node.declaration.declarations &&
166
- node.declaration.declarations[0].id.name === 'DevtoolsExperiments';
165
+ return node.type === 'ExportNamedDeclaration' && node?.declaration?.id?.name === 'DevtoolsExperiments';
167
166
  }
168
167
 
169
168
  /**
@@ -173,9 +172,7 @@ function getUserMetricExperimentList(userMetricsFile) {
173
172
  const userMetricsAST = espree.parse(userMetricsFile, {ecmaVersion: 11, sourceType: 'module', range: true});
174
173
  for (const node of userMetricsAST.body) {
175
174
  if (isExperimentEnumDeclaration(node)) {
176
- return node.declaration.declarations[0].init.properties.map(property => {
177
- return property.key.value;
178
- });
175
+ return node.declaration.members.map(member => member.id.value);
179
176
  }
180
177
  }
181
178
  return null;
@@ -150,20 +150,12 @@ function createServerIndexFile(componentNames) {
150
150
  <meta charset="UTF-8" />
151
151
  <meta name="viewport" content="width=device-width" />
152
152
  <title>DevTools components</title>
153
- <style>
154
- a:link, a:visited {
155
- color: blue;
156
- text-transform: capitalize;
157
- text-decoration: none;
158
- }
159
- a:hover {
160
- text-decoration: underline;
161
- }
162
- </style>
153
+ <link rel="stylesheet" href="/front_end/ui/legacy/themeColors.css" />
154
+ <link rel="stylesheet" href="/front_end/ui/components/docs/component_docs_styles.css" />
163
155
  </head>
164
- <body>
156
+ <body id="index-page">
165
157
  <h1>DevTools components</h1>
166
- <ul>
158
+ <ul class="components-list">
167
159
  ${componentNames.map(name => {
168
160
  const niceName = name.replace(/_/g, ' ');
169
161
  return `<li><a href='/front_end/ui/components/docs/${name}'>${niceName}</a></li>`;
@@ -0,0 +1,32 @@
1
+ // Copyright 2020 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
+ 'use strict';
5
+
6
+ module.exports = {
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'check arguments when recording enumerated histograms',
11
+ category: 'Possible Errors',
12
+ },
13
+ fixable: 'code',
14
+ schema: [] // no options
15
+ },
16
+ create: function(context) {
17
+ return {
18
+ CallExpression(node) {
19
+ if (node?.callee?.object?.name === 'InspectorFrontendHostInstance' &&
20
+ node.callee.property.name === 'recordEnumeratedHistogram') {
21
+ if (node?.arguments[2]?.property?.name !== 'MaxValue') {
22
+ context.report({
23
+ node: node,
24
+ message:
25
+ 'When calling \'recordEnumeratedHistogram\' the third argument should be of the form \'SomeEnum.MaxValue\'.'
26
+ });
27
+ }
28
+ }
29
+ }
30
+ };
31
+ }
32
+ };
@@ -0,0 +1,32 @@
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
+ 'use strict';
5
+
6
+ const rule = require('../lib/check_enumerated_histograms.js');
7
+ const ruleTester = new (require('eslint').RuleTester)({
8
+ parserOptions: {ecmaVersion: 9, sourceType: 'module'},
9
+ parser: require.resolve('@typescript-eslint/parser'),
10
+ });
11
+
12
+ ruleTester.run('check_enumerated_histograms', rule, {
13
+ valid: [
14
+ {
15
+ code: 'InspectorFrontendHostInstance.recordEnumeratedHistogram(\'someparam\', 1, foo.MaxValue);',
16
+ filename: 'front_end/components/test.ts',
17
+ },
18
+ {
19
+ code:
20
+ 'InspectorFrontendHostInstance.recordEnumeratedHistogram(EnumeratedHistogram.IssueCreated, issueCreated, IssueCreated.MaxValue);',
21
+ filename: 'front_end/components/test.ts'
22
+ }
23
+ ],
24
+ invalid: [{
25
+ code: 'InspectorFrontendHostInstance.recordEnumeratedHistogram(\'someparam\', 1, 5);',
26
+ filename: 'front_end/components/test.ts',
27
+ errors: [{
28
+ message:
29
+ 'When calling \'recordEnumeratedHistogram\' the third argument should be of the form \'SomeEnum.MaxValue\'.'
30
+ }],
31
+ }]
32
+ });