chrome-devtools-frontend 1.0.927127 → 1.0.928589

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 (144) hide show
  1. package/AUTHORS +1 -0
  2. package/config/gni/all_devtools_files.gni +0 -1
  3. package/config/gni/devtools_grd_files.gni +30 -4
  4. package/config/gni/devtools_image_files.gni +1 -0
  5. package/front_end/Images/src/ic_preview_feature.svg +3 -0
  6. package/front_end/Tests.js +2 -3
  7. package/front_end/core/common/Settings.ts +26 -45
  8. package/front_end/core/host/UserMetrics.ts +2 -2
  9. package/front_end/core/i18n/locales/en-US.json +60 -15
  10. package/front_end/core/i18n/locales/en-XL.json +60 -15
  11. package/front_end/core/platform/keyboard-utilities.ts +1 -0
  12. package/front_end/core/root/Runtime.ts +62 -61
  13. package/front_end/core/sdk/AccessibilityModel.ts +73 -73
  14. package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
  15. package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
  16. package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
  17. package/front_end/core/sdk/CSSFontFace.ts +10 -10
  18. package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
  19. package/front_end/core/sdk/CSSMedia.ts +22 -22
  20. package/front_end/core/sdk/CSSMetadata.ts +53 -49
  21. package/front_end/core/sdk/CSSModel.ts +139 -135
  22. package/front_end/core/sdk/CSSProperty.ts +18 -18
  23. package/front_end/core/sdk/CSSRule.ts +15 -15
  24. package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
  25. package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
  26. package/front_end/core/sdk/ChildTargetManager.ts +41 -40
  27. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
  28. package/front_end/core/sdk/Connections.ts +81 -81
  29. package/front_end/core/sdk/ConsoleModel.ts +68 -68
  30. package/front_end/core/sdk/Cookie.ts +48 -48
  31. package/front_end/core/sdk/CookieModel.ts +13 -13
  32. package/front_end/core/sdk/CookieParser.ts +45 -45
  33. package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
  34. package/front_end/core/sdk/DOMModel.ts +264 -252
  35. package/front_end/core/sdk/DebuggerModel.ts +209 -205
  36. package/front_end/core/sdk/EmulationModel.ts +76 -76
  37. package/front_end/core/sdk/FilmStripModel.ts +29 -29
  38. package/front_end/core/sdk/FrameManager.ts +43 -42
  39. package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
  40. package/front_end/core/sdk/IsolateManager.ts +82 -82
  41. package/front_end/core/sdk/IssuesModel.ts +6 -6
  42. package/front_end/core/sdk/LayerTreeBase.ts +37 -37
  43. package/front_end/core/sdk/LogModel.ts +5 -5
  44. package/front_end/core/sdk/NetworkManager.ts +229 -225
  45. package/front_end/core/sdk/NetworkRequest.ts +368 -360
  46. package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
  47. package/front_end/core/sdk/OverlayModel.ts +155 -153
  48. package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
  49. package/front_end/core/sdk/PageResourceLoader.ts +30 -30
  50. package/front_end/core/sdk/PaintProfiler.ts +16 -16
  51. package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
  52. package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
  53. package/front_end/core/sdk/RemoteObject.ts +108 -104
  54. package/front_end/core/sdk/Resource.ts +85 -84
  55. package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
  56. package/front_end/core/sdk/RuntimeModel.ts +38 -34
  57. package/front_end/core/sdk/SDKModel.ts +3 -3
  58. package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
  59. package/front_end/core/sdk/Script.ts +29 -29
  60. package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
  61. package/front_end/core/sdk/ServerTiming.ts +2 -2
  62. package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
  63. package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
  64. package/front_end/core/sdk/SourceMap.ts +40 -36
  65. package/front_end/core/sdk/SourceMapManager.ts +57 -57
  66. package/front_end/core/sdk/Target.ts +64 -63
  67. package/front_end/core/sdk/TargetManager.ts +60 -56
  68. package/front_end/core/sdk/TracingManager.ts +39 -39
  69. package/front_end/core/sdk/TracingModel.ts +125 -125
  70. package/front_end/core/sdk/WebAuthnModel.ts +9 -9
  71. package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
  72. package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
  73. package/front_end/entrypoints/main/MainImpl.ts +7 -2
  74. package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
  75. package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
  76. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
  77. package/front_end/models/issues_manager/GenericIssue.ts +86 -0
  78. package/front_end/models/issues_manager/Issue.ts +24 -0
  79. package/front_end/models/issues_manager/IssuesManager.ts +18 -6
  80. package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
  81. package/front_end/models/issues_manager/issues_manager.ts +2 -0
  82. package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
  83. package/front_end/panels/console/ConsoleSidebar.ts +0 -3
  84. package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
  85. package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
  86. package/front_end/panels/elements/components/LayoutPane.ts +5 -1
  87. package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
  88. package/front_end/panels/issues/IssueAggregator.ts +16 -0
  89. package/front_end/panels/issues/IssueKindView.ts +95 -0
  90. package/front_end/panels/issues/IssueView.ts +6 -0
  91. package/front_end/panels/issues/IssuesPane.ts +81 -18
  92. package/front_end/panels/issues/issuesTree.css +8 -3
  93. package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
  94. package/front_end/panels/network/NetworkItemView.ts +1 -1
  95. package/front_end/panels/network/networkLogView.css +5 -0
  96. package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
  97. package/front_end/panels/settings/SettingsScreen.ts +1 -0
  98. package/front_end/panels/settings/settingsScreen.css +24 -0
  99. package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
  100. package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
  101. package/front_end/panels/sources/sources-meta.ts +22 -7
  102. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  103. package/front_end/third_party/codemirror.next/package.json +4 -4
  104. package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
  105. package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
  106. package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
  107. package/front_end/ui/components/docs/text_editor/basic.html +28 -0
  108. package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
  109. package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
  110. package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
  111. package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
  112. package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
  113. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
  114. package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
  115. package/front_end/ui/components/text_editor/config.ts +264 -0
  116. package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
  117. package/front_end/ui/components/text_editor/theme.ts +113 -0
  118. package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
  119. package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
  120. package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
  121. package/front_end/ui/legacy/ARIAUtils.ts +14 -11
  122. package/front_end/ui/legacy/TabbedPane.ts +32 -3
  123. package/front_end/ui/legacy/UIUtils.ts +3 -1
  124. package/front_end/ui/legacy/View.ts +6 -0
  125. package/front_end/ui/legacy/ViewManager.ts +5 -1
  126. package/front_end/ui/legacy/ViewRegistration.ts +5 -0
  127. package/front_end/ui/legacy/XLink.ts +1 -1
  128. package/front_end/ui/legacy/closeButton.css +6 -0
  129. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
  130. package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
  131. package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
  132. package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
  133. package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
  134. package/front_end/ui/legacy/filter.css +1 -0
  135. package/front_end/ui/legacy/tabbedPane.css +24 -0
  136. package/front_end/ui/legacy/toolbar.css +5 -0
  137. package/inspector_overlay/main.ts +2 -1
  138. package/inspector_overlay/tool_screenshot.ts +8 -1
  139. package/package.json +1 -1
  140. package/scripts/build/rollup.config.js +9 -0
  141. package/scripts/migration/class-fields/migrate.js +56 -0
  142. package/scripts/migration/class-fields/package.json +5 -0
  143. package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
  144. package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
