chrome-devtools-frontend 1.0.948445 → 1.0.950484

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 (62) hide show
  1. package/config/gni/all_devtools_files.gni +5 -0
  2. package/config/gni/devtools_grd_files.gni +5 -6
  3. package/front_end/core/i18n/locales/en-US.json +45 -30
  4. package/front_end/core/i18n/locales/en-XL.json +49 -34
  5. package/front_end/core/root/Runtime.ts +1 -0
  6. package/front_end/core/sdk/AccessibilityModel.ts +7 -7
  7. package/front_end/core/sdk/RemoteObject.ts +15 -1
  8. package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
  9. package/front_end/entrypoints/visibility.gni +3 -1
  10. package/front_end/entrypoints/worker_app/worker_app.ts +0 -1
  11. package/front_end/generated/InspectorBackendCommands.js +8 -1
  12. package/front_end/generated/protocol-mapping.d.ts +4 -0
  13. package/front_end/generated/protocol-proxy-api.d.ts +6 -0
  14. package/front_end/generated/protocol.d.ts +9 -0
  15. package/front_end/models/issues_manager/AttributionReportingIssue.ts +75 -4
  16. package/front_end/models/issues_manager/CorsIssue.ts +1 -4
  17. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourceExpiry.md +4 -0
  18. package/front_end/models/issues_manager/descriptions/arInvalidAttributionSourcePriority.md +4 -0
  19. package/front_end/models/issues_manager/descriptions/arInvalidEventSourceTriggerData.md +9 -0
  20. package/front_end/models/issues_manager/descriptions/arInvalidTriggerDedupKey.md +5 -0
  21. package/front_end/models/issues_manager/descriptions/arInvalidTriggerPriority.md +5 -0
  22. package/front_end/models/issues_manager/descriptions/corsPreflightResponseInvalid.md +2 -2
  23. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +45 -3
  24. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +2 -4
  25. package/front_end/panels/accessibility/axBreadcrumbs.css +4 -0
  26. package/front_end/panels/animation/animationTimeline.css +2 -1
  27. package/front_end/panels/application/components/FrameDetailsView.ts +29 -15
  28. package/front_end/panels/console/ConsolePrompt.ts +14 -12
  29. package/front_end/panels/elements/AccessibilityTreeUtils.ts +1 -7
  30. package/front_end/panels/elements/AccessibilityTreeView.ts +4 -6
  31. package/front_end/panels/elements/PropertiesWidget.ts +109 -4
  32. package/front_end/panels/elements/propertiesWidget.css +34 -0
  33. package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -1
  34. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +44 -0
  35. package/front_end/panels/issues/CorsIssueDetailsView.ts +6 -2
  36. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +1 -0
  37. package/front_end/panels/sources/BreakpointEditDialog.ts +8 -5
  38. package/front_end/panels/timeline/TimelinePanel.ts +5 -4
  39. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  40. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +8 -6
  41. package/front_end/third_party/codemirror.next/package.json +3 -3
  42. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +16 -0
  43. package/front_end/ui/components/text_editor/javascript.ts +16 -7
  44. package/package.json +1 -1
  45. package/scripts/eslint_rules/lib/ban_a_tags_in_lit_html.js +2 -11
  46. package/scripts/eslint_rules/lib/ban_literal_devtools_component_tag_names.js +2 -11
  47. package/scripts/eslint_rules/lib/ban_self_closing_custom_element_tagnames.js +2 -11
  48. package/scripts/eslint_rules/lib/ban_style_tags_in_lit_html.js +2 -11
  49. package/scripts/eslint_rules/lib/lit_html_data_as_type.js +2 -11
  50. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +1 -13
  51. package/scripts/eslint_rules/lib/lit_no_style_interpolation.js +2 -11
  52. package/scripts/eslint_rules/lib/static_tag_must_be_static_property.js +2 -11
  53. package/scripts/eslint_rules/lib/utils.js +29 -0
  54. package/scripts/eslint_rules/tests/.eslintrc.js +4 -0
  55. package/scripts/eslint_rules/tests/utils_test.js +40 -0
  56. package/front_end/panels/help/HelpImpl.ts +0 -141
  57. package/front_end/panels/help/ReleaseNoteText.ts +0 -1496
  58. package/front_end/panels/help/ReleaseNoteView.ts +0 -107
  59. package/front_end/panels/help/help-meta.ts +0 -145
  60. package/front_end/panels/help/help.ts +0 -13
  61. package/front_end/panels/help/releaseNote.css +0 -115
  62. package/scripts/build/rjsmin.py +0 -484
