chrome-devtools-frontend 1.0.939473 → 1.0.941208

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 (69) hide show
  1. package/config/gni/all_devtools_files.gni +0 -7
  2. package/config/gni/devtools_grd_files.gni +7 -1
  3. package/config/gni/devtools_image_files.gni +1 -0
  4. package/docs/triage_guidelines.md +3 -3
  5. package/front_end/.eslintrc.js +1 -0
  6. package/front_end/Images/src/feedback_button_icon.svg +3 -0
  7. package/front_end/Tests.js +14 -0
  8. package/front_end/core/host/InspectorFrontendHostAPI.ts +5 -0
  9. package/front_end/core/host/UserMetrics.ts +71 -0
  10. package/front_end/core/i18n/locales/en-US.json +30 -9
  11. package/front_end/core/i18n/locales/en-XL.json +30 -9
  12. package/front_end/core/sdk/DOMDebuggerModel.ts +18 -1
  13. package/front_end/devtools_compatibility.js +5 -0
  14. package/front_end/entrypoints/main/MainImpl.ts +6 -3
  15. package/front_end/entrypoints/main/main-meta.ts +1 -0
  16. package/front_end/entrypoints/shell/shell.json +0 -1
  17. package/front_end/global_typings/global_defs.d.ts +5 -0
  18. package/front_end/legacy_test_runner/console_test_runner/console_test_runner.js +14 -2
  19. package/front_end/legacy_test_runner/test_runner/TestRunner.js +9 -0
  20. package/front_end/models/logs/LogManager.ts +1 -0
  21. package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +1 -1
  22. package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -1
  23. package/front_end/panels/application/ApplicationPanelCacheSection.ts +1 -1
  24. package/front_end/panels/application/BackForwardCacheView.ts +24 -24
  25. package/front_end/panels/application/module.json +0 -1
  26. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +6 -8
  27. package/front_end/panels/css_overview/components/cssOverviewStartView.css +7 -1
  28. package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
  29. package/front_end/panels/issues/IssueKindView.ts +22 -4
  30. package/front_end/panels/layer_viewer/module.json +1 -2
  31. package/front_end/panels/lighthouse/LighthouseController.ts +10 -33
  32. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -1
  33. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +2 -1
  34. package/front_end/panels/media/module.json +1 -2
  35. package/front_end/panels/network/NetworkLogView.ts +3 -0
  36. package/front_end/panels/network/module.json +0 -1
  37. package/front_end/panels/profiler/module.json +1 -2
  38. package/front_end/panels/settings/components/SyncSection.ts +25 -4
  39. package/front_end/panels/sources/SourcesPanel.ts +9 -5
  40. package/front_end/panels/timeline/module.json +0 -1
  41. package/front_end/third_party/codemirror.next/bundle-tsconfig.json +1 -1
  42. package/front_end/ui/components/buttons/Button.ts +11 -0
  43. package/front_end/ui/components/buttons/button.css +4 -0
  44. package/front_end/ui/components/docs/button/basic.ts +10 -0
  45. package/front_end/ui/components/docs/panel_feedback/basic.html +25 -0
  46. package/front_end/ui/components/docs/panel_feedback/basic.ts +20 -0
  47. package/front_end/ui/components/docs/panel_feedback/button.html +25 -0
  48. package/front_end/ui/components/docs/panel_feedback/button.ts +18 -0
  49. package/front_end/ui/components/helpers/get-stylesheet.ts +1 -0
  50. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +67 -0
  51. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +100 -0
  52. package/front_end/ui/components/panel_feedback/panelFeedback.css +76 -0
  53. package/front_end/ui/components/panel_feedback/panel_feedback.ts +6 -0
  54. package/front_end/ui/components/report_view/reportValue.css +1 -0
  55. package/front_end/ui/legacy/Widget.ts +1 -1
  56. package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +2 -1
  57. package/front_end/ui/legacy/components/perf_ui/FilmStripView.ts +3 -1
  58. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +2 -1
  59. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
  60. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +3 -1
  61. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +2 -1
  62. package/front_end/ui/legacy/softContextMenu.css +1 -0
  63. package/front_end/ui/legacy/utils/append-style.ts +9 -4
  64. package/package.json +2 -2
  65. package/scripts/build/generate_css_js_files.js +23 -9
  66. package/scripts/build/ninja/generate_css.gni +10 -1
  67. package/scripts/eslint_rules/lib/check_css_import.js +2 -2
  68. package/scripts/eslint_rules/tests/check_css_import_test.js +12 -0
  69. package/front_end/ui/legacy/components/perf_ui/module.json +0 -13
