chrome-devtools-frontend 1.0.952784 → 1.0.953776

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 (144) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -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/i18nImpl.ts +8 -30
  8. package/front_end/core/i18n/locales/af.json +158 -176
  9. package/front_end/core/i18n/locales/am.json +163 -181
  10. package/front_end/core/i18n/locales/ar.json +162 -180
  11. package/front_end/core/i18n/locales/as.json +163 -181
  12. package/front_end/core/i18n/locales/az.json +161 -179
  13. package/front_end/core/i18n/locales/be.json +160 -178
  14. package/front_end/core/i18n/locales/bg.json +159 -177
  15. package/front_end/core/i18n/locales/bn.json +166 -184
  16. package/front_end/core/i18n/locales/bs.json +161 -179
  17. package/front_end/core/i18n/locales/ca.json +159 -177
  18. package/front_end/core/i18n/locales/cs.json +159 -177
  19. package/front_end/core/i18n/locales/cy.json +164 -182
  20. package/front_end/core/i18n/locales/da.json +158 -176
  21. package/front_end/core/i18n/locales/de.json +160 -178
  22. package/front_end/core/i18n/locales/el.json +158 -176
  23. package/front_end/core/i18n/locales/en-GB.json +158 -176
  24. package/front_end/core/i18n/locales/en-US.json +48 -0
  25. package/front_end/core/i18n/locales/en-XL.json +48 -0
  26. package/front_end/core/i18n/locales/es-419.json +160 -178
  27. package/front_end/core/i18n/locales/es.json +156 -174
  28. package/front_end/core/i18n/locales/et.json +161 -179
  29. package/front_end/core/i18n/locales/eu.json +159 -177
  30. package/front_end/core/i18n/locales/fa.json +166 -184
  31. package/front_end/core/i18n/locales/fi.json +161 -179
  32. package/front_end/core/i18n/locales/fil.json +162 -180
  33. package/front_end/core/i18n/locales/fr-CA.json +159 -177
  34. package/front_end/core/i18n/locales/fr.json +158 -176
  35. package/front_end/core/i18n/locales/gl.json +160 -178
  36. package/front_end/core/i18n/locales/gu.json +179 -197
  37. package/front_end/core/i18n/locales/he.json +160 -178
  38. package/front_end/core/i18n/locales/hi.json +166 -184
  39. package/front_end/core/i18n/locales/hr.json +161 -179
  40. package/front_end/core/i18n/locales/hu.json +161 -179
  41. package/front_end/core/i18n/locales/hy.json +157 -175
  42. package/front_end/core/i18n/locales/id.json +160 -178
  43. package/front_end/core/i18n/locales/is.json +163 -181
  44. package/front_end/core/i18n/locales/it.json +162 -180
  45. package/front_end/core/i18n/locales/ja.json +160 -178
  46. package/front_end/core/i18n/locales/ka.json +161 -179
  47. package/front_end/core/i18n/locales/kk.json +164 -182
  48. package/front_end/core/i18n/locales/km.json +160 -178
  49. package/front_end/core/i18n/locales/kn.json +162 -180
  50. package/front_end/core/i18n/locales/ko.json +162 -180
  51. package/front_end/core/i18n/locales/ky.json +160 -178
  52. package/front_end/core/i18n/locales/lo.json +159 -177
  53. package/front_end/core/i18n/locales/lt.json +159 -177
  54. package/front_end/core/i18n/locales/lv.json +162 -180
  55. package/front_end/core/i18n/locales/mk.json +162 -180
  56. package/front_end/core/i18n/locales/ml.json +160 -178
  57. package/front_end/core/i18n/locales/mn.json +164 -182
  58. package/front_end/core/i18n/locales/mr.json +163 -181
  59. package/front_end/core/i18n/locales/ms.json +163 -181
  60. package/front_end/core/i18n/locales/my.json +164 -182
  61. package/front_end/core/i18n/locales/ne.json +160 -178
  62. package/front_end/core/i18n/locales/nl.json +160 -178
  63. package/front_end/core/i18n/locales/no.json +281 -299
  64. package/front_end/core/i18n/locales/or.json +165 -183
  65. package/front_end/core/i18n/locales/pa.json +159 -177
  66. package/front_end/core/i18n/locales/pl.json +163 -181
  67. package/front_end/core/i18n/locales/pt-PT.json +160 -178
  68. package/front_end/core/i18n/locales/pt.json +159 -177
  69. package/front_end/core/i18n/locales/ro.json +161 -179
  70. package/front_end/core/i18n/locales/ru.json +159 -177
  71. package/front_end/core/i18n/locales/si.json +161 -179
  72. package/front_end/core/i18n/locales/sk.json +158 -176
  73. package/front_end/core/i18n/locales/sl.json +160 -178
  74. package/front_end/core/i18n/locales/sq.json +279 -297
  75. package/front_end/core/i18n/locales/sr-Latn.json +160 -178
  76. package/front_end/core/i18n/locales/sr.json +160 -178
  77. package/front_end/core/i18n/locales/sv.json +159 -177
  78. package/front_end/core/i18n/locales/sw.json +164 -182
  79. package/front_end/core/i18n/locales/ta.json +160 -178
  80. package/front_end/core/i18n/locales/te.json +165 -183
  81. package/front_end/core/i18n/locales/th.json +158 -176
  82. package/front_end/core/i18n/locales/tr.json +162 -180
  83. package/front_end/core/i18n/locales/uk.json +160 -178
  84. package/front_end/core/i18n/locales/ur.json +160 -178
  85. package/front_end/core/i18n/locales/uz.json +160 -178
  86. package/front_end/core/i18n/locales/vi.json +162 -180
  87. package/front_end/core/i18n/locales/zh-HK.json +160 -178
  88. package/front_end/core/i18n/locales/zh-TW.json +161 -179
  89. package/front_end/core/i18n/locales/zh.json +162 -180
  90. package/front_end/core/i18n/locales/zu.json +164 -182
  91. package/front_end/core/sdk/ChildTargetManager.ts +1 -0
  92. package/front_end/core/sdk/PageResourceLoader.ts +1 -2
  93. package/front_end/panels/application/components/BackForwardCacheStrings.ts +93 -15
  94. package/front_end/panels/application/components/EndpointsGrid.ts +1 -1
  95. package/front_end/panels/elements/components/elementsBreadcrumbs.css +2 -0
  96. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +2 -0
  97. package/front_end/panels/network/NetworkDataGridNode.ts +0 -2
  98. package/front_end/panels/network/components/WebBundleInfoView.ts +1 -1
  99. package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +188 -185
  100. package/front_end/third_party/lighthouse/locales/en-US.json +1 -1
  101. package/front_end/third_party/lighthouse/locales/en-XL.json +1 -1
  102. package/front_end/third_party/lighthouse/report/bundle.js +3 -3
  103. package/front_end/third_party/lighthouse/report-assets/report-generator.js +1 -1
  104. package/front_end/third_party/puppeteer/package/README.md +11 -11
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js +2 -2
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +2 -0
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +20 -11
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +13 -3
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +2 -2
  115. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +2 -0
  117. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +20 -11
  119. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +13 -3
  122. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/types.d.ts +2 -0
  124. package/front_end/third_party/puppeteer/package/package.json +1 -1
  125. package/front_end/ui/components/docs/component_docs.ts +4 -4
  126. package/front_end/ui/components/docs/component_docs_styles.css +51 -0
  127. package/front_end/ui/components/input/checkbox.css +11 -0
  128. package/front_end/ui/components/input/input.ts +3 -3
  129. package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
  130. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +2 -1
  131. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -1
  132. package/front_end/ui/components/settings/settingCheckbox.css +0 -5
  133. package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +10 -3
  134. package/front_end/ui/legacy/UIUtils.ts +0 -12
  135. package/front_end/ui/legacy/themeColors.css +1 -0
  136. package/inspector_overlay/main.ts +2 -16
  137. package/package.json +1 -1
  138. package/scripts/check_experiments.js +3 -6
  139. package/scripts/component_server/server.js +4 -12
  140. package/scripts/eslint_rules/lib/check_enumerated_histograms.js +32 -0
  141. package/scripts/eslint_rules/lib/lit_html_host_this.js +1 -10
  142. package/scripts/eslint_rules/lib/utils.js +20 -1
  143. package/scripts/eslint_rules/tests/check_enumerated_histograms_test.js +32 -0
  144. package/scripts/eslint_rules/tests/utils_test.js +30 -0
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.952784"
56
+ "version": "1.0.953776"
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
+ };
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlRenderCall(callExpressionNode) {
7
- if (callExpressionNode.callee.type !== 'MemberExpression') {
8
- return false;
9
- }
10
-
11
- // TODO: would miss cases where the render function is destructured. Should
12
- // we support that case, or enforce that it's not done?
13
- const {callee} = callExpressionNode;
14
- return callee.object?.name === 'LitHtml' && callee.property?.name === 'render';
15
- }
6
+ const {isLitHtmlRenderCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -26,4 +26,23 @@ function isLitHtmlTemplateCall(taggedTemplateExpressionNode) {
26
26
  return isLitHtmlDotHtmlCall || isDestructuredHtmlCall;
27
27
  }
28
28
 
29
- module.exports = {isLitHtmlTemplateCall};
29
+ /**
30
+ * @param callExpressionNode - a CallExpression node from the AST of the parsed code.
31
+ * @returns {boolean} - `true` if the code matches LitHtml.render() or render(), and false otherwise.
32
+ */
33
+ function isLitHtmlRenderCall(callExpressionNode) {
34
+ if (callExpressionNode.type !== 'CallExpression') {
35
+ throw new Error('Node of type other than CallExpresson passed to isLitHtmlRenderCall.');
36
+ }
37
+
38
+ const {callee} = callExpressionNode;
39
+ const isDestructuredRenderCall = callee.type === 'Identifier' && callee.name === 'render';
40
+ const isLitHtmlDotRenderCall = callee.object?.name === 'LitHtml' && callee.property?.name === 'render';
41
+
42
+ return isDestructuredRenderCall || isLitHtmlDotRenderCall;
43
+ }
44
+
45
+ module.exports = {
46
+ isLitHtmlTemplateCall,
47
+ isLitHtmlRenderCall
48
+ };
@@ -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
+ });
@@ -37,4 +37,34 @@ describe('eslint utils', () => {
37
37
  assert.strictEqual(result, false);
38
38
  });
