chrome-devtools-frontend 1.0.930109 → 1.0.930993

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 (61) hide show
  1. package/config/gni/devtools_grd_files.gni +2 -1
  2. package/front_end/core/host/InspectorFrontendHost.ts +8 -1
  3. package/front_end/core/host/InspectorFrontendHostAPI.ts +12 -0
  4. package/front_end/core/i18n/locales/en-US.json +3 -0
  5. package/front_end/core/i18n/locales/en-XL.json +3 -0
  6. package/front_end/core/protocol_client/InspectorBackend.ts +71 -71
  7. package/front_end/core/sdk/NetworkManager.ts +6 -2
  8. package/front_end/devtools_compatibility.js +8 -0
  9. package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +2 -2
  10. package/front_end/legacy_test_runner/test_runner/TestRunner.js +2 -3
  11. package/front_end/models/bindings/BreakpointManager.ts +158 -154
  12. package/front_end/models/bindings/CSSWorkspaceBinding.ts +64 -56
  13. package/front_end/models/bindings/CompilerScriptMapping.ts +70 -70
  14. package/front_end/models/bindings/ContentProviderBasedProject.ts +20 -20
  15. package/front_end/models/bindings/DebuggerLanguagePlugins.ts +132 -132
  16. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +73 -72
  17. package/front_end/models/bindings/DefaultScriptMapping.ts +22 -22
  18. package/front_end/models/bindings/FileUtils.ts +81 -81
  19. package/front_end/models/bindings/IgnoreListManager.ts +17 -17
  20. package/front_end/models/bindings/LiveLocation.ts +21 -21
  21. package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +28 -28
  22. package/front_end/models/bindings/ResourceMapping.ts +50 -50
  23. package/front_end/models/bindings/ResourceScriptMapping.ts +71 -71
  24. package/front_end/models/bindings/SASSSourceMapping.ts +32 -32
  25. package/front_end/models/bindings/StylesSourceMapping.ts +57 -57
  26. package/front_end/models/bindings/TempFile.ts +34 -34
  27. package/front_end/models/emulation/DeviceModeModel.ts +208 -203
  28. package/front_end/models/emulation/EmulatedDevices.ts +34 -34
  29. package/front_end/panels/console/ConsoleView.ts +2 -1
  30. package/front_end/panels/console/ConsoleViewMessage.ts +3 -3
  31. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +133 -133
  32. package/front_end/panels/css_overview/CSSOverviewModel.ts +16 -16
  33. package/front_end/panels/css_overview/CSSOverviewPanel.ts +77 -77
  34. package/front_end/panels/css_overview/CSSOverviewProcessingView.ts +5 -5
  35. package/front_end/panels/css_overview/components/CSSOverviewStartView.ts +4 -4
  36. package/front_end/panels/elements/ElementsTreeElement.ts +6 -10
  37. package/front_end/panels/elements/ElementsTreeOutline.ts +3 -1
  38. package/front_end/panels/elements/components/LayoutPane.ts +6 -0
  39. package/front_end/panels/elements/elementsPanel.css +0 -1
  40. package/front_end/panels/elements/elementsTreeOutline.css +0 -4
  41. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
  42. package/front_end/panels/network/BlockedURLsPane.ts +8 -5
  43. package/front_end/panels/network/blockedURLsPane.css +0 -1
  44. package/front_end/panels/search/SearchView.ts +0 -2
  45. package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
  46. package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
  47. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
  48. package/front_end/ui/components/text_editor/config.ts +6 -0
  49. package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
  50. package/front_end/ui/components/text_editor/javascript.ts +590 -0
  51. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  52. package/front_end/ui/components/text_editor/theme.ts +11 -0
  53. package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
  54. package/front_end/ui/legacy/ARIAUtils.ts +24 -8
  55. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
  56. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
  57. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
  58. package/package.json +1 -1
  59. package/scripts/migration/class-fields/migrate.js +15 -2
  60. package/scripts/migration/class-fields/migrate.sh +10 -0
  61. package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
@@ -39,27 +39,27 @@ import {CSSWorkspaceBinding} from './CSSWorkspaceBinding.js';
39
39
  import {NetworkProject} from './NetworkProject.js';