@@ -17,67 +17,67 @@ import backForwardCacheViewStyles from './backForwardCacheView.css.js';
17
17
 
18
18
  const UIStrings = {
19
19
  /**
20
- * @description Title text in Back-forward Cache view of the Application panel
20
+ * @description Title text in Back-Forward Cache view of the Application panel
21
21
  */
22
22
  mainFrame: 'Main Frame',
23
23
  /**
24
- * @description Title text in Back-forward Cache view of the Application panel
24
+ * @description Title text in Back-Forward Cache view of the Application panel
25
25
  */
26
- backForwardCacheTitle: 'Back-forward Cache',
26
+ backForwardCacheTitle: 'Back-Forward Cache',
27
27
  /**
28
28
  * @description Status text for the status of the main frame
29
29
  */
30
30
  unavailable: 'unavailable',
31
31
  /**
32
- * @description Entry name text in the Back-forward Cache view of the Application panel
32
+ * @description Entry name text in the Back-Forward Cache view of the Application panel
33
33
  */
34
34
  url: 'URL',
35
35
  /**
36
- * @description Entry name text in the Back-forward Cache view of the Application panel
36
+ * @description Entry name text in the Back-Forward Cache view of the Application panel
37
37
  */
38
- bfcacheStatus: 'Back-forward Cache Status',
38
+ bfcacheStatus: 'Back-Forward Cache Status',
39
39
  /**
40
- * @description Status text for the status of the back-forward cache status
40
+ * @description Status text for the status of the Back-Forward Cache status
41
41
  */
42
42
  unknown: 'unknown',
43
43
  /**
44
- * @description Status text for the status of the back-forward cache status indicating that
45
- * the back-forward cache was not used and a normal navigation occured instead.
44
+ * @description Status text for the status of the Back-Forward Cache status indicating that
45
+ * the Back-Forward Cache was not used and a normal navigation occured instead.
46
46
  */
47
- normalNavigation: 'Normal navigation (Not restored from back-forward cache)',
47
+ normalNavigation: 'Normal navigation (Not restored from Back-Forward Cache)',
48
48
  /**
49
- * @description Status text for the status of the back-forward cache status indicating that
50
- * the back-forward cache was used to restore the page instead of reloading it.
49
+ * @description Status text for the status of the Back-Forward Cache status indicating that
50
+ * the Back-Forward Cache was used to restore the page instead of reloading it.
51
51
  */
52
- restoredFromBFCache: 'Restored from back-forward cache',
52
+ restoredFromBFCache: 'Restored from Back-Forward Cache',
53
53
  /**
54
54
  * @description Label for a list of reasons which prevent the page from being eligible for
55
- * back-forward cache. These reasons are actionable i.e. they can be cleaned up to make the
56
- * page eligible for back-forward cache.
55
+ * Back-Forward Cache. These reasons are actionable i.e. they can be cleaned up to make the
56
+ * page eligible for Back-Forward Cache.
57
57
  */
58
58
  pageSupportNeeded: 'Actionable',
59
59
  /**
60
60
  * @description Explanation for actionable items which prevent the page from being eligible
61
- * for back-forward cache.
61
+ * for Back-Forward Cache.
62
62
  */
63
63
  pageSupportNeededExplanation:
64
- 'These reasons are actionable i.e. they can be cleaned up to make the page eligible for back-forward cache.',
64
+ 'These reasons are actionable i.e. they can be cleaned up to make the page eligible for Back-Forward Cache.',
65
65
  /**
66
66
  * @description Label for a list of reasons which prevent the page from being eligible for
67
- * back-forward cache. These reasons are circumstantial / not actionable i.e. they cannot be
68
- * cleaned up by developers to make the page eligible for back-forward cache.
67
+ * Back-Forward Cache. These reasons are circumstantial / not actionable i.e. they cannot be
68
+ * cleaned up by developers to make the page eligible for Back-Forward Cache.
69
69
  */
70
70
  circumstantial: 'Not Actionable',
71
71
  /**
72
72
  * @description Explanation for circumstantial/non-actionable items which prevent the page from being eligible
73
- * for back-forward cache.
73
+ * for Back-Forward Cache.
74
74
  */
75
75
  circumstantialExplanation:
76
76
  'These reasons are not actionable i.e. caching was prevented by something outside of the direct control of the page.',
77
77
  /**
78
78
  * @description Label for a list of reasons which prevent the page from being eligible for
79
- * back-forward cache. These reasons are pending support by chrome i.e. in a future version
80
- * of chrome they will not prevent back-forward cache usage anymore.
79
+ * Back-Forward Cache. These reasons are pending support by chrome i.e. in a future version
80
+ * of chrome they will not prevent Back-Forward Cache usage anymore.
81
81
  */
82
82
  supportPending: 'Pending Support',
83
83
  /**
@@ -86,10 +86,10 @@ const UIStrings = {
86
86
  runTest: 'Run Test',
87
87
  /**
88
88
  * @description Explanation for 'pending support' items which prevent the page from being eligible
89
- * for back-forward cache.
89
+ * for Back-Forward Cache.
90
90
  */
91
91
  supportPendingExplanation:
92
- 'Chrome support for these reasons is pending i.e. they will not prevent the page from being eligible for back-forward cache in a future version of Chrome.',
92
+ 'Chrome support for these reasons is pending i.e. they will not prevent the page from being eligible for Back-Forward Cache in a future version of Chrome.',
93
93
  };