@@ -2276,6 +2276,7 @@ interface MeasureRequest<T> {
2276
2276
  */
2277
2277
  key?: any;
2278
2278
  }
2279
+ declare type AttrSource = Attrs | ((view: EditorView) => Attrs | null);
2279
2280
  /**
2280
2281
  View [plugins](https://codemirror.net/6/docs/ref/#view.ViewPlugin) are given instances of this
2281
2282
  class, which describe what happened, whenever the view is updated.
@@ -2539,6 +2540,7 @@ declare class EditorView {
2539
2540
  readonly contentDOM: HTMLElement;
2540
2541
  private announceDOM;
2541
2542
  private plugins;
2543
+ private pluginMap;
2542
2544
  private editorAttrs;
2543
2545
  private contentAttrs;
2544
2546
  private styleModules;
@@ -2960,12 +2962,12 @@ declare class EditorView {
2960
2962
  Facet that provides additional DOM attributes for the editor's
2961
2963
  editable DOM element.
2962
2964
  */
2963
- static contentAttributes: Facet<Attrs, Attrs>;
2965
+ static contentAttributes: Facet<AttrSource, readonly AttrSource[]>;
2964
2966
  /**
2965
2967
  Facet that provides DOM attributes for the editor's outer
2966
2968
  element.
2967
2969
  */
