chrome-devtools-frontend 1.0.1654411 → 1.0.1656897

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 (204) hide show
  1. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +116 -0
  2. package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +82 -0
  3. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +123 -0
  4. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +125 -0
  5. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +75 -0
  6. package/AUTHORS +1 -0
  7. package/config/owner/COMMON_OWNERS +0 -4
  8. package/docs/playbook.md +1 -1
  9. package/front_end/Tests.js +1 -0
  10. package/front_end/core/common/Settings.ts +47 -30
  11. package/front_end/core/sdk/CPUThrottlingManager.ts +10 -159
  12. package/front_end/core/sdk/ConsoleModel.ts +13 -11
  13. package/front_end/core/sdk/DOMDebuggerModel.ts +11 -5
  14. package/front_end/core/sdk/DOMModel.ts +7 -5
  15. package/front_end/core/sdk/EventBreakpointsModel.ts +9 -5
  16. package/front_end/core/sdk/IsolateManager.ts +6 -6
  17. package/front_end/core/sdk/ResourceTreeModel.ts +5 -3
  18. package/front_end/core/sdk/SourceMapCache.ts +2 -4
  19. package/front_end/core/sdk/SourceMapManager.ts +8 -7
  20. package/front_end/core/sdk/TargetManager.ts +17 -0
  21. package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
  22. package/front_end/entrypoints/main/MainImpl.ts +12 -36
  23. package/front_end/entrypoints/main/SimpleApp.ts +0 -13
  24. package/front_end/entrypoints/main/main-meta.ts +1 -1
  25. package/front_end/foundation/Universe.ts +110 -3
  26. package/front_end/generated/InspectorBackendCommands.ts +5 -1
  27. package/front_end/generated/SupportedCSSProperties.js +2 -6
  28. package/front_end/generated/protocol-mapping.d.ts +8 -0
  29. package/front_end/generated/protocol-proxy-api.d.ts +15 -0
  30. package/front_end/generated/protocol.ts +36 -1
  31. package/front_end/models/ai_assistance/AiConversation.ts +0 -6
  32. package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +1 -1
  33. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -156
  34. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
  35. package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -358
  36. package/front_end/models/ai_assistance/ai_assistance.ts +0 -6
  37. package/front_end/models/ai_assistance/contexts/RequestContext.snapshot.txt +0 -1
  38. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +0 -2
  39. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -14
  40. package/front_end/models/autofill_manager/AutofillManager.ts +1 -2
  41. package/front_end/models/crux-manager/CrUXManager.ts +16 -11
  42. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  43. package/front_end/models/persistence/AutomaticFileSystemManager.ts +14 -13
  44. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +12 -9
  45. package/front_end/models/persistence/IsolatedFileSystemManager.ts +18 -9
  46. package/front_end/models/project_settings/ProjectSettingsModel.ts +12 -11
  47. package/front_end/models/trace/handlers/ScreenshotsHandler.ts +14 -59
  48. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +3 -29
  49. package/front_end/panels/application/DeviceBoundSessionsView.ts +15 -3
  50. package/front_end/panels/application/FrameDetailsView.ts +2 -1
  51. package/front_end/panels/application/ServiceWorkersView.ts +193 -161
  52. package/front_end/panels/application/serviceWorkersView.css +8 -0
  53. package/front_end/panels/common/CPUThrottlingOption.ts +142 -0
  54. package/front_end/panels/common/ThrottlingUtils.ts +9 -4
  55. package/front_end/panels/common/common.ts +1 -1
  56. package/front_end/panels/console/ConsoleViewMessage.ts +45 -0
  57. package/front_end/panels/elements/ElementsPanel.ts +35 -102
  58. package/front_end/panels/elements/ElementsTreeOutline.ts +0 -4
  59. package/front_end/panels/elements/elements-meta.ts +3 -2
  60. package/front_end/panels/emulation/DeviceModeToolbar.ts +46 -45
  61. package/front_end/panels/mobile_throttling/CalibrationController.ts +6 -5
  62. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +1 -1
  63. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +40 -13
  64. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +13 -17
  65. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +15 -13
  66. package/front_end/panels/network/NetworkLogView.ts +0 -9
  67. package/front_end/panels/network/NetworkPanel.ts +1 -63
  68. package/front_end/panels/network/RequestInitiatorView.ts +29 -4
  69. package/front_end/panels/network/components/HeaderSectionRow.css +9 -7
  70. package/front_end/panels/network/components/HeaderSectionRow.ts +20 -1
  71. package/front_end/panels/network/components/RequestHeaderSection.css +5 -3
  72. package/front_end/panels/network/components/RequestHeaderSection.ts +1 -2
  73. package/front_end/panels/network/components/RequestHeadersView.css +1 -1
  74. package/front_end/panels/security/SecurityPanel.ts +36 -23
  75. package/front_end/panels/settings/SettingsScreen.ts +18 -103
  76. package/front_end/panels/settings/settings-meta.ts +0 -24
  77. package/front_end/panels/timeline/TimelineController.ts +3 -2
  78. package/front_end/panels/timeline/TimelinePanel.ts +20 -3
  79. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +15 -14
  80. package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -0
  81. package/front_end/panels/utils/utils.ts +25 -24
  82. package/front_end/third_party/chromium/README.chromium +1 -1
  83. package/front_end/third_party/puppeteer/README.chromium +2 -2
  84. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +34 -55
  85. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +96 -83
  86. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +10 -1
  87. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.d.ts.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.js.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +3 -2
  95. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.d.ts +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.js +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +2 -1
  105. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.js.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +2 -2
  109. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +5 -2
  111. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +23 -13
  116. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +4 -1
  119. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Input.js +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.d.ts.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts +3 -41
  126. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +4 -2
  131. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts +5 -0
  133. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +1 -1
  136. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js +5 -5
  139. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js.map +1 -1
  140. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  142. package/front_end/third_party/puppeteer/package/lib/types.d.ts +34 -55
  143. package/front_end/third_party/puppeteer/package/package.json +4 -4
  144. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
  145. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -3
  146. package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +3 -1
  147. package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +3 -2
  148. package/front_end/third_party/puppeteer/package/src/api/Realm.ts +1 -2
  149. package/front_end/third_party/puppeteer/package/src/api/Target.ts +1 -1
  150. package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +1 -2
  151. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +3 -1
  152. package/front_end/third_party/puppeteer/package/src/bidi/core/Realm.ts +1 -3
  153. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +13 -3
  154. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +1 -1
  155. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +24 -13
  156. package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +4 -1
  157. package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +1 -1
  158. package/front_end/third_party/puppeteer/package/src/cdp/LifecycleWatcher.ts +1 -4
  159. package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +2 -4
  160. package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -76
  161. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +1 -4
  162. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +4 -1
  163. package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +5 -0
  164. package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
  165. package/front_end/third_party/puppeteer/package/src/util/httpUtils.ts +5 -5
  166. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  167. package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -1
  168. package/front_end/ui/components/dialogs/Dialog.ts +3 -0
  169. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -7
  170. package/front_end/ui/helpers/OpenInNewTab.ts +15 -7
  171. package/front_end/ui/legacy/TabbedPane.ts +1 -108
  172. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -0
  173. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +172 -123
  174. package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +89 -0
  175. package/front_end/ui/legacy/components/data_grid/dataGrid.css +10 -0
  176. package/front_end/ui/legacy/components/data_grid/data_grid.ts +3 -1
  177. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +89 -40
  178. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  179. package/package.json +1 -1
  180. package/front_end/Images/navigationControls.png +0 -0
  181. package/front_end/Images/navigationControls_2x.png +0 -0
  182. package/front_end/Images/popoverArrows.png +0 -0
  183. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -746
  184. package/front_end/entrypoints/greendev_floaty/floaty.css +0 -301
  185. package/front_end/entrypoints/greendev_floaty/floaty.html +0 -38
  186. package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -415
  187. package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +0 -834
  188. package/front_end/models/ai_assistance/agents/GreenDevAgentAntigravityCliSocketClient.ts +0 -53
  189. package/front_end/models/ai_assistance/agents/GreenDevAgentGeminiCliSocketClient.ts +0 -117
  190. package/front_end/models/annotations/AnnotationRepository.ts +0 -238
  191. package/front_end/models/annotations/AnnotationType.ts +0 -10
  192. package/front_end/models/annotations/README.md +0 -7
  193. package/front_end/models/annotations/annotations.ts +0 -6
  194. package/front_end/models/greendev/Prototypes.ts +0 -68
  195. package/front_end/models/greendev/README.md +0 -5
  196. package/front_end/models/greendev/greendev.ts +0 -5
  197. package/front_end/panels/common/Annotation.ts +0 -184
  198. package/front_end/panels/common/AnnotationManager.ts +0 -208
  199. package/front_end/panels/common/annotation.css +0 -40
  200. package/front_end/panels/greendev/GreenDevPanel.css +0 -282
  201. package/front_end/panels/greendev/GreenDevPanel.ts +0 -364
  202. package/front_end/panels/greendev/GreenDevShared.ts +0 -13
  203. package/front_end/panels/greendev/greendev-meta.ts +0 -52
  204. package/front_end/panels/greendev/greendev.ts +0 -9