94
94
  const str_ = i18n.i18n.registerUIStrings('panels/application/BackForwardCacheView.ts', UIStrings);
95
95
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "dependencies": [
3
3
  "ui/legacy",
4
- "ui/legacy/components/perf_ui",
5
4
  "panels/network"
6
5
  ]
7
6
  }
@@ -6,6 +6,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
6
6
  import * as Buttons from '../../../ui/components/buttons/buttons.js';
7
7
  import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
8
8
  import * as IconButton from '../../../ui/components/icon_button/icon_button.js';
9
+ import * as Legacy from '../../../ui/legacy/legacy.js';
9
10
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
11
 
11
12
  import cssOverviewStartViewStyles from './cssOverviewStartView.css.js';
@@ -76,14 +77,12 @@ export class OverviewStartRequestedEvent extends Event {
76
77
  export class CSSOverviewStartView extends HTMLElement {
77
78
  static readonly litTagName = LitHtml.literal`devtools-css-overview-start-view`;
78
79
  readonly #shadow = this.attachShadow({mode: 'open'});
79
- #feedbackLink: HTMLAnchorElement;
80
+ #feedbackLink: HTMLElement;
80
81
 
81
82
  constructor() {
82
83
  super();
83
- this.#feedbackLink = document.createElement('a');
84
- this.#feedbackLink.href = FEEDBACK_LINK;
85
- this.#feedbackLink.target = '_blank';
86
- this.#feedbackLink.innerText = i18nString(UIStrings.feedbackInline);
84
+ this.#feedbackLink =
85
+ Legacy.XLink.XLink.create(FEEDBACK_LINK, i18nString(UIStrings.feedbackInline), 'devtools-link');
87
86
  }
88
87
 
89
88
  connectedCallback(): void {
@@ -106,7 +105,6 @@ export class CSSOverviewStartView extends HTMLElement {
106
105
  private render(): void {
107
106
  // Disabled until https://crbug.com/1079231 is fixed.
108
107
  // clang-format off
109
- // eslint-disable-next-line rulesdir/ban_a_tags_in_lit_html
110
108
  render(html`
111
109
  <div class="css-overview-start-view">
112
110
  <h1 class="summary-header">${i18nString(UIStrings.identifyCSSImprovements)}</h1>
@@ -144,11 +142,11 @@ export class CSSOverviewStartView extends HTMLElement {
144
142
  </div>
145
143
  <div>
146
144
  <h1 class="video-doc-header">${i18nString(UIStrings.videoAndDocumentation)}</h1>
147
- <a href=${DOC_LINK} target="_blank">${i18nString(UIStrings.quickStartWithCSSOverview)}</a>
145
+ <x-link class="devtools-link" href=${DOC_LINK}>${i18nString(UIStrings.quickStartWithCSSOverview)}</x-link>
148
146
  </div>
149
147
  </div>
150
148
  </section>
151
- <a class="feedback-standalone" href=${FEEDBACK_LINK} target="_blank">${i18nString(UIStrings.feedbackStandalone)}</a>
149
+ <x-link class="feedback-standalone" href=${FEEDBACK_LINK}>${i18nString(UIStrings.feedbackStandalone)}</x-link>
152
150
  </div>
153
151
  `, this.#shadow, {
154
152
  host: this,
@@ -95,6 +95,12 @@ h1 {
95
95
  margin-bottom: 24px;
96
96
  }
97
97
 
98
+ .feedback-prompt .devtools-link {
99
+ color: -webkit-link;
100
+ cursor: pointer;
101
+ text-decoration: underline;
102
+ }
103
+
98
104
  .resources {
99
105
  display: flex;
100
106
  flex-direction: row;
@@ -125,7 +131,7 @@ h1 {
125
131
  font-weight: bold;
126
132
  }
127
133
 
128
- .resources a {
134
+ .resources .devtools-link {
129
135
  font-size: 14px;
130
136
  line-height: 22px;
131
137
  letter-spacing: 0.04em;
@@ -1827,7 +1827,8 @@ export class StylePropertiesSection {
1827
1827
  containerElement.data = {
1828
1828
  container: ElementsComponents.Helper.legacyNodeToElementsComponentsNode(container.containerNode),
1829
1829
  queryName: containerQuery.name,
1830
- onContainerLinkClick: (): void => {
1830
+ onContainerLinkClick: (event): void => {
1831
+ event.preventDefault();
1831
1832
  ElementsPanel.instance().revealAndSelectNode(container.containerNode, true, true);
1832
1833
  container.containerNode.scrollIntoView();
1833
1834
  },
@@ -14,10 +14,17 @@ import * as Components from './components/components.js';
14
14
 
15
15
  const UIStrings = {
16
16
  /**
17
- * @description Menu entry for hiding all current issues belonging to a particular kind.
18
- * @example {Page Errors} PH1
17
+ * @description Menu entry for hiding all current Page Errors.
19
18
  */
20
- hideAllCurrent: 'Hide all current {PH1}',
19
+ hideAllCurrentPageErrors: 'Hide all current Page Errors',
20
+ /**
21
+ * @description Menu entry for hiding all current Breaking Changes.
22
+ */
23
+ hideAllCurrentBreakingChanges: 'Hide all current Breaking Changes',
24
+ /**
25
+ * @description Menu entry for hiding all current Page Errors.
26
+ */
27
+ hideAllCurrentImprovements: 'Hide all current Improvements',
21
28
  };
22
29
  const str_ = i18n.i18n.registerUIStrings('panels/issues/IssueKindView.ts', UIStrings);
23
30
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -70,6 +77,17 @@ export class IssueKindView extends UI.TreeOutline.TreeElement {
70
77
  return this.kind;
71
78
  }
72
79
 
80
+ getHideAllCurrentKindString(): Common.UIString.LocalizedString {
81
+ switch (this.kind) {
82
+ case IssuesManager.Issue.IssueKind.PageError:
83
+ return i18nString(UIStrings.hideAllCurrentPageErrors);
84
+ case IssuesManager.Issue.IssueKind.Improvement:
85
+ return i18nString(UIStrings.hideAllCurrentImprovements);
86
+ case IssuesManager.Issue.IssueKind.BreakingChange:
87
+ return i18nString(UIStrings.hideAllCurrentBreakingChanges);
88
+ }
89
+ }
90
+
73
91
  private appendHeader(): void {
74
92
  const header = document.createElement('div');
75
93
  header.classList.add('header');
@@ -93,7 +111,7 @@ export class IssueKindView extends UI.TreeOutline.TreeElement {
93
111
  const hideAvailableIssuesBtn = new Components.HideIssuesMenu.HideIssuesMenu();
94
112
  hideAvailableIssuesBtn.classList.add('hide-available-issues');
95
113
  hideAvailableIssuesBtn.data = {
96
- menuItemLabel: i18nString(UIStrings.hideAllCurrent, {PH1: IssuesManager.Issue.getIssueKindName(this.kind)}),
114
+ menuItemLabel: this.getHideAllCurrentKindString(),
97
115
  menuItemAction: (): void => {
98
116
  const setting = IssuesManager.IssuesManager.getHideIssueByCodeSetting();
99
117
  const values = setting.get();
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -262,42 +262,19 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
262
262
  return '';
263
263
  }
264
264
  const mainTarget = this.manager.target();
265
- const runtimeModel = mainTarget.model(SDK.RuntimeModel.RuntimeModel);
266
- const executionContext = runtimeModel && runtimeModel.defaultExecutionContext();
267
- let inspectedURL = mainTarget.inspectedURL();
268
- if (!executionContext) {
269
- return inspectedURL;
270
- }
265
+ // target.inspectedURL is reliably populated, however it lacks any url #hash
266
+ const inspectedURL = mainTarget.inspectedURL();
271
267
 
272
- // Evaluate location.href for a more specific URL than inspectedURL provides so that SPA hash navigation routes
273
- // will be respected and audited.
274
- try {
275
- const result = await executionContext.evaluate(
276
- {
277
- expression: 'window.location.href',
278
- objectGroup: 'lighthouse',
279
- includeCommandLineAPI: false,
280
- silent: false,
281
- returnByValue: true,
282
- generatePreview: false,
283
- allowUnsafeEvalBlockedByCSP: undefined,
284
- disableBreaks: undefined,
285
- replMode: undefined,
286
- throwOnSideEffect: undefined,
287
- timeout: undefined,
288
- },
289
- /* userGesture */ false, /* awaitPromise */ false);
290
- if ((!('exceptionDetails' in result) || !result.exceptionDetails) && 'object' in result && result.object) {
291
- if (result.object.value) {
292
- inspectedURL = result.object.value;
293
- }
294
- result.object.release();
295
- }
296
- } catch (err) {
297
- console.error(err);
268
+ // We'll use the navigationHistory to acquire the current URL including hash
269
+ const resourceTreeModel = mainTarget.model(SDK.ResourceTreeModel.ResourceTreeModel);
270
+ const navHistory = resourceTreeModel && await resourceTreeModel.navigationHistory();
271
+ if (!resourceTreeModel || !navHistory) {
272
+ return inspectedURL;
298
273
  }
299
274
 
300
- return inspectedURL;
275
+ const {currentIndex, entries} = navHistory;
276
+ const navigationEntry = entries[currentIndex];
277
+ return navigationEntry.url;
301
278
  }
302
279
 
303
280
  getFlags(): {internalDisableDeviceScreenEmulation: boolean, emulatedFormFactor: (string|undefined)} {
@@ -263,7 +263,8 @@ export class LighthousePanel extends UI.Panel.Panel {
263
263
 
264
264
  const reportContainer = this.auditResultsElement.createChild('div', 'lh-vars lh-root lh-devtools');
265
265
 
266
- const dom = new LighthouseReport.DOM(this.auditResultsElement.ownerDocument as Document);
266
+ // @ts-ignore: Second argument will soon be required.
267
+ const dom = new LighthouseReport.DOM(this.auditResultsElement.ownerDocument as Document, reportContainer);
267
268
  const renderer = new LighthouseReportRenderer(dom) as LighthouseReport.ReportRenderer;
268
269
 
269
270
  const el = renderer.renderReport(lighthouseResult, reportContainer);
@@ -221,8 +221,9 @@ export class LighthouseReportUIFeatures extends LighthouseReport.ReportUIFeature
221
221
  }
222
222
 
223
223
  getDocument(): Document {
224
- return this._document;
224
+ return this._dom.document();
225
225
  }
226
+
226
227
  resetUIState(): void {
227
228
  this._resetUIState();
228
229
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -1548,6 +1548,8 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
1548
1548
  footerSection.appendItem(i18nString(UIStrings.copyAllAsCurlCmd), this.copyAllCurlCommand.bind(this, 'win'));
1549
1549
  footerSection.appendItem(i18nString(UIStrings.copyAllAsCurlBash), this.copyAllCurlCommand.bind(this, 'unix'));
1550
1550
  } else {
1551
+ footerSection.appendItem(
1552
+ i18nString(UIStrings.copyAsPowershell), this.copyPowerShellCommand.bind(this, request), disableIfBlob);
1551
1553
  footerSection.appendItem(
1552
1554
  i18nString(UIStrings.copyAsFetch), this.copyFetchCall.bind(this, request, FetchStyle.Browser),
1553
1555
  disableIfBlob);
@@ -1556,6 +1558,7 @@ export class NetworkLogView extends Common.ObjectWrapper.eventMixin<EventTypes,
1556
1558
  disableIfBlob);
1557
1559
  footerSection.appendItem(
1558
1560
  i18nString(UIStrings.copyAsCurl), this.copyCurlCommand.bind(this, request, 'unix'), disableIfBlob);
1561
+ footerSection.appendItem(i18nString(UIStrings.copyAllAsPowershell), this.copyAllPowerShellCommand.bind(this));
1559
1562
  footerSection.appendItem(
1560
1563
  i18nString(UIStrings.copyAllAsFetch), this.copyAllFetchCall.bind(this, FetchStyle.Browser));
1561
1564
  footerSection.appendItem(
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy/components/perf_ui",
4
3
  "ui/legacy"
5
4
  ]
6
5
  }
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "dependencies": [
3
- "ui/legacy",
4
- "ui/legacy/components/perf_ui"
3
+ "ui/legacy"
5
4
  ]
6
5
  }
@@ -8,6 +8,7 @@ import type * as Host from '../../../core/host/host.js';
8
8
  import * as i18n from '../../../core/i18n/i18n.js';
9
9
  import * as LitHtml from '../../../ui/lit-html/lit-html.js';
10
10
  import * as Settings from '../../../ui/components/settings/settings.js';
11
+ import * as SDK from '../../../core/sdk/sdk.js';
11
12
 
12
13
  import syncSectionStyles from './syncSection.css.js';
13
14
 
@@ -81,21 +82,31 @@ export class SyncSection extends HTMLElement {
81
82
  }
82
83
  }
83
84
 
85
+ /* x-link doesn't work with custom click/keydown handlers */
86
+ /* eslint-disable rulesdir/ban_a_tags_in_lit_html */
87
+
84
88
  function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.SyncInformation): LitHtml.TemplateResult {
85
89
  if (!syncInfo.isSyncActive) {
90
+ const link = 'chrome://settings/syncSetup';
91
+ // Disabled until https://crbug.com/1079231 is fixed.
92
+ // clang-format off
86
93
  return LitHtml.html`
87
94
  <span class="warning">
88
- ${i18nString(UIStrings.syncDisabled)} <x-link href="chrome://settings/syncSetup" class="link">${
89
- i18nString(UIStrings.settings)}</x-link>
95
+ ${i18nString(UIStrings.syncDisabled)} <a href="${link}" class="link" target="_blank"
96
+ @click=${(e: Event): void => openSettingsTab(link, e)}
97
+ @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
90
98
  </span>`;
99
+ // clang-format on
91
100
  }
92
101
  if (!syncInfo.arePreferencesSynced) {
102
+ const link = 'chrome://settings/syncSetup/advanced';
93
103
  // Disabled until https://crbug.com/1079231 is fixed.
94
104
  // clang-format off
95
105
  return LitHtml.html`
96
106
  <span class="warning">
97
- ${i18nString(UIStrings.preferencesSyncDisabled)} <x-link href="chrome://settings/syncSetup/advanced" class="link">${
98
- i18nString(UIStrings.settings)}</x-link>
107
+ ${i18nString(UIStrings.preferencesSyncDisabled)} <a href="${link}" class="link" target="_blank"
108
+ @click=${(e: Event): void => openSettingsTab(link, e)}
109
+ @keydown=${(e: Event): void => openSettingsTab(link, e)}>${i18nString(UIStrings.settings)}</x-link>
99
110
  </span>`;
100
111
  // clang-format on
101
112
  }
@@ -109,6 +120,16 @@ function renderAccountInfoOrWarning(syncInfo: Host.InspectorFrontendHostAPI.Sync
109
120
  </div>`;
110
121
  }
111
122
 
123
+ // Navigating to a chrome:// link via a normal anchor doesn't work, so we "navigate"
124
+ // there using CDP.
125
+ function openSettingsTab(url: string, event: Event): void {
126
+ if (event.type === 'click' || (event.type === 'keydown' && self.isEnterOrSpaceKey(event))) {
127
+ const mainTarget = SDK.TargetManager.TargetManager.instance().mainTarget();
128
+ mainTarget && mainTarget.targetAgent().invoke_createTarget({url});
129
+ event.consume(true);
130
+ }
131
+ }
132
+
112
133
  ComponentHelpers.CustomElements.defineComponent('devtools-sync-section', SyncSection);
113
134
 
114
135
  declare global {
@@ -424,7 +424,8 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
424
424
  private debuggerPaused(event: Common.EventTarget.EventTargetEvent<SDK.DebuggerModel.DebuggerModel>): void {
425
425
  const debuggerModel = event.data;
426
426
  const details = debuggerModel.debuggerPausedDetails();
427
- if (!this.pausedInternal) {
427
+ if (!this.pausedInternal &&
428
+ Common.Settings.Settings.instance().moduleSetting('autoFocusOnDebuggerPausedEnabled').get()) {
428
429
  this.setAsCurrentPanel();
429
430
  }
430
431
 
@@ -986,6 +987,9 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
986
987
  }
987
988
 
988
989
  private revealDebuggerSidebar(): void {
990
+ if (!Common.Settings.Settings.instance().moduleSetting('autoFocusOnDebuggerPausedEnabled').get()) {
991
+ return;
992
+ }
989
993
  this.setAsCurrentPanel();
990
994
  this.splitWidget.showBoth(true);
991
995
  }
@@ -1083,10 +1087,7 @@ export class SourcesPanel extends UI.Panel.Panel implements UI.ContextMenu.Provi
1083
1087
  }
1084
1088
 
1085
1089
  setAsCurrentPanel(): Promise<void> {
1086
- if (Common.Settings.Settings.instance().moduleSetting('autoFocusOnDebuggerPausedEnabled').get()) {
1087
- return UI.ViewManager.ViewManager.instance().showView('sources');
1088
- }
1089
- return Promise.resolve();
1090
+ return UI.ViewManager.ViewManager.instance().showView('sources');
1090
1091
  }
1091
1092
 
1092
1093
  private extensionSidebarPaneAdded(
@@ -1207,6 +1208,9 @@ export class DebuggerPausedDetailsRevealer implements Common.Revealer.Revealer {
1207
1208
  }
1208
1209
 
1209
1210
  reveal(_object: Object): Promise<void> {
1211
+ if (!Common.Settings.Settings.instance().moduleSetting('autoFocusOnDebuggerPausedEnabled').get()) {
1212
+ return Promise.resolve();
1213
+ }
1210
1214
  return SourcesPanel.instance().setAsCurrentPanel();
1211
1215
  }
1212
1216
  }
@@ -2,7 +2,6 @@
2
2
  "dependencies": [
3
3
  "ui/legacy",
4
4
  "panels/layer_viewer",
5
- "ui/legacy/components/perf_ui",
6
5
  "panels/profiler"
7
6
  ]
8
7
  }
@@ -16,6 +16,6 @@
16
16
  "chunk/php.js",
17
17
  "chunk/python.js",
18
18
  "chunk/wast.js",
19
- "chunk/xml.js",
19
+ "chunk/xml.js"
20
20
  ]
21
21
  }
@@ -30,6 +30,7 @@ interface ButtonState {
30
30
  variant?: Variant;
31
31
  size?: Size;
32
32
  disabled: boolean;
33
+ active: boolean;
33
34
  }
34
35
 
35
36
  export type ButtonData = {
@@ -37,11 +38,13 @@ export type ButtonData = {
37
38
  iconUrl: string,
38
39
  size?: Size,
39
40
  disabled?: boolean,
41
+ active?: boolean,
40
42
  }|{
41
43
  variant: Variant.PRIMARY | Variant.SECONDARY,
42
44
  iconUrl?: string,
43
45
  size?: Size,
44
46
  disabled?: boolean,
47
+ active?: boolean,
45
48
  };
46
49
 
47
50
  export class Button extends HTMLElement {
@@ -52,6 +55,7 @@ export class Button extends HTMLElement {
52
55
  private readonly props: ButtonState = {
53
56
  size: Size.MEDIUM,
54
57
  disabled: false,
58
+ active: false,
55
59
  };
56
60
  private isEmpty = true;
57
61
 
@@ -69,6 +73,7 @@ export class Button extends HTMLElement {
69
73
  this.props.variant = data.variant;
70
74
  this.props.iconUrl = data.iconUrl;
71
75
  this.props.size = data.size || Size.MEDIUM;
76
+ this.props.active = Boolean(data.active);
72
77
  this.setDisabledProperty(data.disabled || false);
73
78
  ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
74
79
  }
@@ -93,6 +98,11 @@ export class Button extends HTMLElement {
93
98
  ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
94
99
  }
95
100
 
101
+ set active(active: boolean) {
102
+ this.props.active = active;
103
+ ComponentHelpers.ScheduledRender.scheduleRender(this, this.boundRender);
104
+ }
105
+
96
106
  private setDisabledProperty(disabled: boolean): void {
97
107
  this.props.disabled = disabled;
98
108
  this.toggleAttribute('disabled', disabled);
@@ -140,6 +150,7 @@ export class Button extends HTMLElement {
140
150
  'text-with-icon': Boolean(this.props.iconUrl) && !this.isEmpty,
141
151
  'only-icon': Boolean(this.props.iconUrl) && this.isEmpty,
142
152
  small: Boolean(this.props.size === Size.SMALL),
153
+ active: this.props.active,
143
154
  };
144
155
  // clang-format off
145
156
  LitHtml.render(
@@ -80,6 +80,7 @@ button.primary:hover {
80
80
  border: 1px solid var(--color-button-primary-background-hovering);
81
81
  }
82
82
 
83
+ button.primary.active,
83
84
  button.primary:active {
84
85
  background: var(--color-button-primary-background-pressed);
85
86
  border: 1px solid var(--color-button-primary-background-pressed);
@@ -103,6 +104,7 @@ button.secondary:hover {
103
104
  background: var(--color-button-secondary-background-hovering);
104
105
  }
105
106
 
107
+ button.secondary.active,
106
108
  button.secondary:active {
107
109
  background: var(--color-button-secondary-background-pressed);
108
110
  border: 1px solid var(--color-button-secondary-background-pressed);
@@ -120,6 +122,7 @@ button.secondary:disabled:hover {
120
122
  cursor: not-allowed;
121
123
  }
122
124
 
125
+ button.secondary.active:focus-visible,
123
126
  button.secondary:active:focus-visible {
124
127
  border: 1px solid var(--color-button-secondary-background-pressed);
125
128
  }
@@ -128,6 +131,7 @@ button.toolbar:hover {
128
131
  background-color: var(--color-button-secondary-background-hovering);
129
132
  }
130
133
 
134
+ button.toolbar.active,
131
135
  button.toolbar:active {
132
136
  background-color: var(--color-button-secondary-background-pressed);
133
137
  }
@@ -32,6 +32,16 @@ primaryButton.innerText = 'Click me';
32
32
  primaryButton.onclick = () => alert('clicked');
33
33
  appendButton(primaryButton);
34
34
 
35
+ // Primary (forced active)
36
+ const forcedActive = new Buttons.Button.Button();
37
+ forcedActive.data = {
38
+ variant: Buttons.Button.Variant.PRIMARY,
39
+ active: true,
40
+ };
41
+ forcedActive.innerText = 'Forced active';
42
+ forcedActive.onclick = () => alert('clicked');
43
+ appendButton(forcedActive);
44
+
35
45
  // Secondary
36
46
  const secondaryButton = new Buttons.Button.Button();
37
47
  secondaryButton.innerText = 'Click me';
@@ -0,0 +1,25 @@
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
+ <!DOCTYPE html>
7
+ <html>
8
+ <head>
9
+ <meta charset="UTF-8" />
10
+ <meta name="viewport" content="width=device-width" />
11
+ <title>Panel Feedback</title>
12
+ <style>
13
+ #container {
14
+ width: 80%;
15
+ border: 1px solid black;
16
+ padding: 10px;
17
+ }
18
+ </style>
19
+ </head>
20
+ <body>
21
+ <div id="container">
22
+ </div>
23
+ <script type="module" src="./basic.js"></script>
24
+ </body>
25
+ </html>
@@ -0,0 +1,20 @@
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 * as FrontendHelpers from '../../../../../test/unittests/front_end/helpers/EnvironmentHelpers.js';
6
+ import * as PanelFeedback from '../../../components/panel_feedback/panel_feedback.js';
7
+ import * as ComponentHelpers from '../../helpers/helpers.js';
8
+
9
+ await ComponentHelpers.ComponentServerSetup.setup();
10
+ await FrontendHelpers.initializeGlobalVars();
11
+
12
+ const component = new PanelFeedback.PanelFeedback.PanelFeedback();
13
+
14
+ component.data = {
15
+ feedbackUrl: 'https://www.example.com',
16
+ quickStartUrl: 'https://www.example.com',
17
+ quickStartLinkText: 'Quick start: get started with the Recorder',
18
+ };
19
+
20
+ document.getElementById('container')?.appendChild(component);