chrome-devtools-frontend 1.0.956881 → 1.0.958475

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/.eslintignore +0 -1
  2. package/extension-api/ExtensionAPI.d.ts +7 -0
  3. package/front_end/Tests.js +14 -0
  4. package/front_end/core/common/Debouncer.ts +1 -1
  5. package/front_end/core/common/Settings.ts +33 -0
  6. package/front_end/core/host/InspectorFrontendHost.ts +7 -3
  7. package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
  8. package/front_end/core/host/UserMetrics.ts +2 -2
  9. package/front_end/core/i18n/i18nImpl.ts +1 -1
  10. package/front_end/core/i18n/locales/en-US.json +6 -0
  11. package/front_end/core/i18n/locales/en-XL.json +6 -0
  12. package/front_end/core/protocol_client/InspectorBackend.ts +3 -3
  13. package/front_end/core/sdk/Connections.ts +1 -1
  14. package/front_end/core/sdk/IsolateManager.ts +1 -1
  15. package/front_end/core/sdk/PageResourceLoader.ts +4 -2
  16. package/front_end/devtools_compatibility.js +9 -0
  17. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  18. package/front_end/models/extensions/ExtensionAPI.ts +33 -5
  19. package/front_end/models/extensions/ExtensionServer.ts +28 -0
  20. package/front_end/models/logs/LogManager.ts +1 -1
  21. package/front_end/models/persistence/Automapping.ts +32 -4
  22. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
  23. package/front_end/models/persistence/PersistenceImpl.ts +33 -13
  24. package/front_end/models/workspace/UISourceCode.ts +1 -1
  25. package/front_end/panels/application/AppManifestView.ts +41 -0
  26. package/front_end/panels/application/StorageView.ts +1 -1
  27. package/front_end/panels/console/ConsoleView.ts +1 -1
  28. package/front_end/panels/elements/AccessibilityTreeView.ts +2 -2
  29. package/front_end/panels/elements/ComputedStyleModel.ts +1 -1
  30. package/front_end/panels/elements/ElementsPanel.ts +16 -15
  31. package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
  32. package/front_end/panels/elements/elementsPanel.css +4 -2
  33. package/front_end/panels/network/NetworkItemView.ts +1 -1
  34. package/front_end/panels/network/NetworkLogViewColumns.ts +5 -0
  35. package/front_end/panels/profiler/HeapTimelineOverview.ts +2 -2
  36. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -1
  37. package/front_end/panels/screencast/ScreencastView.ts +2 -2
  38. package/front_end/panels/settings/SettingsScreen.ts +1 -1
  39. package/front_end/panels/settings/settingsScreen.css +8 -3
  40. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  41. package/front_end/panels/sources/NavigatorView.ts +1 -1
  42. package/front_end/panels/sources/SourcesSearchScope.ts +1 -1
  43. package/front_end/panels/sources/sources-meta.ts +14 -11
  44. package/front_end/panels/timeline/TimelineController.ts +2 -2
  45. package/front_end/panels/timeline/TimelineLoader.ts +3 -3
  46. package/front_end/panels/timeline/TimelinePanel.ts +1 -1
  47. package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
  48. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  49. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  50. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +76 -12
  51. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  52. package/front_end/third_party/codemirror.next/package.json +13 -13
  53. package/front_end/ui/components/buttons/Button.ts +5 -1
  54. package/front_end/ui/components/buttons/button.css +10 -1
  55. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +2 -2
  56. package/front_end/ui/components/text_editor/TextEditor.ts +1 -1
  57. package/front_end/ui/components/text_editor/cursor_tooltip.ts +1 -1
  58. package/front_end/ui/components/text_editor/javascript.ts +1 -1
  59. package/front_end/ui/components/text_editor/theme.ts +1 -0
  60. package/front_end/ui/legacy/SearchableView.ts +1 -1
  61. package/front_end/ui/legacy/SoftDropDown.ts +2 -2
  62. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  63. package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +1 -1
  64. package/front_end/ui/legacy/theme_support/theme_support_impl.ts +1 -1
  65. package/front_end/ui/legacy/toolbar.css +2 -0
  66. package/package.json +1 -1
  67. package/front_end/third_party/codemirror/README.md +0 -3
  68. package/front_end/third_party/codemirror/codemirror.css +0 -283
  69. package/front_end/third_party/codemirror/codemirror.ts +0 -19
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
6
7
  import * as Platform from '../../core/platform/platform.js';
