chrome-devtools-frontend 1.0.929965 → 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 (63) 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/LighthouseController.ts +18 -9
  42. package/front_end/panels/lighthouse/LighthousePanel.ts +2 -2
  43. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +7 -2
  44. package/front_end/panels/network/BlockedURLsPane.ts +8 -5
  45. package/front_end/panels/network/blockedURLsPane.css +0 -1
  46. package/front_end/panels/search/SearchView.ts +0 -2
  47. package/front_end/panels/sources/BreakpointEditDialog.ts +98 -81
  48. package/front_end/panels/sources/DebuggerPlugin.ts +15 -14
  49. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +18 -2
  50. package/front_end/ui/components/text_editor/config.ts +6 -0
  51. package/front_end/ui/components/text_editor/cursor_tooltip.ts +70 -0
  52. package/front_end/ui/components/text_editor/javascript.ts +590 -0
  53. package/front_end/ui/components/text_editor/text_editor.ts +1 -0
  54. package/front_end/ui/components/text_editor/theme.ts +11 -0
  55. package/front_end/ui/components/tree_outline/TreeOutline.ts +3 -1
  56. package/front_end/ui/legacy/ARIAUtils.ts +24 -8
  57. package/front_end/ui/legacy/components/text_editor/cmdevtools.css +1 -0
  58. package/front_end/ui/legacy/components/text_editor/text_editor-legacy.ts +0 -3
  59. package/front_end/ui/legacy/components/text_editor/text_editor.ts +0 -2
  60. package/package.json +1 -1
  61. package/scripts/migration/class-fields/migrate.js +15 -2
  62. package/scripts/migration/class-fields/migrate.sh +10 -0
  63. package/front_end/ui/legacy/components/text_editor/SyntaxHighlighter.ts +0 -62
@@ -42,28 +42,27 @@ let breakpointManagerInstance: BreakpointManager;
42
42
 
43
43
  export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
44
44
  readonly storage: Storage;
45
- private readonly workspace: Workspace.Workspace.WorkspaceImpl;
45
+ readonly #workspace: Workspace.Workspace.WorkspaceImpl;
46
46
  readonly targetManager: SDK.TargetManager.TargetManager;
47
47
  readonly debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
48
- private readonly breakpointsForUISourceCode:
49
- Map<Workspace.UISourceCode.UISourceCode, Map<string, BreakpointLocation>>;
50
- private readonly breakpointByStorageId: Map<string, Breakpoint>;
48
+ readonly #breakpointsForUISourceCode: Map<Workspace.UISourceCode.UISourceCode, Map<string, BreakpointLocation>>;
49
+ readonly #breakpointByStorageId: Map<string, Breakpoint>;
51
50
 
52
51
  private constructor(
53
52
  targetManager: SDK.TargetManager.TargetManager, workspace: Workspace.Workspace.WorkspaceImpl,
54
53
  debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
55
54
  super();
56
55
  this.storage = new Storage();
57
- this.workspace = workspace;
56
+ this.#workspace = workspace;
58
57
  this.targetManager = targetManager;
59
58
  this.debuggerWorkspaceBinding = debuggerWorkspaceBinding;
60
59
 
61
- this.breakpointsForUISourceCode = new Map();
62
- this.breakpointByStorageId = new Map();
60
+ this.#breakpointsForUISourceCode = new Map();
61
+ this.#breakpointByStorageId = new Map();
63
62
 
64
- this.workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.uiSourceCodeAdded, this);
65
- this.workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemoved, this.uiSourceCodeRemoved, this);
66
- this.workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this.projectRemoved, this);
63
+ this.#workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeAdded, this.uiSourceCodeAdded, this);
64
+ this.#workspace.addEventListener(Workspace.Workspace.Events.UISourceCodeRemoved, this.uiSourceCodeRemoved, this);
65
+ this.#workspace.addEventListener(Workspace.Workspace.Events.ProjectRemoved, this.projectRemoved, this);
67
66
  }
68
67
 
69
68
  static instance(opts: {
@@ -154,7 +153,7 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
154
153
  uiSourceCode: Workspace.UISourceCode.UISourceCode, lineNumber: number, columnNumber: number|undefined,
155
154
  condition: string, enabled: boolean): Breakpoint {
156
155
  const itemId = BreakpointManager.breakpointStorageId(uiSourceCode.url(), lineNumber, columnNumber);
157
- let breakpoint = this.breakpointByStorageId.get(itemId);
156
+ let breakpoint = this.#breakpointByStorageId.get(itemId);
158
157
  if (breakpoint) {
159
158
  breakpoint.updateState(condition, enabled);
160
159
  breakpoint.addUISourceCode(uiSourceCode);
@@ -162,12 +161,12 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
162
161
  return breakpoint;
163
162
  }
164
163
  breakpoint = new Breakpoint(this, uiSourceCode, uiSourceCode.url(), lineNumber, columnNumber, condition, enabled);
165
- this.breakpointByStorageId.set(itemId, breakpoint);
164
+ this.#breakpointByStorageId.set(itemId, breakpoint);
166
165
  return breakpoint;
167
166
  }
168
167
 
169
168
  findBreakpoint(uiLocation: Workspace.UISourceCode.UILocation): BreakpointLocation|null {
170
- const breakpoints = this.breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
169
+ const breakpoints = this.#breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
171
170
  return breakpoints ? (breakpoints.get(uiLocation.id())) || null : null;
172
171
  }
173
172
 
@@ -243,13 +242,13 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
243
242
  }