@@ -25,47 +25,47 @@ const str_ = i18n.i18n.registerUIStrings('core/sdk/ServiceWorkerCacheModel.ts',
25
25
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
26
26
 
27
27
  export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements ProtocolProxyApi.StorageDispatcher {
28
- private readonly cachesInternal: Map<string, Cache>;
28
+ readonly #cachesInternal: Map<string, Cache>;
29
29
  readonly cacheAgent: ProtocolProxyApi.CacheStorageApi;
30
- private readonly storageAgent: ProtocolProxyApi.StorageApi;
31
- private readonly securityOriginManager: SecurityOriginManager;
32
- private readonly originsUpdated: Set<string>;
33
- private readonly throttler: Common.Throttler.Throttler;
34
- private enabled: boolean;
30
+ readonly #storageAgent: ProtocolProxyApi.StorageApi;
31
+ readonly #securityOriginManager: SecurityOriginManager;
32
+ readonly #originsUpdated: Set<string>;
33
+ readonly #throttler: Common.Throttler.Throttler;
34
+ #enabled: boolean;
35
35
 
36
36
  /**
37
- * Invariant: This model can only be constructed on a ServiceWorker target.
37
+ * Invariant: This #model can only be constructed on a ServiceWorker target.
38
38
  */
39
39
  constructor(target: Target) {
40
40
  super(target);
41
41
  target.registerStorageDispatcher(this);
42
42
 
43
- this.cachesInternal = new Map();
43
+ this.#cachesInternal = new Map();
44
44
 
45
45
  this.cacheAgent = target.cacheStorageAgent();
46
- this.storageAgent = target.storageAgent();
47
- this.securityOriginManager = (target.model(SecurityOriginManager) as SecurityOriginManager);
46
+ this.#storageAgent = target.storageAgent();
47
+ this.#securityOriginManager = (target.model(SecurityOriginManager) as SecurityOriginManager);
48
48
 
49
- this.originsUpdated = new Set();
50
- this.throttler = new Common.Throttler.Throttler(2000);
49
+ this.#originsUpdated = new Set();
50
+ this.#throttler = new Common.Throttler.Throttler(2000);
51
51
 
52
- this.enabled = false;
52
+ this.#enabled = false;
53
53
  }
54
54
 
55
55
  enable(): void {
56
- if (this.enabled) {
56
+ if (this.#enabled) {
57
57
  return;
58
58
  }
59
59
 
60
- this.securityOriginManager.addEventListener(
60
+ this.#securityOriginManager.addEventListener(
61
61
  SecurityOriginManagerEvents.SecurityOriginAdded, this.securityOriginAdded, this);
62
- this.securityOriginManager.addEventListener(
62
+ this.#securityOriginManager.addEventListener(
63
63
  SecurityOriginManagerEvents.SecurityOriginRemoved, this.securityOriginRemoved, this);
64
64
 
65
- for (const securityOrigin of this.securityOriginManager.securityOrigins()) {
65
+ for (const securityOrigin of this.#securityOriginManager.securityOrigins()) {
66
66
  this.addOrigin(securityOrigin);
67
67
  }
68
- this.enabled = true;
68
+ this.#enabled = true;
69
69
  }
70
70
 
71
71
  clearForOrigin(origin: string): void {
@@ -74,11 +74,11 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
74
74
  }
75
75
 
76
76
  refreshCacheNames(): void {
77
- for (const cache of this.cachesInternal.values()) {
77
+ for (const cache of this.#cachesInternal.values()) {
78
78
  this.cacheRemoved(cache);
79
79
  }
80
- this.cachesInternal.clear();
81
- const securityOrigins = this.securityOriginManager.securityOrigins();
80
+ this.#cachesInternal.clear();
81
+ const securityOrigins = this.#securityOriginManager.securityOrigins();
82
82
  for (const securityOrigin of securityOrigins) {
83
83
  this.loadCacheNames(securityOrigin);
84
84
  }
@@ -90,7 +90,7 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
90
90
  console.error(`ServiceWorkerCacheAgent error deleting cache ${cache.toString()}: ${response.getError()}`);
91
91
  return;
92
92
  }
93
- this.cachesInternal.delete(cache.cacheId);
93
+ this.#cachesInternal.delete(cache.cacheId);
94
94
  this.cacheRemoved(cache);
95
95
  }
96
96
 
@@ -117,21 +117,21 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
117
117
 
118
118
  caches(): Cache[] {
119
119
  const caches = new Array();
120
- for (const cache of this.cachesInternal.values()) {
120
+ for (const cache of this.#cachesInternal.values()) {
121
121
  caches.push(cache);
122
122
  }
123
123
  return caches;
124
124
  }
125
125
 
126
126
  dispose(): void {
127
- for (const cache of this.cachesInternal.values()) {
127
+ for (const cache of this.#cachesInternal.values()) {
128
128
  this.cacheRemoved(cache);
129
129
  }
130
- this.cachesInternal.clear();
131
- if (this.enabled) {
132
- this.securityOriginManager.removeEventListener(
130
+ this.#cachesInternal.clear();
131
+ if (this.#enabled) {
132
+ this.#securityOriginManager.removeEventListener(
133
133
  SecurityOriginManagerEvents.SecurityOriginAdded, this.securityOriginAdded, this);
134
- this.securityOriginManager.removeEventListener(
134
+ this.#securityOriginManager.removeEventListener(
135
135
  SecurityOriginManagerEvents.SecurityOriginRemoved, this.securityOriginRemoved, this);
136
136
  }
137
137
  }
@@ -139,19 +139,19 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
139
139
  private addOrigin(securityOrigin: string): void {
140
140
  this.loadCacheNames(securityOrigin);
141
141
  if (this.isValidSecurityOrigin(securityOrigin)) {
142
- this.storageAgent.invoke_trackCacheStorageForOrigin({origin: securityOrigin});
142
+ this.#storageAgent.invoke_trackCacheStorageForOrigin({origin: securityOrigin});
143
143
  }
144
144
  }
145
145
 
146
146
  private removeOrigin(securityOrigin: string): void {
147
- for (const [opaqueId, cache] of this.cachesInternal.entries()) {
147
+ for (const [opaqueId, cache] of this.#cachesInternal.entries()) {
148
148
  if (cache.securityOrigin === securityOrigin) {
149
- this.cachesInternal.delete((opaqueId as string));
149
+ this.#cachesInternal.delete((opaqueId as string));
150
150
  this.cacheRemoved((cache as Cache));
151
151
  }
152
152
  }
153
153
  if (this.isValidSecurityOrigin(securityOrigin)) {
154
- this.storageAgent.invoke_untrackCacheStorageForOrigin({origin: securityOrigin});
154
+ this.#storageAgent.invoke_untrackCacheStorageForOrigin({origin: securityOrigin});
155
155
  }
156
156
  }
157
157
 
@@ -172,7 +172,7 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
172
172
  function deleteAndSaveOldCaches(this: ServiceWorkerCacheModel, cache: Cache): void {
173
173
  if (cache.securityOrigin === securityOrigin && !updatingCachesIds.has(cache.cacheId)) {
174
174
  oldCaches.set(cache.cacheId, cache);
175
- this.cachesInternal.delete(cache.cacheId);
175
+ this.#cachesInternal.delete(cache.cacheId);
176
176
  }
177
177
  }
178
178
 
@@ -183,13 +183,13 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
183
183
  for (const cacheJson of cachesJson) {
184
184
  const cache = new Cache(this, cacheJson.securityOrigin, cacheJson.cacheName, cacheJson.cacheId);
185
185
  updatingCachesIds.add(cache.cacheId);
186
- if (this.cachesInternal.has(cache.cacheId)) {
186
+ if (this.#cachesInternal.has(cache.cacheId)) {
187
187
  continue;
188
188
  }
189
189
  newCaches.set(cache.cacheId, cache);
190
- this.cachesInternal.set(cache.cacheId, cache);
190
+ this.#cachesInternal.set(cache.cacheId, cache);
191
191
  }
192
- this.cachesInternal.forEach(deleteAndSaveOldCaches, this);
192
+ this.#cachesInternal.forEach(deleteAndSaveOldCaches, this);
193
193
  newCaches.forEach(this.cacheAdded, this);
194
194
  oldCaches.forEach(this.cacheRemoved, this);
195
195
  }
@@ -234,11 +234,11 @@ export class ServiceWorkerCacheModel extends SDKModel<EventTypes> implements Pro
234
234
  }
235
235
 
236
236
  cacheStorageListUpdated({origin}: Protocol.Storage.CacheStorageListUpdatedEvent): void {
237
- this.originsUpdated.add(origin);
237
+ this.#originsUpdated.add(origin);
238
238
 
239
- this.throttler.schedule(() => {
240
- const promises = Array.from(this.originsUpdated, origin => this.loadCacheNames(origin));
241
- this.originsUpdated.clear();
239
+ this.#throttler.schedule(() => {
240
+ const promises = Array.from(this.#originsUpdated, origin => this.loadCacheNames(origin));
241
+ this.#originsUpdated.clear();
242
242
  return Promise.all(promises);
243
243
  });
244
244
  }
@@ -279,7 +279,7 @@ export type EventTypes = {
279
279
  };
280
280
 
281
281
  export class Cache {
282
- private readonly model: ServiceWorkerCacheModel;
282
+ readonly #model: ServiceWorkerCacheModel;
283
283
  securityOrigin: string;
284
284
  cacheName: string;
285
285
  cacheId: Protocol.CacheStorage.CacheId;
@@ -287,7 +287,7 @@ export class Cache {
287
287
  constructor(
288
288
  model: ServiceWorkerCacheModel, securityOrigin: string, cacheName: string,
289
289
  cacheId: Protocol.CacheStorage.CacheId) {
290
- this.model = model;
290
+ this.#model = model;
291
291
  this.securityOrigin = securityOrigin;
292
292
  this.cacheName = cacheName;
293
293
  this.cacheId = cacheId;
@@ -303,7 +303,7 @@ export class Cache {
303
303
 
304
304
  async requestCachedResponse(url: string, requestHeaders: NameValue[]):
305
305
  Promise<Protocol.CacheStorage.CachedResponse|null> {
306
- const response = await this.model.cacheAgent.invoke_requestCachedResponse(
306
+ const response = await this.#model.cacheAgent.invoke_requestCachedResponse(
307
307
  {cacheId: this.cacheId, requestURL: url, requestHeaders});
308
308
  if (response.getError()) {
309
309
  return null;
@@ -1,3 +1,7 @@
1
+ // Copyright 2021 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
1
5
  /*
2
6
  * Copyright (C) 2011 Google Inc. All rights reserved.
3
7
  *
@@ -11,7 +15,7 @@
11
15
  * copyright notice, this list of conditions and the following disclaimer
12
16
  * in the documentation and/or other materials provided with the
13
17
  * distribution.
14
- * * Neither the name of Google Inc. nor the names of its
18
+ * * Neither the #name of Google Inc. nor the names of its
15
19
  * contributors may be used to endorse or promote products derived from
16
20
  * this software without specific prior written permission.
17
21
  *
@@ -94,11 +98,11 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
94
98
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
95
99
 
96
100
  export class ServiceWorkerManager extends SDKModel<EventTypes> {
97
- private readonly lastAnonymousTargetId: number;
98
- private readonly agent: ProtocolProxyApi.ServiceWorkerApi;
99
- private readonly registrationsInternal: Map<string, ServiceWorkerRegistration>;
100
- private enabled: boolean;
101
- private readonly forceUpdateSetting: Common.Settings.Setting<boolean>;
101
+ readonly #lastAnonymousTargetId: number;
102
+ readonly #agent: ProtocolProxyApi.ServiceWorkerApi;
103
+ readonly #registrationsInternal: Map<string, ServiceWorkerRegistration>;
104
+ #enabled: boolean;
105
+ readonly #forceUpdateSetting: Common.Settings.Setting<boolean>;
102
106
  serviceWorkerNetworkRequestsPanelStatus: {
103
107
  isOpen: boolean,
104
108
  openedAt: number,
@@ -107,16 +111,16 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
107
111
  constructor(target: Target) {
108
112
  super(target);
109
113
  target.registerServiceWorkerDispatcher(new ServiceWorkerDispatcher(this));
110
- this.lastAnonymousTargetId = 0;
111
- this.agent = target.serviceWorkerAgent();
112
- this.registrationsInternal = new Map();
113
- this.enabled = false;
114
+ this.#lastAnonymousTargetId = 0;
115
+ this.#agent = target.serviceWorkerAgent();
116
+ this.#registrationsInternal = new Map();
117
+ this.#enabled = false;
114
118
  this.enable();
115
- this.forceUpdateSetting = Common.Settings.Settings.instance().createSetting('serviceWorkerUpdateOnReload', false);
116
- if (this.forceUpdateSetting.get()) {
119
+ this.#forceUpdateSetting = Common.Settings.Settings.instance().createSetting('serviceWorkerUpdateOnReload', false);
120
+ if (this.#forceUpdateSetting.get()) {
117
121
  this.forceUpdateSettingChanged();
118
122
  }
119
- this.forceUpdateSetting.addChangeListener(this.forceUpdateSettingChanged, this);
123
+ this.#forceUpdateSetting.addChangeListener(this.forceUpdateSettingChanged, this);
120
124
  new ServiceWorkerContextNamer(target, this);
121
125
 
122
126
  /** Status of service worker network requests panel */
@@ -127,28 +131,28 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
127
131
  }
128
132
 
129
133
  async enable(): Promise<void> {
130
- if (this.enabled) {
134
+ if (this.#enabled) {
131
135
  return;
132
136
  }
133
- this.enabled = true;
134
- await this.agent.invoke_enable();
137
+ this.#enabled = true;
138
+ await this.#agent.invoke_enable();
135
139
  }
136
140
 
137
141
  async disable(): Promise<void> {
138
- if (!this.enabled) {
142
+ if (!this.#enabled) {
139
143
  return;
140
144
  }
141
- this.enabled = false;
142
- this.registrationsInternal.clear();
143
- await this.agent.invoke_enable();
145
+ this.#enabled = false;
146
+ this.#registrationsInternal.clear();
147
+ await this.#agent.invoke_enable();
144
148
  }
145
149
 
146
150
  registrations(): Map<string, ServiceWorkerRegistration> {
147
- return this.registrationsInternal;
151
+ return this.#registrationsInternal;
148
152
  }
149
153
 
150
154
  hasRegistrationForURLs(urls: string[]): boolean {
151
- for (const registration of this.registrationsInternal.values()) {
155
+ for (const registration of this.#registrationsInternal.values()) {
152
156
  if (urls.filter(url => url && url.startsWith(registration.scopeURL)).length === urls.length) {
153
157
  return true;
154
158
  }
@@ -167,12 +171,12 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
167
171
  }
168
172
 
169
173
  deleteRegistration(registrationId: string): void {
170
- const registration = this.registrationsInternal.get(registrationId);
174
+ const registration = this.#registrationsInternal.get(registrationId);
171
175
  if (!registration) {
172
176
  return;
173
177
  }
174
178
  if (registration.isRedundant()) {
175
- this.registrationsInternal.delete(registrationId);
179
+ this.#registrationsInternal.delete(registrationId);
176
180
  this.dispatchEventToListeners(Events.RegistrationDeleted, registration);
177
181
  return;
178
182
  }
@@ -184,74 +188,74 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
184
188
  }
185
189
 
186
190
  async updateRegistration(registrationId: string): Promise<void> {
187
- const registration = this.registrationsInternal.get(registrationId);
191
+ const registration = this.#registrationsInternal.get(registrationId);
188
192
  if (!registration) {
189
193
  return;
190
194
  }
191
- await this.agent.invoke_updateRegistration({scopeURL: registration.scopeURL});
195
+ await this.#agent.invoke_updateRegistration({scopeURL: registration.scopeURL});
192
196
  }
193
197
 
194
198
  async deliverPushMessage(registrationId: Protocol.ServiceWorker.RegistrationID, data: string): Promise<void> {
195
- const registration = this.registrationsInternal.get(registrationId);
199
+ const registration = this.#registrationsInternal.get(registrationId);
196
200
  if (!registration) {
197
201
  return;
198
202
  }
199
203
  const origin = Common.ParsedURL.ParsedURL.extractOrigin(registration.scopeURL);
200
- await this.agent.invoke_deliverPushMessage({origin, registrationId, data});
204
+ await this.#agent.invoke_deliverPushMessage({origin, registrationId, data});
201
205
  }
202
206
 
203
207
  async dispatchSyncEvent(registrationId: Protocol.ServiceWorker.RegistrationID, tag: string, lastChance: boolean):
204
208
  Promise<void> {
205
- const registration = this.registrationsInternal.get(registrationId);
209
+ const registration = this.#registrationsInternal.get(registrationId);
206
210
  if (!registration) {
207
211
  return;
208
212
  }
209
213
  const origin = Common.ParsedURL.ParsedURL.extractOrigin(registration.scopeURL);
210
- await this.agent.invoke_dispatchSyncEvent({origin, registrationId, tag, lastChance});
214
+ await this.#agent.invoke_dispatchSyncEvent({origin, registrationId, tag, lastChance});
211
215
  }
212
216
 
213
217
  async dispatchPeriodicSyncEvent(registrationId: Protocol.ServiceWorker.RegistrationID, tag: string): Promise<void> {
214
- const registration = this.registrationsInternal.get(registrationId);
218
+ const registration = this.#registrationsInternal.get(registrationId);
215
219
  if (!registration) {
216
220
  return;
217
221
  }
218
222
  const origin = Common.ParsedURL.ParsedURL.extractOrigin(registration.scopeURL);
219
- await this.agent.invoke_dispatchPeriodicSyncEvent({origin, registrationId, tag});
223
+ await this.#agent.invoke_dispatchPeriodicSyncEvent({origin, registrationId, tag});
220
224
  }
221
225
 
222
226
  private async unregister(scopeURL: string): Promise<void> {
223
- await this.agent.invoke_unregister({scopeURL});
227
+ await this.#agent.invoke_unregister({scopeURL});
224
228
  }
225
229
 
226
230
  async startWorker(scopeURL: string): Promise<void> {
227
- await this.agent.invoke_startWorker({scopeURL});
231
+ await this.#agent.invoke_startWorker({scopeURL});
228
232
  }
229
233
 
230
234
  async skipWaiting(scopeURL: string): Promise<void> {
231
- await this.agent.invoke_skipWaiting({scopeURL});
235
+ await this.#agent.invoke_skipWaiting({scopeURL});
232
236
  }
233
237
 
234
238
  async stopWorker(versionId: string): Promise<void> {
235
- await this.agent.invoke_stopWorker({versionId});
239
+ await this.#agent.invoke_stopWorker({versionId});
236
240
  }
237
241
 
238
242
  async inspectWorker(versionId: string): Promise<void> {
239
- await this.agent.invoke_inspectWorker({versionId});
243
+ await this.#agent.invoke_inspectWorker({versionId});
240
244
  }
241
245
 
242
246
  workerRegistrationUpdated(registrations: Protocol.ServiceWorker.ServiceWorkerRegistration[]): void {
243
247
  for (const payload of registrations) {
244
- let registration = this.registrationsInternal.get(payload.registrationId);
248
+ let registration = this.#registrationsInternal.get(payload.registrationId);
245
249
  if (!registration) {
246
250
  registration = new ServiceWorkerRegistration(payload);
247
- this.registrationsInternal.set(payload.registrationId, registration);
251
+ this.#registrationsInternal.set(payload.registrationId, registration);
248
252
  this.dispatchEventToListeners(Events.RegistrationUpdated, registration);
249
253
  continue;
250
254
  }
251
255
  registration.update(payload);
252
256
 
253
257
  if (registration.shouldBeRemoved()) {
254
- this.registrationsInternal.delete(registration.id);
258
+ this.#registrationsInternal.delete(registration.id);
255
259
  this.dispatchEventToListeners(Events.RegistrationDeleted, registration);
256
260
  } else {
257
261
  this.dispatchEventToListeners(Events.RegistrationUpdated, registration);
@@ -262,7 +266,7 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
262
266
  workerVersionUpdated(versions: Protocol.ServiceWorker.ServiceWorkerVersion[]): void {
263
267
  const registrations = new Set<ServiceWorkerRegistration>();
264
268
  for (const payload of versions) {
265
- const registration = this.registrationsInternal.get(payload.registrationId);
269
+ const registration = this.#registrationsInternal.get(payload.registrationId);
266
270
  if (!registration) {
267
271
  continue;
268
272
  }
@@ -271,7 +275,7 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
271
275
  }
272
276
  for (const registration of registrations) {
273
277
  if (registration.shouldBeRemoved()) {
274
- this.registrationsInternal.delete(registration.id);
278
+ this.#registrationsInternal.delete(registration.id);
275
279
  this.dispatchEventToListeners(Events.RegistrationDeleted, registration);
276
280
  } else {
277
281
  this.dispatchEventToListeners(Events.RegistrationUpdated, registration);
@@ -280,7 +284,7 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
280
284
  }
281
285
 
282
286
  workerErrorReported(payload: Protocol.ServiceWorker.ServiceWorkerErrorMessage): void {
283
- const registration = this.registrationsInternal.get(payload.registrationId);
287
+ const registration = this.#registrationsInternal.get(payload.registrationId);
284
288
  if (!registration) {
285
289
  return;
286
290
  }
@@ -289,12 +293,12 @@ export class ServiceWorkerManager extends SDKModel<EventTypes> {
289
293
  }
290
294
 
291
295
  forceUpdateOnReloadSetting(): Common.Settings.Setting<boolean> {
292
- return this.forceUpdateSetting;
296
+ return this.#forceUpdateSetting;
293
297
  }
294
298
 
295
299
  private forceUpdateSettingChanged(): void {
296
- const forceUpdateOnPageLoad = this.forceUpdateSetting.get();
297
- this.agent.invoke_setForceUpdateOnPageLoad({forceUpdateOnPageLoad});
300
+ const forceUpdateOnPageLoad = this.#forceUpdateSetting.get();
301
+ this.#agent.invoke_setForceUpdateOnPageLoad({forceUpdateOnPageLoad});
298
302
  }
299
303
  }
300
304
 
@@ -318,21 +322,21 @@ export type EventTypes = {
318
322
  };
319
323
 
320
324
  class ServiceWorkerDispatcher implements ProtocolProxyApi.ServiceWorkerDispatcher {
321
- private readonly manager: ServiceWorkerManager;
325
+ readonly #manager: ServiceWorkerManager;
322
326
  constructor(manager: ServiceWorkerManager) {
323
- this.manager = manager;
327
+ this.#manager = manager;
324
328
  }
325
329
 
326
330
  workerRegistrationUpdated({registrations}: Protocol.ServiceWorker.WorkerRegistrationUpdatedEvent): void {
327
- this.manager.workerRegistrationUpdated(registrations);
331
+ this.#manager.workerRegistrationUpdated(registrations);
328
332
  }
329
333
 
330
334
  workerVersionUpdated({versions}: Protocol.ServiceWorker.WorkerVersionUpdatedEvent): void {
331
- this.manager.workerVersionUpdated(versions);
335
+ this.#manager.workerVersionUpdated(versions);
332
336
  }
333
337
 
334
338
  workerErrorReported({errorMessage}: Protocol.ServiceWorker.WorkerErrorReportedEvent): void {
335
- this.manager.workerErrorReported(errorMessage);
339
+ this.#manager.workerErrorReported(errorMessage);
336
340
  }
337
341
  }
338
342
 
@@ -492,7 +496,7 @@ export namespace ServiceWorkerVersion {
492
496
  }
493
497
 
494
498
  export class ServiceWorkerRegistration {
495
- private fingerprintInternal!: symbol;
499
+ #fingerprintInternal!: symbol;
496
500
  id!: Protocol.ServiceWorker.RegistrationID;
497
501
  scopeURL!: string;
498
502
  securityOrigin!: string;
@@ -509,7 +513,7 @@ export class ServiceWorkerRegistration {
509
513
  }
510
514
 
511
515
  update(payload: Protocol.ServiceWorker.ServiceWorkerRegistration): void {
512
- this.fingerprintInternal = Symbol('fingerprint');
516
+ this.#fingerprintInternal = Symbol('fingerprint');
513
517
  this.id = payload.registrationId;
514
518
  this.scopeURL = payload.scopeURL;
515
519
  const parsedURL = new Common.ParsedURL.ParsedURL(payload.scopeURL);
@@ -518,7 +522,7 @@ export class ServiceWorkerRegistration {
518
522
  }
519
523
 
520
524
  fingerprint(): symbol {
521
- return this.fingerprintInternal;
525
+ return this.#fingerprintInternal;
522
526
  }
523
527
 
524
528
  versionsByMode(): Map<string, ServiceWorkerVersion> {
@@ -530,7 +534,7 @@ export class ServiceWorkerRegistration {
530
534
  }
531
535
 
532
536
  updateVersion(payload: Protocol.ServiceWorker.ServiceWorkerVersion): ServiceWorkerVersion {
533
- this.fingerprintInternal = Symbol('fingerprint');
537
+ this.#fingerprintInternal = Symbol('fingerprint');
534
538
  let version = this.versions.get(payload.versionId);
535
539
  if (!version) {
536
540
  version = new ServiceWorkerVersion(this, payload);
@@ -559,20 +563,20 @@ export class ServiceWorkerRegistration {
559
563
  }
560
564
 
561
565
  clearErrors(): void {
562
- this.fingerprintInternal = Symbol('fingerprint');
566
+ this.#fingerprintInternal = Symbol('fingerprint');
563
567
  this.errors = [];
564
568
  }
565
569
  }
566
570
 
567
571
  class ServiceWorkerContextNamer {
568
- private readonly target: Target;
569
- private readonly serviceWorkerManager: ServiceWorkerManager;
570
- private readonly versionByTargetId: Map<string, ServiceWorkerVersion>;
572
+ readonly #target: Target;
573
+ readonly #serviceWorkerManager: ServiceWorkerManager;
574
+ readonly #versionByTargetId: Map<string, ServiceWorkerVersion>;
571
575
 
572
576
  constructor(target: Target, serviceWorkerManager: ServiceWorkerManager) {
573
- this.target = target;
574
- this.serviceWorkerManager = serviceWorkerManager;
575
- this.versionByTargetId = new Map();
577
+ this.#target = target;
578
+ this.#serviceWorkerManager = serviceWorkerManager;
579
+ this.#versionByTargetId = new Map();
576
580
  serviceWorkerManager.addEventListener(Events.RegistrationUpdated, this.registrationsUpdated, this);
577
581
  serviceWorkerManager.addEventListener(Events.RegistrationDeleted, this.registrationsUpdated, this);
578
582
  TargetManager.instance().addModelListener(
@@ -580,12 +584,12 @@ class ServiceWorkerContextNamer {
580
584
  }
581
585
 
582
586
  private registrationsUpdated(): void {
583
- this.versionByTargetId.clear();
584
- const registrations = this.serviceWorkerManager.registrations().values();
587
+ this.#versionByTargetId.clear();
588
+ const registrations = this.#serviceWorkerManager.registrations().values();
585
589
  for (const registration of registrations) {
586
590
  for (const version of registration.versions.values()) {
587
591
  if (version.targetId) {
588
- this.versionByTargetId.set(version.targetId, version);
592
+ this.#versionByTargetId.set(version.targetId, version);
589
593
  }
590
594
  }
591
595
  }
@@ -598,11 +602,11 @@ class ServiceWorkerContextNamer {
598
602
  if (!serviceWorkerTargetId) {
599
603
  return;
600
604
  }
601
- this.updateContextLabel(executionContext, this.versionByTargetId.get(serviceWorkerTargetId) || null);
605
+ this.updateContextLabel(executionContext, this.#versionByTargetId.get(serviceWorkerTargetId) || null);
602
606
  }
603
607
 
604
608
  private serviceWorkerTargetId(target: Target): string|null {
605
- if (target.parentTarget() !== this.target || target.type() !== Type.ServiceWorker) {
609
+ if (target.parentTarget() !== this.#target || target.type() !== Type.ServiceWorker) {
606
610
  return null;
607
611
  }
608
612
  return target.id();
@@ -614,7 +618,7 @@ class ServiceWorkerContextNamer {
614
618
  if (!serviceWorkerTargetId) {
615
619
  continue;
616
620
  }
617
- const version = this.versionByTargetId.get(serviceWorkerTargetId) || null;
621
+ const version = this.#versionByTargetId.get(serviceWorkerTargetId) || null;
618
622
  const runtimeModel = target.model(RuntimeModel);
619
623
  const executionContexts = runtimeModel ? runtimeModel.executionContexts() : [];
620
624
  for (const context of executionContexts) {