7
8
  import * as SDK from '../../core/sdk/sdk.js';
8
9
  import * as Components from '../../ui/legacy/components/utils/utils.js';
@@ -18,7 +19,7 @@ let persistenceInstance: PersistenceImpl;
18
19
  export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
19
20
  private readonly workspace: Workspace.Workspace.WorkspaceImpl;
20
21
  private readonly breakpointManager: Bindings.BreakpointManager.BreakpointManager;
21
- private readonly filePathPrefixesToBindingCount: Map<string, number>;
22
+ private readonly filePathPrefixesToBindingCount: FilePathPrefixesBindingCounts;
22
23
  private subscribedBindingEventListeners:
23
24
  Platform.MapUtilities.Multimap<Workspace.UISourceCode.UISourceCode, () => void>;
24
25
  private readonly mapping: Automapping;
@@ -28,7 +29,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
28
29
  super();
29
30
  this.workspace = workspace;
30
31
  this.breakpointManager = breakpointManager;
31
- this.filePathPrefixesToBindingCount = new Map();
32
+ this.filePathPrefixesToBindingCount = new FilePathPrefixesBindingCounts();
32
33
 
33
34
  this.subscribedBindingEventListeners = new Platform.MapUtilities.Multimap();
34
35
 
@@ -92,7 +93,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
92
93
  binding.fileSystem.addEventListener(
93
94
  Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
94
95
 
95
- this.addFilePathBindingPrefixes(binding.fileSystem.url());
96
+ this.filePathPrefixesToBindingCount.add(binding.fileSystem.url());
96
97
 
97
98
  await this.moveBreakpoints(binding.fileSystem, binding.network);
98
99
 
@@ -131,7 +132,7 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
131
132
  binding.fileSystem.removeEventListener(
132
133
  Workspace.UISourceCode.Events.WorkingCopyChanged, this.onWorkingCopyChanged, this);
133
134
 
134
- this.removeFilePathBindingPrefixes(binding.fileSystem.url());
135
+ this.filePathPrefixesToBindingCount.remove(binding.fileSystem.url());
135
136
  await this.breakpointManager.copyBreakpoints(binding.network.url(), binding.fileSystem);
136
137
 
137
138
  this.notifyBindingEvent(binding.network);
@@ -307,33 +308,52 @@ export class PersistenceImpl extends Common.ObjectWrapper.ObjectWrapper<EventTyp
307
308
  return binding ? binding.network : null;
308
309
  }
309
310
 
