chrome-devtools-frontend 1.0.957495 → 1.0.959543

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 (159) hide show
  1. package/.eslintignore +0 -1
  2. package/AUTHORS +1 -0
  3. package/config/owner/COMMON_OWNERS +0 -1
  4. package/config/owner/INFRA_OWNERS +0 -1
  5. package/extension-api/ExtensionAPI.d.ts +7 -0
  6. package/front_end/Images/generate-css-vars.js +12 -13
  7. package/front_end/Tests.js +14 -0
  8. package/front_end/core/common/Debouncer.ts +1 -1
  9. package/front_end/core/common/Settings.ts +33 -0
  10. package/front_end/core/host/InspectorFrontendHost.ts +7 -3
  11. package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
  12. package/front_end/core/host/UserMetrics.ts +2 -2
  13. package/front_end/core/i18n/i18nImpl.ts +1 -1
  14. package/front_end/core/i18n/locales/af.json +399 -354
  15. package/front_end/core/i18n/locales/am.json +399 -354
  16. package/front_end/core/i18n/locales/ar.json +399 -354
  17. package/front_end/core/i18n/locales/as.json +399 -354
  18. package/front_end/core/i18n/locales/az.json +399 -354
  19. package/front_end/core/i18n/locales/be.json +399 -354
  20. package/front_end/core/i18n/locales/bg.json +399 -354
  21. package/front_end/core/i18n/locales/bn.json +399 -354
  22. package/front_end/core/i18n/locales/bs.json +400 -355
  23. package/front_end/core/i18n/locales/ca.json +399 -354
  24. package/front_end/core/i18n/locales/cs.json +399 -354
  25. package/front_end/core/i18n/locales/cy.json +399 -354
  26. package/front_end/core/i18n/locales/da.json +399 -354
  27. package/front_end/core/i18n/locales/de.json +399 -354
  28. package/front_end/core/i18n/locales/el.json +399 -354
  29. package/front_end/core/i18n/locales/en-GB.json +420 -375
  30. package/front_end/core/i18n/locales/es-419.json +399 -354
  31. package/front_end/core/i18n/locales/es.json +399 -354
  32. package/front_end/core/i18n/locales/et.json +399 -354
  33. package/front_end/core/i18n/locales/eu.json +403 -358
  34. package/front_end/core/i18n/locales/fa.json +399 -354
  35. package/front_end/core/i18n/locales/fi.json +399 -354
  36. package/front_end/core/i18n/locales/fil.json +399 -354
  37. package/front_end/core/i18n/locales/fr-CA.json +399 -354
  38. package/front_end/core/i18n/locales/fr.json +399 -354
  39. package/front_end/core/i18n/locales/gl.json +399 -354
  40. package/front_end/core/i18n/locales/gu.json +399 -354
  41. package/front_end/core/i18n/locales/he.json +399 -354
  42. package/front_end/core/i18n/locales/hi.json +399 -354
  43. package/front_end/core/i18n/locales/hr.json +399 -354
  44. package/front_end/core/i18n/locales/hu.json +399 -354
  45. package/front_end/core/i18n/locales/hy.json +399 -354
  46. package/front_end/core/i18n/locales/id.json +399 -354
  47. package/front_end/core/i18n/locales/is.json +399 -354
  48. package/front_end/core/i18n/locales/it.json +399 -354
  49. package/front_end/core/i18n/locales/ja.json +399 -354
  50. package/front_end/core/i18n/locales/ka.json +399 -354
  51. package/front_end/core/i18n/locales/kk.json +400 -355
  52. package/front_end/core/i18n/locales/km.json +399 -354
  53. package/front_end/core/i18n/locales/kn.json +399 -354
  54. package/front_end/core/i18n/locales/ko.json +399 -354
  55. package/front_end/core/i18n/locales/ky.json +399 -354
  56. package/front_end/core/i18n/locales/lo.json +399 -354
  57. package/front_end/core/i18n/locales/lt.json +399 -354
  58. package/front_end/core/i18n/locales/lv.json +399 -354
  59. package/front_end/core/i18n/locales/mk.json +399 -354
  60. package/front_end/core/i18n/locales/ml.json +399 -354
  61. package/front_end/core/i18n/locales/mn.json +399 -354
  62. package/front_end/core/i18n/locales/mr.json +399 -354
  63. package/front_end/core/i18n/locales/ms.json +399 -354
  64. package/front_end/core/i18n/locales/my.json +399 -354
  65. package/front_end/core/i18n/locales/ne.json +399 -354
  66. package/front_end/core/i18n/locales/nl.json +399 -354
  67. package/front_end/core/i18n/locales/no.json +399 -354
  68. package/front_end/core/i18n/locales/or.json +399 -354
  69. package/front_end/core/i18n/locales/pa.json +410 -365
  70. package/front_end/core/i18n/locales/pl.json +399 -354
  71. package/front_end/core/i18n/locales/pt-PT.json +399 -354
  72. package/front_end/core/i18n/locales/pt.json +399 -354
  73. package/front_end/core/i18n/locales/ro.json +399 -354
  74. package/front_end/core/i18n/locales/ru.json +399 -354
  75. package/front_end/core/i18n/locales/si.json +399 -354
  76. package/front_end/core/i18n/locales/sk.json +399 -354
  77. package/front_end/core/i18n/locales/sl.json +399 -354
  78. package/front_end/core/i18n/locales/sq.json +399 -354
  79. package/front_end/core/i18n/locales/sr-Latn.json +399 -354
  80. package/front_end/core/i18n/locales/sr.json +399 -354
  81. package/front_end/core/i18n/locales/sv.json +399 -354
  82. package/front_end/core/i18n/locales/sw.json +399 -354
  83. package/front_end/core/i18n/locales/ta.json +405 -360
  84. package/front_end/core/i18n/locales/te.json +399 -354
  85. package/front_end/core/i18n/locales/th.json +399 -354
  86. package/front_end/core/i18n/locales/tr.json +399 -354
  87. package/front_end/core/i18n/locales/uk.json +399 -354
  88. package/front_end/core/i18n/locales/ur.json +399 -354
  89. package/front_end/core/i18n/locales/uz.json +399 -354
  90. package/front_end/core/i18n/locales/vi.json +399 -354
  91. package/front_end/core/i18n/locales/zh-HK.json +399 -354
  92. package/front_end/core/i18n/locales/zh-TW.json +399 -354
  93. package/front_end/core/i18n/locales/zh.json +399 -354
  94. package/front_end/core/i18n/locales/zu.json +399 -354
  95. package/front_end/core/platform/generate-dcheck.js +2 -2
  96. package/front_end/core/protocol_client/InspectorBackend.ts +3 -3
  97. package/front_end/core/sdk/Connections.ts +1 -1
  98. package/front_end/core/sdk/IsolateManager.ts +1 -1
  99. package/front_end/core/sdk/PageResourceLoader.ts +4 -2
  100. package/front_end/core/sdk/ProfileTreeModel.ts +1 -1
  101. package/front_end/devtools_compatibility.js +9 -0
  102. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  103. package/front_end/entrypoints/main/main-meta.ts +24 -24
  104. package/front_end/generated/SupportedCSSProperties.js +2 -2
  105. package/front_end/models/extensions/ExtensionAPI.ts +33 -5
  106. package/front_end/models/extensions/ExtensionServer.ts +28 -0
  107. package/front_end/models/logs/LogManager.ts +1 -1
  108. package/front_end/models/persistence/Automapping.ts +32 -4
  109. package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
  110. package/front_end/models/persistence/PersistenceImpl.ts +33 -13
  111. package/front_end/models/persistence/WorkspaceSettingsTab.ts +0 -1
  112. package/front_end/models/persistence/workspaceSettingsTab.css +3 -7
  113. package/front_end/models/workspace/UISourceCode.ts +1 -1
  114. package/front_end/panels/application/StorageView.ts +1 -1
  115. package/front_end/panels/console/ConsoleView.ts +1 -1
  116. package/front_end/panels/elements/AccessibilityTreeView.ts +2 -2
  117. package/front_end/panels/elements/ComputedStyleModel.ts +1 -1
  118. package/front_end/panels/elements/ElementsPanel.ts +34 -29
  119. package/front_end/panels/elements/StylesSidebarPane.ts +2 -2
  120. package/front_end/panels/elements/elementsPanel.css +10 -4
  121. package/front_end/panels/network/NetworkItemView.ts +1 -1
  122. package/front_end/panels/profiler/HeapTimelineOverview.ts +2 -2
  123. package/front_end/panels/profiler/LiveHeapProfileView.ts +1 -1
  124. package/front_end/panels/screencast/ScreencastView.ts +2 -2
  125. package/front_end/panels/settings/SettingsScreen.ts +1 -1
  126. package/front_end/panels/settings/settingsScreen.css +11 -5
  127. package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
  128. package/front_end/panels/sources/NavigatorView.ts +1 -1
  129. package/front_end/panels/sources/SourcesSearchScope.ts +1 -1
  130. package/front_end/panels/sources/sources-meta.ts +14 -11
  131. package/front_end/panels/timeline/TimelineController.ts +2 -2
  132. package/front_end/panels/timeline/TimelineLoader.ts +3 -3
  133. package/front_end/panels/timeline/TimelinePanel.ts +1 -1
  134. package/front_end/panels/webauthn/WebauthnPane.ts +1 -1
  135. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  136. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
  137. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +76 -12
  138. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
  139. package/front_end/third_party/codemirror.next/package.json +13 -13
  140. package/front_end/ui/components/buttons/Button.ts +5 -1
  141. package/front_end/ui/components/buttons/button.css +10 -1
  142. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +2 -2
  143. package/front_end/ui/components/text_editor/TextEditor.ts +1 -1
  144. package/front_end/ui/components/text_editor/cursor_tooltip.ts +1 -1
  145. package/front_end/ui/components/text_editor/javascript.ts +1 -1
  146. package/front_end/ui/legacy/SearchableView.ts +1 -1
  147. package/front_end/ui/legacy/SoftDropDown.ts +2 -2
  148. package/front_end/ui/legacy/TextPrompt.ts +2 -1
  149. package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +1 -1
  150. package/front_end/ui/legacy/filter.css +1 -0
  151. package/front_end/ui/legacy/toolbar.css +2 -0
  152. package/package.json +1 -1
  153. package/scripts/build/generate_css_js_files.js +8 -6
  154. package/scripts/build/generate_html_entrypoint.js +2 -1
  155. package/scripts/build/ninja/copy-file.js +2 -1
  156. package/scripts/build/ninja/copy-files.js +2 -1
  157. package/scripts/build/ninja/generate-declaration.js +2 -1
  158. package/scripts/build/ninja/node.gni +4 -1
  159. package/scripts/build/ninja/write-if-changed.js +27 -0
