chrome-devtools-frontend 1.0.945579 → 1.0.946920

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 (100) hide show
  1. package/config/gni/all_devtools_files.gni +0 -7
  2. package/config/gni/devtools_grd_files.gni +3 -39
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +0 -1
  4. package/front_end/core/host/UserMetrics.ts +0 -22
  5. package/front_end/core/i18n/locales/en-US.json +33 -27
  6. package/front_end/core/i18n/locales/en-XL.json +33 -27
  7. package/front_end/core/root/Runtime.ts +0 -1
  8. package/front_end/core/sdk/CSSProperty.ts +16 -9
  9. package/front_end/core/sdk/sdk-meta.ts +20 -8
  10. package/front_end/devtools_compatibility.js +1 -8
  11. package/front_end/entrypoints/devtools_app/devtools_app.js +3 -0
  12. package/front_end/entrypoints/devtools_app/devtools_app.json +1 -2
  13. package/front_end/entrypoints/formatter_worker/CSSFormatter.ts +1 -3
  14. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +0 -2
  15. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +0 -120
  16. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +1 -11
  17. package/front_end/entrypoints/formatter_worker/formatter_worker.ts +5 -0
  18. package/front_end/entrypoints/js_app/js_app.js +3 -0
  19. package/front_end/entrypoints/js_app/js_app.json +1 -2
  20. package/front_end/entrypoints/main/MainImpl.ts +0 -6
  21. package/front_end/entrypoints/ndb_app/ndb_app.js +3 -0
  22. package/front_end/entrypoints/ndb_app/ndb_app.json +1 -2
  23. package/front_end/entrypoints/{node_main → node_app}/NodeConnectionsPanel.ts +1 -1
  24. package/front_end/entrypoints/{node_main → node_app}/NodeMain.ts +2 -4
  25. package/front_end/entrypoints/{node_main → node_app}/nodeConnectionsPanel.css +0 -0
  26. package/front_end/entrypoints/node_app/node_app.ts +81 -0
  27. package/front_end/entrypoints/shell/shell.js +18 -1
  28. package/front_end/entrypoints/worker_app/worker_app.js +3 -0
  29. package/front_end/entrypoints/worker_app/worker_app.json +1 -2
  30. package/front_end/legacy_test_runner/sources_test_runner/sources_test_runner.js +0 -1
  31. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
  32. package/front_end/models/bindings/ResourceMapping.ts +1 -1
  33. package/front_end/models/formatter/FormatterWorkerPool.ts +0 -18
  34. package/front_end/models/text_utils/CodeMirrorUtils.ts +6 -51
  35. package/front_end/models/text_utils/TextUtils.ts +1 -2
  36. package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
  37. package/front_end/panels/animation/AnimationTimeline.ts +1 -1
  38. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -4
  39. package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +0 -11
  40. package/front_end/panels/elements/StylesSidebarPane.ts +0 -1
  41. package/front_end/panels/elements/elementsTreeOutline.css +0 -13
  42. package/front_end/panels/emulation/DeviceModeToolbar.ts +0 -16
  43. package/front_end/panels/network/NetworkConfigView.ts +10 -0
  44. package/front_end/panels/network/NetworkItemView.ts +10 -1
  45. package/front_end/panels/network/networkConfigView.css +5 -0
  46. package/front_end/panels/profiler/heapProfiler.css +2 -5
  47. package/front_end/panels/profiler/profilesPanel.css +1 -1
  48. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +6 -4
  49. package/front_end/panels/settings/emulation/components/userAgentClientHintsForm.css +0 -12
  50. package/front_end/panels/sources/DebuggerPlugin.ts +7 -3
  51. package/front_end/panels/sources/sourcesView.css +0 -130
  52. package/front_end/panels/timeline/TimelineTreeView.ts +1 -0
  53. package/front_end/panels/webauthn/WebauthnPane.ts +31 -32
  54. package/front_end/third_party/codemirror/codemirror-tsconfig.json +1 -25
  55. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  56. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1486 -1423
  57. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  58. package/front_end/third_party/codemirror.next/package.json +9 -9
  59. package/front_end/ui/components/buttons/Button.ts +17 -0
  60. package/front_end/ui/components/buttons/button.css +31 -0
  61. package/front_end/ui/components/data_grid/DataGrid.ts +9 -0
  62. package/front_end/ui/components/docs/button/basic.ts +42 -0
  63. package/front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.ts +0 -8
  64. package/front_end/ui/components/text_editor/TextEditor.ts +5 -2
  65. package/front_end/ui/components/text_editor/config.ts +3 -3
  66. package/front_end/ui/components/text_editor/javascript.ts +28 -10
  67. package/front_end/ui/components/text_editor/theme.ts +1 -0
  68. package/front_end/ui/legacy/InspectorView.ts +10 -0
  69. package/front_end/ui/legacy/ListWidget.ts +2 -2
  70. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +2 -3
  71. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +0 -1
  72. package/front_end/ui/legacy/components/object_ui/object_ui-legacy.ts +0 -8
  73. package/front_end/ui/legacy/components/object_ui/object_ui.ts +0 -4
  74. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -0
  75. package/front_end/ui/legacy/inspectorSyntaxHighlight.css +0 -211
  76. package/front_end/ui/legacy/legacy-legacy.ts +0 -6
  77. package/front_end/ui/legacy/legacy.ts +0 -2
  78. package/front_end/ui/legacy/tabbedPane.css +1 -1
  79. package/package.json +1 -1
  80. package/scripts/check_gn.js +1 -1
  81. package/scripts/eslint_rules/lib/l10n_filename_matches.js +17 -4
  82. package/scripts/eslint_rules/tests/l10n_filename_matches_test.js +21 -0
  83. package/scripts/hosted_mode/server.js +17 -2
  84. package/front_end/entrypoints/node_app/node_app-meta.ts +0 -43
  85. package/front_end/entrypoints/node_app/node_app.js +0 -13
  86. package/front_end/entrypoints/node_app/node_app.json +0 -4
  87. package/front_end/entrypoints/node_main/node_main-meta.ts +0 -48
  88. package/front_end/entrypoints/node_main/node_main.ts +0 -11
  89. package/front_end/entrypoints/shell/shell-meta-files.ts +0 -22
  90. package/front_end/entrypoints/shell/shell.json +0 -5
  91. package/front_end/ui/legacy/TextEditor.ts +0 -82
  92. package/front_end/ui/legacy/components/object_ui/JavaScriptAutocomplete.ts +0 -836
  93. package/front_end/ui/legacy/components/text_editor/CodeMirrorTextEditor.ts +0 -1676
  94. package/front_end/ui/legacy/components/text_editor/TextEditorAutocompleteController.ts +0 -586
  95. package/front_end/ui/legacy/components/text_editor/autocompleteTooltip.css +0 -20
  96. package/front_end/ui/legacy/components/text_editor/cm_modes.ts +0 -23
  97. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +0 -995
  98. package/front_end/ui/legacy/components/text_editor/module.json +0 -7
  99. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -33
  100. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -13