39
39
  });
40
+
41
+ describe('isLitHtmlRenderCall', () => {
42
+ it('returns true if the code is LitHtml.render()', () => {
43
+ const code = 'LitHtml.render(LitHtml.html``, this.#shadow)';
44
+ const parsed = parser.parse(code);
45
+ const result = utils.isLitHtmlRenderCall(parsed.body[0].expression);
46
+ assert.strictEqual(result, true);
47
+ });
48
+
49
+ it('returns true if the code is render()', () => {
50
+ const code = 'render(html``, this.#shadow)';
51
+ const parsed = parser.parse(code);
52
+ const result = utils.isLitHtmlRenderCall(parsed.body[0].expression);
53
+ assert.strictEqual(result, true);
54
+ });
55
+
56
+ it('returns false if the code is not render()', () => {
57
+ const code = 'notRender(html``, this.#shadow)';
58
+ const parsed = parser.parse(code);
59
+ const result = utils.isLitHtmlRenderCall(parsed.body[0].expression);
60
+ assert.strictEqual(result, false);
61
+ });
62
+
63
+ it('returns false if the code is LitHtml.notRender()', () => {
64
+ const code = 'LitHtml.notRender(html``, this.#shadow)';
65
+ const parsed = parser.parse(code);
66
+ const result = utils.isLitHtmlRenderCall(parsed.body[0].expression);
67
+ assert.strictEqual(result, false);
68
+ });
69
+ });
40
70
  });