@@ -2,8 +2,8 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- const fs = require('fs');
6
5
  const path = require('path');
6
+ const {writeIfChanged} = require('../../../scripts/build/ninja/write-if-changed.js');
7
7
  const [, , targetGenDir] = process.argv;
8
8
 
9
9
  let functionImplementation = '';
@@ -16,6 +16,6 @@ if (process.argv.includes('--should-dcheck')) {
16
16
  `;
17
17
  }
18
18
 
19
- fs.writeFileSync(
19
+ writeIfChanged(
20
20
  path.join(targetGenDir, 'dcheck.js'),
21
21
  `export function DCHECK(condition, message = 'DCHECK') {${functionImplementation}}`);
@@ -442,7 +442,7 @@ export class SessionRouter {
442
442
  }
443
443
 
444
444
  // Execute all promises.
445
- setTimeout(() => {
445
+ window.setTimeout(() => {
446
446
  if (!this.hasOutstandingNonLongPollingRequests()) {
447
447
  this.executeAfterPendingDispatches();
448
448
  } else {
@@ -467,7 +467,7 @@ export class SessionRouter {
467
467
  code: ConnectionClosedErrorCode,
468
468
  data: null,
469
469
  };
470
- setTimeout(() => callback(error, null), 0);
470
+ window.setTimeout(() => callback(error, null), 0);
471
471
  }
472
472
 
473
473
  static dispatchUnregisterSessionError({callback, method}: CallbackWithDebugInfo): void {
@@ -476,7 +476,7 @@ export class SessionRouter {
476
476
  code: ConnectionClosedErrorCode,
477
477
  data: null,
478
478
  };
479
- setTimeout(() => callback(error, null), 0);
479
+ window.setTimeout(() => callback(error, null), 0);
480
480
  }
481
481
  }
482
482
 
@@ -189,7 +189,7 @@ export class StubConnection implements ProtocolClient.InspectorBackend.Connectio
189
189
  }
190
190
 
191
191
  sendRawMessage(message: string): void {
192
- setTimeout(this.respondWithError.bind(this, message), 0);
192
+ window.setTimeout(this.respondWithError.bind(this, message), 0);
193
193
  }
194
194
 
195
195
  private respondWithError(message: string): void {
@@ -126,7 +126,7 @@ export class IsolateManager extends Common.ObjectWrapper.ObjectWrapper<EventType
126
126
  const pollId = this.#pollId;
127
127
  while (pollId === this.#pollId) {
128
128
  await Promise.all(Array.from(this.isolates(), isolate => isolate.update()));
129
- await new Promise(r => setTimeout(r, PollIntervalMs));
129
+ await new Promise(r => window.setTimeout(r, PollIntervalMs));
130
130
  }
131
131
  }
132
132
  }
@@ -163,7 +163,8 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
163
163
 
164
164
  static async withTimeout<T>(promise: Promise<T>, timeout: number): Promise<T> {
165
165
  const timeoutPromise = new Promise<T>(
166
- (_, reject) => setTimeout(reject, timeout, new Error(i18nString(UIStrings.loadCanceledDueToLoadTimeout))));
166
+ (_, reject) =>
167
+ window.setTimeout(reject, timeout, new Error(i18nString(UIStrings.loadCanceledDueToLoadTimeout))));
167
168
  return Promise.race([promise, timeoutPromise]);
168
169
  }
169
170
 
@@ -219,7 +220,8 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
219
220
  return this.#loadOverride(url);
220
221
  }
221
222
  const parsedURL = new Common.ParsedURL.ParsedURL(url);
222
- const eligibleForLoadFromTarget = getLoadThroughTargetSetting().get() && parsedURL && parsedURL.isHttpOrHttps();
223
+ const eligibleForLoadFromTarget = getLoadThroughTargetSetting().get() && parsedURL && parsedURL.scheme !== 'file' &&
224
+ parsedURL.scheme !== 'data' && parsedURL.scheme !== 'devtools';
223
225
  Host.userMetrics.developerResourceScheme(this.getDeveloperResourceScheme(parsedURL));
224
226
  if (eligibleForLoadFromTarget) {
225
227
  try {
@@ -32,7 +32,7 @@ export class ProfileNode {
32
32
  }
33
33
 
34
34
  get scriptId(): Protocol.Runtime.ScriptId {
35
- return this.callFrame.scriptId;
35
+ return String(this.callFrame.scriptId) as Protocol.Runtime.ScriptId;
36
36
  }
37
37
 
38
38
  get url(): string {
@@ -542,6 +542,15 @@
542
542
  DevToolsAPI.sendMessageToEmbedder('getPreferences', [], /** @type {function(?Object)} */ (callback));
543
543
  }
544
544
 
545
+ /**
546
+ * @override
547
+ * @param {string} name
548
+ * @param {function(string)} callback
549
+ */
550
+ getPreference(name, callback) {
551
+ DevToolsAPI.sendMessageToEmbedder('getPreference', [name], /** @type {function(string)} */ (callback));
552
+ }
553
+
545
554
  /**
546
555
  * @override
547
556
  * @param {string} name
@@ -233,6 +233,11 @@ export class MainImpl {
233
233
  register: (name: string) =>
234
234
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.registerPreference(name, {synced: false}),
235
235
  set: Host.InspectorFrontendHost.InspectorFrontendHostInstance.setPreference,
236
+ get: (name: string) => {
237
+ return new Promise(resolve => {
238
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.getPreference(name, resolve);
239
+ });
240
+ },
236
241
  remove: Host.InspectorFrontendHost.InspectorFrontendHostInstance.removePreference,
237
242
  clear: Host.InspectorFrontendHost.InspectorFrontendHostInstance.clearPreferences,
238
243
  };
@@ -571,7 +576,7 @@ export class MainImpl {
571
576
  UI.ARIAUtils.alertElementInstance();
572
577
 
573
578
  // Allow UI cycles to repaint prior to creating connection.
574
- setTimeout(this.#initializeTarget.bind(this), 0);
579
+ window.setTimeout(this.#initializeTarget.bind(this), 0);
575
580
  MainImpl.timeEnd('Main._showAppUI');
576
581
  }
577
582
 
@@ -587,7 +592,7 @@ export class MainImpl {
587
592
  // Used for browser tests.
588
593
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.readyForTest();
589
594
  // Asynchronously run the extensions.
590
- setTimeout(this.#lateInitialization.bind(this), 100);
595
+ window.setTimeout(this.#lateInitialization.bind(this), 100);
591
596
  MainImpl.timeEnd('Main._initializeTarget');
592
597
  }
593
598
 
@@ -672,6 +672,30 @@ Common.Settings.registerSettingExtension({
672
672
  ],
673
673
  });
674
674
 
675
+ // Not all locales that are supported should also be made available in the
676
+ // settings. Filter out pseudo locales e.g.
677
+ function filterLocalesForSettings(): string[] {
678
+ return i18n.i18n.getAllSupportedDevToolsLocales().filter(locale => locale !== 'en-XL');
679
+ }
680
+
681
+ Common.Settings.registerSettingExtension({
682
+ category: Common.Settings.SettingCategory.APPEARANCE,
683
+ storageType: Common.Settings.SettingStorageType.Synced,
684
+ settingName: 'language',
685
+ settingType: Common.Settings.SettingType.ENUM,
686
+ title: i18nLazyString(UIStrings.language),
687
+ defaultValue: 'en-US',
688
+ options: [
689
+ {
690
+ value: 'browserLanguage',
691
+ title: i18nLazyString(UIStrings.browserLanguage),
692
+ text: i18nLazyString(UIStrings.browserLanguage),
693
+ },
694
+ ...filterLocalesForSettings().map(locale => createOptionForLocale(locale)),
695
+ ],
696
+ reloadRequired: true,
697
+ });
698
+
675
699
  Common.Settings.registerSettingExtension({
676
700
  category: Common.Settings.SettingCategory.APPEARANCE,
677
701
  storageType: Common.Settings.SettingStorageType.Synced,
@@ -743,30 +767,6 @@ function createOptionForLocale(localeString: string): Common.Settings.SettingExt
743
767
  };
744
768
  }
745
769
 
746
- // Not all locales that are supported should also be made available in the
747
- // settings. Filter out pseudo locales e.g.
748
- function filterLocalesForSettings(): string[] {
749
- return i18n.i18n.getAllSupportedDevToolsLocales().filter(locale => locale !== 'en-XL');
750
- }
751
-
752
- Common.Settings.registerSettingExtension({
753
- category: Common.Settings.SettingCategory.APPEARANCE,
754
- storageType: Common.Settings.SettingStorageType.Synced,
755
- settingName: 'language',
756
- settingType: Common.Settings.SettingType.ENUM,
757
- title: i18nLazyString(UIStrings.language),
758
- defaultValue: 'en-US',
759
- options: [
760
- {
761
- value: 'browserLanguage',
762
- title: i18nLazyString(UIStrings.browserLanguage),
763
- text: i18nLazyString(UIStrings.browserLanguage),
764
- },
765
- ...filterLocalesForSettings().map(locale => createOptionForLocale(locale)),
766
- ],
767
- reloadRequired: true,
768
- });
769
-
770
770
  Common.Settings.registerSettingExtension({
771
771
  category: Common.Settings.SettingCategory.SYNC,
772
772
  // This name must be kept in sync with DevToolsSettings::kSyncDevToolsPreferencesFrontendName.
@@ -582,7 +582,7 @@ export const generatedProperties = [
582
582
  'name': 'mix-blend-mode',
583
583
  'keywords': [
584
584
  'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light',
585
- 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'
585
+ 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'
586
586
  ]
587
587
  },
588
588
  {'name': 'negative'},
@@ -1086,7 +1086,7 @@ export const generatedPropertyValues = {
1086
1086
  'mix-blend-mode': {
1087
1087
  'values': [
1088
1088
  'normal', 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', 'color-burn', 'hard-light',
1089
- 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity'
1089
+ 'soft-light', 'difference', 'exclusion', 'hue', 'saturation', 'color', 'luminosity', 'plus-lighter'
1090
1090
  ]
1091
1091
  },
1092
1092
  'object-fit': {'values': ['fill', 'contain', 'cover', 'none', 'scale-down']},
@@ -55,6 +55,7 @@ export namespace PrivateAPI {
55
55
  ResourceContentCommitted = 'resource-content-committed',
56
56
  ViewShown = 'view-shown-',
57
57
  ViewHidden = 'view-hidden,',
58
+ ThemeChange = 'host-theme-change',
58
59
  }
59
60
 
60
61
  export const enum Commands {
@@ -75,6 +76,7 @@ export namespace PrivateAPI {
75
76
  Reload = 'Reload',
76
77
  Subscribe = 'subscribe',
77
78
  SetOpenResourceHandler = 'setOpenResourceHandler',
79
+ SetThemeChangeHandler = 'setThemeChangeHandler',
78
80
  SetResourceContent = 'setResourceContent',
79
81
  SetSidebarContent = 'setSidebarContent',
80
82
  SetSidebarHeight = 'setSidebarHeight',
@@ -151,6 +153,7 @@ export namespace PrivateAPI {
151
153
  type SetSidebarPageRequest = {command: Commands.SetSidebarPage, id: string, page: string};
152
154
  type OpenResourceRequest = {command: Commands.OpenResource, url: string, lineNumber: number, columnNumber: number};
153
155
  type SetOpenResourceHandlerRequest = {command: Commands.SetOpenResourceHandler, handlerPresent: boolean};
156
+ type SetThemeChangeHandlerRequest = {command: Commands.SetThemeChangeHandler, handlerPresent: boolean};
154
157
  type ReloadRequest = {
155
158
  command: Commands.Reload,
156
159
  options: null|{
@@ -180,9 +183,10 @@ export namespace PrivateAPI {
180
183
  export type ServerRequests = RegisterLanguageExtensionPluginRequest|SubscribeRequest|UnsubscribeRequest|
181
184
  AddRequestHeadersRequest|ApplyStyleSheetRequest|CreatePanelRequest|ShowPanelRequest|CreateToolbarButtonRequest|
182
185
  UpdateButtonRequest|CompleteTraceSessionRequest|CreateSidebarPaneRequest|SetSidebarHeightRequest|
183
- SetSidebarContentRequest|SetSidebarPageRequest|OpenResourceRequest|SetOpenResourceHandlerRequest|ReloadRequest|
184
- EvaluateOnInspectedPageRequest|GetRequestContentRequest|GetResourceContentRequest|SetResourceContentRequest|
185
- AddTraceProviderRequest|ForwardKeyboardEventRequest|GetHARRequest|GetPageResourcesRequest;
186
+ SetSidebarContentRequest|SetSidebarPageRequest|OpenResourceRequest|SetOpenResourceHandlerRequest|
187
+ SetThemeChangeHandlerRequest|ReloadRequest|EvaluateOnInspectedPageRequest|GetRequestContentRequest|
188
+ GetResourceContentRequest|SetResourceContentRequest|AddTraceProviderRequest|ForwardKeyboardEventRequest|
189
+ GetHARRequest|GetPageResourcesRequest;
186
190
  export type ExtensionServerRequestMessage = PrivateAPI.ServerRequests&{requestId?: number};
187
191
 
188
192
  type AddRawModuleRequest = {
@@ -330,6 +334,7 @@ namespace APIImpl {
330
334
  applyStyleSheet(styleSheet: string): void;
331
335
  setOpenResourceHandler(callback?: (resource: PublicAPI.Chrome.DevTools.Resource, lineNumber: number) => unknown):
332
336
  void;
337
+ setThemeChangeHandler(callback?: (themeName: string) => unknown): void;
333
338
  }
334
339
 
335
340
  export interface ExtensionView extends PublicAPI.Chrome.DevTools.ExtensionView {
@@ -539,7 +544,8 @@ self.injectedExtensionAPI = function(
539
544
  };
540
545
  }
541
546
 
542
- (Panels.prototype as Pick<APIImpl.Panels, 'create'|'setOpenResourceHandler'|'openResource'|'SearchAction'>) = {
547
+ (Panels.prototype as
548
+ Pick<APIImpl.Panels, 'create'|'setOpenResourceHandler'|'openResource'|'SearchAction'|'setThemeChangeHandler'>) = {
543
549
  create: function(
544
550
  title: string, icon: string, page: string,
545
551
  callback: (panel: PublicAPI.Chrome.DevTools.ExtensionPanel) => unknown): void {
@@ -577,6 +583,28 @@ self.injectedExtensionAPI = function(
577
583
  }
578
584
  },
579
585
 
586
+ setThemeChangeHandler: function(callback: (themeName: string) => unknown): void {
587
+ const hadHandler = extensionServer.hasHandler(PrivateAPI.Events.ThemeChange);
588
+
589
+ function callbackWrapper(message: unknown): void {
590
+ const {themeName} = message as {themeName: string};
591
+ chrome.devtools.panels.themeName = themeName;
592
+ callback.call(null, themeName);
593
+ }
594
+
595
+ if (!callback) {
596
+ extensionServer.unregisterHandler(PrivateAPI.Events.ThemeChange);
597
+ } else {
598
+ extensionServer.registerHandler(PrivateAPI.Events.ThemeChange, callbackWrapper);
599
+ }
600
+
601
+ // Only send command if we either removed an existing handler or added handler and had none before.
602
+ if (hadHandler === !callback) {
603
+ extensionServer.sendRequest(
604
+ {command: PrivateAPI.Commands.SetThemeChangeHandler, 'handlerPresent': Boolean(callback)});
605
+ }
606
+ },
607
+
580
608
  openResource: function(
581
609
  url: string, lineNumber: number, columnNumber?: number, _callback?: (response: unknown) => unknown): void {
582
610
  const callbackArg = extractCallbackArgument(arguments);
@@ -1084,7 +1112,7 @@ self.injectedExtensionAPI = function(
1084
1112
  };
1085
1113
  keyboardEventRequestQueue.push(requestPayload);
1086
1114
  if (!forwardTimer) {
1087
- forwardTimer = setTimeout(forwardEventQueue, 0);
1115
+ forwardTimer = window.setTimeout(forwardEventQueue, 0);
1088
1116
  }
1089
1117
  }
1090
1118
 
@@ -89,6 +89,7 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
89
89
  private extensionsEnabled: boolean;
90
90
  private inspectedTabId?: string;
91
91
  private readonly extensionAPITestHook?: (server: unknown, api: unknown) => unknown;
92
+ private themeChangeHandlers: Map<string, MessagePort> = new Map();
92
93
 
93
94
  private constructor() {
94
95
  super();
@@ -124,6 +125,7 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
124
125
  this.registerHandler(PrivateAPI.Commands.GetResourceContent, this.onGetResourceContent.bind(this));
125
126
  this.registerHandler(PrivateAPI.Commands.Reload, this.onReload.bind(this));
126
127
  this.registerHandler(PrivateAPI.Commands.SetOpenResourceHandler, this.onSetOpenResourceHandler.bind(this));
128
+ this.registerHandler(PrivateAPI.Commands.SetThemeChangeHandler, this.onSetThemeChangeHandler.bind(this));
127
129
  this.registerHandler(PrivateAPI.Commands.SetResourceContent, this.onSetResourceContent.bind(this));
128
130
  this.registerHandler(PrivateAPI.Commands.SetSidebarHeight, this.onSetSidebarHeight.bind(this));
129
131
  this.registerHandler(PrivateAPI.Commands.SetSidebarContent, this.onSetSidebarContent.bind(this));
@@ -147,6 +149,13 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
147
149
  Host.InspectorFrontendHostAPI.Events.SetInspectedTabId, this.setInspectedTabId, this);
148
150
 
149
151
  this.initExtensions();
152
+
153
+ ThemeSupport.ThemeSupport.instance().addEventListener(ThemeSupport.ThemeChangeEvent.eventName, () => {
154
+ const themeName = ThemeSupport.ThemeSupport.instance().themeName();
155
+ for (const port of this.themeChangeHandlers.values()) {
156
+ port.postMessage({command: PrivateAPI.Events.ThemeChange, themeName});
157
+ }
158
+ });
150
159
  }
151
160
 
152
161
  static instance(opts: {
@@ -530,6 +539,25 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
530
539
  return undefined;
531
540
  }
532
541
 
542
+ private onSetThemeChangeHandler(message: PrivateAPI.ExtensionServerRequestMessage, port: MessagePort): Record
543
+ |undefined {
544
+ if (message.command !== PrivateAPI.Commands.SetThemeChangeHandler) {
545
+ return this.status.E_BADARG('command', `expected ${PrivateAPI.Commands.SetThemeChangeHandler}`);
546
+ }
547
+ const extensionOrigin = this.getExtensionOrigin(port);
548
+ const extension = this.registeredExtensions.get(extensionOrigin);
549
+ if (!extension) {
550
+ throw new Error('Received a message from an unregistered extension');
551
+ }
552
+
553
+ if (message.handlerPresent) {
554
+ this.themeChangeHandlers.set(extensionOrigin, port);
555
+ } else {
556
+ this.themeChangeHandlers.delete(extensionOrigin);
557
+ }
558
+ return undefined;
559
+ }
560
+
533
561
  private handleOpenURL(
534
562
  port: MessagePort, contentProvider: TextUtils.ContentProvider.ContentProvider, lineNumber: number): void {
535
563
  port.postMessage(
@@ -67,7 +67,7 @@ export class LogManager implements SDK.TargetManager.SDKModelObserver<SDK.LogMod
67
67
  if (SDK.TargetManager.TargetManager.instance().targetById(workerId)) {
68
68
  return;
69
69
  }
70
- setTimeout(() => {
70
+ window.setTimeout(() => {
71
71
  if (!SDK.TargetManager.TargetManager.instance().targetById(workerId)) {
72
72
  SDK.ConsoleModel.ConsoleModel.instance().addMessage(consoleMessage);
73
73
  }
@@ -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 Platform from '../../core/platform/platform.js';
8
9
  import * as SDK from '../../core/sdk/sdk.js';
@@ -28,7 +29,7 @@ export class Automapping {
28
29
  private readonly onStatusAdded: (arg0: AutomappingStatus) => Promise<void>;
29
30
  private readonly onStatusRemoved: (arg0: AutomappingStatus) => Promise<void>;
30
31
  private readonly statuses: Set<AutomappingStatus>;
31
- private readonly fileSystemUISourceCodes: Map<string, Workspace.UISourceCode.UISourceCode>;
32
+ private readonly fileSystemUISourceCodes: FileSystemUISourceCodes;
32
33
  private readonly sweepThrottler: Common.Throttler.Throttler;
33
34
  private readonly sourceCodeToProcessingPromiseMap: WeakMap<Workspace.UISourceCode.UISourceCode, Promise<void>>;
34
35
  private readonly sourceCodeToAutoMappingStatusMap: WeakMap<Workspace.UISourceCode.UISourceCode, AutomappingStatus>;
@@ -47,7 +48,7 @@ export class Automapping {
47
48
  this.onStatusRemoved = onStatusRemoved;
48
49
  this.statuses = new Set();
49
50
 
50
- this.fileSystemUISourceCodes = new Map();
51
+ this.fileSystemUISourceCodes = new FileSystemUISourceCodes();
51
52
  this.sweepThrottler = new Common.Throttler.Throttler(100);
52
53
 
53
54
  this.sourceCodeToProcessingPromiseMap = new WeakMap();
@@ -144,7 +145,7 @@ export class Automapping {
144
145
  return;
145
146
  }
146
147
  this.filesIndex.addPath(uiSourceCode.url());
147
- this.fileSystemUISourceCodes.set(uiSourceCode.url(), uiSourceCode);
148
+ this.fileSystemUISourceCodes.add(uiSourceCode);
148
149
  this.scheduleSweep();
149
150
  } else if (project.type() === Workspace.Workspace.projectTypes.Network) {
150
151
  this.computeNetworkStatus(uiSourceCode);
@@ -179,7 +180,7 @@ export class Automapping {
179
180
  }
180
181
 
181
182
  this.filesIndex.addPath(uiSourceCode.url());
182
- this.fileSystemUISourceCodes.set(uiSourceCode.url(), uiSourceCode);
183
+ this.fileSystemUISourceCodes.add(uiSourceCode);
183
184
  this.scheduleSweep();
184
185
  }
185
186
 
@@ -489,6 +490,33 @@ class FolderIndex {
489
490
  }
490
491
  }
491
492
 
493
+ class FileSystemUISourceCodes {
494
+ private readonly sourceCodes: Map<string, Workspace.UISourceCode.UISourceCode>;
495
+
496
+ constructor() {
497
+ this.sourceCodes = new Map();
498
+ }
499
+
500
+ private getPlatformCanonicalFileUrl(path: string): string {
501
+ return Host.Platform.isWin() ? path.toLowerCase() : path;
502
+ }
503
+
504
+ add(sourceCode: Workspace.UISourceCode.UISourceCode): void {
505
+ const fileUrl = this.getPlatformCanonicalFileUrl(sourceCode.url());
506
+ this.sourceCodes.set(fileUrl, sourceCode);
507
+ }
508
+
509
+ get(fileUrl: string): Workspace.UISourceCode.UISourceCode|undefined {
510
+ fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
511
+ return this.sourceCodes.get(fileUrl);
512
+ }
513
+
514
+ delete(fileUrl: string): void {
515
+ fileUrl = this.getPlatformCanonicalFileUrl(fileUrl);
516
+ this.sourceCodes.delete(fileUrl);
517
+ }
518
+ }
519
+
492
520
  export class AutomappingStatus {
493
521
  network: Workspace.UISourceCode.UISourceCode;
494
522
  fileSystem: Workspace.UISourceCode.UISourceCode;
@@ -331,7 +331,7 @@ export class FileSystem extends Workspace.Workspace.ProjectStore implements Work
331
331
  this.addFile(filePaths[i]);
332
332
  }
333
333
  if (to < filePaths.length) {
334
- setTimeout(reportFileChunk.bind(this, to), 100);
334
+ window.setTimeout(reportFileChunk.bind(this, to), 100);
335
335
  }
336
336
  }
337
337
  }
@@ -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
 
@@ -106,7 +106,6 @@ export class WorkspaceSettingsTab extends UI.Widget.VBox {
106
106
  const inputElement = UI.UIUtils.createInput('', 'text');
107
107
  UI.ARIAUtils.bindLabelToControl(labelElement, inputElement);
108
108
  p.appendChild(inputElement);
109
- inputElement.style.width = '270px';
110
109
  const folderExcludeSetting = IsolatedFileSystemManager.instance().workspaceFolderExcludePatternSetting();
111
110
  const setValue =
112
111
  UI.UIUtils.bindInput(inputElement, folderExcludeSetting.set.bind(folderExcludeSetting), regexValidator, false);
@@ -32,11 +32,6 @@
32
32
  column-width: 308px;
33
33
  }
34
34
 
35
- .workspace-settings-tab .settings-tab label {
36
- padding-right: 4px;
37
- display: inline-flex;
38
- }
39
-
40
35
  .workspace-settings-tab .settings-container-wrapper {
41
36
  position: absolute;
42
37
  top: 31px;
@@ -57,12 +52,13 @@
57
52
  }
58
53
 
59
54
  .workspace-settings-tab p.folder-exclude-pattern {
60
- display: flex;
55
+ display: grid;
61
56
  align-items: center;
62
57
  }
63
58
 
64
59
  .workspace-settings-tab p.folder-exclude-pattern > input {
65
- flex: auto;
60
+ width: 80%;
61
+ margin-left: 10px;
66
62
  }
67
63
 
68
64
  .workspace-settings-tab .settings-tab .file-system-container {
@@ -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) {
@@ -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.