310
- private addFilePathBindingPrefixes(filePath: string): void {
311
+ filePathHasBindings(filePath: string): boolean {
312
+ return this.filePathPrefixesToBindingCount.hasBindingPrefix(filePath);
313
+ }
314
+ }
315
+
316
+ class FilePathPrefixesBindingCounts {
317
+ private prefixCounts: Map<string, number>;
318
+
319
+ constructor() {
320
+ this.prefixCounts = new Map();
321
+ }
322
+
323
+ private getPlatformCanonicalFilePath(path: string): string {
324
+ return Host.Platform.isWin() ? path.toLowerCase() : path;
325
+ }
326
+
327
+ add(filePath: string): void {
328
+ filePath = this.getPlatformCanonicalFilePath(filePath);
311
329
  let relative = '';
312
330
  for (const token of filePath.split('/')) {
313
331
  relative += token + '/';
314
- const count = this.filePathPrefixesToBindingCount.get(relative) || 0;
315
- this.filePathPrefixesToBindingCount.set(relative, count + 1);
332
+ const count = this.prefixCounts.get(relative) || 0;
333
+ this.prefixCounts.set(relative, count + 1);
316
334
  }
317
335
  }
318
336
 
319
- private removeFilePathBindingPrefixes(filePath: string): void {
337
+ remove(filePath: string): void {
338
+ filePath = this.getPlatformCanonicalFilePath(filePath);
320
339
  let relative = '';
321
340
  for (const token of filePath.split('/')) {
322
341
  relative += token + '/';
323
- const count = this.filePathPrefixesToBindingCount.get(relative);
342
+ const count = this.prefixCounts.get(relative);
324
343
  if (count === 1) {
325
- this.filePathPrefixesToBindingCount.delete(relative);
344
+ this.prefixCounts.delete(relative);
326
345
  } else if (count !== undefined) {
327
- this.filePathPrefixesToBindingCount.set(relative, count - 1);
346
+ this.prefixCounts.set(relative, count - 1);
328
347
  }
329
348
  }
330
349
  }
331
350
 
332
- filePathHasBindings(filePath: string): boolean {
351
+ hasBindingPrefix(filePath: string): boolean {
352
+ filePath = this.getPlatformCanonicalFilePath(filePath);
333
353
  if (!filePath.endsWith('/')) {
334
354
  filePath += '/';
335
355
  }
336
- return this.filePathPrefixesToBindingCount.has(filePath);
356
+ return this.prefixCounts.has(filePath);
337
357
  }
338
358
  }
339
359
 
@@ -277,7 +277,7 @@ export class UISourceCode extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
277
277
  await Common.Revealer.reveal(this);
278
278
 
279
279
  // Make sure we are in the next frame before stopping the world with confirm
280
- await new Promise(resolve => setTimeout(resolve, 0));
280
+ await new Promise(resolve => window.setTimeout(resolve, 0));
281
281
 
282
282
  const shouldUpdate = window.confirm(i18nString(UIStrings.thisFileWasChangedExternally));
283
283
  if (shouldUpdate) {
@@ -102,6 +102,14 @@ const UIStrings = {
102
102
  */
103
103
  backgroundColor: 'Background color',
104
104
  /**
105
+ *@description Text in App Manifest View of the Application panel
106
+ */
107
+ darkThemeColor: 'Dark theme color',
108
+ /**
109
+ *@description Text in App Manifest View of the Application panel
110
+ */
111
+ darkBackgroundColor: 'Dark background color',
112
+ /**
105
113
  *@description Text for the orientation of something
106
114
  */
107
115
  orientation: 'Orientation',
@@ -403,6 +411,10 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
403
411
  private readonly startURLField: HTMLElement;
404
412
  private readonly themeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
405
413
  private readonly backgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
414
+ private readonly darkThemeColorField: HTMLElement;
415
+ private readonly darkThemeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
416
+ private readonly darkBackgroundColorField: HTMLElement;
417
+ private readonly darkBackgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
406
418
  private orientationField: HTMLElement;
407
419
  private displayField: HTMLElement;
408
420
  private readonly newNoteUrlField: HTMLElement;
@@ -456,6 +468,14 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
456
468
  this.backgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
457
469
  backgroundColorField.appendChild(this.backgroundColorSwatch);
458
470
 
471
+ this.darkThemeColorField = this.presentationSection.appendField(i18nString(UIStrings.darkThemeColor));
472
+ this.darkThemeColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
473
+ this.darkThemeColorField.appendChild(this.darkThemeColorSwatch);
474
+
475
+ this.darkBackgroundColorField = this.presentationSection.appendField(i18nString(UIStrings.darkBackgroundColor));
476
+ this.darkBackgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
477
+ this.darkBackgroundColorField.appendChild(this.darkBackgroundColorSwatch);
478
+
459
479
  this.orientationField = this.presentationSection.appendField(i18nString(UIStrings.orientation));
460
480
  this.displayField = this.presentationSection.appendField(i18nString(UIStrings.display));
461
481
 
@@ -634,6 +654,27 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
634
654
  this.backgroundColorSwatch.renderColor(backgroundColor, true);
635
655
  }
636
656
 
657
+ const userPreferences = parsedManifest['user_preferences'] || {};
658
+ const colorSchemeDark = userPreferences['color_scheme_dark'] || {};
659
+ const darkThemeColorString = colorSchemeDark['theme_color'];
660
+ const hasDarkThemeColor = typeof darkThemeColorString === 'string';
661
+ this.darkThemeColorField.parentElement?.classList.toggle('hidden', !hasDarkThemeColor);
662
+ if (hasDarkThemeColor) {
663
+ const darkThemeColor = Common.Color.Color.parse(darkThemeColorString);
664
+ if (darkThemeColor) {
665
+ this.darkThemeColorSwatch.renderColor(darkThemeColor, true);
666
+ }
667
+ }
668
+ const darkBackgroundColorString = colorSchemeDark['background_color'];
669
+ const hasDarkBackgroundColor = typeof darkBackgroundColorString === 'string';
670
+ this.darkBackgroundColorField.parentElement?.classList.toggle('hidden', !hasDarkBackgroundColor);
671
+ if (hasDarkBackgroundColor) {
672
+ const darkBackgroundColor = Common.Color.Color.parse(darkBackgroundColorString);
673
+ if (darkBackgroundColor) {
674
+ this.darkBackgroundColorSwatch.renderColor(darkBackgroundColor, true);
675
+ }
676
+ }
677
+
637
678
  this.orientationField.textContent = stringProperty('orientation');
638
679
  const displayType = stringProperty('display');
639
680
  this.displayField.textContent = displayType;
@@ -381,7 +381,7 @@ export class StorageView extends UI.ThrottledWidget.ThrottledWidget {
381
381
  this.clearButton.disabled = true;
382
382
  const label = this.clearButton.textContent;
383
383
  this.clearButton.textContent = i18nString(UIStrings.clearing);
384
- setTimeout(() => {
384
+ window.setTimeout(() => {
385
385
  this.clearButton.disabled = false;
386
386
  this.clearButton.textContent = label;
387
387
  this.clearButton.focus();
@@ -1390,7 +1390,7 @@ export class ConsoleView extends UI.Widget.VBox implements UI.SearchableView.Sea
1390
1390
 
1391
1391
  if (index === this.visibleViewMessages.length) {
1392
1392
  this.cleanupAfterSearch();
1393
- setTimeout(this.searchFinishedForTests.bind(this), 0);
1393
+ window.setTimeout(this.searchFinishedForTests.bind(this), 0);
1394
1394
  return;
1395
1395
  }
1396
1396
 
@@ -12,11 +12,11 @@ import {ElementsPanel} from './ElementsPanel.js';
12
12
  export class AccessibilityTreeView extends UI.Widget.VBox implements
13
13
  SDK.TargetManager.SDKModelObserver<SDK.AccessibilityModel.AccessibilityModel> {
14
14
  private accessibilityTreeComponent = new TreeOutline.TreeOutline.TreeOutline<AccessibilityTreeUtils.AXTreeNodeData>();
15
- private readonly toggleButton: HTMLButtonElement;
15
+ private readonly toggleButton: HTMLElement;
16
16
  private inspectedDOMNode: SDK.DOMModel.DOMNode|null = null;
17
17
  private root: SDK.AccessibilityModel.AccessibilityNode|null = null;
18
18
 
19
- constructor(toggleButton: HTMLButtonElement) {
19
+ constructor(toggleButton: HTMLElement) {
20
20
  super();
21
21
  // toggleButton is bound to a click handler on ElementsPanel to switch between the DOM tree
22
22
  // and accessibility tree views.
@@ -83,7 +83,7 @@ export class ComputedStyleModel extends Common.ObjectWrapper.ObjectWrapper<Event
83
83
  clearTimeout(this.frameResizedTimer);
84
84
  }
85
85
 
86
- this.frameResizedTimer = setTimeout(refreshContents.bind(this), 100);
86
+ this.frameResizedTimer = window.setTimeout(refreshContents.bind(this), 100);
87
87
  }
88
88
 
89
89
  private elementNode(): SDK.DOMModel.DOMNode|null {
@@ -42,7 +42,7 @@ import * as Extensions from '../../models/extensions/extensions.js';
42
42
  import elementsPanelStyles from './elementsPanel.css.js';
43
43
 
44
44
  import type * as Adorners from '../../ui/components/adorners/adorners.js';
45
- import * as IconButton from '../../ui/components/icon_button/icon_button.js';
45
+ import * as Buttons from '../../ui/components/buttons/buttons.js';
46
46
  import * as Components from '../../ui/legacy/components/utils/utils.js';
47
47
  import * as UI from '../../ui/legacy/legacy.js';
48
48
 
@@ -142,20 +142,21 @@ const UIStrings = {
142
142
  const str_ = i18n.i18n.registerUIStrings('panels/elements/ElementsPanel.ts', UIStrings);
143
143
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
144
144
 
145
- const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLButtonElement => {
146
- const button = document.createElement('button');
145
+ const createAccessibilityTreeToggleButton = (isActive: boolean): HTMLElement => {
146
+ const button = new Buttons.Button.Button();
147
+ const title =
148
+ isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
149
+ button.data = {
150
+ active: isActive,
151
+ variant: Buttons.Button.Variant.TOOLBAR,
152
+ iconUrl: new URL('../../Images/accessibility-icon.svg', import.meta.url).toString(),
153
+ title,
154
+ };
155
+ button.tabIndex = 0;
156
+ button.classList.add('axtree-button');
147
157
  if (isActive) {
148
- button.classList.add('axtree-button', 'axtree-button-active');
149
- } else {
150
- button.classList.add('axtree-button');
158
+ button.classList.add('active');
151
159
  }
152
- button.tabIndex = 0;
153
- button.title =
154
- isActive ? i18nString(UIStrings.switchToDomTreeView) : i18nString(UIStrings.switchToAccessibilityTreeView);
155
- const icon = new IconButton.Icon.Icon();
156
- const bgColor = isActive ? 'var(--color-primary)' : 'var(--color-text-secondary)';
157
- icon.data = {iconName: 'accessibility-icon', color: bgColor, width: '16px', height: '16px'};
158
- button.appendChild(icon);
159
160
  return button;
160
161
  };
161
162
 
@@ -185,8 +186,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
185
186
  private readonly adornerManager: ElementsComponents.AdornerManager.AdornerManager;
186
187
  private adornerSettingsPane: ElementsComponents.AdornerSettingsPane.AdornerSettingsPane|null;
187
188
  private readonly adornersByName: Map<string, Set<Adorners.Adorner.Adorner>>;
188
- accessibilityTreeButton?: HTMLButtonElement;
189
- domTreeButton?: HTMLButtonElement;
189
+ accessibilityTreeButton?: HTMLElement;
190
+ domTreeButton?: HTMLElement;
190
191
  private selectedNodeOnReset?: SDK.DOMModel.DOMNode;
191
192
  private hasNonDefaultSelectedNode?: boolean;
192
193
  private searchConfig?: UI.SearchableView.SearchConfig;
@@ -590,7 +590,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
590
590
 
591
591
  async doUpdate(): Promise<void> {
592
592
  if (!this.initialUpdateCompleted) {
593
- setTimeout(() => {
593
+ window.setTimeout(() => {
594
594
  if (!this.initialUpdateCompleted) {
595
595
  // the spinner will get automatically removed when innerRebuildUpdate is called
596
596
  this.sectionsContainer.createChild('span', 'spinner');
@@ -1650,7 +1650,7 @@ export class StylePropertiesSection {
1650
1650
  if (this.hoverTimer) {
1651
1651
  clearTimeout(this.hoverTimer);
1652
1652
  }
1653
- this.hoverTimer = setTimeout(this.highlight.bind(this), 300);
1653
+ this.hoverTimer = window.setTimeout(this.highlight.bind(this), 300);
1654
1654
  }
1655
1655
 
1656
1656
  highlight(mode: string|undefined = 'all'): void {
@@ -82,11 +82,13 @@ devtools-tree-outline {
82
82
 
83
83
  .axtree-button {
84
84
  position: absolute;
85
- padding: 4px;
86
85
  top: 16px;
87
- right: 16px;
86
+ right: 20px;
87
+ background-color: var(--color-background-elevation-1);
88
88
  display: flex;
89
89
  justify-content: center;
90
90
  align-items: center;
91
91
  z-index: 1;
92
+ border: 1px solid var(--color-details-hairline);
93
+ border-radius: 3px;
92
94
  }
@@ -275,7 +275,7 @@ export class NetworkItemView extends UI.TabbedPane.TabbedPane {
275
275
  if (!this.selectTab(tabId)) {
276
276
  // maybeAppendPayloadPanel might cause payload tab to appear asynchronously, so
277
277
  // it makes sense to retry on the next tick
278
- setTimeout(() => {
278
+ window.setTimeout(() => {
279
279
  if (!this.selectTab(tabId)) {
280
280
  this.selectTab('headers');
281
281
  }
@@ -8,6 +8,7 @@ import type * as SDK from '../../core/sdk/sdk.js';
8
8
  import * as DataGrid from '../../ui/legacy/components/data_grid/data_grid.js';
9
9
  import * as Components from '../../ui/legacy/components/utils/utils.js';
10
10
  import * as UI from '../../ui/legacy/legacy.js';
11
+ import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
11
12
 
12
13
  import type {NetworkNode} from './NetworkDataGridNode.js';
13
14
  import {NetworkRequestNode} from './NetworkDataGridNode.js';
@@ -205,6 +206,10 @@ export class NetworkLogViewColumns {
205
206
 
206
207
  this.setupDataGrid();
207
208
  this.setupWaterfall();
209
+
210
+ ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
211
+ this.scheduleRefresh();
212
+ });
208
213
  }
209
214
 
210
215
  private static convertToDataGridDescriptor(columnConfig: Descriptor): DataGrid.DataGrid.ColumnDescriptor {
@@ -196,7 +196,7 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
196
196
 
197
197
  onWindowChanged(): void {
198
198
  if (!this.updateGridTimerId) {
199
- this.updateGridTimerId = setTimeout(this.updateGrid.bind(this), 10);
199
+ this.updateGridTimerId = window.setTimeout(this.updateGrid.bind(this), 10);
200
200
  }
201
201
  }
202
202
 
@@ -204,7 +204,7 @@ export class HeapTimelineOverview extends Common.ObjectWrapper.eventMixin<EventT
204
204
  if (this.updateTimerId) {
205
205
  return;
206
206
  }
207
- this.updateTimerId = setTimeout(this.update.bind(this), 10);
207
+ this.updateTimerId = window.setTimeout(this.update.bind(this), 10);
208
208
  }
209
209
 
210
210
  updateBoundaries(): void {
@@ -203,7 +203,7 @@ export class LiveHeapProfileView extends UI.Widget.VBox {
203
203
  return;
204
204
  }
205
205
  this.update(isolates, profiles);
206
- await new Promise(r => setTimeout(r, 3000));
206
+ await new Promise(r => window.setTimeout(r, 3000));
207
207
  } while (this.currentPollId === pollId);
208
208
  }
209
209
 
@@ -796,7 +796,7 @@ export class ProgressTracker {
796
796
  private onLoad(): void {
797
797
  this.requestIds = null;
798
798
  this.updateProgress(1); // Display 100% progress on load, hide it in 0.5s.
799
- setTimeout(() => {
799
+ window.setTimeout(() => {
800
800
  if (!this.navigationProgressVisible()) {
801
801
  this.displayProgress(0);
802
802
  }
@@ -831,7 +831,7 @@ export class ProgressTracker {
831
831
  return;
832
832
  }
833
833
  ++this.finishedRequests;
834
- setTimeout(() => {
834
+ window.setTimeout(() => {
835
835
  this.updateProgress(
836
836
  this.finishedRequests / this.startedRequests * 0.9); // Finished requests drive the progress up to 90%.
837
837
  }, 500); // Delay to give the new requests time to start. This makes the progress smoother.
@@ -392,7 +392,7 @@ export class ExperimentsSettingsTab extends SettingsTab {
392
392
  constructor() {
393
393
  super(i18nString(UIStrings.experiments), 'experiments-tab-content');
394
394
  const filterSection = this.appendSection();
395
- filterSection.style.paddingTop = '1px';
395
+ filterSection.classList.add('experiments-filter');
396
396
 
397
397
  const labelElement = filterSection.createChild('label');
398
398
  labelElement.textContent = i18nString(UIStrings.filterExperimentsLabel);
@@ -74,9 +74,14 @@ fieldset {
74
74
  border: none;
75
75
  }
76
76
 
77
- .settings-tab label {
78
- padding-right: 4px;
79
- display: inline-flex;
77
+ .experiments-filter {
78
+ padding-top: 1px;
79
+ display: flex;
80
+ align-items: center;
81
+ }
82
+
83
+ .experiments-filter label {
84
+ padding-right: 8px;
80
85
  flex-shrink: 0;
81
86
  }
82
87
 
@@ -603,7 +603,7 @@ export class DebuggerPlugin extends Plugin {
603
603
  } else if (/^text\/(javascript|typescript|jsx)/.test(this.uiSourceCode.mimeType())) {
604
604
  let node: CodeMirror.SyntaxNode|null = CodeMirror.syntaxTree(editor.state).resolveInner(textPosition, 1);
605
605
  // Only do something if the cursor is over a leaf node.
606
- if (node.firstChild) {
606
+ if (node?.firstChild) {
607
607
  return null;
608
608
  }
609
609
  while (
@@ -1137,7 +1137,7 @@ export class NavigatorSourceTreeElement extends UI.TreeOutline.TreeElement {
1137
1137
  super.selectOnMouseDown(event);
1138
1138
  return;
1139
1139
  }
1140
- setTimeout(rename.bind(this), 300);
1140
+ window.setTimeout(rename.bind(this), 300);
1141
1141
 
1142
1142
  function rename(this: NavigatorSourceTreeElement): void {
1143
1143
  if (this.shouldRenameOnMouseDown()) {
@@ -240,7 +240,7 @@ export class SourcesSearchScope implements Search.SearchConfig.SearchScope {
240
240
 
241
241
  ++callbacksLeft;
242
242
  const uiSourceCode = files[fileIndex++];
243
- setTimeout(searchInNextFile.bind(this, uiSourceCode), 0);
243
+ window.setTimeout(searchInNextFile.bind(this, uiSourceCode), 0);
244
244
  }
245
245
 
246
246
  function contentLoaded(
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
6
7
  import * as i18n from '../../core/i18n/i18n.js';
7
8
  import * as Root from '../../core/root/root.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
@@ -1097,17 +1098,19 @@ UI.ActionRegistration.registerActionExtension({
1097
1098
  title: i18nLazyString(UIStrings.createNewSnippet),
1098
1099
  });
1099
1100
 
1100
- UI.ActionRegistration.registerActionExtension({
1101
- category: UI.ActionRegistration.ActionCategory.SOURCES,
1102
- actionId: 'sources.add-folder-to-workspace',
1103
- async loadActionDelegate() {
1104
- const Sources = await loadSourcesModule();
1105
- return Sources.SourcesNavigator.ActionDelegate.instance();
1106
- },
1107
- iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_ADD,
1108
- title: i18nLazyString(UIStrings.addFolderToWorkspace),
1109
- condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
1110
- });
1101
+ if (!Host.InspectorFrontendHost.InspectorFrontendHostInstance.isHostedMode()) {
1102
+ UI.ActionRegistration.registerActionExtension({
1103
+ category: UI.ActionRegistration.ActionCategory.SOURCES,
1104
+ actionId: 'sources.add-folder-to-workspace',
1105
+ async loadActionDelegate() {
1106
+ const Sources = await loadSourcesModule();
1107
+ return Sources.SourcesNavigator.ActionDelegate.instance();
1108
+ },
1109
+ iconClass: UI.ActionRegistration.IconClass.LARGE_ICON_ADD,
1110
+ title: i18nLazyString(UIStrings.addFolderToWorkspace),
1111
+ condition: Root.Runtime.ConditionName.NOT_SOURCES_HIDE_ADD_FOLDER,
1112
+ });
1113
+ }
1111
1114
 
1112
1115
  UI.ActionRegistration.registerActionExtension({
1113
1116
  category: UI.ActionRegistration.ActionCategory.DEBUGGER,
@@ -146,7 +146,7 @@ export class TimelineController implements SDK.TargetManager.SDKModelObserver<SD
146
146
  const extensionCompletionPromises = this.extensionSessions.map(session => session.stop());
147
147
  if (extensionCompletionPromises.length) {
148
148
  tracingStoppedPromises.push(
149
- Promise.race([Promise.all(extensionCompletionPromises), new Promise(r => setTimeout(r, 5000))]));
149
+ Promise.race([Promise.all(extensionCompletionPromises), new Promise(r => window.setTimeout(r, 5000))]));
150
150
  }
151
151
  await Promise.all(tracingStoppedPromises);
152
152
  }
@@ -222,7 +222,7 @@ export class TimelineController implements SDK.TargetManager.SDKModelObserver<SD
222
222
 
223
223
  private allSourcesFinished(): void {
224
224
  this.client.processingStarted();
225
- setTimeout(() => this.finalizeTrace(), 0);
225
+ window.setTimeout(() => this.finalizeTrace(), 0);
226
226
  }
227
227
 
228
228
  private async finalizeTrace(): Promise<void> {
@@ -80,14 +80,14 @@ export class TimelineLoader implements Common.StringOutputStream.OutputStream {
80
80
  static loadFromEvents(events: SDK.TracingManager.EventPayload[], client: Client): TimelineLoader {
81
81
  const loader = new TimelineLoader(client);
82
82
 
83
- setTimeout(async () => {
83
+ window.setTimeout(async () => {
84
84
  const eventsPerChunk = 5000;
85
85
  client.loadingStarted();
86
86
  for (let i = 0; i < events.length; i += eventsPerChunk) {
87
87
  const chunk = events.slice(i, i + eventsPerChunk);
88
88
  (loader.tracingModel as SDK.TracingModel.TracingModel).addEvents(chunk);
89
89
  client.loadingProgress((i + chunk.length) / events.length);
90
- await new Promise(r => setTimeout(r)); // Yield event loop to paint.
90
+ await new Promise(r => window.setTimeout(r)); // Yield event loop to paint.
91
91
  }
92
92
  void loader.close();
93
93
  });
@@ -228,7 +228,7 @@ export class TimelineLoader implements Common.StringOutputStream.OutputStream {
228
228
  return;
229
229
  }
230
230
  this.client.processingStarted();
231
- setTimeout(() => this.finalizeTrace(), 0);
231
+ window.setTimeout(() => this.finalizeTrace(), 0);
232
232
  }
233
233
 
234
234
  private finalizeTrace(): void {
@@ -1148,7 +1148,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
1148
1148
  return;
1149
1149
  }
1150
1150
  const controller = this.controller;
1151
- await new Promise(r => setTimeout(r, this.millisecondsToRecordAfterLoadEvent));
1151
+ await new Promise(r => window.setTimeout(r, this.millisecondsToRecordAfterLoadEvent));
1152
1152
 
1153
1153
  // Check if we're still in the same recording session.
1154
1154
  if (controller !== this.controller || this.state !== State.Recording) {
@@ -404,7 +404,7 @@ export class WebauthnPaneImpl extends UI.Widget.VBox implements
404
404
  }
405
405
 
406
406
  // TODO(crbug.com/1112528): Add back-end events for credential creation and removal to avoid polling.
407
- setTimeout(this.#updateCredentials.bind(this, authenticatorId), TIMEOUT);
407
+ window.setTimeout(this.#updateCredentials.bind(this, authenticatorId), TIMEOUT);
408
408
  }
409
409
 
410
410
  #maybeAddEmptyNode(dataGrid: DataGrid.DataGrid.DataGridImpl<DataGridNode>): void {