@@ -1616,7 +1616,6 @@ export class StylePropertiesSection {
1616
1616
 
1617
1617
  private onFontEditorButtonClicked(): void {
1618
1618
  if (this.fontEditorSectionManager && this.fontEditorButton) {
1619
- Host.userMetrics.cssEditorOpened('fontEditor');
1620
1619
  this.fontEditorSectionManager.showPopover(this.fontEditorButton.element, this.parentPane);
1621
1620
  }
1622
1621
  }
@@ -186,19 +186,6 @@
186
186
  margin-right: 4px;
187
187
  }
188
188
 
189
- .CodeMirror {
190
- background-color: var(--color-background);
191
- height: 300px !important; /* stylelint-disable-line declaration-no-important */
192
- }
193
-
194
- .CodeMirror-lines {
195
- padding: 0;
196
- }
197
-
198
- .CodeMirror pre {
199
- padding: 0;
200
- }
201
-
202
189
  button,
203
190
  input,
204
191
  select {
@@ -225,10 +225,6 @@ export class DeviceModeToolbar {
225
225
  showMediaInspectorSetting: Common.Settings.Setting<boolean>,
226
226
  showRulersSetting: Common.Settings.Setting<boolean>) {
227
227
  this.model = model;
228
- const device = model.device();
229
- if (device) {
230
- this.recordDeviceChange(device, null);
231
- }
232
228
  this.showMediaInspectorSetting = showMediaInspectorSetting;
233
229
  this.showRulersSetting = showRulersSetting;
234
230
 
@@ -302,16 +298,6 @@ export class DeviceModeToolbar {
302
298
  }
303
299
  }
304
300
 
305
- private recordDeviceChange(
306
- device: EmulationModel.EmulatedDevices.EmulatedDevice,
307
- oldDevice: EmulationModel.EmulatedDevices.EmulatedDevice|null): void {
308
- if (device !== oldDevice && device && device.isDualScreen) {
309
- // When we start emulating a device, whether we start a new emulation session, or switch to
310
- // a new device, if the device is dual screen, we count this once.
311
- Host.userMetrics.dualScreenDeviceEmulated(Host.UserMetrics.DualScreenDeviceEmulated.DualScreenDeviceSelected);
312
- }
313
- }
314
-
315
301
  private createEmptyToolbarElement(): Element {
316
302
  const element = document.createElement('div');
317
303
  element.classList.add('device-mode-empty-toolbar-element');
@@ -527,7 +513,6 @@ export class DeviceModeToolbar {
527
513
 
528
514
  private emulateDevice(device: EmulationModel.EmulatedDevices.EmulatedDevice): void {
529
515
  const scale = this.autoAdjustScaleSetting.get() ? undefined : this.model.scaleSetting().get();
530
- this.recordDeviceChange(device, this.model.device());
531
516
  this.model.emulate(
532
517
  EmulationModel.DeviceModeModel.Type.Device, device, this.lastMode.get(device) || device.modes[0], scale);
533
518
  }
@@ -615,7 +600,6 @@ export class DeviceModeToolbar {
615
600
  return;
616
601
  }
617
602
 
618
- Host.userMetrics.dualScreenDeviceEmulated(Host.UserMetrics.DualScreenDeviceEmulated.SpanButtonClicked);
619
603
  const scale = this.autoAdjustScaleSetting.get() ? undefined : this.model.scaleSetting().get();
620
604
  const mode = this.model.mode();
621
605
  if (!mode) {
@@ -50,6 +50,10 @@ const UIStrings = {
50
50
  * a set of checkboxes to override the content encodings supported by the browser.
51
51
  */
52
52
  acceptedEncoding: 'Accepted `Content-Encoding`s',
53
+ /**
54
+ * @description Status text for successful update of client hints.
55
+ */
56
+ clientHintsStatusText: 'User agent updated.',
53
57
  };
54
58
  const str_ = i18n.i18n.registerUIStrings('panels/network/NetworkConfigView.ts', UIStrings);
55
59
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -246,10 +250,12 @@ export class NetworkConfigView extends UI.Widget.VBox {
246
250
  showMobileCheckbox: true,
247
251
  showSubmitButton: true,
248
252
  };
253
+ userAgentUpdateButtonStatusText.textContent = '';
249
254
  });
250
255
 
251
256
  clientHints.addEventListener('clienthintschange', () => {
252
257
  customSelectAndInput.select.value = 'custom';
258
+ userAgentUpdateButtonStatusText.textContent = '';
253
259
  });
254
260
 
255
261
  clientHints.addEventListener('clienthintssubmit', (event: Event) => {
@@ -257,8 +263,12 @@ export class NetworkConfigView extends UI.Widget.VBox {
257
263
  const customUA = customUserAgentSetting.get();
258
264
  userAgentMetadataSetting.set(metaData);
259
265
  SDK.NetworkManager.MultitargetNetworkManager.instance().setCustomUserAgentOverride(customUA, metaData);
266
+ userAgentUpdateButtonStatusText.textContent = i18nString(UIStrings.clientHintsStatusText);
260
267
  });
261
268
 
269
+ const userAgentUpdateButtonStatusText = section.createChild('span', 'status-text');
270
+ userAgentUpdateButtonStatusText.textContent = '';
271
+
262
272
  userAgentSelectBoxChanged();
263
273
 
264
274
  function userAgentSelectBoxChanged(): void {
@@ -250,6 +250,9 @@ export class NetworkItemView extends UI.TabbedPane.TabbedPane {
250
250
  }
251
251
 
252
252
  private async maybeAppendPayloadPanel(): Promise<void> {
253
+ if (this.hasTab('payload')) {
254
+ return;
255
+ }
253
256
  if (this.requestInternal.queryParameters || await this.requestInternal.requestFormData()) {
254
257
  this.payloadView = new RequestPayloadView(this.requestInternal);
255
258
  this.appendTab(
@@ -270,7 +273,13 @@ export class NetworkItemView extends UI.TabbedPane.TabbedPane {
270
273
 
271
274
  private selectTabInternal(tabId: string): void {
272
275
  if (!this.selectTab(tabId)) {
273
- this.selectTab('headers');
276
+ // maybeAppendPayloadPanel might cause payload tab to appear asynchronously, so
277
+ // it makes sense to retry on the next tick
278
+ setTimeout(() => {
279
+ if (!this.selectTab(tabId)) {
280
+ this.selectTab('headers');
281
+ }
282
+ }, 0);
274
283
  }
275
284
  }
276
285
 
@@ -99,3 +99,8 @@
99
99
  margin-top: 14px;
100
100
  width: min(100%, 400px);
101
101
  }
102
+
103
+ .status-text {
104
+ padding: 10px;
105
+ color: var(--color-accent-green);
106
+ }
@@ -132,11 +132,8 @@
132
132
  }
133
133
  }
134
134
 
135
- .heap-snapshot-view tr:not(.selected) td.object-column span.heap-object-tag {
136
- color: var(--color-text-secondary);
137
- }
138
-
139
- .heap-snapshot-view td.object-column span.grayed {
135
+ .heap-snapshot-view tr:not(.selected) td.object-column span.heap-object-tag,
136
+ .heap-snapshot-view tr:not(.selected) td.object-column span.grayed {
140
137
  color: var(--color-text-secondary);
141
138
  }
142
139
 
@@ -55,7 +55,7 @@
55
55
 
56
56
  .profile-view .data-grid span.percent-column {
57
57
  color: var(--color-text-secondary);
58
- width: 55px;
58
+ width: 9ex;
59
59
  display: inline-block;
60
60
  }
61
61
 
@@ -3,8 +3,10 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as i18n from '../../../../core/i18n/i18n.js';
6
+ import * as Buttons from '../../../../ui/components/buttons/buttons.js';
6
7
  import * as ComponentHelpers from '../../../../ui/components/helpers/helpers.js';
7
8
  import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
9
+
8
10
  import userAgentClientHintsFormStyles from './userAgentClientHintsForm.css.js';
9
11
 
10
12
  import type * as Protocol from '../../../../generated/protocol.js';
@@ -532,12 +534,12 @@ export class UserAgentClientHintsForm extends HTMLElement {
532
534
  'architecture');
533
535
  const deviceModelSection = this.renderDeviceModelSection();
534
536
  const submitButton = this.showSubmitButton ? LitHtml.html`
535
- <button
536
- type="submit"
537
- class="submit-button full-row"
537
+ <${Buttons.Button.Button.litTagName}
538
+ .variant=${Buttons.Button.Variant.SECONDARY}
539
+ .type=${'submit'}
538
540
  >
539
541
  ${i18nString(UIStrings.update)}
540
- </button>
542
+ </${Buttons.Button.Button.litTagName}>
541
543
  ` :
542
544
  LitHtml.html``;
543
545
  const output = LitHtml.html`
@@ -96,18 +96,6 @@
96
96
  margin-left: 5px;
97
97
  }
98
98
 
99
- .submit-button {
100
- border: none;
101
- border-radius: 2px;
102
- font-weight: normal;
103
- height: 24px;
104
- font-size: 12px;
105
- padding: 0 12px;
106
- cursor: pointer;
107
- background-color: var(--color-primary-variant);
108
- color: var(--color-text-primary);
109
- }
110
-
111
99
  .hide-container {
112
100
  display: none;
113
101
  }
@@ -589,8 +589,12 @@ export class DebuggerPlugin extends Plugin {
589
589
  if (node.firstChild) {
590
590
  return null;
591
591
  }
592
- while (node && node.name !== 'VariableDefinition' && node.name !== 'VariableName' &&
593
- node.name !== 'MemberExpression') {
592
+ while (
593
+ node && node.name !== 'VariableDefinition' && node.name !== 'VariableName' &&
594
+ node.name !== 'MemberExpression' &&
595
+ !(node.name === 'PropertyName' && node.parent?.name === 'PatternProperty' &&
596
+ node.nextSibling?.name !== ':') &&
597
+ !(node.name === 'PropertyDefinition' && node.parent?.name === 'Property' && node.nextSibling?.name !== ':')) {
594
598
  node = node.parent;
595
599
  }
596
600
  if (!node) {
@@ -1298,7 +1302,7 @@ export class DebuggerPlugin extends Plugin {
1298
1302
  Bindings.ResourceScriptMapping.ResourceScriptFile.Events.DidMergeToVM, this.didMergeToVM, this);
1299
1303
  oldScriptFile.removeEventListener(
1300
1304
  Bindings.ResourceScriptMapping.ResourceScriptFile.Events.DidDivergeFromVM, this.didDivergeFromVM, this);
1301
- if (this.muted && !this.uiSourceCode.isDirty() && this.consistentScripts) {
1305
+ if (this.muted && !this.uiSourceCode.isDirty() && this.consistentScripts()) {
1302
1306
  this.setMuted(false);
1303
1307
  }
1304
1308
  }
@@ -58,133 +58,3 @@
58
58
  .-theme-with-dark-background .source-frame-debugger-script {
59
59
  --override-debugger-background-tint: rgb(61 61 0 / 50%);
60
60
  }
61
-
62
- @keyframes source-frame-value-update-highlight-animation {
63
- from {
64
- background-color: inherit;
65
- color: inherit;
66
- }
67
-
68
- 10% {
69
- background-color: var(--override-highlight-animation-10pc-background-color);
70
- color: var(--override-highlight-animation-10pc-foreground-color);
71
- }
72
-
73
- to {
74
- background-color: inherit;
75
- color: inherit;
76
- }
77
- }
78
-
79
- .source-frame-value-update-highlight {
80
- animation: source-frame-value-update-highlight-animation 0.8s 1 cubic-bezier(0, 0, 0.2, 1);
81
- border-radius: 2px;
82
- }
83
-
84
- .diff-entry-insert {
85
- --override-diff-line-number-background-color: hsl(144deg 55% 49% / 20%);
86
- }
87
-
88
- .-theme-with-dark-background .diff-entry-insert,
89
- :host-context(.-theme-with-dark-background) .diff-entry-insert {
90
- --override-diff-line-number-background-color: rgb(61 199 116 / 20%);
91
- }
92
-
93
- .diff-entry-insert .diff-marker {
94
- border-left: 4px solid var(--color-accent-green);
95
- }
96
-
97
- .diff-entry-insert .CodeMirror-gutter-background {
98
- background-color: var(--override-diff-line-number-background-color);
99
- }
100
-
101
- .diff-entry-modify {
102
- --override-diff-line-number-background-color: rgb(186 104 200 / 20%);
103
- --override-diff-line-number-border-color: #9c27b0;
104
- }
105
-
106
- .-theme-with-dark-background .diff-entry-modify,
107
- :host-context(.-theme-with-dark-background) .diff-entry-modify {
108
- --override-diff-line-number-background-color: rgb(137 55 151 / 20%);
109
- --override-diff-line-number-border-color: rgb(196 79 216);
110
- }
111
-
112
- .diff-entry-modify .diff-marker {
113
- border-left: 4px solid var(--override-diff-line-number-border-color);
114
- }
115
-
116
- .diff-entry-modify .CodeMirror-gutter-background {
117
- background-color: var(--override-diff-line-number-background-color);
118
- }
119
-
120
- .diff-entry-delete {
121
- --override-diff-deletion-color: #d32f2f;
122
- }
123
-
124
- .-theme-with-dark-background .diff-entry-delete,
125
- :host-context(.-theme-with-dark-background) .diff-entry-delete {
126
- --override-diff-deletion-color: rgb(208 44 44);
127
- }
128
-
129
- .diff-entry-delete .diff-marker {
130
- width: 0;
131
- height: 0;
132
- border-top: 6px solid transparent;
133
- border-bottom: 6px solid transparent;
134
- border-left: 6px solid var(--override-diff-deletion-color);
135
- position: relative;
136
- top: 6px;
137
- cursor: pointer;
138
- left: 0;
139
- }
140
-
141
- .diff-entry-delete .CodeMirror-gutter-background {
142
- border-bottom: 2px solid var(--override-diff-deletion-color);
143
- }
144
-
145
- .CodeMirror-gutter-diff {
146
- width: 4px;
147
- }
148
-
149
- .highlight-line-modification {
150
- --override-modification-background-fadeout-from: rgb(158 54 153 / 50%);
151
- --override-modification-background-fadeout-90pc: rgb(158 54 153 / 0%);
152
- --override-modification-foreground-fadeout-from: #fff;
153
-
154
- animation: source-line-modification-background-fadeout 0.4s 0s;
155
- animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
156
- }
157
-
158
- .highlight-line-modification span {
159
- animation: source-line-modification-foreground-fadeout 0.4s 0s;
160
- animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
161
- }
162
-
163
- @keyframes source-line-modification-background-fadeout {
164
- from {
165
- background-color: var(--override-modification-background-fadeout-from);
166
- }
167
-
168
- 50% {
169
- /* Purposefully uses the `from` color to delay the animation from 0-50% */
170
- background-color: var(--override-modification-background-fadeout-from);
171
- }
172
-
173
- 90% {
174
- background-color: var(--override-modification-background-fadeout-90pc);
175
- }
176
- to { background-color: transparent; }
177
- }
178
-
179
- @keyframes source-line-modification-foreground-fadeout {
180
- from {
181
- color: var(--override-modification-foreground-fadeout-from);
182
- }
183
-
184
- 50% {
185
- /* Purposefully uses the `from` color to delay the animation from 0-50% */
186
- color: var(--override-modification-foreground-fadeout-from);
187
- }
188
- 90% { color: initial; }
189
- to { color: initial; }
190
- }
@@ -651,6 +651,7 @@ export class GridNode extends DataGrid.SortableDataGrid.SortableDataGridNode<Gri
651
651
  }
652
652
  const cell = this.createTD(columnId);
653
653
  cell.className = 'numeric-column';
654
+ cell.setAttribute('title', i18nString(UIStrings.fms, {PH1: value.toFixed(4)}));
654
655
  const textDiv = cell.createChild('div');
655
656
  textDiv.createChild('span').textContent = i18nString(UIStrings.fms, {PH1: value.toFixed(1)});
656
657
 
@@ -227,15 +227,15 @@ const PROTOCOL_AUTHENTICATOR_VALUES: Protocol.EnumerableEnum<typeof Protocol.Web
227
227
  U2f: Protocol.WebAuthn.AuthenticatorProtocol.U2f,
228
228
  };
229
229
 
230
- export class WebauthnPaneImpl extends UI.Widget.VBox {
231
- private enabled: boolean;
232
- private activeAuthId: Protocol.WebAuthn.AuthenticatorId|null;
233
- private hasBeenEnabled: boolean;
234
- private readonly dataGrids: Map<Protocol.WebAuthn.AuthenticatorId, DataGrid.DataGrid.DataGridImpl<DataGridNode>>;
235
- // @ts-ignore
236
- private enableCheckbox: UI.Toolbar.ToolbarCheckbox;
230
+ export class WebauthnPaneImpl extends UI.Widget.VBox implements
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
237
  private readonly availableAuthenticatorSetting: Common.Settings.Setting<AvailableAuthenticatorOptions[]>;
238
- private model: SDK.WebAuthnModel.WebAuthnModel|null|undefined;
238
+ private model?: SDK.WebAuthnModel.WebAuthnModel;
239
239
  private authenticatorsView: HTMLElement;
240
240
  private topToolbarContainer: HTMLElement|undefined;
241
241
  private topToolbar: UI.Toolbar.Toolbar|undefined;
@@ -253,21 +253,13 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
253
253
 
254
254
  constructor() {
255
255
  super(true);
256
+ SDK.TargetManager.TargetManager.instance().observeModels(SDK.WebAuthnModel.WebAuthnModel, this);
256
257
 
257
258
  this.contentElement.classList.add('webauthn-pane');
258
- this.enabled = false;
259
- this.activeAuthId = null;
260
- this.hasBeenEnabled = false;
261
- this.dataGrids = new Map();
262
259
 
263
260
  this.availableAuthenticatorSetting =
264
- (Common.Settings.Settings.instance().createSetting('webauthnAuthenticators', []) as
265
- Common.Settings.Setting<AvailableAuthenticatorOptions[]>);
266
-
267
- const mainTarget = SDK.TargetManager.TargetManager.instance().mainTarget();
268
- if (mainTarget) {
269
- this.model = mainTarget.model(SDK.WebAuthnModel.WebAuthnModel);
270
- }
261
+ Common.Settings.Settings.instance().createSetting<AvailableAuthenticatorOptions[]>(
262
+ 'webauthnAuthenticators', []);
271
263
 
272
264
  this.createToolbar();
273
265
  this.authenticatorsView = this.contentElement.createChild('div', 'authenticators-view');
@@ -284,6 +276,18 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
284
276
  return webauthnPaneImplInstance;
285
277
  }
286
278
 
279
+ modelAdded(model: SDK.WebAuthnModel.WebAuthnModel): void {
280
+ if (model.target() === SDK.TargetManager.TargetManager.instance().mainTarget()) {
281
+ this.model = model;
282
+ }
283
+ }
284
+
285
+ modelRemoved(model: SDK.WebAuthnModel.WebAuthnModel): void {
286
+ if (model.target() === SDK.TargetManager.TargetManager.instance().mainTarget()) {
287
+ this.model = undefined;
288
+ }
289
+ }
290
+
287
291
  private async loadInitialAuthenticators(): Promise<void> {
288
292
  let activeAuthenticatorId: Protocol.WebAuthn.AuthenticatorId|null = null;
289
293
  const availableAuthenticators = this.availableAuthenticatorSetting.get();
@@ -422,7 +426,6 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
422
426
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.VirtualAuthenticatorEnvironmentEnabled);
423
427
  this.hasBeenEnabled = true;
424
428
  }
425
- this.enabled = enable;
426
429
  if (this.model) {
427
430
  await this.model.setVirtualAuthEnvEnabled(enable);
428
431
  }
@@ -609,7 +612,7 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
609
612
  UI.UIUtils.createRadioLabel(`active-authenticator-${authenticatorId}`, i18nString(UIStrings.active));
610
613
  activeLabel.radioElement.addEventListener('click', this.setActiveAuthenticator.bind(this, authenticatorId));
611
614
  activeButtonContainer.appendChild(activeLabel);
612
- /** @type {!HTMLInputElement} */ (activeLabel.radioElement as HTMLInputElement).checked = true;
615
+ (activeLabel.radioElement as HTMLInputElement).checked = true;
613
616
  this.activeAuthId = authenticatorId; // Newly added authenticator is automatically set as active.
614
617
 
615
618
  const removeButton = headerElement.createChild('button', 'text-button');
@@ -783,19 +786,16 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
783
786
  throw new Error('Unable to create options from current inputs');
784
787
  }
785
788
 
786
- /**
787
- * @type {!Protocol.WebAuthn.VirtualAuthenticatorOptions}
788
- */
789
- const options = ({
790
- protocol: this.protocolSelect.options[this.protocolSelect.selectedIndex].value,
791
- transport: this.transportSelect.options[this.transportSelect.selectedIndex].value,
789
+ return {
790
+ protocol: this.protocolSelect.options[this.protocolSelect.selectedIndex].value as
791
+ Protocol.WebAuthn.AuthenticatorProtocol,
792
+ transport: this.transportSelect.options[this.transportSelect.selectedIndex].value as
793
+ Protocol.WebAuthn.AuthenticatorTransport,
792
794
  hasResidentKey: this.residentKeyCheckbox.checked,
793
795
  hasUserVerification: this.userVerificationCheckbox.checked,
794
796
  automaticPresenceSimulation: true,
795
797
  isUserVerified: true,
796
- } as Protocol.WebAuthn.VirtualAuthenticatorOptions);
797
-
798
- return options;
798
+ };
799
799
  }
800
800
 
801
801
  /**
@@ -824,8 +824,7 @@ export class WebauthnPaneImpl extends UI.Widget.VBox {
824
824
  if (!button) {
825
825
  return;
826
826
  }
827
- button.checked =
828
- /** @type {!HTMLElement} */ (authenticator as HTMLElement).dataset.authenticatorId === this.activeAuthId;
827
+ button.checked = (authenticator as HTMLElement).dataset.authenticatorId === this.activeAuthId;
829
828
  });
830
829
  }
831
830
 
@@ -3,33 +3,9 @@
3
3
  "composite": true
4
4
  },
5
5
  "files": [
6
- "package/addon/comment/comment.js",
7
- "package/addon/edit/closebrackets.js",
8
- "package/addon/edit/matchbrackets.js",
9
- "package/addon/fold/brace-fold.js",
10
- "package/addon/fold/foldcode.js",
11
- "package/addon/fold/foldgutter.js",
12
- "package/addon/mode/multiplex.js",
13
- "package/addon/mode/overlay.js",
14
- "package/addon/mode/simple.js",
15
6
  "package/addon/runmode/runmode-standalone.js",
16
- "package/addon/selection/active-line.js",
17
- "package/addon/selection/mark-selection.js",
18
- "package/lib/codemirror.js",
19
- "package/mode/clike/clike.js",
20
- "package/mode/clojure/clojure.js",
21
- "package/mode/coffeescript/coffeescript.js",
22
7
  "package/mode/css/css.js",
23
- "package/mode/htmlembedded/htmlembedded.js",
24
- "package/mode/htmlmixed/htmlmixed.js",
25
8
  "package/mode/javascript/javascript.js",
26
- "package/mode/jsx/jsx.js",
27
- "package/mode/livescript/livescript.js",
28
- "package/mode/markdown/markdown.js",
29
- "package/mode/php/php.js",
30
- "package/mode/python/python.js",
31
- "package/mode/shell/shell.js",
32
- "package/mode/wast/wast.js",
33
9
  "package/mode/xml/xml.js"
34
10
  ]
35
- }
11
+ }