2968
- static editorAttributes: Facet<Attrs, Attrs>;
2970
+ static editorAttributes: Facet<AttrSource, readonly AttrSource[]>;
2969
2971
  /**
2970
2972
  An extension that enables line wrapping in the editor (by
2971
2973
  setting CSS `white-space` to `pre-wrap` in the content).
@@ -3157,10 +3159,10 @@ Configuration options.
3157
3159
  config?: SpecialCharConfig): Extension;
3158
3160
 
3159
3161
  /**
3160
- Returns a plugin that makes sure the content has a bottom margin
3161
- equivalent to the height of the editor, minus one line height, so
3162
- that every line in the document can be scrolled to the top of the
3163
- editor.
3162
+ Returns an extension that makes sure the content has a bottom
3163
+ margin equivalent to the height of the editor, minus one line
3164
+ height, so that every line in the document can be scrolled to the
3165
+ top of the editor.
3164
3166
 
3165
3167
  This is only meaningful when the editor is scrollable, and should
3166
3168
  not be enabled in editors that take the size of their content.
@@ -8,7 +8,7 @@
8
8
  "@codemirror/commands": "0.19.5",
9
9
  "@codemirror/comment": "0.19.0",
10
10
  "@codemirror/fold": "0.19.2",
11
- "@codemirror/gutter": "0.19.7",
11
+ "@codemirror/gutter": "0.19.8",
12
12
  "@codemirror/highlight": "0.19.6",
13
13
  "@codemirror/history": "0.19.0",
14
14
  "@codemirror/lang-cpp": "0.19.1",
@@ -22,7 +22,7 @@
22
22
  "@codemirror/lang-python": "0.19.2",
23
23
  "@codemirror/lang-wast": "0.19.0",
24
24
  "@codemirror/lang-xml": "0.19.2",
25
- "@codemirror/language": "0.19.6",
25
+ "@codemirror/language": "0.19.7",
26
26
  "@codemirror/legacy-modes": "0.19.0",
27
27
  "@codemirror/matchbrackets": "0.19.3",
28
28
  "@codemirror/panel": "0.19.0",
@@ -32,7 +32,7 @@
32
32
  "@codemirror/stream-parser": "0.19.2",
33
33
  "@codemirror/text": "0.19.5",
34
34
  "@codemirror/tooltip": "0.19.10",
35
- "@codemirror/view": "0.19.23",
35
+ "@codemirror/view": "0.19.25",
36
36
  "@lezer/common": "0.15.10",
37
37
  "@lezer/lr": "0.15.5",
38
38
  "@rollup/plugin-node-resolve": "^13.0.4",
@@ -27,9 +27,25 @@ export const markdownLinks = new Map<string, string>([
27
27
  ],
28
28
  ['issueQuirksModeDoctype', 'https://web.dev/doctype/'],
29
29
  ['sameSiteAndSameOrigin', 'https://web.dev/same-site-same-origin/'],
30
+ // Link URLs for deprecation issues (see blink::Deprecation)
31
+ ['https://xhr.spec.whatwg.org/', 'https://xhr.spec.whatwg.org/'],
32
+ ['https://goo.gl/rStTGz', 'https://goo.gl/rStTGz'],
33
+ ['https://webrtc.org/web-apis/chrome/unified-plan/', 'https://webrtc.org/web-apis/chrome/unified-plan/'],
34
+ [
35
+ 'https://developer.chrome.com/blog/enabling-shared-array-buffer/',
36
+ 'https://developer.chrome.com/blog/enabling-shared-array-buffer/',
37
+ ],
38
+ ['https://developer.chrome.com/docs/extensions/mv3/', 'https://developer.chrome.com/docs/extensions/mv3/'],
39
+ [
40
+ 'https://developer.chrome.com/blog/immutable-document-domain',
41
+ 'https://developer.chrome.com/blog/immutable-document-domain',
42
+ ],
30
43
  ]);
31
44
 
32
45
  export const getMarkdownLink = (key: string): string => {
46
+ if (/^https:\/\/www.chromestatus.com\/feature\/\d+$/.test(key)) {
47
+ return key;
48
+ }
33
49
  const link = markdownLinks.get(key);
34
50
  if (!link) {
35
51
  throw new Error(`Markdown link with key '${key}' is not available, please check MarkdownLinksMap.ts`);
@@ -402,13 +402,22 @@ async function completeExpressionGlobal(): Promise<CompletionSet> {
402
402
  return fetchNames;
403
403
  }
404
404
 
405
- export function isExpressionComplete(state: CodeMirror.EditorState): boolean {
406
- for (const cursor = CodeMirror.syntaxTree(state).cursor(); cursor.next();) {
407
- if (cursor.type.isError) {
408
- return false;
409
- }
410
- }
411
- return true;
405
+ export async function isExpressionComplete(expression: string): Promise<boolean> {
406
+ const currentExecutionContext = UI.Context.Context.instance().flavor(SDK.RuntimeModel.ExecutionContext);
407
+ if (!currentExecutionContext) {
408
+ return true;
409
+ }
410
+ const result =
411
+ await currentExecutionContext.runtimeModel.compileScript(expression, '', false, currentExecutionContext.id);
412
+ if (!result || !result.exceptionDetails || !result.exceptionDetails.exception) {
413
+ return true;
414
+ }
415
+ const description = result.exceptionDetails.exception.description;
416
+ if (description) {
417
+ return !description.startsWith('SyntaxError: Unexpected end of input') &&
418
+ !description.startsWith('SyntaxError: Unterminated template literal');
419
+ }
420
+ return false;
412
421
  }
413
422
 
414
423
  export function argumentHints(): CodeMirror.Extension {
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.948445"
56
+ "version": "1.0.950484"
57
57
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -27,7 +18,7 @@ module.exports = {
27
18
  create: function(context) {
28
19
  return {
29
20
  TaggedTemplateExpression(node) {
30
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
21
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
31
22
  if (!isLitHtmlCall) {
32
23
  return;
33
24
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -28,7 +19,7 @@ module.exports = {
28
19
  create: function(context) {
29
20
  return {
30
21
  TaggedTemplateExpression(node) {
31
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
22
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
32
23
  if (!isLitHtmlCall) {
33
24
  return;
34
25
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -27,7 +18,7 @@ module.exports = {
27
18
  create: function(context) {
28
19
  return {
29
20
  TaggedTemplateExpression(node) {
30
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
21
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
31
22
  if (!isLitHtmlCall) {
32
23
  return;
33
24
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -28,7 +19,7 @@ module.exports = {
28
19
  create: function(context) {
29
20
  return {
30
21
  TaggedTemplateExpression(node) {
31
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
22
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
32
23
  if (!isLitHtmlCall) {
33
24
  return;
34
25
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  function findIndexOfDataSetterUsageForNode(taggedTemplateExpression) {
18
9
  const dataSetterText = '.data=';
@@ -66,7 +57,7 @@ module.exports = {
66
57
  create: function(context) {
67
58
  return {
68
59
  TaggedTemplateExpression(node) {
69
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
60
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
70
61
  if (!isLitHtmlCall) {
71
62
  return;
72
63
  }
@@ -3,19 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpressionNode) {
7
- // Match LitHtml.html``
8
- const {tag} = taggedTemplateExpressionNode;
9
- if (!tag) {
10
- return false;
11
- }
12
- // Match LitHtml.html``
13
- const isLitHtmlDotHtmlCall = tag.object?.name === 'LitHtml' && tag.property?.name === 'html';
14
- // Match html`` (and guess that it's Lit)
15
- const isDestructuredHtmlCall = tag.type === 'Identifier' && tag.name === 'html';
16
-
17
- return isLitHtmlDotHtmlCall || isDestructuredHtmlCall;
18
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
19
7
 
20
8
  function templateElementPartStartsWithDoubleQuote(templateElementPartNode) {
21
9
  return templateElementPartNode.value.raw.startsWith('"');
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  function countOccurencesOfSubstring(string, subString) {
18
9
  let count = 0;
@@ -71,7 +62,7 @@ module.exports = {
71
62
  create: function(context) {
72
63
  return {
73
64
  TaggedTemplateExpression(node) {
74
- const isLitHtmlCall = isLitHtmlTemplateCall(node.tag);
65
+ const isLitHtmlCall = isLitHtmlTemplateCall(node);
75
66
  if (!isLitHtmlCall) {
76
67
  return;
77
68
  }
@@ -3,16 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
  'use strict';
5
5
 
6
- function isLitHtmlTemplateCall(taggedTemplateExpression) {
7
- if (taggedTemplateExpression.name) {
8
- // Call to html`` and we assume that html = LitHtml's html function.
9
- return taggedTemplateExpression.name === 'html';
10
- }
11
-
12
- // Match calls to LitHtml.html``
13
- return taggedTemplateExpression.object && taggedTemplateExpression.object.name === 'LitHtml' &&
14
- taggedTemplateExpression.property.name === 'html';
15
- }
6
+ const {isLitHtmlTemplateCall} = require('./utils.js');
16
7
 
17
8
  module.exports = {
18
9
  meta: {
@@ -52,7 +43,7 @@ module.exports = {
52
43
 
53
44
  return {
54
45
  TaggedTemplateExpression(node) {
55
- if (!isLitHtmlTemplateCall(node.tag)) {
46
+ if (!isLitHtmlTemplateCall(node)) {
56
47
  return;
57
48
  }
58
49
 
@@ -0,0 +1,29 @@
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
+ // This file contains utility functions that are commonly needed in ESLint
6
+ // rules. It does not contain any ESLint rules itself.
7
+
8
+ /**
9
+ * @param taggedTemplateExpressionNode - a TaggedTemplateExpression node from the AST of the parsed code.
10
+ * @returns {boolean} - `true` if the code matches LitHtml.html`` or html``, and false otherwise.
11
+ */
12
+ function isLitHtmlTemplateCall(taggedTemplateExpressionNode) {
13
+ if (taggedTemplateExpressionNode.type !== 'TaggedTemplateExpression') {
14
+ throw new Error('Node of type other than TaggedTemplateExpression passed to isLitHtmlTemplateCall.');
15
+ }
16
+ // Match LitHtml.html``
17
+ const {tag} = taggedTemplateExpressionNode;
18
+ if (!tag) {
19
+ return false;
20
+ }
21
+ // Match LitHtml.html``
22
+ const isLitHtmlDotHtmlCall = tag.object?.name === 'LitHtml' && tag.property?.name === 'html';
23
+ // Match html`` (and guess that it's Lit)
24
+ const isDestructuredHtmlCall = tag.type === 'Identifier' && tag.name === 'html';
25
+
26
+ return isLitHtmlDotHtmlCall || isDestructuredHtmlCall;
27
+ }
28
+
29
+ module.exports = {isLitHtmlTemplateCall};
@@ -10,5 +10,9 @@ rulesDirPlugin.RULES_DIR = path.join(__dirname, '..', 'lib');
10
10
  module.exports = {
11
11
  'rules': {
12
12
  'rulesdir/no_only_eslint_tests': 2,
13
+ // errors on it('test') with no body
14
+ 'mocha/no-pending-tests': 2,
15
+ // errors on {describe, it}.only
16
+ 'mocha/no-exclusive-tests': 2,
13
17
  }
14
18
  };