244
243
 
245
244
  breakpointLocationsForUISourceCode(uiSourceCode: Workspace.UISourceCode.UISourceCode): BreakpointLocation[] {
246
- const breakpoints = this.breakpointsForUISourceCode.get(uiSourceCode);
245
+ const breakpoints = this.#breakpointsForUISourceCode.get(uiSourceCode);
247
246
  return breakpoints ? Array.from(breakpoints.values()) : [];
248
247
  }
249
248
 
250
249
  allBreakpointLocations(): BreakpointLocation[] {
251
250
  const result = [];
252
- for (const breakpoints of this.breakpointsForUISourceCode.values()) {
251
+ for (const breakpoints of this.#breakpointsForUISourceCode.values()) {
253
252
  result.push(...breakpoints.values());
254
253
  }
255
254
  return result;
@@ -259,14 +258,14 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
259
258
  if (removeFromStorage) {
260
259
  this.storage.removeBreakpoint(breakpoint);
261
260
  }
262
- this.breakpointByStorageId.delete(breakpoint.breakpointStorageId());
261
+ this.#breakpointByStorageId.delete(breakpoint.breakpointStorageId());
263
262
  }
264
263
 
265
264
  uiLocationAdded(breakpoint: Breakpoint, uiLocation: Workspace.UISourceCode.UILocation): void {
266
- let breakpoints = this.breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
265
+ let breakpoints = this.#breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
267
266
  if (!breakpoints) {
268
267
  breakpoints = new Map();
269
- this.breakpointsForUISourceCode.set(uiLocation.uiSourceCode, breakpoints);
268
+ this.#breakpointsForUISourceCode.set(uiLocation.uiSourceCode, breakpoints);
270
269
  }
271
270
  const breakpointLocation = {breakpoint: breakpoint, uiLocation: uiLocation};
272
271
  breakpoints.set(uiLocation.id(), breakpointLocation);
@@ -274,7 +273,7 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
274
273
  }
275
274
 
276
275
  uiLocationRemoved(breakpoint: Breakpoint, uiLocation: Workspace.UISourceCode.UILocation): void {
277
- const breakpoints = this.breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
276
+ const breakpoints = this.#breakpointsForUISourceCode.get(uiLocation.uiSourceCode);
278
277
  if (!breakpoints) {
279
278
  return;
280
279
  }
@@ -284,7 +283,7 @@ export class BreakpointManager extends Common.ObjectWrapper.ObjectWrapper<EventT
284
283
  }
285
284
  breakpoints.delete(uiLocation.id());
286
285
  if (breakpoints.size === 0) {
287
- this.breakpointsForUISourceCode.delete(uiLocation.uiSourceCode);
286
+ this.#breakpointsForUISourceCode.delete(uiLocation.uiSourceCode);
288
287
  }
289
288
  this.dispatchEventToListeners(Events.BreakpointRemoved, {breakpoint: breakpoint, uiLocation: uiLocation});
290
289
  }
