chrome-devtools-frontend 1.0.951864 → 1.0.952784

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 (175) hide show
  1. package/config/gni/devtools_grd_files.gni +3 -0
  2. package/front_end/.eslintrc.js +6 -0
  3. package/front_end/core/host/UserMetrics.ts +2 -1
  4. package/front_end/core/i18n/locales/en-US.json +3 -0
  5. package/front_end/core/i18n/locales/en-XL.json +3 -0
  6. package/front_end/core/root/Runtime.ts +4 -12
  7. package/front_end/core/sdk/PageResourceLoader.ts +2 -1
  8. package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +39 -39
  9. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +54 -54
  10. package/front_end/entrypoints/formatter_worker/ESTreeWalker.ts +20 -20
  11. package/front_end/entrypoints/formatter_worker/FormattedContentBuilder.ts +54 -54
  12. package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +145 -144
  13. package/front_end/entrypoints/formatter_worker/JavaScriptFormatter.ts +40 -40
  14. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +64 -69
  15. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +202 -200
  16. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +109 -108
  17. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +17 -17
  18. package/front_end/entrypoints/inspector_main/InspectorMain.ts +30 -30
  19. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +25 -25
  20. package/front_end/entrypoints/main/ExecutionContextSelector.ts +52 -55
  21. package/front_end/entrypoints/main/MainImpl.ts +49 -49
  22. package/front_end/entrypoints/node_app/NodeConnectionsPanel.ts +43 -43
  23. package/front_end/entrypoints/node_app/NodeMain.ts +38 -38
  24. package/front_end/generated/InspectorBackendCommands.js +5 -1
  25. package/front_end/generated/protocol.d.ts +16 -0
  26. package/front_end/legacy/legacy-defs.d.ts +0 -21
  27. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +1 -1
  28. package/front_end/models/issues_manager/ClientHintIssue.ts +95 -0
  29. package/front_end/models/issues_manager/ContentSecurityPolicyIssue.ts +6 -6
  30. package/front_end/models/issues_manager/ContrastCheckTrigger.ts +15 -15
  31. package/front_end/models/issues_manager/CorsIssue.ts +9 -9
  32. package/front_end/models/issues_manager/CrossOriginEmbedderPolicyIssue.ts +5 -5
  33. package/front_end/models/issues_manager/DeprecationIssue.ts +7 -7
  34. package/front_end/models/issues_manager/GenericIssue.ts +5 -5
  35. package/front_end/models/issues_manager/HeavyAdIssue.ts +5 -5
  36. package/front_end/models/issues_manager/Issue.ts +10 -10
  37. package/front_end/models/issues_manager/IssueResolver.ts +11 -10
  38. package/front_end/models/issues_manager/IssuesManager.ts +61 -56
  39. package/front_end/models/issues_manager/LowTextContrastIssue.ts +4 -4
  40. package/front_end/models/issues_manager/MixedContentIssue.ts +7 -7
  41. package/front_end/models/issues_manager/NavigatorUserAgentIssue.ts +7 -7
  42. package/front_end/models/issues_manager/QuirksModeIssue.ts +4 -4
  43. package/front_end/models/issues_manager/SameSiteCookieIssue.ts +16 -16
  44. package/front_end/models/issues_manager/SharedArrayBufferIssue.ts +5 -5
  45. package/front_end/models/issues_manager/SourceFrameIssuesManager.ts +32 -31
  46. package/front_end/models/issues_manager/TrustedWebActivityIssue.ts +5 -5
  47. package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +5 -5
  48. package/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  49. package/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  50. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  51. package/front_end/panels/application/components/BackForwardCacheView.ts +33 -33
  52. package/front_end/panels/application/components/EndpointsGrid.ts +12 -12
  53. package/front_end/panels/application/components/FrameDetailsView.ts +108 -110
  54. package/front_end/panels/application/components/OriginTrialTreeView.ts +45 -45
  55. package/front_end/panels/application/components/PermissionsPolicySection.ts +19 -19
  56. package/front_end/panels/application/components/ReportsGrid.ts +30 -30
  57. package/front_end/panels/application/components/StackTrace.ts +48 -47
  58. package/front_end/panels/application/components/TrustTokensView.ts +31 -31
  59. package/front_end/panels/console/ConsoleView.ts +1 -1
  60. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +41 -52
  61. package/front_end/panels/css_overview/CSSOverviewController.ts +2 -2
  62. package/front_end/panels/css_overview/CSSOverviewPanel.ts +18 -27
  63. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +2 -2
  64. package/front_end/panels/css_overview/CSSOverviewSidebarPanel.ts +6 -6
  65. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
  66. package/front_end/panels/elements/components/AccessibilityTreeNode.ts +17 -17
  67. package/front_end/panels/elements/components/AdornerManager.ts +21 -21
  68. package/front_end/panels/elements/components/AdornerSettingsPane.ts +14 -14
  69. package/front_end/panels/elements/components/CSSQuery.ts +16 -16
  70. package/front_end/panels/elements/components/ComputedStyleProperty.ts +14 -14
  71. package/front_end/panels/elements/components/ComputedStyleTrace.ts +15 -15
  72. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +78 -78
  73. package/front_end/panels/elements/components/ElementsPanelLink.ts +16 -16
  74. package/front_end/panels/elements/components/LayoutPane.ts +47 -47
  75. package/front_end/panels/elements/components/NodeText.ts +18 -18
  76. package/front_end/panels/elements/components/QueryContainer.ts +40 -40
  77. package/front_end/panels/elements/components/StylePropertyEditor.ts +18 -18
  78. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +4 -4
  79. package/front_end/panels/issues/AffectedBlockedByResponseView.ts +4 -4
  80. package/front_end/panels/issues/AffectedCookiesView.ts +4 -5
  81. package/front_end/panels/issues/AffectedDirectivesView.ts +19 -19
  82. package/front_end/panels/issues/AffectedDocumentsInQuirksModeView.ts +7 -8
  83. package/front_end/panels/issues/AffectedElementsView.ts +4 -4
  84. package/front_end/panels/issues/AffectedElementsWithLowContrastView.ts +7 -8
  85. package/front_end/panels/issues/AffectedHeavyAdView.ts +8 -8
  86. package/front_end/panels/issues/AffectedResourcesView.ts +25 -26
  87. package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +8 -8
  88. package/front_end/panels/issues/AffectedSourcesView.ts +4 -4
  89. package/front_end/panels/issues/AffectedTrustedWebActivityIssueDetailsView.ts +4 -4
  90. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +17 -17
  91. package/front_end/panels/issues/CSPViolationsListView.ts +22 -23
  92. package/front_end/panels/issues/CSPViolationsView.ts +17 -17
  93. package/front_end/panels/issues/ComboBoxOfCheckBoxes.ts +13 -13
  94. package/front_end/panels/issues/CorsIssueDetailsView.ts +23 -23
  95. package/front_end/panels/issues/GenericIssueDetailsView.ts +4 -4
  96. package/front_end/panels/issues/HiddenIssuesRow.ts +7 -7
  97. package/front_end/panels/issues/IssueAggregator.ts +95 -95
  98. package/front_end/panels/issues/IssueKindView.ts +14 -14
  99. package/front_end/panels/issues/IssueView.ts +98 -98
  100. package/front_end/panels/issues/IssuesPane.ts +102 -102
  101. package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +5 -5
  102. package/front_end/panels/issues/components/HideIssuesMenu.ts +10 -10
  103. package/front_end/panels/media/PlayerListView.ts +160 -97
  104. package/front_end/panels/media/PlayerMessagesView.ts +1 -0
  105. package/front_end/panels/media/playerListView.css +58 -0
  106. package/front_end/panels/network/NetworkLogView.ts +2 -6
  107. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -4
  108. package/front_end/panels/network/components/RequestTrustTokensView.ts +40 -40
  109. package/front_end/panels/network/components/WebBundleInfoView.ts +9 -9
  110. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +92 -37
  111. package/front_end/panels/performance_monitor/performanceMonitor.css +32 -0
  112. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -2
  113. package/front_end/panels/settings/components/SyncSection.ts +14 -14
  114. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +96 -96
  115. package/front_end/panels/sources/BreakpointEditDialog.ts +4 -3
  116. package/front_end/panels/timeline/TimelineFlameChartView.ts +1 -1
  117. package/front_end/panels/timeline/TimelineTreeView.ts +1 -1
  118. package/front_end/panels/timeline/components/WebVitalsLane.ts +77 -76
  119. package/front_end/panels/timeline/components/WebVitalsTimeline.ts +133 -133
  120. package/front_end/panels/timeline/components/WebVitalsTooltip.ts +9 -9
  121. package/front_end/panels/webauthn/WebauthnPane.ts +203 -205
  122. package/front_end/third_party/diff/DiffWrapper.ts +7 -0
  123. package/front_end/ui/components/adorners/Adorner.ts +2 -2
  124. package/front_end/ui/components/buttons/Button.ts +9 -9
  125. package/front_end/ui/components/data_grid/DataGrid.ts +64 -64
  126. package/front_end/ui/components/data_grid/DataGridController.ts +22 -22
  127. package/front_end/ui/components/data_grid/DataGridUtils.ts +3 -0
  128. package/front_end/ui/components/diff_view/DiffView.ts +6 -6
  129. package/front_end/ui/components/expandable_list/ExpandableList.ts +5 -5
  130. package/front_end/ui/components/icon_button/Icon.ts +4 -4
  131. package/front_end/ui/components/icon_button/IconButton.ts +4 -4
  132. package/front_end/ui/components/issue_counter/IssueCounter.ts +3 -3
  133. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +11 -11
  134. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +50 -50
  135. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +6 -6
  136. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +4 -4
  137. package/front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.ts +12 -12
  138. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +11 -11
  139. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +40 -39
  140. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.ts +18 -18
  141. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +6 -6
  142. package/front_end/ui/components/linkifier/LinkifierImpl.ts +4 -4
  143. package/front_end/ui/components/markdown_view/MarkdownImage.ts +5 -5
  144. package/front_end/ui/components/markdown_view/MarkdownLink.ts +2 -2
  145. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  146. package/front_end/ui/components/panel_feedback/FeedbackButton.ts +2 -2
  147. package/front_end/ui/components/panel_feedback/PanelFeedback.ts +2 -2
  148. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +4 -4
  149. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +22 -22
  150. package/front_end/ui/components/report_view/ReportView.ts +16 -16
  151. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +14 -14
  152. package/front_end/ui/components/settings/SettingCheckbox.ts +5 -5
  153. package/front_end/ui/components/survey_link/SurveyLink.ts +8 -8
  154. package/front_end/ui/components/text_editor/TextEditor.ts +9 -9
  155. package/front_end/ui/components/text_prompt/TextPrompt.ts +18 -18
  156. package/front_end/ui/components/tree_outline/TreeOutline.ts +69 -70
  157. package/front_end/ui/legacy/SearchableView.ts +13 -4
  158. package/front_end/ui/legacy/components/source_frame/JSONView.ts +1 -1
  159. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +13 -12
  160. package/front_end/ui/legacy/components/source_frame/XMLView.ts +2 -2
  161. package/front_end/ui/legacy/themeColors.css +2 -0
  162. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +34 -7
  163. package/package.json +1 -1
  164. package/scripts/eslint_rules/lib/use_private_class_members.js +41 -0
  165. package/scripts/eslint_rules/tests/use_private_class_members_test.js +62 -0
  166. package/scripts/migration/class-fields/migrate.js +2 -3
  167. package/scripts/migration/class-fields/migrate.sh +1 -3
  168. package/scripts/migration/class-fields/package.json +1 -1
  169. package/config/gni/all_devtools_files.gni +0 -255
  170. package/scripts/build/devtools_file_hashes.py +0 -82
  171. package/scripts/devtools_run/devtools_run_cli +0 -49
  172. package/scripts/devtools_run/package.json +0 -13
  173. package/scripts/unzip.py +0 -20
  174. package/scripts/visualize_deps/jquery_svg.html +0 -57
  175. package/scripts/visualize_deps/run_visualize.js +0 -119