@@ -0,0 +1,40 @@
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
+ const parser = require('@typescript-eslint/parser');
6
+
7
+ const utils = require('../lib/utils.js');
8
+ const {assert} = require('chai');
9
+
10
+ describe('eslint utils', () => {
11
+ describe('isLitHtmlTemplateCall', () => {
12
+ it('returns true if the code is LitHtml.html``', () => {
13
+ const code = 'LitHtml.html`<span>foo</span>`';
14
+ const parsed = parser.parse(code);
15
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
16
+ assert.strictEqual(result, true);
17
+ });
18
+
19
+ it('returns true if the code is html``', () => {
20
+ const code = 'html`<span>foo</span>`';
21
+ const parsed = parser.parse(code);
22
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
23
+ assert.strictEqual(result, true);
24
+ });
25
+
26
+ it('returns false if the code is LitHtml.somethingElse``', () => {
27
+ const code = 'LitHtml.somethingElse`<span>foo</span>`';
28
+ const parsed = parser.parse(code);
29
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
30
+ assert.strictEqual(result, false);
31
+ });
32
+
33
+ it('returns false if the code is another tagged template function``', () => {
34
+ const code = 'notLitHtml`<span>foo</span>`';
35
+ const parsed = parser.parse(code);
36
+ const result = utils.isLitHtmlTemplateCall(parsed.body[0].expression);
37
+ assert.strictEqual(result, false);
38
+ });
39
+ });
40
+ });
@@ -1,141 +0,0 @@
1
- // Copyright 2017 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 * as Common from '../../core/common/common.js';
6
- import * as Host from '../../core/host/host.js';
7
- import * as UI from '../../ui/legacy/legacy.js';
8
-
9
- import {releaseNoteText} from './ReleaseNoteText.js';
10
-
11
- export const releaseVersionSeen = 'releaseNoteVersionSeen';
12
-
13
- export const releaseNoteViewId: string = 'release-note';
14
-
15
- let latestReleaseNoteInstance: ReleaseNote;
16
-
17
- let releaseNotesForTest: ReleaseNote[];
18
-
19
- let releaseNoteVersionSetting: Common.Settings.Setting<number>;
20
-
21
- export function latestReleaseNote(): ReleaseNote {
22
- if (!latestReleaseNoteInstance) {
23
- latestReleaseNoteInstance =
24
- (releaseNotesForTest || releaseNoteText).reduce((acc, note) => note.version > acc.version ? note : acc);
25
- }
26
- return latestReleaseNoteInstance;
27
- }
28
-
29
- export function showReleaseNoteIfNeeded(): void {
30
- const releaseNoteVersionSetting = Common.Settings.Settings.instance().createSetting(releaseVersionSeen, 0);
31
- const releaseNoteVersionSettingValue = releaseNoteVersionSetting.get();
32
- innerShowReleaseNoteIfNeeded(
33
- releaseNoteVersionSettingValue, latestReleaseNote().version,
34
- Common.Settings.Settings.instance().moduleSetting('help.show-release-note').get());
35
- }
36
-
37
- export function setReleaseNotesForTest(releaseNote: ReleaseNote[]): void {
38
- releaseNotesForTest = releaseNote;
39
- }
40
-
41
- export function getReleaseNoteVersionSetting(): Common.Settings.Setting<number> {
42
- if (!releaseNoteVersionSetting) {
43
- releaseNoteVersionSetting = Common.Settings.Settings.instance().createSetting(releaseVersionSeen, 0);
44
- }
45
- return releaseNoteVersionSetting;
46
- }
47
-
48
- export function innerShowReleaseNoteIfNeeded(
49
- lastSeenVersion: number, latestVersion: number, showReleaseNote: boolean): boolean {
50
- const releaseNoteVersionSetting = Common.Settings.Settings.instance().createSetting(releaseVersionSeen, 0);
51
- if (!lastSeenVersion) {
52
- releaseNoteVersionSetting.set(latestVersion);
53
- return false;
54
- }
55
- if (!showReleaseNote) {
56
- return false;
57
- }
58
- if (lastSeenVersion >= latestVersion) {
59
- return false;
60
- }
61
- releaseNoteVersionSetting.set(latestVersion);
62
- UI.ViewManager.ViewManager.instance().showView(releaseNoteViewId, true);
63
- return true;
64
- }
65
-
66
- let helpLateInitializationInstance: HelpLateInitialization;
67
- export class HelpLateInitialization implements Common.Runnable.Runnable {
68
- static instance(opts: {forceNew: boolean|null} = {forceNew: null}): HelpLateInitialization {
69
- const {forceNew} = opts;
70
- if (!helpLateInitializationInstance || forceNew) {
71
- helpLateInitializationInstance = new HelpLateInitialization();
72
- }
73
- return helpLateInitializationInstance;
74
- }
75
-
76
- async run(): Promise<void> {
77
- if (!Host.InspectorFrontendHost.isUnderTest()) {
78
- showReleaseNoteIfNeeded();
79
- }
80
- }
81
- }
82
-
83
- let releaseNotesActionDelegateInstance: ReleaseNotesActionDelegate;
84
- export class ReleaseNotesActionDelegate implements UI.ActionRegistration.ActionDelegate {
85
- handleAction(_context: UI.Context.Context, _actionId: string): boolean {
86
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(latestReleaseNote().link);
87
- return true;
88
- }
89
- static instance(opts: {forceNew: boolean|null} = {forceNew: null}): ReleaseNotesActionDelegate {
90
- const {forceNew} = opts;
91
- if (!releaseNotesActionDelegateInstance || forceNew) {
92
- releaseNotesActionDelegateInstance = new ReleaseNotesActionDelegate();
93
- }
94
-
95
- return releaseNotesActionDelegateInstance;
96
- }
97
- }
98
-
99
- let reportIssueActionDelegateInstance: ReportIssueActionDelegate;
100
- export class ReportIssueActionDelegate implements UI.ActionRegistration.ActionDelegate {
101
- handleAction(_context: UI.Context.Context, _actionId: string): boolean {
102
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(
103
- 'https://bugs.chromium.org/p/chromium/issues/entry?template=DevTools+issue');
104
- return true;
105
- }
106
- static instance(opts: {forceNew: boolean|null} = {forceNew: null}): ReportIssueActionDelegate {
107
- const {forceNew} = opts;
108
- if (!reportIssueActionDelegateInstance || forceNew) {
109
- reportIssueActionDelegateInstance = new ReportIssueActionDelegate();
110
- }
111
-
112
- return reportIssueActionDelegateInstance;
113
- }
114
- }
115
-
116
- let reportTranslationIssueActionDelegateInstance: ReportTranslationIssueActionDelegate;
117
- export class ReportTranslationIssueActionDelegate implements UI.ActionRegistration.ActionDelegate {
118
- handleAction(_context: UI.Context.Context, _actionId: string): boolean {
119
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab('https://goo.gle/devtools-translate');
120
- return true;
121
- }
122
- static instance(opts: {forceNew: boolean|null} = {forceNew: null}): ReportTranslationIssueActionDelegate {
123
- const {forceNew} = opts;
124
- if (!reportTranslationIssueActionDelegateInstance || forceNew) {
125
- reportTranslationIssueActionDelegateInstance = new ReportTranslationIssueActionDelegate();
126
- }
127
-
128
- return reportTranslationIssueActionDelegateInstance;
129
- }
130
- }
131
- export interface ReleaseNoteHighlight {
132
- title: string;
133
- subtitle: string;
134
- link: string;
135
- }
136
- export interface ReleaseNote {
137
- version: number;
138
- header: string;
139
- highlights: {title: string, subtitle: string, link: string}[];
140
- link: string;
141
- }