@@ -21,6 +21,7 @@ import * as CspEvaluator from '../../third_party/csp_evaluator/csp_evaluator.js'
21
21
  import * as Buttons from '../../ui/components/buttons/buttons.js';
22
22
  import type * as ExpandableList from '../../ui/components/expandable_list/expandable_list.js';
23
23
  import type * as ReportView from '../../ui/components/report_view/report_view.js';
24
+ import * as UIHelpers from '../../ui/helpers/helpers.js';
24
25
  import * as Components from '../../ui/legacy/components/utils/utils.js';
25
26
  import * as UI from '../../ui/legacy/legacy.js';
26
27
  import {html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
@@ -680,7 +681,7 @@ function renderSingleCSP(cspInfo: Protocol.Network.ContentSecurityPolicyStatus,
680
681
  .accessibleLabel=${i18nString(UIStrings.learnMore)}
681
682
  .variant=${Buttons.Button.Variant.ICON}
682
683
  .size=${Buttons.Button.Size.SMALL}
683
- @click=${()=> {window.location.href = 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only';}}
684
+ @click=${()=> {UIHelpers.openInNewTab('https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only');}}
684
685
  jslog=${VisualLogging.link('learn-more.csp-report-only').track({click: true})}
685
686
  ></devtools-button>`}
686
687
  </devtools-report-key>
@@ -13,6 +13,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
13
13
  import {Link} from '../../ui/kit/kit.js';
14
14
  import * as Components from '../../ui/legacy/components/utils/utils.js';
15
15
  import * as UI from '../../ui/legacy/legacy.js';
16
+ import {html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
16
17
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
18
  import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
18
19
 
@@ -220,6 +221,15 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
220
221
 
221
222
  this.sectionToRegistration = new WeakMap();
222
223
 
224
+ this.createOthersOriginView();
225
+ this.setupToolbar();
226
+
227
+ this.eventListeners = new Map();
228
+ SDK.TargetManager.TargetManager.instance().observeModels(SDK.ServiceWorkerManager.ServiceWorkerManager, this);
229
+ this.updateListVisibility();
230
+ }
231
+
232
+ private createOthersOriginView(): void {
223
233
  const othersDiv = this.contentElement.createChild('div', 'service-workers-other-origin');
224
234
  othersDiv.setAttribute('jslog', `${VisualLogging.section('other-origin')}`);
225
235
  // TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
@@ -231,7 +241,9 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
231
241
  const seeOthers = Link.create('chrome://serviceworker-internals', i18nString(UIStrings.seeAllRegistrations),
232
242
  undefined, 'view-all', 0, /* allowPrivileged=*/ true);
233
243
  othersSectionRow.appendChild(seeOthers);
244
+ }
234
245
 
246
+ private setupToolbar(): void {
235
247
  this.toolbar.appendToolbarItem(
236
248
  MobileThrottling.ThrottlingManager.throttlingManager().createOfflineToolbarCheckbox());
237
249
  const updateOnReloadSetting =
@@ -246,10 +258,6 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
246
258
  const fallbackToNetwork = new UI.Toolbar.ToolbarSettingCheckbox(
247
259
  bypassServiceWorkerSetting, i18nString(UIStrings.bypassTheServiceWorkerAndLoad));
248
260
  this.toolbar.appendToolbarItem(fallbackToNetwork);
249
-
250
- this.eventListeners = new Map();
251
- SDK.TargetManager.TargetManager.instance().observeModels(SDK.ServiceWorkerManager.ServiceWorkerManager, this);
252
- this.updateListVisibility();
253
261
  }
254
262
 
255
263
  modelAdded(serviceWorkerManager: SDK.ServiceWorkerManager.ServiceWorkerManager): void {
@@ -266,14 +274,14 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
266
274
  }
267
275
 
268
276
  this.eventListeners.set(serviceWorkerManager, [
269
- this.manager.addEventListener(
270
- SDK.ServiceWorkerManager.Events.REGISTRATION_UPDATED, this.registrationUpdated, this),
271
- this.manager.addEventListener(
272
- SDK.ServiceWorkerManager.Events.REGISTRATION_DELETED, this.registrationDeleted, this),
273
- this.securityOriginManager.addEventListener(
274
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.updateSectionVisibility, this),
275
- this.securityOriginManager.addEventListener(
276
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.updateSectionVisibility, this),
277
+ this.manager.addEventListener(SDK.ServiceWorkerManager.Events.REGISTRATION_UPDATED, this.registrationUpdated,
278
+ this),
279
+ this.manager.addEventListener(SDK.ServiceWorkerManager.Events.REGISTRATION_DELETED, this.registrationDeleted,
280
+ this),
281
+ this.securityOriginManager.addEventListener(SDK.SecurityOriginManager.Events.SecurityOriginAdded,
282
+ this.updateSectionVisibility, this),
283
+ this.securityOriginManager.addEventListener(SDK.SecurityOriginManager.Events.SecurityOriginRemoved,
284
+ this.updateSectionVisibility, this),
277
285
  ]);
278
286
  }
279
287
 
@@ -324,7 +332,7 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
324
332
 
325
333
  for (const section of movedSections) {
326
334
  const registration = section.registration;
327
- this.removeRegistrationFromList(registration);
335
+ this.removeRegistrationFromList(registration, true);
328
336
  this.updateRegistration(registration, true);
329
337
  }
330
338
 
@@ -392,8 +400,8 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
392
400
  return null;
393
401
  }
394
402
 
395
- private updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration, skipUpdate?: boolean):
396
- void {
403
+ private updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration,
404
+ skipUpdate?: boolean): void {
397
405
  let section = this.sections.get(registration);
398
406
  if (!section) {
399
407
  const title = registration.scopeURL;
@@ -419,13 +427,16 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
419
427
  this.removeRegistrationFromList(event.data);
420
428
  }
421
429
 
422
- private removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): void {
430
+ private removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration,
431
+ skipVisibilityUpdate = false): void {
423
432
  const section = this.sections.get(registration);
424
433
  if (section) {
425
434
  section.section.detach();
426
435
  }
427
436
  this.sections.delete(registration);
428
- this.updateSectionVisibility();
437
+ if (!skipVisibilityUpdate) {
438
+ this.updateSectionVisibility();
439
+ }
429
440
  }
430
441
 
431
442
  private isRegistrationVisible(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): boolean {
@@ -453,17 +464,16 @@ export class Section {
453
464
  private readonly networkRequests: Buttons.Button.Button;
454
465
  private readonly updateButton: Buttons.Button.Button;
455
466
  private readonly deleteButton: Buttons.Button.Button;
456
- private sourceField: Element;
457
- private readonly statusField: Element;
458
- private readonly clientsField: Element;
467
+ private sourceField: HTMLElement;
468
+ private readonly statusField: HTMLElement;
469
+ private readonly clientsField: HTMLElement;
459
470
  private readonly clientInfoCache: Map<string, Protocol.Target.TargetInfo>;
460
471
  private readonly throttler: Common.Throttler.Throttler;
461
- private updateCycleField?: Element;
462
- private routerField?: Element;
472
+ private updateCycleField?: HTMLElement;
473
+ private routerField?: HTMLElement;
463
474
 
464
- constructor(
465
- manager: SDK.ServiceWorkerManager.ServiceWorkerManager, section: UI.ReportView.Section,
466
- registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration) {
475
+ constructor(manager: SDK.ServiceWorkerManager.ServiceWorkerManager, section: UI.ReportView.Section,
476
+ registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration) {
467
477
  this.manager = manager;
468
478
  this.section = section;
469
479
  this.registration = registration;
@@ -502,15 +512,13 @@ export class Section {
502
512
  this.sourceField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.source)));
503
513
  this.statusField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.status)));
504
514
  this.clientsField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.clients)));
505
- this.createSyncNotificationField(
506
- i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(), i18nString(UIStrings.pushData),
507
- this.push.bind(this), 'push-message');
508
- this.createSyncNotificationField(
509
- i18nString(UIStrings.syncString), this.syncTagNameSetting.get(), i18nString(UIStrings.syncTag),
510
- this.sync.bind(this), 'sync-tag');
511
- this.createSyncNotificationField(
512
- i18nString(UIStrings.periodicSync), this.periodicSyncTagNameSetting.get(),
513
- i18nString(UIStrings.periodicSyncTag), tag => this.periodicSync(tag), 'periodic-sync-tag');
515
+ this.createSyncNotificationField(i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(),
516
+ i18nString(UIStrings.pushData), this.push.bind(this), 'push-message');
517
+ this.createSyncNotificationField(i18nString(UIStrings.syncString), this.syncTagNameSetting.get(),
518
+ i18nString(UIStrings.syncTag), this.sync.bind(this), 'sync-tag');
519
+ this.createSyncNotificationField(i18nString(UIStrings.periodicSync), this.periodicSyncTagNameSetting.get(),
520
+ i18nString(UIStrings.periodicSyncTag), tag => this.periodicSync(tag),
521
+ 'periodic-sync-tag');
514
522
  this.createUpdateCycleField();
515
523
  this.maybeCreateRouterField();
516
524
 
@@ -518,53 +526,66 @@ export class Section {
518
526
  this.throttler = new Common.Throttler.Throttler(500);
519
527
  }
520
528
 
521
- private createSyncNotificationField(
522
- label: string, initialValue: string, placeholder: string, callback: (arg0: string) => void,
523
- jslogContext: string): void {
524
- const form =
525
- this.wrapWidget(this.section.appendField(label)).createChild('form', 'service-worker-editor-with-button');
526
- const editor = UI.UIUtils.createInput('source-code service-worker-notification-editor');
527
- editor.setAttribute('jslog', `${VisualLogging.textField().track({change: true}).context(jslogContext)}`);
528
- form.appendChild(editor);
529
- const button = UI.UIUtils.createTextButton(label, undefined, {jslogContext});
530
- button.type = 'submit';
531
- form.appendChild(button);
532
-
533
- editor.value = initialValue;
534
- editor.placeholder = placeholder;
535
- UI.ARIAUtils.setLabel(editor, label);
536
-
537
- form.addEventListener('submit', (e: Event) => {
538
- callback(editor.value || '');
539
- e.consume(true);
540
- });
529
+ private createSyncNotificationField(label: string, initialValue: string, placeholder: string,
530
+ callback: (arg0: string) => void, jslogContext: string): void {
531
+ const fieldElement = this.wrapWidget(this.section.appendField(label));
532
+
533
+ // clang-format off
534
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
535
+ render(html`
536
+ <form class="service-worker-editor-with-button" @submit=${(e: Event) => {
537
+ const {editor} = e.target as HTMLFormElement;
538
+ callback(editor.value || '');
539
+ e.consume(true);
540
+ }}>
541
+ <input name="editor" class="source-code service-worker-notification-editor harmony-input" type="text"
542
+ .value=${initialValue}
543
+ placeholder=${placeholder}
544
+ aria-label=${label}
545
+ .spellcheck=${false}
546
+ jslog=${VisualLogging.textField().track({change: true}).context(jslogContext)}
547
+ >
548
+ <devtools-button .data=${{
549
+ type: 'submit',
550
+ variant: Buttons.Button.Variant.OUTLINED,
551
+ jslogContext} as Buttons.Button.ButtonData}>
552
+ ${label}
553
+ </devtools-button>
554
+ </form>
555
+ `, fieldElement);
556
+ // clang-format on
541
557
  }
542
558
 
543
559
  scheduleUpdate(): void {
544
560
  if (throttleDisabledForDebugging) {
545
- void this.update();
561
+ void this.performUpdate();
546
562
  return;
547
563
  }
548
- void this.throttler.schedule(this.update.bind(this));
564
+ void this.throttler.schedule(this.performUpdate.bind(this));
549
565
  }
550
566
 
551
- private addVersion(versionsStack: Element, icon: string, label: string): Element {
552
- const installingEntry = versionsStack.createChild('div', 'service-worker-version');
553
- installingEntry.createChild('div', icon);
554
- const statusString = installingEntry.createChild('span', 'service-worker-version-string');
555
- statusString.textContent = label;
556
- UI.ARIAUtils.markAsAlert(statusString);
557
- return installingEntry;
567
+ private renderVersion(icon: string, label: string, content: LitTemplate = nothing): LitTemplate {
568
+ // clang-format off
569
+ return html`
570
+ <div class="service-worker-version">
571
+ <div class=${icon}></div>
572
+ <span class="service-worker-version-string" role="alert" aria-live="polite">
573
+ ${label}
574
+ </span>
575
+ ${content}
576
+ </div>`;
577
+ // clang-format on
558
578
  }
559
579
 
560
580
  private updateClientsField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
561
581
  this.clientsField.removeChildren();
562
582
  this.section.setFieldVisible(i18nString(UIStrings.clients), Boolean(version.controlledClients.length));
563
583
  for (const client of version.controlledClients) {
564
- const clientLabelText = this.clientsField.createChild('div', 'service-worker-client');
584
+ const clientLabelText = this.clientsField.createChild('div', 'service-worker-client') as HTMLElement;
565
585
  const info = this.clientInfoCache.get(client);
566
586
  if (info) {
567
- this.updateClientInfo(clientLabelText, info);
587
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
588
+ render(this.renderClientInfo(info), clientLabelText);
568
589
  }
569
590
  void this.manager.target()
570
591
  .targetAgent()
@@ -574,34 +595,34 @@ export class Section {
574
595
  }
575
596
 
576
597
  private updateSourceField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
577
- this.sourceField.removeChildren();
578
598
  const fileName = Common.ParsedURL.ParsedURL.extractName(version.scriptURL);
579
- const name = this.sourceField.createChild('div', 'report-field-value-filename');
580
- const link = Components.Linkifier.Linkifier.linkifyURL(
581
- version.scriptURL, ({text: fileName} as Components.Linkifier.LinkifyURLOptions));
582
- link.tabIndex = 0;
583
- link.setAttribute('jslog', `${VisualLogging.link('source-location').track({click: true})}`);
584
- name.appendChild(link);
585
- if (this.registration.errors.length) {
586
- const errorsLabel = UI.UIUtils.createIconLabel({
587
- title: String(this.registration.errors.length),
588
- iconName: 'cross-circle-filled',
589
- color: 'var(--icon-error)',
590
- });
591
- errorsLabel.classList.add('devtools-link', 'link');
592
- errorsLabel.tabIndex = 0;
593
- UI.ARIAUtils.setLabel(
594
- errorsLabel, i18nString(UIStrings.sRegistrationErrors, {PH1: this.registration.errors.length}));
595
- self.onInvokeElement(errorsLabel, () => Common.Console.Console.instance().show());
596
- name.appendChild(errorsLabel);
597
- }
598
- if (version.scriptResponseTime !== undefined) {
599
- this.sourceField.createChild('div', 'report-field-value-subtitle').textContent =
600
- i18nString(UIStrings.receivedS, {PH1: new Date(version.scriptResponseTime * 1000).toLocaleString()});
601
- }
602
- }
603
-
604
- private update(): Promise<void> {
599
+ // clang-format off
600
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
601
+ render(html`
602
+ <div class="report-field-value-filename">
603
+ ${Components.Linkifier.Linkifier.renderLinkifiedUrl(version.scriptURL, {
604
+ text: fileName, tabStop: true, jslogContext: 'source-location'})}
605
+ ${this.registration.errors.length ? html`
606
+ <button
607
+ class="devtools-link link"
608
+ tabindex="0"
609
+ aria-label=${i18nString(UIStrings.sRegistrationErrors, {PH1: this.registration.errors.length})}
610
+ @click=${() => Common.Console.Console.instance().show()}>
611
+ <devtools-icon name="cross-circle-filled" class="error-icon">
612
+ </devtools-icon>
613
+ ${this.registration.errors.length}
614
+ </button>` : nothing}
615
+ </div>
616
+ ${version.scriptResponseTime !== undefined ? html`
617
+ <div class="report-field-value-subtitle">
618
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(version.scriptResponseTime * 1000).toLocaleString()})}
619
+ </div>
620
+ ` : nothing}
621
+ `, this.sourceField);
622
+ // clang-format on
623
+ }
624
+
625
+ private performUpdate(): Promise<void> {
605
626
  const fingerprint = this.registration.fingerprint();
606
627
  if (fingerprint === this.fingerprint) {
607
628
  return Promise.resolve();
@@ -620,62 +641,69 @@ export class Section {
620
641
  const installing = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.INSTALLING);
621
642
  const redundant = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.REDUNDANT);
622
643
 
623
- this.statusField.removeChildren();
624
- const versionsStack = this.statusField.createChild('div', 'service-worker-version-stack');
625
- versionsStack.createChild('div', 'service-worker-version-stack-bar');
644
+ // clang-format off
645
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
646
+ render(html`
647
+ <div class="service-worker-version-stack">
648
+ <div class="service-worker-version-stack-bar"></div>
649
+ ${active ? this.renderVersion(
650
+ 'service-worker-active-circle',
651
+ i18nString(UIStrings.sActivatedAndIsS, {
652
+ PH1: active.id,
653
+ PH2: SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.currentState.runningStatus](),
654
+ }),
655
+ active.isRunning() || active.isStarting() ? html`
656
+ <devtools-button .data=${{jslogContext: 'stop', variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
657
+ @click=${this.stopButtonClicked.bind(this, active.id)}>
658
+ ${i18nString(UIStrings.stopString)}
659
+ </devtools-button>`
660
+ : active.isStartable() ? html`
661
+ <devtools-button .data=${{jslogContext: 'start', variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
662
+ @click=${this.startButtonClicked.bind(this)}>
663
+ ${i18nString(UIStrings.startString)}
664
+ </devtools-button>`
665
+ : nothing)
666
+ : redundant ? this.renderVersion(
667
+ 'service-worker-redundant-circle',
668
+ i18nString(UIStrings.sIsRedundant, {PH1: redundant.id}))
669
+ : nothing}
670
+ ${waiting ? this.renderVersion(
671
+ 'service-worker-waiting-circle',
672
+ i18nString(UIStrings.sWaitingToActivate, {PH1: waiting.id}), html`
673
+ <devtools-button .data=${{
674
+ jslogContext: 'skip-waiting',
675
+ title: i18n.i18n.lockedString('skipWaiting'),
676
+ variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
677
+ @click=${this.skipButtonClicked.bind(this)}>
678
+ ${i18n.i18n.lockedString('skipWaiting')}
679
+ </devtools-button>
680
+ ${waiting.scriptResponseTime !== undefined ? html`
681
+ <div class="service-worker-subtitle">
682
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(waiting.scriptResponseTime * 1000).toLocaleString()})}
683
+ </div>
684
+ ` : nothing}
685
+ `,
686
+ ) : nothing}
687
+ ${installing ? this.renderVersion(
688
+ 'service-worker-installing-circle',
689
+ i18nString(UIStrings.sTryingToInstall, {PH1: installing.id}),
690
+ installing.scriptResponseTime !== undefined ? html`
691
+ <div class="service-worker-subtitle">
692
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(installing.scriptResponseTime * 1000).toLocaleString()})}
693
+ </div>` : nothing) : nothing}
694
+ </div>
695
+ `, this.statusField);
696
+ // clang-format on
626
697
 
627
698
  if (active) {
628
699
  this.updateSourceField(active);
629
- const localizedRunningStatus =
630
- SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.currentState.runningStatus]();
631
- // TODO(l10n): Don't concatenate strings here.
632
- const activeEntry = this.addVersion(
633
- versionsStack, 'service-worker-active-circle',
634
- i18nString(UIStrings.sActivatedAndIsS, {PH1: active.id, PH2: localizedRunningStatus}));
635
-
636
- if (active.isRunning() || active.isStarting()) {
637
- const stopButton = UI.UIUtils.createTextButton(
638
- i18nString(UIStrings.stopString), this.stopButtonClicked.bind(this, active.id), {jslogContext: 'stop'});
639
- activeEntry.appendChild(stopButton);
640
- } else if (active.isStartable()) {
641
- const startButton = UI.UIUtils.createTextButton(
642
- i18nString(UIStrings.startString), this.startButtonClicked.bind(this), {jslogContext: 'start'});
643
- activeEntry.appendChild(startButton);
644
- }
645
700
  this.updateClientsField(active);
646
701
  this.maybeCreateRouterField();
647
702
  } else if (redundant) {
648
703
  this.updateSourceField(redundant);
649
- this.addVersion(
650
- versionsStack, 'service-worker-redundant-circle', i18nString(UIStrings.sIsRedundant, {PH1: redundant.id}));
651
704
  this.updateClientsField(redundant);
652
705
  }
653
706
 
654
- if (waiting) {
655
- const waitingEntry = this.addVersion(
656
- versionsStack, 'service-worker-waiting-circle', i18nString(UIStrings.sWaitingToActivate, {PH1: waiting.id}));
657
- const skipWaitingButton =
658
- UI.UIUtils.createTextButton(i18n.i18n.lockedString('skipWaiting'), this.skipButtonClicked.bind(this), {
659
- title: i18n.i18n.lockedString('skipWaiting'),
660
- jslogContext: 'skip-waiting',
661
- });
662
- waitingEntry.appendChild(skipWaitingButton);
663
- if (waiting.scriptResponseTime !== undefined) {
664
- waitingEntry.createChild('div', 'service-worker-subtitle').textContent =
665
- i18nString(UIStrings.receivedS, {PH1: new Date(waiting.scriptResponseTime * 1000).toLocaleString()});
666
- }
667
- }
668
- if (installing) {
669
- const installingEntry = this.addVersion(
670
- versionsStack, 'service-worker-installing-circle',
671
- i18nString(UIStrings.sTryingToInstall, {PH1: installing.id}));
672
- if (installing.scriptResponseTime !== undefined) {
673
- installingEntry.createChild('div', 'service-worker-subtitle').textContent = i18nString(UIStrings.receivedS, {
674
- PH1: new Date(installing.scriptResponseTime * 1000).toLocaleString(),
675
- });
676
- }
677
- }
678
-
679
707
  this.updateCycleView.refresh();
680
708
 
681
709
  return Promise.resolve();
@@ -740,36 +768,40 @@ export class Section {
740
768
  void this.manager.dispatchPeriodicSyncEvent(this.registration.id, tag);
741
769
  }
742
770
 
743
- private onClientInfo(element: Element, targetInfoResponse: Protocol.Target.GetTargetInfoResponse): void {
771
+ private onClientInfo(element: HTMLElement, targetInfoResponse: Protocol.Target.GetTargetInfoResponse): void {
744
772
  const targetInfo = targetInfoResponse.targetInfo;
745
773
  if (!targetInfo) {
746
774
  return;
747
775
  }
748
776
  this.clientInfoCache.set(targetInfo.targetId, targetInfo);
749
- this.updateClientInfo(element, targetInfo);
777
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
778
+ render(this.renderClientInfo(targetInfo), element);
750
779
  }
751
780
 
752
- private updateClientInfo(element: Element, targetInfo: Protocol.Target.TargetInfo): void {
753
- if (targetInfo.type !== 'page' && targetInfo.type === 'iframe') {
754
- const clientString = element.createChild('span', 'service-worker-client-string');
755
- UI.UIUtils.createTextChild(clientString, i18nString(UIStrings.workerS, {PH1: targetInfo.url}));
756
- return;
781
+ private renderClientInfo(targetInfo: Protocol.Target.TargetInfo): LitTemplate {
782
+ if (targetInfo.type !== 'page' && targetInfo.type !== 'iframe') {
783
+ // clang-format off
784
+ return html`<span class="service-worker-client-string">
785
+ ${i18nString(UIStrings.workerS, {PH1: targetInfo.url})}
786
+ </span>`;
787
+ // clang-format on
757
788
  }
758
- element.removeChildren();
759
- const clientString = element.createChild('span', 'service-worker-client-string');
760
- UI.UIUtils.createTextChild(clientString, targetInfo.url);
761
-
762
- const focusButton = new Buttons.Button.Button();
763
- focusButton.data = {
764
- iconName: 'select-element',
765
- variant: Buttons.Button.Variant.ICON,
766
- size: Buttons.Button.Size.SMALL,
767
- title: i18nString(UIStrings.focus),
768
- jslogContext: 'client-focus',
769
- };
770
- focusButton.className = 'service-worker-client-focus-link';
771
- focusButton.addEventListener('click', this.activateTarget.bind(this, targetInfo.targetId));
772
- element.appendChild(focusButton);
789
+
790
+ // clang-format off
791
+ return html`
792
+ <span class="service-worker-client-string">${targetInfo.url}</span>
793
+ <devtools-button
794
+ .data=${{
795
+ iconName: 'select-element',
796
+ variant: Buttons.Button.Variant.ICON,
797
+ size: Buttons.Button.Size.SMALL,
798
+ title: i18nString(UIStrings.focus),
799
+ jslogContext: 'client-focus',
800
+ } as Buttons.Button.ButtonData}
801
+ class="service-worker-client-focus-link"
802
+ @click=${this.activateTarget.bind(this, targetInfo.targetId)}
803
+ ></devtools-button>`;
804
+ // clang-format on
773
805
  }
774
806
 
775
807
  private activateTarget(targetId: Protocol.Target.TargetID): void {
@@ -788,7 +820,7 @@ export class Section {
788
820
  void this.manager.stopWorker(versionId);
789
821
  }
790
822
 
791
- private wrapWidget(container: Element): Element {
823
+ private wrapWidget(container: Element): HTMLElement {
792
824
  const shadowRoot = UI.UIUtils.createShadowRootWithCoreStyles(container, {
793
825
  cssFile: [
794
826
  serviceWorkersViewStyles,
@@ -154,3 +154,11 @@ button.link {
154
154
  button.link:focus-visible {
155
155
  background-color: inherit;
156
156
  }
157
+
158
+ devtools-icon.error-icon {
159
+ color: var(--sys-color-error-bright);
160
+ height: var(--sys-size-7);
161
+ margin-right: var(--sys-size-2);
162
+ vertical-align: bottom;
163
+ width: var(--sys-size-7);
164
+ }