@@ -305,30 +304,30 @@ export type EventTypes = {
305
304
  export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.DebuggerModel.DebuggerModel> {
306
305
  readonly breakpointManager: BreakpointManager;
307
306
  urlInternal: string;
308
- private readonly lineNumberInternal: number;
309
- private readonly columnNumberInternal: number|undefined;
310
- private readonly uiLocations: Set<Workspace.UISourceCode.UILocation>;
307
+ readonly #lineNumberInternal: number;
308
+ readonly #columnNumberInternal: number|undefined;
309
+ readonly #uiLocations: Set<Workspace.UISourceCode.UILocation>;
311
310
  uiSourceCodes: Set<Workspace.UISourceCode.UISourceCode>;
312
- private conditionInternal!: string;
313
- private enabledInternal!: boolean;
311
+ #conditionInternal!: string;
312
+ #enabledInternal!: boolean;
314
313
  isRemoved!: boolean;
315
314
  currentState: Breakpoint.State|null;
316
- private readonly modelBreakpoints: Map<SDK.DebuggerModel.DebuggerModel, ModelBreakpoint>;
315
+ readonly #modelBreakpoints: Map<SDK.DebuggerModel.DebuggerModel, ModelBreakpoint>;
317
316
 
318
317
  constructor(
319
318
  breakpointManager: BreakpointManager, primaryUISourceCode: Workspace.UISourceCode.UISourceCode, url: string,
320
319
  lineNumber: number, columnNumber: number|undefined, condition: string, enabled: boolean) {
321
320
  this.breakpointManager = breakpointManager;
322
321
  this.urlInternal = url;
323
- this.lineNumberInternal = lineNumber;
324
- this.columnNumberInternal = columnNumber;
322
+ this.#lineNumberInternal = lineNumber;
323
+ this.#columnNumberInternal = columnNumber;
325
324
 
326
- this.uiLocations = new Set(); // Bound locations
325
+ this.#uiLocations = new Set(); // Bound locations
327
326
  this.uiSourceCodes = new Set(); // All known UISourceCodes with this url
328
327
 
329
328
  this.currentState = null;
330
329
 
331
- this.modelBreakpoints = new Map();
330
+ this.#modelBreakpoints = new Map();
332
331
  this.updateState(condition, enabled);
333
332
  this.addUISourceCode(primaryUISourceCode);
334
333
  this.breakpointManager.targetManager.observeModels(SDK.DebuggerModel.DebuggerModel, this);
@@ -336,19 +335,19 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
336
335
 
337
336
  async refreshInDebugger(): Promise<void> {
338
337
  if (!this.isRemoved) {
339
- const breakpoints = Array.from(this.modelBreakpoints.values());
338
+ const breakpoints = Array.from(this.#modelBreakpoints.values());
340
339
  await Promise.all(breakpoints.map(breakpoint => breakpoint.refreshBreakpoint()));
341
340
  }
342
341
  }
343
342
 
344
343
  modelAdded(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
345
344
  const debuggerWorkspaceBinding = this.breakpointManager.debuggerWorkspaceBinding;
346
- this.modelBreakpoints.set(debuggerModel, new ModelBreakpoint(debuggerModel, this, debuggerWorkspaceBinding));
345
+ this.#modelBreakpoints.set(debuggerModel, new ModelBreakpoint(debuggerModel, this, debuggerWorkspaceBinding));
347
346
  }
348
347
 
349
348
  modelRemoved(debuggerModel: SDK.DebuggerModel.DebuggerModel): void {
350
- const modelBreakpoint = this.modelBreakpoints.get(debuggerModel);
351
- this.modelBreakpoints.delete(debuggerModel);
349
+ const modelBreakpoint = this.#modelBreakpoints.get(debuggerModel);
350
+ this.#modelBreakpoints.delete(debuggerModel);
352
351
 
353
352
  if (!modelBreakpoint) {
354
353
  return;
@@ -383,9 +382,9 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
383
382
 
384
383
  // Do we need to do this? Not sure if bound locations will leak...
385
384
  if (this.bound()) {
386
- for (const uiLocation of this.uiLocations) {
385
+ for (const uiLocation of this.#uiLocations) {
387
386
  if (uiLocation.uiSourceCode === uiSourceCode) {
388
- this.uiLocations.delete(uiLocation);
387
+ this.#uiLocations.delete(uiLocation);
389
388
  this.breakpointManager.uiLocationRemoved(this, uiLocation);
390
389
  }
391
390
  }
@@ -402,11 +401,11 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
402
401
  }
403
402
 
404
403
  lineNumber(): number {
405
- return this.lineNumberInternal;
404
+ return this.#lineNumberInternal;
406
405
  }
407
406
 
408
407
  columnNumber(): number|undefined {
409
- return this.columnNumberInternal;
408
+ return this.#columnNumberInternal;
410
409
  }
411
410
 
412
411
  uiLocationAdded(uiLocation: Workspace.UISourceCode.UILocation): void {
@@ -417,13 +416,13 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
417
416
  // This is our first bound location; remove all unbound locations
418
417
  this.removeAllUnboundLocations();
419
418
  }
420
- this.uiLocations.add(uiLocation);
419
+ this.#uiLocations.add(uiLocation);
421
420
  this.breakpointManager.uiLocationAdded(this, uiLocation);
422
421
  }
423
422
 
424
423
  uiLocationRemoved(uiLocation: Workspace.UISourceCode.UILocation): void {
425
- if (this.uiLocations.has(uiLocation)) {
426
- this.uiLocations.delete(uiLocation);
424
+ if (this.#uiLocations.has(uiLocation)) {
425
+ this.#uiLocations.delete(uiLocation);
427
426
  this.breakpointManager.uiLocationRemoved(this, uiLocation);
428
427
  if (!this.bound() && !this.isRemoved) {
429
428
  this.addAllUnboundLocations();
@@ -432,11 +431,11 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
432
431
  }
433
432
 
434
433
  enabled(): boolean {
435
- return this.enabledInternal;
434
+ return this.#enabledInternal;
436
435
  }
437
436
 
438
437
  bound(): boolean {
439
- return this.uiLocations.size !== 0;
438
+ return this.#uiLocations.size !== 0;
440
439
  }
441
440
 
442
441
  hasBoundScript(): boolean {
@@ -449,23 +448,23 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
449
448
  }
450
449
 
451
450
  setEnabled(enabled: boolean): void {
452
- this.updateState(this.conditionInternal, enabled);
451
+ this.updateState(this.#conditionInternal, enabled);
453
452
  }
454
453
 
455
454
  condition(): string {
456
- return this.conditionInternal;
455
+ return this.#conditionInternal;
457
456
  }
458
457
 
459
458
  setCondition(condition: string): void {
460
- this.updateState(condition, this.enabledInternal);
459
+ this.updateState(condition, this.#enabledInternal);
461
460
  }
462
461
 
463
462
  updateState(condition: string, enabled: boolean): void {
464
- if (this.enabledInternal === enabled && this.conditionInternal === condition) {
463
+ if (this.#enabledInternal === enabled && this.#conditionInternal === condition) {
465
464
  return;
466
465
  }
467
- this.enabledInternal = enabled;
468
- this.conditionInternal = condition;
466
+ this.#enabledInternal = enabled;
467
+ this.#conditionInternal = condition;
469
468
  this.breakpointManager.storage.updateBreakpoint(this);
470
469
  this.updateBreakpoint();
471
470
  }
@@ -477,7 +476,7 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
477
476
  this.addAllUnboundLocations();
478
477
  }
479
478
  }
480
- for (const modelBreakpoint of this.modelBreakpoints.values()) {
479
+ for (const modelBreakpoint of this.#modelBreakpoints.values()) {
481
480
  modelBreakpoint.scheduleUpdateInDebugger();
482
481
  }
483
482
  }
@@ -485,7 +484,7 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
485
484
  remove(keepInStorage: boolean): void {
486
485
  this.isRemoved = true;
487
486
  const removeFromStorage = !keepInStorage;
488
- for (const modelBreakpoint of this.modelBreakpoints.values()) {
487
+ for (const modelBreakpoint of this.#modelBreakpoints.values()) {
489
488
  modelBreakpoint.scheduleUpdateInDebugger();
490
489
  modelBreakpoint.removeEventListeners();
491
490
  }
@@ -496,18 +495,19 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
496
495
  }
497
496
 
498
497
  breakpointStorageId(): string {
499
- return BreakpointManager.breakpointStorageId(this.urlInternal, this.lineNumberInternal, this.columnNumberInternal);
498
+ return BreakpointManager.breakpointStorageId(
499
+ this.urlInternal, this.#lineNumberInternal, this.#columnNumberInternal);
500
500
  }
501
501
 
502
502
  private resetLocations(): void {
503
503
  this.clearUISourceCodes();
504
- for (const modelBreakpoint of this.modelBreakpoints.values()) {
504
+ for (const modelBreakpoint of this.#modelBreakpoints.values()) {
505
505
  modelBreakpoint.resetLocations();
506
506
  }
507
507
  }
508
508
 
509
509
  private defaultUILocation(uiSourceCode: Workspace.UISourceCode.UISourceCode): Workspace.UISourceCode.UILocation {
510
- return uiSourceCode.uiLocation(this.lineNumberInternal, this.columnNumberInternal);
510
+ return uiSourceCode.uiLocation(this.#lineNumberInternal, this.#columnNumberInternal);
511
511
  }
512
512
 
513
513
  private removeAllUnboundLocations(): void {
@@ -532,69 +532,69 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
532
532
  }
533
533
 
534
534
  export class ModelBreakpoint {
535
- private debuggerModel: SDK.DebuggerModel.DebuggerModel;
536
- private breakpoint: Breakpoint;
537
- private readonly debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
538
- private readonly liveLocations: LiveLocationPool;
539
- private readonly uiLocations: Map<LiveLocation, Workspace.UISourceCode.UILocation>;
540
- private hasPendingUpdate: boolean;
541
- private isUpdating: boolean;
542
- private cancelCallback: boolean;
543
- private currentState: Breakpoint.State|null;
544
- private breakpointIds: Protocol.Debugger.BreakpointId[];
535
+ #debuggerModel: SDK.DebuggerModel.DebuggerModel;
536
+ #breakpoint: Breakpoint;
537
+ readonly #debuggerWorkspaceBinding: DebuggerWorkspaceBinding;
538
+ readonly #liveLocations: LiveLocationPool;
539
+ readonly #uiLocations: Map<LiveLocation, Workspace.UISourceCode.UILocation>;
540
+ #hasPendingUpdate: boolean;
541
+ #isUpdating: boolean;
542
+ #cancelCallback: boolean;
543
+ #currentState: Breakpoint.State|null;
544
+ #breakpointIds: Protocol.Debugger.BreakpointId[];
545
545
 
546
546
  constructor(
547
547
  debuggerModel: SDK.DebuggerModel.DebuggerModel, breakpoint: Breakpoint,
548
548
  debuggerWorkspaceBinding: DebuggerWorkspaceBinding) {
549
- this.debuggerModel = debuggerModel;
550
- this.breakpoint = breakpoint;
551
- this.debuggerWorkspaceBinding = debuggerWorkspaceBinding;
549
+ this.#debuggerModel = debuggerModel;
550
+ this.#breakpoint = breakpoint;
551
+ this.#debuggerWorkspaceBinding = debuggerWorkspaceBinding;
552
552
 
553
- this.liveLocations = new LiveLocationPool();
553
+ this.#liveLocations = new LiveLocationPool();
554
554
 
555
- this.uiLocations = new Map();
556
- this.debuggerModel.addEventListener(
555
+ this.#uiLocations = new Map();
556
+ this.#debuggerModel.addEventListener(
557
557
  SDK.DebuggerModel.Events.DebuggerWasDisabled, this.cleanUpAfterDebuggerIsGone, this);
558
- this.debuggerModel.addEventListener(
558
+ this.#debuggerModel.addEventListener(
559
559
  SDK.DebuggerModel.Events.DebuggerWasEnabled, this.scheduleUpdateInDebugger, this);
560
- this.hasPendingUpdate = false;
561
- this.isUpdating = false;
562
- this.cancelCallback = false;
563
- this.currentState = null;
564
- this.breakpointIds = [];
565
- if (this.debuggerModel.debuggerEnabled()) {
560
+ this.#hasPendingUpdate = false;
561
+ this.#isUpdating = false;
562
+ this.#cancelCallback = false;
563
+ this.#currentState = null;
564
+ this.#breakpointIds = [];
565
+ if (this.#debuggerModel.debuggerEnabled()) {
566
566
  this.scheduleUpdateInDebugger();
567
567
  }
568
568
  }
569
569
 
570
570
  resetLocations(): void {
571
- for (const uiLocation of this.uiLocations.values()) {
572
- this.breakpoint.uiLocationRemoved(uiLocation);
571
+ for (const uiLocation of this.#uiLocations.values()) {
572
+ this.#breakpoint.uiLocationRemoved(uiLocation);
573
573
  }
574
574
 
575
- this.uiLocations.clear();
576
- this.liveLocations.disposeAll();
575
+ this.#uiLocations.clear();
576
+ this.#liveLocations.disposeAll();
577
577
  }
578
578
 
579
579
  scheduleUpdateInDebugger(): void {
580
- if (this.isUpdating) {
581
- this.hasPendingUpdate = true;
580
+ if (this.#isUpdating) {
581
+ this.#hasPendingUpdate = true;
582
582
  return;
583
583
  }
584
584
 
585
- this.isUpdating = true;
585
+ this.#isUpdating = true;
586
586
  this.updateInDebugger().then(() => {
587
- this.isUpdating = false;
588
- if (this.hasPendingUpdate) {
589
- this.hasPendingUpdate = false;
587
+ this.#isUpdating = false;
588
+ if (this.#hasPendingUpdate) {
589
+ this.#hasPendingUpdate = false;
590
590
  this.scheduleUpdateInDebugger();
591
591
  }
592
592
  });
593
593
  }
594
594
 
595
595
  private scriptDiverged(): boolean {
596
- for (const uiSourceCode of this.breakpoint.getUiSourceCodes()) {
597
- const scriptFile = this.debuggerWorkspaceBinding.scriptFile(uiSourceCode, this.debuggerModel);
596
+ for (const uiSourceCode of this.#breakpoint.getUiSourceCodes()) {
597
+ const scriptFile = this.#debuggerWorkspaceBinding.scriptFile(uiSourceCode, this.#debuggerModel);
598
598
  if (scriptFile && scriptFile.hasDivergedFromVM()) {
599
599
  return true;
600
600
  }
@@ -603,22 +603,22 @@ export class ModelBreakpoint {
603
603
  }
604
604
 
605
605
  private async updateInDebugger(): Promise<void> {
606
- if (this.debuggerModel.target().isDisposed()) {
606
+ if (this.#debuggerModel.target().isDisposed()) {
607
607
  this.cleanUpAfterDebuggerIsGone();
608
608
  return;
609
609
  }
610
610
 
611
- const lineNumber = this.breakpoint.lineNumber();
612
- const columnNumber = this.breakpoint.columnNumber();
613
- const condition = this.breakpoint.condition();
611
+ const lineNumber = this.#breakpoint.lineNumber();
612
+ const columnNumber = this.#breakpoint.columnNumber();
613
+ const condition = this.#breakpoint.condition();
614
614
 
615
615
  let newState: Breakpoint.State|null = null;
616
- if (!this.breakpoint.getIsRemoved() && this.breakpoint.enabled() && !this.scriptDiverged()) {
616
+ if (!this.#breakpoint.getIsRemoved() && this.#breakpoint.enabled() && !this.scriptDiverged()) {
617
617
  let debuggerLocations: SDK.DebuggerModel.Location[] = [];
618
- for (const uiSourceCode of this.breakpoint.getUiSourceCodes()) {
618
+ for (const uiSourceCode of this.#breakpoint.getUiSourceCodes()) {
619
619
  const locations =
620
620
  await DebuggerWorkspaceBinding.instance().uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber);
621
- debuggerLocations = locations.filter(location => location.debuggerModel === this.debuggerModel);
621
+ debuggerLocations = locations.filter(location => location.debuggerModel === this.#debuggerModel);
622
622
  if (debuggerLocations.length) {
623
623
  break;
624
624
  }
@@ -635,14 +635,14 @@ export class ModelBreakpoint {
635
635
  };
636
636
  });
637
637
  newState = new Breakpoint.State(positions, condition);
638
- } else if (this.breakpoint.currentState) {
639
- newState = new Breakpoint.State(this.breakpoint.currentState.positions, condition);
638
+ } else if (this.#breakpoint.currentState) {
639
+ newState = new Breakpoint.State(this.#breakpoint.currentState.positions, condition);
640
640
  } else {
641
641
  // TODO(bmeurer): This fallback doesn't make a whole lot of sense, we should
642
- // at least signal a warning to the developer that this breakpoint wasn't
642
+ // at least signal a warning to the developer that this #breakpoint wasn't
643
643
  // really resolved.
644
644
  const position = {
645
- url: this.breakpoint.url(),
645
+ url: this.#breakpoint.url(),
646
646
  scriptId: '' as Protocol.Runtime.ScriptId,
647
647
  scriptHash: '',
648
648
  lineNumber,
@@ -652,12 +652,12 @@ export class ModelBreakpoint {
652
652
  }
653
653
  }
654
654
 
655
- if (this.breakpointIds.length && Breakpoint.State.equals(newState, this.currentState)) {
655
+ if (this.#breakpointIds.length && Breakpoint.State.equals(newState, this.#currentState)) {
656
656
  return;
657
657
  }
658
- this.breakpoint.currentState = newState;
658
+ this.#breakpoint.currentState = newState;
659
659
 
660
- if (this.breakpointIds.length) {
660
+ if (this.#breakpointIds.length) {
661
661
  await this.refreshBreakpoint();
662
662
  return;
663
663
  }
@@ -668,9 +668,9 @@ export class ModelBreakpoint {
668
668
 
669
669
  const results = await Promise.all(newState.positions.map(pos => {
670
670
  if (pos.url) {
671
- return this.debuggerModel.setBreakpointByURL(pos.url, pos.lineNumber, pos.columnNumber, condition);
671
+ return this.#debuggerModel.setBreakpointByURL(pos.url, pos.lineNumber, pos.columnNumber, condition);
672
672
  }
673
- return this.debuggerModel.setBreakpointInAnonymousScript(
673
+ return this.#debuggerModel.setBreakpointInAnonymousScript(
674
674
  pos.scriptId, pos.scriptHash as string, pos.lineNumber, pos.columnNumber, condition);
675
675
  }));
676
676
  const breakpointIds: Protocol.Debugger.BreakpointId[] = [];
@@ -680,13 +680,13 @@ export class ModelBreakpoint {
680
680
  if (result.breakpointId) {
681
681
  breakpointIds.push(result.breakpointId);
682
682
  locations = locations.concat(result.locations);
683
- } else if (this.debuggerModel.debuggerEnabled() && !this.debuggerModel.isReadyToPause()) {
683
+ } else if (this.#debuggerModel.debuggerEnabled() && !this.#debuggerModel.isReadyToPause()) {
684
684
  maybeRescheduleUpdate = true;
685
685
  }
686
686
  }
687
687
 
688
688
  if (!breakpointIds.length && maybeRescheduleUpdate) {
689
- // TODO(crbug.com/1229541): This is a quickfix to prevent breakpoints from
689
+ // TODO(crbug.com/1229541): This is a quickfix to prevent #breakpoints from
690
690
  // disappearing if the Debugger is actually not enabled
691
691
  // yet. This quickfix should be removed as soon as we have a solution
692
692
  // to correctly synchronize the front-end with the inspector back-end.
@@ -694,44 +694,44 @@ export class ModelBreakpoint {
694
694
  return;
695
695
  }
696
696
 
697
- this.currentState = newState;
698
- if (this.cancelCallback) {
699
- this.cancelCallback = false;
697
+ this.#currentState = newState;
698
+ if (this.#cancelCallback) {
699
+ this.#cancelCallback = false;
700
700
  return;
701
701
  }
702
702
 
703
703
  if (!breakpointIds.length) {
704
- this.breakpoint.remove(true);
704
+ this.#breakpoint.remove(true);
705
705
  return;
706
706
  }
707
707
 
708
- this.breakpointIds = breakpointIds;
709
- this.breakpointIds.forEach(
710
- breakpointId => this.debuggerModel.addBreakpointListener(breakpointId, this.breakpointResolved, this));
708
+ this.#breakpointIds = breakpointIds;
709
+ this.#breakpointIds.forEach(
710
+ breakpointId => this.#debuggerModel.addBreakpointListener(breakpointId, this.breakpointResolved, this));
711
711
  await Promise.all(locations.map(location => this.addResolvedLocation(location)));
712
712
  }
713
713
 
714
714
  async refreshBreakpoint(): Promise<void> {
715
- if (!this.breakpointIds.length) {
715
+ if (!this.#breakpointIds.length) {
716
716
  return;
717
717
  }
718
718
  this.resetLocations();
719
- await Promise.all(this.breakpointIds.map(id => this.debuggerModel.removeBreakpoint(id)));
719
+ await Promise.all(this.#breakpointIds.map(id => this.#debuggerModel.removeBreakpoint(id)));
720
720
  this.didRemoveFromDebugger();
721
- this.currentState = null;
721
+ this.#currentState = null;
722
722
  this.scheduleUpdateInDebugger();
723
723
  }
724
724
 
725
725
  private didRemoveFromDebugger(): void {
726
- if (this.cancelCallback) {
727
- this.cancelCallback = false;
726
+ if (this.#cancelCallback) {
727
+ this.#cancelCallback = false;
728
728
  return;
729
729
  }
730
730
 
731
731
  this.resetLocations();
732
- this.breakpointIds.forEach(
733
- breakpointId => this.debuggerModel.removeBreakpointListener(breakpointId, this.breakpointResolved, this));
734
- this.breakpointIds = [];
732
+ this.#breakpointIds.forEach(
733
+ breakpointId => this.#debuggerModel.removeBreakpointListener(breakpointId, this.breakpointResolved, this));
734
+ this.#breakpointIds = [];
735
735
  }
736
736
 
737
737
  private async breakpointResolved({data: location}: Common.EventTarget.EventTargetEvent<SDK.DebuggerModel.Location>):
@@ -740,52 +740,52 @@ export class ModelBreakpoint {
740
740
  }
741
741
 
742
742
  private async locationUpdated(liveLocation: LiveLocation): Promise<void> {
743
- const oldUILocation = this.uiLocations.get(liveLocation);
743
+ const oldUILocation = this.#uiLocations.get(liveLocation);
744
744
  const uiLocation = await liveLocation.uiLocation();
745
745
 
746
746
  if (oldUILocation) {
747
- this.breakpoint.uiLocationRemoved(oldUILocation);
747
+ this.#breakpoint.uiLocationRemoved(oldUILocation);
748
748
  }
749
749
 
750
750
  if (uiLocation) {
751
- this.uiLocations.set(liveLocation, uiLocation);
752
- this.breakpoint.uiLocationAdded(uiLocation);
751
+ this.#uiLocations.set(liveLocation, uiLocation);
752
+ this.#breakpoint.uiLocationAdded(uiLocation);
753
753
  } else {
754
- this.uiLocations.delete(liveLocation);
754
+ this.#uiLocations.delete(liveLocation);
755
755
  }
756
756
  }
757
757
 
758
758
  private async addResolvedLocation(location: SDK.DebuggerModel.Location): Promise<void> {
759
- const uiLocation = await this.debuggerWorkspaceBinding.rawLocationToUILocation(location);
759
+ const uiLocation = await this.#debuggerWorkspaceBinding.rawLocationToUILocation(location);
760
760
  if (!uiLocation) {
761
761
  return;
762
762
  }
763
- const breakpointLocation = this.breakpoint.breakpointManager.findBreakpoint(uiLocation);
764
- if (breakpointLocation && breakpointLocation.breakpoint !== this.breakpoint) {
763
+ const breakpointLocation = this.#breakpoint.breakpointManager.findBreakpoint(uiLocation);
764
+ if (breakpointLocation && breakpointLocation.breakpoint !== this.#breakpoint) {
765
765
  // location clash
766
- this.breakpoint.remove(false /* keepInStorage */);
766
+ this.#breakpoint.remove(false /* keepInStorage */);
767
767
  return;
768
768
  }
769
- await this.debuggerWorkspaceBinding.createLiveLocation(
770
- location, this.locationUpdated.bind(this), this.liveLocations);
769
+ await this.#debuggerWorkspaceBinding.createLiveLocation(
770
+ location, this.locationUpdated.bind(this), this.#liveLocations);
771
771
  }
772
772
 
773
773
  cleanUpAfterDebuggerIsGone(): void {
774
- if (this.isUpdating) {
775
- this.cancelCallback = true;
774
+ if (this.#isUpdating) {
775
+ this.#cancelCallback = true;
776
776
  }
777
777
 
778
778
  this.resetLocations();
779
- this.currentState = null;
780
- if (this.breakpointIds.length) {
779
+ this.#currentState = null;
780
+ if (this.#breakpointIds.length) {
781
781
  this.didRemoveFromDebugger();
782
782
  }
783
783
  }
784
784
 
785
785
  removeEventListeners(): void {
786
- this.debuggerModel.removeEventListener(
786
+ this.#debuggerModel.removeEventListener(
787
787
  SDK.DebuggerModel.Events.DebuggerWasDisabled, this.cleanUpAfterDebuggerIsGone, this);
788
- this.debuggerModel.removeEventListener(
788
+ this.#debuggerModel.removeEventListener(
789
789
  SDK.DebuggerModel.Events.DebuggerWasEnabled, this.scheduleUpdateInDebugger, this);
790
790
  }
791
791
  }
@@ -843,48 +843,52 @@ export namespace Breakpoint {
843
843
  }
844
844
 
845
845
  class Storage {
846
- private readonly setting: Common.Settings.Setting<Storage.Item[]>;
847
- private readonly breakpoints: Map<string, Storage.Item>;
848
- private muted!: boolean|undefined;
846
+ readonly #setting: Common.Settings.Setting<Storage.Item[]>;
847
+ readonly #breakpoints: Map<string, Storage.Item>;
848
+ #muted!: boolean|undefined;
849
849
 
850
850
  constructor() {
851
- this.setting = Common.Settings.Settings.instance().createLocalSetting('breakpoints', []);
852
- this.breakpoints = new Map();
853
- const items = (this.setting.get() as Storage.Item[]);
851
+ this.#setting = Common.Settings.Settings.instance().createLocalSetting('breakpoints', []);
852
+ this.#breakpoints = new Map();
853
+ const items = (this.#setting.get() as Storage.Item[]);
854
854
  for (const item of items) {
855
- this.breakpoints.set(BreakpointManager.breakpointStorageId(item.url, item.lineNumber, item.columnNumber), item);
855
+ this.#breakpoints.set(BreakpointManager.breakpointStorageId(item.url, item.lineNumber, item.columnNumber), item);
856
856
  }
857
857
  }
858
858
 
859
+ get setting(): Common.Settings.Setting<Storage.Item[]> {
860
+ return this.#setting;
861
+ }
862
+
859
863
  mute(): void {
860
- this.muted = true;
864
+ this.#muted = true;
861
865
  }
862
866
 
863
867
  unmute(): void {
864
- delete this.muted;
868
+ this.#muted = undefined;
865
869
  }
866
870
 
867
871
  breakpointItems(url: string): Storage.Item[] {
868
- return Array.from(this.breakpoints.values()).filter(item => item.url === url);
872
+ return Array.from(this.#breakpoints.values()).filter(item => item.url === url);
869
873
  }
870
874
 
871
875
  updateBreakpoint(breakpoint: Breakpoint): void {
872
- if (this.muted || !breakpoint.breakpointStorageId()) {
876
+ if (this.#muted || !breakpoint.breakpointStorageId()) {
873
877
  return;
874
878
  }
875
- this.breakpoints.set(breakpoint.breakpointStorageId(), new Storage.Item(breakpoint));
879
+ this.#breakpoints.set(breakpoint.breakpointStorageId(), new Storage.Item(breakpoint));
876
880
  this.save();
877
881
  }
878
882
 
879
883
  removeBreakpoint(breakpoint: Breakpoint): void {
880
- if (!this.muted) {
881
- this.breakpoints.delete(breakpoint.breakpointStorageId());
884
+ if (!this.#muted) {
885
+ this.#breakpoints.delete(breakpoint.breakpointStorageId());
882
886
  this.save();
883
887
  }
884
888
  }
885
889
 
886
890
  private save(): void {
887
- this.setting.set(Array.from(this.breakpoints.values()));
891
+ this.#setting.set(Array.from(this.#breakpoints.values()));
888
892
  }
889
893
  }
890
894