40
40
 
41
41
  export class SASSSourceMapping implements SourceMapping {
42
- private readonly sourceMapManager: SDK.SourceMapManager.SourceMapManager<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader>;
43
- private readonly project: ContentProviderBasedProject;
44
- private readonly eventListeners: Common.EventTarget.EventDescriptor[];
45
- private readonly bindings: Map<string, Binding>;
42
+ readonly #sourceMapManager: SDK.SourceMapManager.SourceMapManager<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader>;
43
+ readonly #project: ContentProviderBasedProject;
44
+ readonly #eventListeners: Common.EventTarget.EventDescriptor[];
45
+ readonly #bindings: Map<string, Binding>;
46
46
 
47
47
  constructor(
48
48
  target: SDK.Target.Target,
49
49
  sourceMapManager: SDK.SourceMapManager.SourceMapManager<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader>,
50
50
  workspace: Workspace.Workspace.WorkspaceImpl) {
51
- this.sourceMapManager = sourceMapManager;
52
- this.project = new ContentProviderBasedProject(
51
+ this.#sourceMapManager = sourceMapManager;
52
+ this.#project = new ContentProviderBasedProject(
53
53
  workspace, 'cssSourceMaps:' + target.id(), Workspace.Workspace.projectTypes.Network, '',
54
54
  false /* isServiceProject */);
55
- NetworkProject.setTargetForProject(this.project, target);
55
+ NetworkProject.setTargetForProject(this.#project, target);
56
56
 
57
- this.bindings = new Map();
57
+ this.#bindings = new Map();
58
58
 
59
- this.eventListeners = [
60
- this.sourceMapManager.addEventListener(
59
+ this.#eventListeners = [
60
+ this.#sourceMapManager.addEventListener(
61
61
  SDK.SourceMapManager.Events.SourceMapAttached, this.sourceMapAttached, this),
62
- this.sourceMapManager.addEventListener(
62
+ this.#sourceMapManager.addEventListener(
63
63
  SDK.SourceMapManager.Events.SourceMapDetached, this.sourceMapDetached, this),
64
64
  ];
65
65
  }
@@ -73,8 +73,8 @@ export class SASSSourceMapping implements SourceMapping {
73
73
  Promise<void> {
74
74
  const header = event.data.client;
75
75
  const sourceMap = (event.data.sourceMap as SDK.SourceMap.TextSourceMap);
76
- const project = this.project;
77
- const bindings = this.bindings;
76
+ const project = this.#project;
77
+ const bindings = this.#bindings;
78
78
  for (const sourceURL of sourceMap.sourceURLs()) {
79
79
  let binding = bindings.get(sourceURL);
80
80
  if (!binding) {
@@ -93,7 +93,7 @@ export class SASSSourceMapping implements SourceMapping {
93
93
  Promise<void> {
94
94
  const header = event.data.client;
95
95
  const sourceMap = (event.data.sourceMap as SDK.SourceMap.TextSourceMap);
96
- const bindings = this.bindings;
96
+ const bindings = this.#bindings;
97
97
  for (const sourceURL of sourceMap.sourceURLs()) {
98
98
  const binding = bindings.get(sourceURL);
99
99
  if (binding) {
@@ -111,7 +111,7 @@ export class SASSSourceMapping implements SourceMapping {
111
111
  if (!header) {
112
112
  return null;
113
113
  }
114
- const sourceMap = this.sourceMapManager.sourceMapForClient(header);
114
+ const sourceMap = this.#sourceMapManager.sourceMapForClient(header);
115
115
  if (!sourceMap) {
116
116
  return null;
117
117
  }
@@ -128,7 +128,7 @@ export class SASSSourceMapping implements SourceMapping {
128
128
  if (!entry || !entry.sourceURL) {
129
129
  return null;
130
130
  }
131
- const uiSourceCode = this.project.uiSourceCodeForURL(entry.sourceURL);
131
+ const uiSourceCode = this.#project.uiSourceCodeForURL(entry.sourceURL);
132
132
  if (!uiSourceCode) {
133
133
  return null;
134
134
  }
@@ -136,7 +136,7 @@ export class SASSSourceMapping implements SourceMapping {
136
136
  }
137
137
 
138
138
  uiLocationToRawLocations(uiLocation: Workspace.UISourceCode.UILocation): SDK.CSSModel.CSSLocation[] {
139
- // TODO(crbug.com/1153123): Revisit the `columnNumber || 0` and also preserve `undefined` for source maps?
139
+ // TODO(crbug.com/1153123): Revisit the `#columnNumber || 0` and also preserve `undefined` for source maps?
140
140
  const {uiSourceCode, lineNumber, columnNumber = 0} = uiLocation;
141
141
  const binding = uiSourceCodeToBinding.get(uiSourceCode);
142
142
  if (!binding) {
@@ -145,7 +145,7 @@ export class SASSSourceMapping implements SourceMapping {
145
145
  const locations: SDK.CSSModel.CSSLocation[] = [];
146
146
  for (const sourceMap of binding.getReferringSourceMaps()) {
147
147
  const entries = sourceMap.findReverseEntries(uiSourceCode.url(), lineNumber, columnNumber);
148
- for (const header of this.sourceMapManager.clientsForSourceMap(sourceMap)) {
148
+ for (const header of this.#sourceMapManager.clientsForSourceMap(sourceMap)) {
149
149
  locations.push(
150
150
  ...entries.map(entry => new SDK.CSSModel.CSSLocation(header, entry.lineNumber, entry.columnNumber)));
151
151
  }
@@ -154,23 +154,23 @@ export class SASSSourceMapping implements SourceMapping {
154
154
  }
155
155
 
156
156
  dispose(): void {
157
- Common.EventTarget.removeEventListeners(this.eventListeners);
158
- this.project.dispose();
157
+ Common.EventTarget.removeEventListeners(this.#eventListeners);
158
+ this.#project.dispose();
159
159
  }
160
160
  }
161
161
 
162
162
  const uiSourceCodeToBinding = new WeakMap<Workspace.UISourceCode.UISourceCode, Binding>();
163
163
 
164
164
  class Binding {
165
- private readonly project: ContentProviderBasedProject;
166
- private readonly url: string;
165
+ readonly #project: ContentProviderBasedProject;
166
+ readonly #url: string;
167
167
  referringSourceMaps: SDK.SourceMap.TextSourceMap[];
168
- private readonly activeSourceMap?: SDK.SourceMap.TextSourceMap|null;
168
+ readonly #activeSourceMap?: SDK.SourceMap.TextSourceMap|null;
169
169
  uiSourceCode: Workspace.UISourceCode.UISourceCode|null;
170
170
 
171
171
  constructor(project: ContentProviderBasedProject, url: string) {
172
- this.project = project;
173
- this.url = url;
172
+ this.#project = project;
173
+ this.#url = url;
174
174
 
175
175
  this.referringSourceMaps = [];
176
176
  this.uiSourceCode = null;
@@ -180,24 +180,24 @@ class Binding {
180
180
  const sourceMap = this.referringSourceMaps[this.referringSourceMaps.length - 1];
181
181
 
182
182
  const contentProvider =
183
- sourceMap.sourceContentProvider(this.url, Common.ResourceType.resourceTypes.SourceMapStyleSheet);
184
- const newUISourceCode = this.project.createUISourceCode(this.url, contentProvider.contentType());
183
+ sourceMap.sourceContentProvider(this.#url, Common.ResourceType.resourceTypes.SourceMapStyleSheet);
184
+ const newUISourceCode = this.#project.createUISourceCode(this.#url, contentProvider.contentType());
185
185
  uiSourceCodeToBinding.set(newUISourceCode, this);
186
186
  const mimeType =
187
- Common.ResourceType.ResourceType.mimeFromURL(this.url) || contentProvider.contentType().canonicalMimeType();
188
- const embeddedContent = sourceMap.embeddedContentByURL(this.url);
187
+ Common.ResourceType.ResourceType.mimeFromURL(this.#url) || contentProvider.contentType().canonicalMimeType();
188
+ const embeddedContent = sourceMap.embeddedContentByURL(this.#url);
189
189
  const metadata = typeof embeddedContent === 'string' ?
190
190
  new Workspace.UISourceCode.UISourceCodeMetadata(null, embeddedContent.length) :
191
191
  null;
192
192
 
193
193
  if (this.uiSourceCode) {
194
194
  NetworkProject.cloneInitialFrameAttribution(this.uiSourceCode, newUISourceCode);
195
- this.project.removeFile(this.uiSourceCode.url());
195
+ this.#project.removeFile(this.uiSourceCode.url());
196
196
  } else {
197
197
  NetworkProject.setInitialFrameAttribution(newUISourceCode, frameId);
198
198
  }
199
199
  this.uiSourceCode = newUISourceCode;
200
- this.project.addUISourceCodeWithProvider(this.uiSourceCode, contentProvider, metadata, mimeType);
200
+ this.#project.addUISourceCodeWithProvider(this.uiSourceCode, contentProvider, metadata, mimeType);
201
201
  }
202
202
 
203
203
  addSourceMap(sourceMap: SDK.SourceMap.TextSourceMap, frameId: Protocol.Page.FrameId): void {
@@ -216,7 +216,7 @@ class Binding {
216
216
  this.referringSourceMaps.splice(lastIndex, 1);
217
217
  }
218
218
  if (!this.referringSourceMaps.length) {
219
- this.project.removeFile(uiSourceCode.url());
219
+ this.#project.removeFile(uiSourceCode.url());
220
220
  this.uiSourceCode = null;
221
221
  } else {
222
222
  this.recreateUISourceCodeIfNeeded(frameId);
@@ -41,23 +41,23 @@ import {metadataForURL} from './ResourceUtils.js';
41
41
  const uiSourceCodeToStyleMap = new WeakMap<Workspace.UISourceCode.UISourceCode, StyleFile>();
42
42
 
43
43
  export class StylesSourceMapping implements SourceMapping {
44
- private cssModel: SDK.CSSModel.CSSModel;
45
- private project: ContentProviderBasedProject;
46
- private readonly styleFiles: Map<string, StyleFile>;
47
- private readonly eventListeners: Common.EventTarget.EventDescriptor[];
44
+ #cssModel: SDK.CSSModel.CSSModel;
45
+ #project: ContentProviderBasedProject;
46
+ readonly #styleFiles: Map<string, StyleFile>;
47
+ readonly #eventListeners: Common.EventTarget.EventDescriptor[];
48
48
 
49
49
  constructor(cssModel: SDK.CSSModel.CSSModel, workspace: Workspace.Workspace.WorkspaceImpl) {
50
- this.cssModel = cssModel;
51
- const target = this.cssModel.target();
52
- this.project = new ContentProviderBasedProject(
50
+ this.#cssModel = cssModel;
51
+ const target = this.#cssModel.target();
52
+ this.#project = new ContentProviderBasedProject(
53
53
  workspace, 'css:' + target.id(), Workspace.Workspace.projectTypes.Network, '', false /* isServiceProject */);
54
- NetworkProject.setTargetForProject(this.project, target);
54
+ NetworkProject.setTargetForProject(this.#project, target);
55
55
 
56
- this.styleFiles = new Map();
57
- this.eventListeners = [
58
- this.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this.styleSheetAdded, this),
59
- this.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this.styleSheetRemoved, this),
60
- this.cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetChanged, this.styleSheetChanged, this),
56
+ this.#styleFiles = new Map();
57
+ this.#eventListeners = [
58
+ this.#cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this.styleSheetAdded, this),
59
+ this.#cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this.styleSheetRemoved, this),
60
+ this.#cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetChanged, this.styleSheetChanged, this),
61
61
  ];
62
62
  }
63
63
 
@@ -66,7 +66,7 @@ export class StylesSourceMapping implements SourceMapping {
66
66
  if (!header || !this.acceptsHeader(header)) {
67
67
  return null;
68
68
  }
69
- const styleFile = this.styleFiles.get(header.resourceURL());
69
+ const styleFile = this.#styleFiles.get(header.resourceURL());
70
70
  if (!styleFile) {
71
71
  return null;
72
72
  }
@@ -94,7 +94,7 @@ export class StylesSourceMapping implements SourceMapping {
94
94
  let lineNumber = uiLocation.lineNumber;
95
95
  let columnNumber = uiLocation.columnNumber;
96
96
  if (header.isInline && header.hasSourceURL) {
97
- // TODO(crbug.com/1153123): Revisit the `columnNumber || 0` and also preserve `undefined` for source maps?
97
+ // TODO(crbug.com/1153123): Revisit the `#columnNumber || 0` and also preserve `undefined` for source maps?
98
98
  columnNumber = header.columnNumberInSource(lineNumber, uiLocation.columnNumber || 0);
99
99
  lineNumber = header.lineNumberInSource(lineNumber);
100
100
  }
@@ -124,10 +124,10 @@ export class StylesSourceMapping implements SourceMapping {
124
124
  }
125
125
 
126
126
  const url = header.resourceURL();
127
- let styleFile = this.styleFiles.get(url);
127
+ let styleFile = this.#styleFiles.get(url);
128
128
  if (!styleFile) {
129
- styleFile = new StyleFile(this.cssModel, this.project, header);
130
- this.styleFiles.set(url, styleFile);
129
+ styleFile = new StyleFile(this.#cssModel, this.#project, header);
130
+ this.#styleFiles.set(url, styleFile);
131
131
  } else {
132
132
  styleFile.addHeader(header);
133
133
  }
@@ -140,11 +140,11 @@ export class StylesSourceMapping implements SourceMapping {
140
140
  return;
141
141
  }
142
142
  const url = header.resourceURL();
143
- const styleFile = this.styleFiles.get(url);
143
+ const styleFile = this.#styleFiles.get(url);
144
144
  if (styleFile) {
145
145
  if (styleFile.getHeaders().size === 1) {
146
146
  styleFile.dispose();
147
- this.styleFiles.delete(url);
147
+ this.#styleFiles.delete(url);
148
148
  } else {
149
149
  styleFile.removeHeader(header);
150
150
  }
@@ -152,42 +152,42 @@ export class StylesSourceMapping implements SourceMapping {
152
152
  }
153
153
 
154
154
  private styleSheetChanged(event: Common.EventTarget.EventTargetEvent<SDK.CSSModel.StyleSheetChangedEvent>): void {
155
- const header = this.cssModel.styleSheetHeaderForId(event.data.styleSheetId);
155
+ const header = this.#cssModel.styleSheetHeaderForId(event.data.styleSheetId);
156
156
  if (!header || !this.acceptsHeader(header)) {
157
157
  return;
158
158
  }
159
- const styleFile = this.styleFiles.get(header.resourceURL());
159
+ const styleFile = this.#styleFiles.get(header.resourceURL());
160
160
  if (styleFile) {
161
161
  styleFile.styleSheetChanged(header);
162
162
  }
163
163
  }
164
164
 
165
165
  dispose(): void {
166
- for (const styleFile of this.styleFiles.values()) {
166
+ for (const styleFile of this.#styleFiles.values()) {
167
167
  styleFile.dispose();
168
168
  }
169
- this.styleFiles.clear();
170
- Common.EventTarget.removeEventListeners(this.eventListeners);
171
- this.project.removeProject();
169
+ this.#styleFiles.clear();
170
+ Common.EventTarget.removeEventListeners(this.#eventListeners);
171
+ this.#project.removeProject();
172
172
  }
173
173
  }
174
174
 
175
175
  export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
176
- private readonly cssModel: SDK.CSSModel.CSSModel;
177
- private readonly project: ContentProviderBasedProject;
176
+ readonly #cssModel: SDK.CSSModel.CSSModel;
177
+ readonly #project: ContentProviderBasedProject;
178
178
  headers: Set<SDK.CSSStyleSheetHeader.CSSStyleSheetHeader>;
179
179
  uiSourceCode: Workspace.UISourceCode.UISourceCode;
180
- private readonly eventListeners: Common.EventTarget.EventDescriptor[];
181
- private readonly throttler: Common.Throttler.Throttler;
182
- private terminated: boolean;
183
- private isAddingRevision?: boolean;
184
- private isUpdatingHeaders?: boolean;
180
+ readonly #eventListeners: Common.EventTarget.EventDescriptor[];
181
+ readonly #throttler: Common.Throttler.Throttler;
182
+ #terminated: boolean;
183
+ #isAddingRevision?: boolean;
184
+ #isUpdatingHeaders?: boolean;
185
185
 
186
186
  constructor(
187
187
  cssModel: SDK.CSSModel.CSSModel, project: ContentProviderBasedProject,
188
188
  header: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader) {
189
- this.cssModel = cssModel;
190
- this.project = project;
189
+ this.#cssModel = cssModel;
190
+ this.#project = project;
191
191
  this.headers = new Set([header]);
192
192
 
193
193
  const target = cssModel.target();
@@ -195,19 +195,19 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
195
195
  const url = header.resourceURL();
196
196
  const metadata = metadataForURL(target, header.frameId, url);
197
197
 
198
- this.uiSourceCode = this.project.createUISourceCode(url, header.contentType());
198
+ this.uiSourceCode = this.#project.createUISourceCode(url, header.contentType());
199
199
  uiSourceCodeToStyleMap.set(this.uiSourceCode, this);
200
200
  NetworkProject.setInitialFrameAttribution(this.uiSourceCode, header.frameId);
201
- this.project.addUISourceCodeWithProvider(this.uiSourceCode, this, metadata, 'text/css');
201
+ this.#project.addUISourceCodeWithProvider(this.uiSourceCode, this, metadata, 'text/css');
202
202
 
203
- this.eventListeners = [
203
+ this.#eventListeners = [
204
204
  this.uiSourceCode.addEventListener(
205
205
  Workspace.UISourceCode.Events.WorkingCopyChanged, this.workingCopyChanged, this),
206
206
  this.uiSourceCode.addEventListener(
207
207
  Workspace.UISourceCode.Events.WorkingCopyCommitted, this.workingCopyCommitted, this),
208
208
  ];
209
- this.throttler = new Common.Throttler.Throttler(StyleFile.updateTimeout);
210
- this.terminated = false;
209
+ this.#throttler = new Common.Throttler.Throttler(StyleFile.updateTimeout);
210
+ this.#terminated = false;
211
211
  }
212
212
 
213
213
  addHeader(header: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader): void {
@@ -222,32 +222,32 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
222
222
 
223
223
  styleSheetChanged(header: SDK.CSSStyleSheetHeader.CSSStyleSheetHeader): void {
224
224
  console.assert(this.headers.has(header));
225
- if (this.isUpdatingHeaders || !this.headers.has(header)) {
225
+ if (this.#isUpdatingHeaders || !this.headers.has(header)) {
226
226
  return;
227
227
  }
228
228
  const mirrorContentBound = this.mirrorContent.bind(this, header, true /* majorChange */);
229
- this.throttler.schedule(mirrorContentBound, false /* asSoonAsPossible */);
229
+ this.#throttler.schedule(mirrorContentBound, false /* asSoonAsPossible */);
230
230
  }
231
231
 
232
232
  private workingCopyCommitted(): void {
233
- if (this.isAddingRevision) {
233
+ if (this.#isAddingRevision) {
234
234
  return;
235
235
  }
236
236
  const mirrorContentBound = this.mirrorContent.bind(this, this.uiSourceCode, true /* majorChange */);
237
- this.throttler.schedule(mirrorContentBound, true /* asSoonAsPossible */);
237
+ this.#throttler.schedule(mirrorContentBound, true /* asSoonAsPossible */);
238
238
  }
239
239
 
240
240
  private workingCopyChanged(): void {
241
- if (this.isAddingRevision) {
241
+ if (this.#isAddingRevision) {
242
242
  return;
243
243
  }
244
244
  const mirrorContentBound = this.mirrorContent.bind(this, this.uiSourceCode, false /* majorChange */);
245
- this.throttler.schedule(mirrorContentBound, false /* asSoonAsPossible */);
245
+ this.#throttler.schedule(mirrorContentBound, false /* asSoonAsPossible */);
246
246
  }
247
247
 
248
248
  private async mirrorContent(fromProvider: TextUtils.ContentProvider.ContentProvider, majorChange: boolean):
249
249
  Promise<void> {
250
- if (this.terminated) {
250
+ if (this.#terminated) {
251
251
  this.styleFileSyncedForTest();
252
252
  return;
253
253
  }
@@ -260,28 +260,28 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
260
260
  newContent = deferredContent.content;
261
261
  }
262
262
 
263
- if (newContent === null || this.terminated) {
263
+ if (newContent === null || this.#terminated) {
264
264
  this.styleFileSyncedForTest();
265
265
  return;
266
266
  }
267
267
 
268
268
  if (fromProvider !== this.uiSourceCode) {
269
- this.isAddingRevision = true;
269
+ this.#isAddingRevision = true;
270
270
  this.uiSourceCode.addRevision(newContent);
271
- this.isAddingRevision = false;
271
+ this.#isAddingRevision = false;
272
272
  }
273
273
 
274
- this.isUpdatingHeaders = true;
274
+ this.#isUpdatingHeaders = true;
275
275
  const promises = [];
276
276
  for (const header of this.headers) {
277
277
  if (header === fromProvider) {
278
278
  continue;
279
279
  }
280
- promises.push(this.cssModel.setStyleSheetText(header.id, newContent, majorChange));
280
+ promises.push(this.#cssModel.setStyleSheetText(header.id, newContent, majorChange));
281
281
  }
282
282
  // ------ ASYNC ------
283
283
  await Promise.all(promises);
284
- this.isUpdatingHeaders = false;
284
+ this.#isUpdatingHeaders = false;
285
285
  this.styleFileSyncedForTest();
286
286
  }
287
287
 
@@ -289,12 +289,12 @@ export class StyleFile implements TextUtils.ContentProvider.ContentProvider {
289
289
  }
290
290
 
291
291
  dispose(): void {
292
- if (this.terminated) {
292
+ if (this.#terminated) {
293
293
  return;
294
294
  }
295
- this.terminated = true;
296
- this.project.removeFile(this.uiSourceCode.url());
297
- Common.EventTarget.removeEventListeners(this.eventListeners);
295
+ this.#terminated = true;
296
+ this.#project.removeFile(this.uiSourceCode.url());
297
+ Common.EventTarget.removeEventListeners(this.#eventListeners);
298
298
  }
299
299
 
300
300
  contentURL(): string {
@@ -36,16 +36,16 @@ import type {ChunkedReader} from './FileUtils.js';
36
36
  import {ChunkedFileReader} from './FileUtils.js';
37
37
 
38
38
  export class TempFile {
39
- private lastBlob: Blob|null;
39
+ #lastBlob: Blob|null;
40
40
  constructor() {
41
- this.lastBlob = null;
41
+ this.#lastBlob = null;
42
42
  }
43
43
 
44
44
  write(pieces: (string|Blob)[]): void {
45
- if (this.lastBlob) {
46
- pieces.unshift(this.lastBlob);
45
+ if (this.#lastBlob) {
46
+ pieces.unshift(this.#lastBlob);
47
47
  }
48
- this.lastBlob = new Blob(pieces, {type: 'text/plain'});
48
+ this.#lastBlob = new Blob(pieces, {type: 'text/plain'});
49
49
  }
50
50
 
51
51
  read(): Promise<string|null> {
@@ -53,17 +53,17 @@ export class TempFile {
53
53
  }
54
54
 
55
55
  size(): number {
56
- return this.lastBlob ? this.lastBlob.size : 0;
56
+ return this.#lastBlob ? this.#lastBlob.size : 0;
57
57
  }
58
58
 
59
59
  async readRange(startOffset?: number, endOffset?: number): Promise<string|null> {
60
- if (!this.lastBlob) {
60
+ if (!this.#lastBlob) {
61
61
  Common.Console.Console.instance().error('Attempt to read a temp file that was never written');
62
62
  return '';
63
63
  }
64
64
  const blob = typeof startOffset === 'number' || typeof endOffset === 'number' ?
65
- this.lastBlob.slice((startOffset as number), (endOffset as number)) :
66
- this.lastBlob;
65
+ this.#lastBlob.slice((startOffset as number), (endOffset as number)) :
66
+ this.#lastBlob;
67
67
 
68
68
  const reader = new FileReader();
69
69
  try {
@@ -82,58 +82,58 @@ export class TempFile {
82
82
  async copyToOutputStream(
83
83
  outputStream: Common.StringOutputStream.OutputStream,
84
84
  progress?: ((arg0: ChunkedReader) => void)): Promise<DOMError|null> {
85
- if (!this.lastBlob) {
85
+ if (!this.#lastBlob) {
86
86
  outputStream.close();
87
87
  return null;
88
88
  }
89
- const reader = new ChunkedFileReader((this.lastBlob as File), 10 * 1000 * 1000, progress);
89
+ const reader = new ChunkedFileReader((this.#lastBlob as File), 10 * 1000 * 1000, progress);
90
90
  return reader.read(outputStream).then(success => success ? null : reader.error());
91
91
  }
92
92
 
93
93
  remove(): void {
94
- this.lastBlob = null;
94
+ this.#lastBlob = null;
95
95
  }
96
96
  }
97
97
 
98
98
  export class TempFileBackingStorage implements SDK.TracingModel.BackingStorage {
99
- private file: TempFile|null;
100
- private strings!: string[];
101
- private stringsLength!: number;
99
+ #file: TempFile|null;
100
+ #strings!: string[];
101
+ #stringsLength!: number;
102
102
 
103
103
  constructor() {
104
- this.file = null;
104
+ this.#file = null;
105
105
  this.reset();
106
106
  }
107
107
 
108
108
  appendString(string: string): void {
109
- this.strings.push(string);
110
- this.stringsLength += string.length;
109
+ this.#strings.push(string);
110
+ this.#stringsLength += string.length;
111
111
  const flushStringLength = 10 * 1024 * 1024;
112
- if (this.stringsLength > flushStringLength) {
112
+ if (this.#stringsLength > flushStringLength) {
113
113
  this.flush();
114
114
  }
115
115
  }
116
116
 
117
117
  appendAccessibleString(string: string): () => Promise<string|null> {
118
118
  this.flush();
119
- if (!this.file) {
119
+ if (!this.#file) {
120
120
  return async(): Promise<null> => null;
121
121
  }
122
- const startOffset = this.file.size();
123
- this.strings.push(string);
122
+ const startOffset = this.#file.size();
123
+ this.#strings.push(string);
124
124
  this.flush();
125
- return this.file.readRange.bind(this.file, startOffset, this.file.size());
125
+ return this.#file.readRange.bind(this.#file, startOffset, this.#file.size());
126
126
  }
127
127
 
128
128
  private flush(): void {
129
- if (!this.strings.length) {
129
+ if (!this.#strings.length) {
130
130
  return;
131
131
  }
132
- if (!this.file) {
133
- this.file = new TempFile();
132
+ if (!this.#file) {
133
+ this.#file = new TempFile();
134
134
  }
135
- this.stringsLength = 0;
136
- this.file.write(this.strings.splice(0));
135
+ this.#stringsLength = 0;
136
+ this.#file.write(this.#strings.splice(0));
137
137
  }
138
138
 
139
139
  finishWriting(): void {
@@ -141,15 +141,15 @@ export class TempFileBackingStorage implements SDK.TracingModel.BackingStorage {
141
141
  }
142
142
 
143
143
  reset(): void {
144
- if (this.file) {
145
- this.file.remove();
144
+ if (this.#file) {
145
+ this.#file.remove();
146
146
  }
147
- this.file = null;
148
- this.strings = [];
149
- this.stringsLength = 0;
147
+ this.#file = null;
148
+ this.#strings = [];
149
+ this.#stringsLength = 0;
150
150
  }
151
151
 
152
152
  writeToStream(outputStream: Common.StringOutputStream.OutputStream): Promise<DOMError|null> {
153
- return this.file ? this.file.copyToOutputStream(outputStream) : Promise.resolve(null);
153
+ return this.#file ? this.#file.copyToOutputStream(outputStream) : Promise.resolve(null);
154
154
  }
155
155
  }