@@ -229,27 +229,26 @@ const PROTOCOL_AUTHENTICATOR_VALUES: Protocol.EnumerableEnum<typeof Protocol.Web
229
229
 
230
230
  export class WebauthnPaneImpl extends UI.Widget.VBox implements
231
231
  SDK.TargetManager.SDKModelObserver<SDK.WebAuthnModel.WebAuthnModel> {
232
- private activeAuthId: Protocol.WebAuthn.AuthenticatorId|null = null;
233
- private hasBeenEnabled = false;
234
- private readonly dataGrids =
235
- new Map<Protocol.WebAuthn.AuthenticatorId, DataGrid.DataGrid.DataGridImpl<DataGridNode>>();
236
- private enableCheckbox!: UI.Toolbar.ToolbarCheckbox;
237
- private readonly availableAuthenticatorSetting: Common.Settings.Setting<AvailableAuthenticatorOptions[]>;
238
- private model?: SDK.WebAuthnModel.WebAuthnModel;
239
- private authenticatorsView: HTMLElement;
240
- private topToolbarContainer: HTMLElement|undefined;
241
- private topToolbar: UI.Toolbar.Toolbar|undefined;
242
- private learnMoreView: HTMLElement|undefined;
243
- private newAuthenticatorSection: HTMLElement|undefined;
244
- private newAuthenticatorForm: HTMLElement|undefined;
245
- private protocolSelect: HTMLSelectElement|undefined;
246
- private transportSelect: HTMLSelectElement|undefined;
247
- private residentKeyCheckboxLabel: UI.UIUtils.CheckboxLabel|undefined;
248
- private residentKeyCheckbox: HTMLInputElement|undefined;
249
- private userVerificationCheckboxLabel: UI.UIUtils.CheckboxLabel|undefined;
250
- private userVerificationCheckbox: HTMLInputElement|undefined;
251
- private addAuthenticatorButton: HTMLButtonElement|undefined;
252
- private isEnabling?: Promise<void>;
232
+ #activeAuthId: Protocol.WebAuthn.AuthenticatorId|null = null;
233
+ #hasBeenEnabled = false;
234
+ readonly #dataGrids = new Map<Protocol.WebAuthn.AuthenticatorId, DataGrid.DataGrid.DataGridImpl<DataGridNode>>();
235
+ #enableCheckbox!: UI.Toolbar.ToolbarCheckbox;
236
+ readonly #availableAuthenticatorSetting: Common.Settings.Setting<AvailableAuthenticatorOptions[]>;
237
+ #model?: SDK.WebAuthnModel.WebAuthnModel;
238
+ #authenticatorsView: HTMLElement;
239
+ #topToolbarContainer: HTMLElement|undefined;
240
+ #topToolbar: UI.Toolbar.Toolbar|undefined;
241
+ #learnMoreView: HTMLElement|undefined;
242
+ #newAuthenticatorSection: HTMLElement|undefined;
243
+ #newAuthenticatorForm: HTMLElement|undefined;
244
+ #protocolSelect: HTMLSelectElement|undefined;
245
+ #transportSelect: HTMLSelectElement|undefined;
246
+ #residentKeyCheckboxLabel: UI.UIUtils.CheckboxLabel|undefined;
247
+ #residentKeyCheckbox: HTMLInputElement|undefined;
248
+ #userVerificationCheckboxLabel: UI.UIUtils.CheckboxLabel|undefined;
249
+ #userVerificationCheckbox: HTMLInputElement|undefined;
250
+ #addAuthenticatorButton: HTMLButtonElement|undefined;
251
+ #isEnabling?: Promise<void>;
253
252
 
254
253
  constructor() {
255
254
  super(true);
@@ -257,14 +256,14 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
257
256
 
258
257
  this.contentElement.classList.add('webauthn-pane');
259
258
 
260
- this.availableAuthenticatorSetting =
259
+ this.#availableAuthenticatorSetting =
261
260
  Common.Settings.Settings.instance().createSetting<AvailableAuthenticatorOptions[]>(
262
261
  'webauthnAuthenticators', []);
263
262
 
264
- this.createToolbar();
265
- this.authenticatorsView = this.contentElement.createChild('div', 'authenticators-view');
266
- this.createNewAuthenticatorSection();
267
- this.updateVisibility(false);
263
+ this.#createToolbar();
264
+ this.#authenticatorsView = this.contentElement.createChild('div', 'authenticators-view');
265
+ this.#createNewAuthenticatorSection();
266
+ this.#updateVisibility(false);
268
267
  }
269
268
 
270
269
  static instance(opts = {forceNew: null}): WebauthnPaneImpl {
@@ -278,26 +277,26 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
278
277
 
279
278
  modelAdded(model: SDK.WebAuthnModel.WebAuthnModel): void {
280
279
  if (model.target() === SDK.TargetManager.TargetManager.instance().mainTarget()) {
281
- this.model = model;
280
+ this.#model = model;
282
281
  }
283
282
  }
284
283
 
285
284
  modelRemoved(model: SDK.WebAuthnModel.WebAuthnModel): void {
286
285
  if (model.target() === SDK.TargetManager.TargetManager.instance().mainTarget()) {
287
- this.model = undefined;
286
+ this.#model = undefined;
288
287
  }
289
288
  }
290
289
 
291
- private async loadInitialAuthenticators(): Promise<void> {
290
+ async #loadInitialAuthenticators(): Promise<void> {
292
291
  let activeAuthenticatorId: Protocol.WebAuthn.AuthenticatorId|null = null;
293
- const availableAuthenticators = this.availableAuthenticatorSetting.get();
292
+ const availableAuthenticators = this.#availableAuthenticatorSetting.get();
294
293
  for (const options of availableAuthenticators) {
295
- if (!this.model) {
294
+ if (!this.#model) {
296
295
  continue;
297
296
  }
298
297
 
299
- const authenticatorId = await this.model.addAuthenticator(options);
300
- this.addAuthenticatorSection(authenticatorId, options);
298
+ const authenticatorId = await this.#model.addAuthenticator(options);
299
+ this.#addAuthenticatorSection(authenticatorId, options);
301
300
  // Update the authenticatorIds in the options.
302
301
  options.authenticatorId = authenticatorId;
303
302
  if (options.active) {
@@ -306,29 +305,29 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
306
305
  }
307
306
 
308
307
  // Update the settings to reflect the new authenticatorIds.
309
- this.availableAuthenticatorSetting.set(availableAuthenticators);
308
+ this.#availableAuthenticatorSetting.set(availableAuthenticators);
310
309
  if (activeAuthenticatorId) {
311
- this.setActiveAuthenticator(activeAuthenticatorId);
310
+ this.#setActiveAuthenticator(activeAuthenticatorId);
312
311
  }
313
312
  }
314
313
 
315
314
  async ownerViewDisposed(): Promise<void> {
316
- if (this.enableCheckbox) {
317
- this.enableCheckbox.setChecked(false);
315
+ if (this.#enableCheckbox) {
316
+ this.#enableCheckbox.setChecked(false);
318
317
  }
319
- await this.setVirtualAuthEnvEnabled(false);
318
+ await this.#setVirtualAuthEnvEnabled(false);
320
319
  }
321
320
 
322
- private createToolbar(): void {
323
- this.topToolbarContainer = this.contentElement.createChild('div', 'webauthn-toolbar-container');
324
- this.topToolbar = new UI.Toolbar.Toolbar('webauthn-toolbar', this.topToolbarContainer);
321
+ #createToolbar(): void {
322
+ this.#topToolbarContainer = this.contentElement.createChild('div', 'webauthn-toolbar-container');
323
+ this.#topToolbar = new UI.Toolbar.Toolbar('webauthn-toolbar', this.#topToolbarContainer);
325
324
  const enableCheckboxTitle = i18nString(UIStrings.enableVirtualAuthenticator);
326
- this.enableCheckbox =
327
- new UI.Toolbar.ToolbarCheckbox(enableCheckboxTitle, enableCheckboxTitle, this.handleCheckboxToggle.bind(this));
328
- this.topToolbar.appendToolbarItem(this.enableCheckbox);
325
+ this.#enableCheckbox =
326
+ new UI.Toolbar.ToolbarCheckbox(enableCheckboxTitle, enableCheckboxTitle, this.#handleCheckboxToggle.bind(this));
327
+ this.#topToolbar.appendToolbarItem(this.#enableCheckbox);
329
328
  }
330
329
 
331
- private createCredentialsDataGrid(authenticatorId: Protocol.WebAuthn.AuthenticatorId):
330
+ #createCredentialsDataGrid(authenticatorId: Protocol.WebAuthn.AuthenticatorId):
332
331
  DataGrid.DataGrid.DataGridImpl<DataGridNode> {
333
332
  const columns = ([
334
333
  {
@@ -368,33 +367,32 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
368
367
  const dataGrid = new WebauthnDataGrid(dataGridConfig);
369
368
  dataGrid.renderInline();
370
369
  dataGrid.setStriped(true);
371
- dataGrid.addEventListener(Events.ExportCredential, this.handleExportCredential, this);
372
- dataGrid.addEventListener(Events.RemoveCredential, this.handleRemoveCredential.bind(this, authenticatorId));
370
+ dataGrid.addEventListener(Events.ExportCredential, this.#handleExportCredential, this);
371
+ dataGrid.addEventListener(Events.RemoveCredential, this.#handleRemoveCredential.bind(this, authenticatorId));
373
372
 
374
- this.dataGrids.set(authenticatorId, dataGrid);
373
+ this.#dataGrids.set(authenticatorId, dataGrid);
375
374
 
376
375
  return dataGrid;
377
376
  }
378
377
 
379
- private handleExportCredential({data: credential}: Common.EventTarget.EventTargetEvent<Protocol.WebAuthn.Credential>):
380
- void {
381
- this.exportCredential(credential);
378
+ #handleExportCredential({data: credential}: Common.EventTarget.EventTargetEvent<Protocol.WebAuthn.Credential>): void {
379
+ this.#exportCredential(credential);
382
380
  }
383
381
 
384
- private handleRemoveCredential(authenticatorId: Protocol.WebAuthn.AuthenticatorId, {
382
+ #handleRemoveCredential(authenticatorId: Protocol.WebAuthn.AuthenticatorId, {
385
383
  data: credential,
386
384
  }: Common.EventTarget.EventTargetEvent<Protocol.WebAuthn.Credential>): void {
387
- this.removeCredential(authenticatorId, credential.credentialId);
385
+ this.#removeCredential(authenticatorId, credential.credentialId);
388
386
  }
389
387
 
390
- private async updateCredentials(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<void> {
391
- const dataGrid = this.dataGrids.get(authenticatorId);
388
+ async #updateCredentials(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<void> {
389
+ const dataGrid = this.#dataGrids.get(authenticatorId);
392
390
  if (!dataGrid) {
393
391
  return;
394
392
  }
395
393
 
396
- if (this.model) {
397
- const credentials = await this.model.getCredentials(authenticatorId);
394
+ if (this.#model) {
395
+ const credentials = await this.#model.getCredentials(authenticatorId);
398
396
 
399
397
  dataGrid.rootNode().removeChildren();
400
398
  for (const credential of credentials) {
@@ -402,14 +400,14 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
402
400
  dataGrid.rootNode().appendChild(node);
403
401
  }
404
402
 
405
- this.maybeAddEmptyNode(dataGrid);
403
+ this.#maybeAddEmptyNode(dataGrid);
406
404
  }
407
405
 
408
406
  // TODO(crbug.com/1112528): Add back-end events for credential creation and removal to avoid polling.
409
- setTimeout(this.updateCredentials.bind(this, authenticatorId), TIMEOUT);
407
+ setTimeout(this.#updateCredentials.bind(this, authenticatorId), TIMEOUT);
410
408
  }
411
409
 
412
- private maybeAddEmptyNode(dataGrid: DataGrid.DataGrid.DataGridImpl<DataGridNode>): void {
410
+ #maybeAddEmptyNode(dataGrid: DataGrid.DataGrid.DataGridImpl<DataGridNode>): void {
413
411
  if (dataGrid.rootNode().children.length) {
414
412
  return;
415
413
  }
@@ -418,73 +416,73 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
418
416
  dataGrid.rootNode().appendChild(node);
419
417
  }
420
418
 
421
- private async setVirtualAuthEnvEnabled(enable: boolean): Promise<void> {
422
- await this.isEnabling;
423
- this.isEnabling = new Promise<void>(async (resolve: (value: void) => void) => {
424
- if (enable && !this.hasBeenEnabled) {
419
+ async #setVirtualAuthEnvEnabled(enable: boolean): Promise<void> {
420
+ await this.#isEnabling;
421
+ this.#isEnabling = new Promise<void>(async (resolve: (value: void) => void) => {
422
+ if (enable && !this.#hasBeenEnabled) {
425
423
  // Ensures metric is only tracked once per session.
426
424
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.VirtualAuthenticatorEnvironmentEnabled);
427
- this.hasBeenEnabled = true;
425
+ this.#hasBeenEnabled = true;
428
426
  }
429
- if (this.model) {
430
- await this.model.setVirtualAuthEnvEnabled(enable);
427
+ if (this.#model) {
428
+ await this.#model.setVirtualAuthEnvEnabled(enable);
431
429
  }
432
430
 
433
431
  if (enable) {
434
- await this.loadInitialAuthenticators();
432
+ await this.#loadInitialAuthenticators();
435
433
  } else {
436
- this.removeAuthenticatorSections();
434
+ this.#removeAuthenticatorSections();
437
435
  }
438
436
 
439
- this.updateVisibility(enable);
440
- this.isEnabling = undefined;
437
+ this.#updateVisibility(enable);
438
+ this.#isEnabling = undefined;
441
439
  resolve();
442
440
  });
443
441
  }
444
442
 
445
- private updateVisibility(enabled: boolean): void {
443
+ #updateVisibility(enabled: boolean): void {
446
444
  this.contentElement.classList.toggle('enabled', enabled);
447
445
  }
448
446
 
449
- private removeAuthenticatorSections(): void {
450
- this.authenticatorsView.innerHTML = '';
451
- this.dataGrids.clear();
447
+ #removeAuthenticatorSections(): void {
448
+ this.#authenticatorsView.innerHTML = '';
449
+ this.#dataGrids.clear();
452
450
  }
453
451
 
454
- private handleCheckboxToggle(e: MouseEvent): void {
455
- this.setVirtualAuthEnvEnabled((e.target as HTMLInputElement).checked);
452
+ #handleCheckboxToggle(e: MouseEvent): void {
453
+ this.#setVirtualAuthEnvEnabled((e.target as HTMLInputElement).checked);
456
454
  }
457
455
 
458
- private updateEnabledTransportOptions(enabledOptions: Protocol.WebAuthn.AuthenticatorTransport[]): void {
459
- if (!this.transportSelect) {
456
+ #updateEnabledTransportOptions(enabledOptions: Protocol.WebAuthn.AuthenticatorTransport[]): void {
457
+ if (!this.#transportSelect) {
460
458
  return;
461
459
  }
462
460
 
463
- const prevValue = this.transportSelect.value;
464
- this.transportSelect.removeChildren();
461
+ const prevValue = this.#transportSelect.value;
462
+ this.#transportSelect.removeChildren();
465
463
 
466
464
  for (const option of enabledOptions) {
467
- this.transportSelect.appendChild(new Option(option, option));
465
+ this.#transportSelect.appendChild(new Option(option, option));
468
466
  }
469
467
 
470
468
  // Make sure the currently selected value stays the same.
471
- this.transportSelect.value = prevValue;
469
+ this.#transportSelect.value = prevValue;
472
470
  // If the new set does not include the previous value.
473
- if (!this.transportSelect.value) {
471
+ if (!this.#transportSelect.value) {
474
472
  // Select the first available value.
475
- this.transportSelect.selectedIndex = 0;
473
+ this.#transportSelect.selectedIndex = 0;
476
474
  }
477
475
  }
478
476
 
479
- private updateNewAuthenticatorSectionOptions(): void {
480
- if (!this.protocolSelect || !this.residentKeyCheckbox || !this.userVerificationCheckbox) {
477
+ #updateNewAuthenticatorSectionOptions(): void {
478
+ if (!this.#protocolSelect || !this.#residentKeyCheckbox || !this.#userVerificationCheckbox) {
481
479
  return;
482
480
  }
483
481
 
484
- if (this.protocolSelect.value === Protocol.WebAuthn.AuthenticatorProtocol.Ctap2) {
485
- this.residentKeyCheckbox.disabled = false;
486
- this.userVerificationCheckbox.disabled = false;
487
- this.updateEnabledTransportOptions([
482
+ if (this.#protocolSelect.value === Protocol.WebAuthn.AuthenticatorProtocol.Ctap2) {
483
+ this.#residentKeyCheckbox.disabled = false;
484
+ this.#userVerificationCheckbox.disabled = false;
485
+ this.#updateEnabledTransportOptions([
488
486
  Protocol.WebAuthn.AuthenticatorTransport.Usb,
489
487
  Protocol.WebAuthn.AuthenticatorTransport.Ble,
490
488
  Protocol.WebAuthn.AuthenticatorTransport.Nfc,
@@ -493,11 +491,11 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
493
491
  Protocol.WebAuthn.AuthenticatorTransport.Internal,
494
492
  ]);
495
493
  } else {
496
- this.residentKeyCheckbox.checked = false;
497
- this.residentKeyCheckbox.disabled = true;
498
- this.userVerificationCheckbox.checked = false;
499
- this.userVerificationCheckbox.disabled = true;
500
- this.updateEnabledTransportOptions([
494
+ this.#residentKeyCheckbox.checked = false;
495
+ this.#residentKeyCheckbox.disabled = true;
496
+ this.#userVerificationCheckbox.checked = false;
497
+ this.#userVerificationCheckbox.disabled = true;
498
+ this.#updateEnabledTransportOptions([
501
499
  Protocol.WebAuthn.AuthenticatorTransport.Usb,
502
500
  Protocol.WebAuthn.AuthenticatorTransport.Ble,
503
501
  Protocol.WebAuthn.AuthenticatorTransport.Nfc,
@@ -505,9 +503,9 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
505
503
  }
506
504
  }
507
505
 
508
- private createNewAuthenticatorSection(): void {
509
- this.learnMoreView = this.contentElement.createChild('div', 'learn-more');
510
- this.learnMoreView.appendChild(UI.Fragment.html`
506
+ #createNewAuthenticatorSection(): void {
507
+ this.#learnMoreView = this.contentElement.createChild('div', 'learn-more');
508
+ this.#learnMoreView.appendChild(UI.Fragment.html`
511
509
  <div>
512
510
  ${i18nString(UIStrings.useWebauthnForPhishingresistant)}<br /><br />
513
511
  ${
@@ -516,108 +514,108 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
516
514
  </div>
517
515
  `);
518
516
 
519
- this.newAuthenticatorSection = this.contentElement.createChild('div', 'new-authenticator-container');
517
+ this.#newAuthenticatorSection = this.contentElement.createChild('div', 'new-authenticator-container');
520
518
  const newAuthenticatorTitle =
521
519
  UI.UIUtils.createLabel(i18nString(UIStrings.newAuthenticator), 'new-authenticator-title');
522
- this.newAuthenticatorSection.appendChild(newAuthenticatorTitle);
523
- this.newAuthenticatorForm = this.newAuthenticatorSection.createChild('div', 'new-authenticator-form');
520
+ this.#newAuthenticatorSection.appendChild(newAuthenticatorTitle);
521
+ this.#newAuthenticatorForm = this.#newAuthenticatorSection.createChild('div', 'new-authenticator-form');
524
522
 
525
- const protocolGroup = this.newAuthenticatorForm.createChild('div', 'authenticator-option');
526
- const transportGroup = this.newAuthenticatorForm.createChild('div', 'authenticator-option');
527
- const residentKeyGroup = this.newAuthenticatorForm.createChild('div', 'authenticator-option');
528
- const userVerificationGroup = this.newAuthenticatorForm.createChild('div', 'authenticator-option');
529
- const addButtonGroup = this.newAuthenticatorForm.createChild('div', 'authenticator-option');
523
+ const protocolGroup = this.#newAuthenticatorForm.createChild('div', 'authenticator-option');
524
+ const transportGroup = this.#newAuthenticatorForm.createChild('div', 'authenticator-option');
525
+ const residentKeyGroup = this.#newAuthenticatorForm.createChild('div', 'authenticator-option');
526
+ const userVerificationGroup = this.#newAuthenticatorForm.createChild('div', 'authenticator-option');
527
+ const addButtonGroup = this.#newAuthenticatorForm.createChild('div', 'authenticator-option');
530
528
 
531
529
  const protocolSelectTitle = UI.UIUtils.createLabel(i18nString(UIStrings.protocol), 'authenticator-option-label');
532
530
  protocolGroup.appendChild(protocolSelectTitle);
533
- this.protocolSelect = (protocolGroup.createChild('select', 'chrome-select') as HTMLSelectElement);
534
- UI.ARIAUtils.bindLabelToControl(protocolSelectTitle, (this.protocolSelect as Element));
531
+ this.#protocolSelect = (protocolGroup.createChild('select', 'chrome-select') as HTMLSelectElement);
532
+ UI.ARIAUtils.bindLabelToControl(protocolSelectTitle, (this.#protocolSelect as Element));
535
533
  Object.values(PROTOCOL_AUTHENTICATOR_VALUES)
536
534
  .sort()
537
535
  .forEach((option: Protocol.WebAuthn.AuthenticatorProtocol): void => {
538
- if (this.protocolSelect) {
539
- this.protocolSelect.appendChild(new Option(option, option));
536
+ if (this.#protocolSelect) {
537
+ this.#protocolSelect.appendChild(new Option(option, option));
540
538
  }
541
539
  });
542
540
 
543
- if (this.protocolSelect) {
544
- this.protocolSelect.value = Protocol.WebAuthn.AuthenticatorProtocol.Ctap2;
541
+ if (this.#protocolSelect) {
542
+ this.#protocolSelect.value = Protocol.WebAuthn.AuthenticatorProtocol.Ctap2;
545
543
  }
546
544
 
547
545
  const transportSelectTitle = UI.UIUtils.createLabel(i18nString(UIStrings.transport), 'authenticator-option-label');
548
546
  transportGroup.appendChild(transportSelectTitle);
549
- this.transportSelect = (transportGroup.createChild('select', 'chrome-select') as HTMLSelectElement);
550
- UI.ARIAUtils.bindLabelToControl(transportSelectTitle, (this.transportSelect as Element));
547
+ this.#transportSelect = (transportGroup.createChild('select', 'chrome-select') as HTMLSelectElement);
548
+ UI.ARIAUtils.bindLabelToControl(transportSelectTitle, (this.#transportSelect as Element));
551
549
  // transportSelect will be populated in updateNewAuthenticatorSectionOptions.
552
550
 
553
- this.residentKeyCheckboxLabel = UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.supportsResidentKeys), false);
554
- this.residentKeyCheckboxLabel.textElement.classList.add('authenticator-option-label');
555
- residentKeyGroup.appendChild(this.residentKeyCheckboxLabel.textElement);
556
- this.residentKeyCheckbox = this.residentKeyCheckboxLabel.checkboxElement;
557
- this.residentKeyCheckbox.checked = false;
558
- this.residentKeyCheckbox.classList.add('authenticator-option-checkbox');
559
- residentKeyGroup.appendChild(this.residentKeyCheckboxLabel);
560
-
561
- this.userVerificationCheckboxLabel = UI.UIUtils.CheckboxLabel.create('Supports user verification', false);
562
- this.userVerificationCheckboxLabel.textElement.classList.add('authenticator-option-label');
563
- userVerificationGroup.appendChild(this.userVerificationCheckboxLabel.textElement);
564
- this.userVerificationCheckbox = this.userVerificationCheckboxLabel.checkboxElement;
565
- this.userVerificationCheckbox.checked = false;
566
- this.userVerificationCheckbox.classList.add('authenticator-option-checkbox');
567
- userVerificationGroup.appendChild(this.userVerificationCheckboxLabel);
568
-
569
- this.addAuthenticatorButton =
570
- UI.UIUtils.createTextButton(i18nString(UIStrings.add), this.handleAddAuthenticatorButton.bind(this), '');
551
+ this.#residentKeyCheckboxLabel = UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.supportsResidentKeys), false);
552
+ this.#residentKeyCheckboxLabel.textElement.classList.add('authenticator-option-label');
553
+ residentKeyGroup.appendChild(this.#residentKeyCheckboxLabel.textElement);
554
+ this.#residentKeyCheckbox = this.#residentKeyCheckboxLabel.checkboxElement;
555
+ this.#residentKeyCheckbox.checked = false;
556
+ this.#residentKeyCheckbox.classList.add('authenticator-option-checkbox');
557
+ residentKeyGroup.appendChild(this.#residentKeyCheckboxLabel);
558
+
559
+ this.#userVerificationCheckboxLabel = UI.UIUtils.CheckboxLabel.create('Supports user verification', false);
560
+ this.#userVerificationCheckboxLabel.textElement.classList.add('authenticator-option-label');
561
+ userVerificationGroup.appendChild(this.#userVerificationCheckboxLabel.textElement);
562
+ this.#userVerificationCheckbox = this.#userVerificationCheckboxLabel.checkboxElement;
563
+ this.#userVerificationCheckbox.checked = false;
564
+ this.#userVerificationCheckbox.classList.add('authenticator-option-checkbox');
565
+ userVerificationGroup.appendChild(this.#userVerificationCheckboxLabel);
566
+
567
+ this.#addAuthenticatorButton =
568
+ UI.UIUtils.createTextButton(i18nString(UIStrings.add), this.#handleAddAuthenticatorButton.bind(this), '');
571
569
  addButtonGroup.createChild('div', 'authenticator-option-label');
572
- addButtonGroup.appendChild(this.addAuthenticatorButton);
570
+ addButtonGroup.appendChild(this.#addAuthenticatorButton);
573
571
  const addAuthenticatorTitle = UI.UIUtils.createLabel(i18nString(UIStrings.addAuthenticator), '');
574
- UI.ARIAUtils.bindLabelToControl(addAuthenticatorTitle, this.addAuthenticatorButton);
572
+ UI.ARIAUtils.bindLabelToControl(addAuthenticatorTitle, this.#addAuthenticatorButton);
575
573
 
576
- this.updateNewAuthenticatorSectionOptions();
577
- if (this.protocolSelect) {
578
- this.protocolSelect.addEventListener('change', this.updateNewAuthenticatorSectionOptions.bind(this));
574
+ this.#updateNewAuthenticatorSectionOptions();
575
+ if (this.#protocolSelect) {
576
+ this.#protocolSelect.addEventListener('change', this.#updateNewAuthenticatorSectionOptions.bind(this));
579
577
  }
580
578
  }
581
579
 
582
- private async handleAddAuthenticatorButton(): Promise<void> {
583
- const options = this.createOptionsFromCurrentInputs();
584
- if (this.model) {
585
- const authenticatorId = await this.model.addAuthenticator(options);
586
- const availableAuthenticators = this.availableAuthenticatorSetting.get();
580
+ async #handleAddAuthenticatorButton(): Promise<void> {
581
+ const options = this.#createOptionsFromCurrentInputs();
582
+ if (this.#model) {
583
+ const authenticatorId = await this.#model.addAuthenticator(options);
584
+ const availableAuthenticators = this.#availableAuthenticatorSetting.get();
587
585
  availableAuthenticators.push({authenticatorId, active: true, ...options});
588
- this.availableAuthenticatorSetting.set(
586
+ this.#availableAuthenticatorSetting.set(
589
587
  availableAuthenticators.map(a => ({...a, active: a.authenticatorId === authenticatorId})));
590
- const section = await this.addAuthenticatorSection(authenticatorId, options);
588
+ const section = await this.#addAuthenticatorSection(authenticatorId, options);
591
589
  const mediaQueryList = window.matchMedia('(prefers-reduced-motion: reduce)');
592
590
  const prefersReducedMotion = mediaQueryList.matches;
593
591
  section.scrollIntoView({block: 'start', behavior: prefersReducedMotion ? 'auto' : 'smooth'});
594
592
  }
595
593
  }
596
594
 
597
- private async addAuthenticatorSection(
595
+ async #addAuthenticatorSection(
598
596
  authenticatorId: Protocol.WebAuthn.AuthenticatorId,
599
597
  options: Protocol.WebAuthn.VirtualAuthenticatorOptions): Promise<HTMLDivElement> {
600
598
  const section = document.createElement('div');
601
599
  section.classList.add('authenticator-section');
602
600
  section.setAttribute('data-authenticator-id', authenticatorId);
603
- this.authenticatorsView.appendChild(section);
601
+ this.#authenticatorsView.appendChild(section);
604
602
 
605
603
  const headerElement = section.createChild('div', 'authenticator-section-header');
606
604
  const titleElement = headerElement.createChild('div', 'authenticator-section-title');
607
605
  UI.ARIAUtils.markAsHeading(titleElement, 2);
608
606
 
609
- await this.clearActiveAuthenticator();
607
+ await this.#clearActiveAuthenticator();
610
608
  const activeButtonContainer = headerElement.createChild('div', 'active-button-container');
611
609
  const activeLabel =
612
610
  UI.UIUtils.createRadioLabel(`active-authenticator-${authenticatorId}`, i18nString(UIStrings.active));
613
- activeLabel.radioElement.addEventListener('click', this.setActiveAuthenticator.bind(this, authenticatorId));
611
+ activeLabel.radioElement.addEventListener('click', this.#setActiveAuthenticator.bind(this, authenticatorId));
614
612
  activeButtonContainer.appendChild(activeLabel);
615
613
  (activeLabel.radioElement as HTMLInputElement).checked = true;
616
- this.activeAuthId = authenticatorId; // Newly added authenticator is automatically set as active.
614
+ this.#activeAuthId = authenticatorId; // Newly added authenticator is automatically set as active.
617
615
 
618
616
  const removeButton = headerElement.createChild('button', 'text-button');
619
617
  removeButton.textContent = i18nString(UIStrings.remove);
620
- removeButton.addEventListener('click', this.removeAuthenticator.bind(this, authenticatorId));
618
+ removeButton.addEventListener('click', this.#removeAuthenticator.bind(this, authenticatorId));
621
619
 
622
620
  const toolbar = new UI.Toolbar.Toolbar('edit-name-toolbar', titleElement);
623
621
  const editName = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.editName), 'largeicon-edit');
@@ -628,42 +626,42 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
628
626
  nameField.disabled = true;
629
627
  const userFriendlyName = authenticatorId.slice(-5); // User friendly name defaults to last 5 chars of UUID.
630
628
  nameField.value = i18nString(UIStrings.authenticatorS, {PH1: userFriendlyName});
631
- this.updateActiveLabelTitle(activeLabel, nameField.value);
629
+ this.#updateActiveLabelTitle(activeLabel, nameField.value);
632
630
 
633
631
  editName.addEventListener(
634
632
  UI.Toolbar.ToolbarButton.Events.Click,
635
- (): void => this.handleEditNameButton(titleElement, nameField, editName, saveName));
633
+ (): void => this.#handleEditNameButton(titleElement, nameField, editName, saveName));
636
634
  saveName.addEventListener(
637
635
  UI.Toolbar.ToolbarButton.Events.Click,
638
- (): void => this.handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel));
636
+ (): void => this.#handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel));
639
637
 
640
638
  nameField.addEventListener(
641
- 'focusout', (): void => this.handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel));
639
+ 'focusout', (): void => this.#handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel));
642
640
  nameField.addEventListener('keydown', (event: KeyboardEvent): void => {
643
641
  if (event.key === 'Enter') {
644
- this.handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel);
642
+ this.#handleSaveNameButton(titleElement, nameField, editName, saveName, activeLabel);
645
643
  }
646
644
  });
647
645
 
648
646
  toolbar.appendToolbarItem(editName);
649
647
  toolbar.appendToolbarItem(saveName);
650
648
 
651
- this.createAuthenticatorFields(section, authenticatorId, options);
649
+ this.#createAuthenticatorFields(section, authenticatorId, options);
652
650
 
653
651
  const label = document.createElement('div');
654
652
  label.classList.add('credentials-title');
655
653
  label.textContent = i18nString(UIStrings.credentials);
656
654
  section.appendChild(label);
657
655
 
658
- const dataGrid = this.createCredentialsDataGrid(authenticatorId);
656
+ const dataGrid = this.#createCredentialsDataGrid(authenticatorId);
659
657
  dataGrid.asWidget().show(section);
660
658
 
661
- this.updateCredentials(authenticatorId);
659
+ this.#updateCredentials(authenticatorId);
662
660
 
663
661
  return section;
664
662
  }
665
663
 
666
- private exportCredential(credential: Protocol.WebAuthn.Credential): void {
664
+ #exportCredential(credential: Protocol.WebAuthn.Credential): void {
667
665
  let pem = PRIVATE_KEY_HEADER;
668
666
  for (let i = 0; i < credential.privateKey.length; i += 64) {
669
667
  pem += credential.privateKey.substring(i, i + 64) + '\n';
@@ -676,9 +674,8 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
676
674
  link.click();
677
675
  }
678
676
 
679
- private async removeCredential(authenticatorId: Protocol.WebAuthn.AuthenticatorId, credentialId: string):
680
- Promise<void> {
681
- const dataGrid = this.dataGrids.get(authenticatorId);
677
+ async #removeCredential(authenticatorId: Protocol.WebAuthn.AuthenticatorId, credentialId: string): Promise<void> {
678
+ const dataGrid = this.#dataGrids.get(authenticatorId);
682
679
  if (!dataGrid) {
683
680
  return;
684
681
  }
@@ -688,17 +685,17 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
688
685
  .children
689
686
  .find((n: DataGrid.DataGrid.DataGridNode<DataGridNode>): boolean => n.data.credentialId === credentialId)
690
687
  .remove();
691
- this.maybeAddEmptyNode(dataGrid);
688
+ this.#maybeAddEmptyNode(dataGrid);
692
689
 
693
- if (this.model) {
694
- await this.model.removeCredential(authenticatorId, credentialId);
690
+ if (this.#model) {
691
+ await this.#model.removeCredential(authenticatorId, credentialId);
695
692
  }
696
693
  }
697
694
 
698
695
  /**
699
696
  * Creates the fields describing the authenticator in the front end.
700
697
  */
701
- private createAuthenticatorFields(
698
+ #createAuthenticatorFields(
702
699
  section: Element, authenticatorId: string, options: Protocol.WebAuthn.VirtualAuthenticatorOptions): void {
703
700
  const sectionFields = section.createChild('div', 'authenticator-fields');
704
701
  const uuidField = sectionFields.createChild('div', 'authenticator-field');
@@ -724,7 +721,7 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
724
721
  options.hasUserVerification ? i18nString(UIStrings.yes) : i18nString(UIStrings.no);
725
722
  }
726
723
 
727
- private handleEditNameButton(
724
+ #handleEditNameButton(
728
725
  titleElement: Element, nameField: HTMLInputElement, editName: UI.Toolbar.ToolbarButton,
729
726
  saveName: UI.Toolbar.ToolbarButton): void {
730
727
  nameField.disabled = false;
@@ -734,17 +731,17 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
734
731
  editName.setVisible(false);
735
732
  }
736
733
 
737
- private handleSaveNameButton(
734
+ #handleSaveNameButton(
738
735
  titleElement: Element, nameField: HTMLInputElement, editName: UI.Toolbar.ToolbarItem,
739
736
  saveName: UI.Toolbar.ToolbarItem, activeLabel: UI.UIUtils.DevToolsRadioButton): void {
740
737
  nameField.disabled = true;
741
738
  titleElement.classList.remove('editing-name');
742
739
  editName.setVisible(true);
743
740
  saveName.setVisible(false);
744
- this.updateActiveLabelTitle(activeLabel, nameField.value);
741
+ this.#updateActiveLabelTitle(activeLabel, nameField.value);
745
742
  }
746
743
 
747
- private updateActiveLabelTitle(activeLabel: UI.UIUtils.DevToolsRadioButton, authenticatorName: string): void {
744
+ #updateActiveLabelTitle(activeLabel: UI.UIUtils.DevToolsRadioButton, authenticatorName: string): void {
748
745
  UI.Tooltip.Tooltip.install(
749
746
  activeLabel.radioElement, i18nString(UIStrings.setSAsTheActiveAuthenticator, {PH1: authenticatorName}));
750
747
  }
@@ -752,47 +749,48 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
752
749
  /**
753
750
  * Removes both the authenticator and its respective UI element.
754
751
  */
755
- private removeAuthenticator(authenticatorId: Protocol.WebAuthn.AuthenticatorId): void {
756
- if (this.authenticatorsView) {
757
- const child = this.authenticatorsView.querySelector(`[data-authenticator-id=${CSS.escape(authenticatorId)}]`);
752
+ #removeAuthenticator(authenticatorId: Protocol.WebAuthn.AuthenticatorId): void {
753
+ if (this.#authenticatorsView) {
754
+ const child = this.#authenticatorsView.querySelector(`[data-authenticator-id=${CSS.escape(authenticatorId)}]`);
758
755
  if (child) {
759
756
  child.remove();
760
757
  }
761
758
  }
762
- this.dataGrids.delete(authenticatorId);
759
+ this.#dataGrids.delete(authenticatorId);
763
760
 
764
- if (this.model) {
765
- this.model.removeAuthenticator(authenticatorId);
761
+ if (this.#model) {
762
+ this.#model.removeAuthenticator(authenticatorId);
766
763
  }
767
764
 
768
765
  // Update available authenticator setting.
769
- const prevAvailableAuthenticators = this.availableAuthenticatorSetting.get();
766
+ const prevAvailableAuthenticators = this.#availableAuthenticatorSetting.get();
770
767
  const newAvailableAuthenticators = prevAvailableAuthenticators.filter(a => a.authenticatorId !== authenticatorId);
771
- this.availableAuthenticatorSetting.set(newAvailableAuthenticators);
768
+ this.#availableAuthenticatorSetting.set(newAvailableAuthenticators);
772
769
 
773
- if (this.activeAuthId === authenticatorId) {
774
- const availableAuthenticatorIds = Array.from(this.dataGrids.keys());
770
+ if (this.#activeAuthId === authenticatorId) {
771
+ const availableAuthenticatorIds = Array.from(this.#dataGrids.keys());
775
772
  if (availableAuthenticatorIds.length) {
776
- this.setActiveAuthenticator(availableAuthenticatorIds[0]);
773
+ this.#setActiveAuthenticator(availableAuthenticatorIds[0]);
777
774
  } else {
778
- this.activeAuthId = null;
775
+ this.#activeAuthId = null;
779
776
  }
780
777
  }
781
778
  }
782
779
 
783
- private createOptionsFromCurrentInputs(): Protocol.WebAuthn.VirtualAuthenticatorOptions {
780
+ #createOptionsFromCurrentInputs(): Protocol.WebAuthn.VirtualAuthenticatorOptions {
784
781
  // TODO(crbug.com/1034663): Add optionality for isUserVerified param.
785
- if (!this.protocolSelect || !this.transportSelect || !this.residentKeyCheckbox || !this.userVerificationCheckbox) {
782
+ if (!this.#protocolSelect || !this.#transportSelect || !this.#residentKeyCheckbox ||
783
+ !this.#userVerificationCheckbox) {
786
784
  throw new Error('Unable to create options from current inputs');
787
785
  }
788
786
 
789
787
  return {
790
- protocol: this.protocolSelect.options[this.protocolSelect.selectedIndex].value as
788
+ protocol: this.#protocolSelect.options[this.#protocolSelect.selectedIndex].value as
791
789
  Protocol.WebAuthn.AuthenticatorProtocol,
792
- transport: this.transportSelect.options[this.transportSelect.selectedIndex].value as
790
+ transport: this.#transportSelect.options[this.#transportSelect.selectedIndex].value as
793
791
  Protocol.WebAuthn.AuthenticatorTransport,
794
- hasResidentKey: this.residentKeyCheckbox.checked,
795
- hasUserVerification: this.userVerificationCheckbox.checked,
792
+ hasResidentKey: this.#residentKeyCheckbox.checked,
793
+ hasUserVerification: this.#userVerificationCheckbox.checked,
796
794
  automaticPresenceSimulation: true,
797
795
  isUserVerified: true,
798
796
  };
@@ -802,38 +800,38 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
802
800
  * Sets the given authenticator as active.
803
801
  * Note that a newly added authenticator will automatically be set as active.
804
802
  */
805
- private async setActiveAuthenticator(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<void> {
806
- await this.clearActiveAuthenticator();
807
- if (this.model) {
808
- await this.model.setAutomaticPresenceSimulation(authenticatorId, true);
803
+ async #setActiveAuthenticator(authenticatorId: Protocol.WebAuthn.AuthenticatorId): Promise<void> {
804
+ await this.#clearActiveAuthenticator();
805
+ if (this.#model) {
806
+ await this.#model.setAutomaticPresenceSimulation(authenticatorId, true);
809
807
  }
810
- this.activeAuthId = authenticatorId;
808
+ this.#activeAuthId = authenticatorId;
811
809
 
812
- const prevAvailableAuthenticators = this.availableAuthenticatorSetting.get();
810
+ const prevAvailableAuthenticators = this.#availableAuthenticatorSetting.get();
813
811
  const newAvailableAuthenticators =
814
812
  prevAvailableAuthenticators.map(a => ({...a, active: a.authenticatorId === authenticatorId}));
815
- this.availableAuthenticatorSetting.set(newAvailableAuthenticators);
813
+ this.#availableAuthenticatorSetting.set(newAvailableAuthenticators);
816
814
 
817
- this.updateActiveButtons();
815
+ this.#updateActiveButtons();
818
816
  }
819
817
 
820
- private updateActiveButtons(): void {
821
- const authenticators = this.authenticatorsView.getElementsByClassName('authenticator-section');
818
+ #updateActiveButtons(): void {
819
+ const authenticators = this.#authenticatorsView.getElementsByClassName('authenticator-section');
822
820
  Array.from(authenticators).forEach((authenticator: Element): void => {
823
821
  const button = (authenticator.querySelector('input.dt-radio-button') as HTMLInputElement);
824
822
  if (!button) {
825
823
  return;
826
824
  }
827
- button.checked = (authenticator as HTMLElement).dataset.authenticatorId === this.activeAuthId;
825
+ button.checked = (authenticator as HTMLElement).dataset.authenticatorId === this.#activeAuthId;
828
826
  });
829
827
  }
830
828
 
831
- private async clearActiveAuthenticator(): Promise<void> {
832
- if (this.activeAuthId && this.model) {
833
- await this.model.setAutomaticPresenceSimulation(this.activeAuthId, false);
829
+ async #clearActiveAuthenticator(): Promise<void> {
830
+ if (this.#activeAuthId && this.#model) {
831
+ await this.#model.setAutomaticPresenceSimulation(this.#activeAuthId, false);
834
832
  }
835
- this.activeAuthId = null;
836
- this.updateActiveButtons();
833
+ this.#activeAuthId = null;
834
+ this.#updateActiveButtons();
837
835
  }
838
836
  wasShown(): void {
839
837
  super.wasShown();