chrome-devtools-frontend 1.0.1668390 → 1.0.1669021

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 (192) hide show
  1. package/.agents/skills/devtools-ci/SKILL.md +65 -0
  2. package/.agents/skills/gerrit-cli/SKILL.md +59 -0
  3. package/.agents/skills/gerrit-cli/references/commands.md +93 -0
  4. package/.agents/skills/gerrit-cli/references/workflows.md +56 -0
  5. package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +47 -0
  6. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +230 -0
  7. package/docs/contributing/infrastructure.md +7 -1
  8. package/front_end/core/host/AidaClient.ts +66 -47
  9. package/front_end/core/host/GcaClient.ts +4 -6
  10. package/front_end/core/host/ResourceLoader.ts +4 -2
  11. package/front_end/core/root/Runtime.ts +0 -5
  12. package/front_end/core/sdk/ConsoleModel.ts +3 -2
  13. package/front_end/core/sdk/DebuggerModel.ts +14 -6
  14. package/front_end/core/sdk/SDKSettings.ts +19 -0
  15. package/front_end/core/sdk/sdk-meta.ts +0 -58
  16. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  17. package/front_end/generated/protocol.ts +11 -3
  18. package/front_end/models/ai_assistance/AiUtils.ts +67 -4
  19. package/front_end/models/ai_assistance/StorageItem.ts +26 -5
  20. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -19
  21. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -3
  22. package/front_end/models/trace/handlers/RendererHandler.ts +20 -4
  23. package/front_end/models/trace/types/File.ts +1 -0
  24. package/front_end/models/workspace/UISourceCode.ts +0 -10
  25. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +61 -182
  26. package/front_end/panels/ai_assistance/components/ChatInput.ts +25 -8
  27. package/front_end/panels/ai_assistance/components/ChatMessage.ts +13 -69
  28. package/front_end/panels/ai_assistance/components/ChatView.ts +14 -8
  29. package/front_end/panels/ai_assistance/components/chatMessage.css +2 -20
  30. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -2
  31. package/front_end/panels/application/ApplicationPanelTreeElement.ts +41 -3
  32. package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +116 -79
  33. package/front_end/panels/application/ServiceWorkersView.ts +8 -8
  34. package/front_end/panels/application/application.ts +2 -0
  35. package/front_end/panels/application/components/AdsView.ts +10 -6
  36. package/front_end/panels/application/preloading/PreloadingView.ts +53 -45
  37. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +111 -119
  38. package/front_end/panels/application/preloading/components/preloadingDetailsReportView.css +21 -23
  39. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +105 -102
  40. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +107 -96
  41. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +17 -19
  42. package/front_end/panels/common/AiCodeCompletionTeaser.ts +6 -6
  43. package/front_end/panels/common/AiCodeGenerationTeaser.ts +28 -26
  44. package/front_end/panels/common/common.ts +1 -1
  45. package/front_end/panels/console/ConsoleInsightTeaser.ts +3 -6
  46. package/front_end/panels/console/ConsoleView.ts +6 -4
  47. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  48. package/front_end/panels/console/console-meta.ts +28 -0
  49. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -1
  50. package/front_end/panels/elements/StylesSidebarPane.ts +3 -2
  51. package/front_end/panels/emulation/DeviceModeWrapper.ts +18 -4
  52. package/front_end/panels/explain/components/ConsoleInsight.ts +4 -6
  53. package/front_end/panels/explain/explain-meta.ts +7 -49
  54. package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
  55. package/front_end/panels/network/NetworkLogView.ts +1 -0
  56. package/front_end/panels/network/OriginalResourceChunkView.ts +340 -0
  57. package/front_end/panels/network/ResourceChunkView.ts +72 -46
  58. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +3 -2
  59. package/front_end/panels/network/ResourceWebSocketFrameView.ts +3 -3
  60. package/front_end/panels/network/originalResourceChunkView.css +49 -0
  61. package/front_end/panels/screencast/ScreencastView.ts +401 -260
  62. package/front_end/panels/screencast/screencastView.css +113 -100
  63. package/front_end/panels/sensors/LocationsSettingsTab.ts +106 -122
  64. package/front_end/panels/sensors/locationsSettingsTab.css +4 -4
  65. package/front_end/panels/settings/AISettingsTab.ts +17 -100
  66. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -2
  67. package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -4
  68. package/front_end/panels/sources/AddSourceMapURLDialog.ts +3 -3
  69. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +4 -3
  70. package/front_end/panels/sources/BreakpointEditDialog.ts +14 -14
  71. package/front_end/panels/sources/BreakpointsView.ts +14 -14
  72. package/front_end/panels/sources/CallStackSidebarPane.ts +6 -6
  73. package/front_end/panels/sources/CategorizedBreakpointL10n.ts +18 -18
  74. package/front_end/panels/sources/CoveragePlugin.ts +7 -7
  75. package/front_end/panels/sources/DebuggerPausedMessage.ts +23 -23
  76. package/front_end/panels/sources/DebuggerPlugin.ts +29 -29
  77. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -2
  78. package/front_end/panels/sources/GoToLineQuickOpen.ts +10 -10
  79. package/front_end/panels/sources/NavigatorView.ts +34 -27
  80. package/front_end/panels/sources/OutlineQuickOpen.ts +3 -3
  81. package/front_end/panels/sources/PersistenceActions.ts +9 -9
  82. package/front_end/panels/sources/ProfilePlugin.ts +1 -1
  83. package/front_end/panels/sources/ScopeChainSidebarPane.ts +5 -5
  84. package/front_end/panels/sources/SnippetsPlugin.ts +2 -2
  85. package/front_end/panels/sources/SourcesNavigator.ts +20 -18
  86. package/front_end/panels/sources/SourcesPanel.ts +26 -25
  87. package/front_end/panels/sources/SourcesView.ts +5 -6
  88. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -3
  89. package/front_end/panels/sources/ThreadsSidebarPane.ts +1 -1
  90. package/front_end/panels/sources/UISourceCodeFrame.ts +0 -2
  91. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -7
  92. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  93. package/front_end/panels/sources/sources-meta.ts +109 -71
  94. package/front_end/panels/sources/sources.ts +0 -2
  95. package/front_end/panels/timeline/TimelineHistoryManager.ts +14 -3
  96. package/front_end/panels/timeline/TimelineLoader.ts +72 -42
  97. package/front_end/panels/timeline/TimelinePanel.ts +29 -4
  98. package/front_end/panels/timeline/timelineHistoryManager.css +4 -0
  99. package/front_end/third_party/chromium/README.chromium +1 -1
  100. package/front_end/third_party/puppeteer/README.chromium +2 -2
  101. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +187 -1
  102. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +91 -38
  103. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +145 -2
  104. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js +0 -2
  106. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts +0 -2
  108. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +0 -2
  110. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.d.ts +3 -2
  112. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.js +8 -2
  114. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts +0 -2
  116. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js +0 -2
  118. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +1 -3
  120. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +0 -2
  122. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts +0 -1
  124. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js +0 -1
  126. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +2 -2
  129. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts +5 -1
  131. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +12 -0
  133. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +4 -1
  136. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +5 -1
  138. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +49 -0
  140. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts +0 -6
  142. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +0 -6
  144. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.d.ts.map +1 -1
  150. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.js +3 -0
  151. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.js.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +0 -3
  153. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +0 -3
  155. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  157. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  158. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/disposable.d.ts +2 -2
  159. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/disposable.js +2 -2
  160. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  162. package/front_end/third_party/puppeteer/package/lib/types.d.ts +187 -1
  163. package/front_end/third_party/puppeteer/package/package.json +5 -5
  164. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +155 -2
  165. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +0 -2
  166. package/front_end/third_party/puppeteer/package/src/api/Dialog.ts +10 -2
  167. package/front_end/third_party/puppeteer/package/src/api/JSHandle.ts +0 -2
  168. package/front_end/third_party/puppeteer/package/src/api/Page.ts +1 -3
  169. package/front_end/third_party/puppeteer/package/src/api/Realm.ts +0 -1
  170. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +4 -2
  171. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +17 -0
  172. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +5 -4
  173. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +66 -0
  174. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +0 -6
  175. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  176. package/front_end/third_party/puppeteer/package/src/injected/util.ts +4 -1
  177. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +0 -3
  178. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  179. package/front_end/third_party/puppeteer/package/src/util/disposable.ts +2 -2
  180. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  181. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +9 -7
  182. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +7 -8
  183. package/front_end/ui/legacy/Dialog.ts +12 -2
  184. package/front_end/ui/legacy/TabbedPane.ts +7 -2
  185. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +40 -24
  186. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
  187. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +8 -4
  188. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +14 -7
  189. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -1
  190. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  191. package/package.json +1 -1
  192. package/front_end/panels/sources/AiWarningInfobarPlugin.ts +0 -78
@@ -1,7 +1,6 @@
1
1
  // Copyright 2022 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable @devtools/no-lit-render-outside-of-view */
5
4
 
6
5
  import '../../../../ui/components/report_view/report_view.js';
7
6
  import '../../../../ui/components/request_link_icon/request_link_icon.js';
@@ -14,8 +13,6 @@ import * as SDK from '../../../../core/sdk/sdk.js';
14
13
  import * as Protocol from '../../../../generated/protocol.js';
15
14
  import * as Logs from '../../../../models/logs/logs.js';
16
15
  import * as Buttons from '../../../../ui/components/buttons/buttons.js';
17
- import * as LegacyWrapper from '../../../../ui/components/legacy_wrapper/legacy_wrapper.js';
18
- import * as RenderCoordinator from '../../../../ui/components/render_coordinator/render_coordinator.js';
19
16
  import * as UI from '../../../../ui/legacy/legacy.js';
20
17
  import * as Lit from '../../../../ui/lit/lit.js';
21
18
  import * as VisualLogging from '../../../../ui/visual_logging/visual_logging.js';
@@ -168,82 +165,56 @@ interface PreloadingDetailsReportViewDataInternal {
168
165
  requestResolver?: Logs.RequestResolver.RequestResolver;
169
166
  }
170
167
 
171
- export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.WrappableComponent<UI.Widget.VBox> {
172
- readonly #shadow = this.attachShadow({mode: 'open'});
173
- #data: PreloadingDetailsReportViewData = null;
168
+ export interface ViewInput {
169
+ data: PreloadingDetailsReportViewData;
170
+ }
174
171
 
175
- set data(data: PreloadingDetailsReportViewData) {
176
- this.#data = data;
177
- void this.#render();
172
+ const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
173
+ if (input.data === null) {
174
+ // clang-format off
175
+ Lit.render(html`
176
+ <style>${preloadingDetailsReportViewStyles}</style>
177
+ <style>${UI.inspectorCommonStyles}</style>
178
+ <div class="empty-state">
179
+ <span class="empty-state-header">${i18nString(UIStrings.noElementSelected)}</span>
180
+ <span class="empty-state-description">${i18nString(UIStrings.selectAnElementForMoreDetails)}</span>
181
+ </div>
182
+ `, target);
183
+ // clang-format on
184
+ return;
178
185
  }
179
186
 
180
- async #render(): Promise<void> {
181
- await RenderCoordinator.write('PreloadingDetailsReportView render', () => {
182
- if (this.#data === null) {
183
- // Disabled until https://crbug.com/1079231 is fixed.
184
- // clang-format off
185
- Lit.render(html`
186
- <style>${preloadingDetailsReportViewStyles}</style>
187
- <style>${UI.inspectorCommonStyles}</style>
188
- <div class="empty-state">
189
- <span class="empty-state-header">${i18nString(UIStrings.noElementSelected)}</span>
190
- <span class="empty-state-description">${i18nString(UIStrings.selectAnElementForMoreDetails)}</span>
191
- </div>
192
- `, this.#shadow, {host: this});
193
- // clang-format on
194
- return;
195
- }
196
-
197
- const pipeline = this.#data.pipeline;
198
- const pageURL = this.#data.pageURL;
199
- const isFallbackToPrefetch = pipeline.getPrerender()?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
200
- (pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.READY ||
201
- pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS);
187
+ const pipeline = input.data.pipeline;
188
+ const pageURL = input.data.pageURL;
189
+ const isFallbackToPrefetch = pipeline.getPrerender()?.status === SDK.PreloadingModel.PreloadingStatus.FAILURE &&
190
+ (pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.READY ||
191
+ pipeline.getPrefetch()?.status === SDK.PreloadingModel.PreloadingStatus.SUCCESS);
202
192
 
203
- // Disabled until https://crbug.com/1079231 is fixed.
204
- // clang-format off
205
- Lit.render(html`
206
- <style>${preloadingDetailsReportViewStyles}</style>
207
- <style>${UI.inspectorCommonStyles}</style>
208
- <devtools-report
209
- .data=${{reportTitle: 'Speculative Loading Attempt'}}
210
- jslog=${VisualLogging.section('preloading-details')}>
211
- <devtools-report-section-header>${i18nString(UIStrings.detailsDetailedInformation)}</devtools-report-section-header>
212
-
213
- ${this.#url()}
214
- ${this.#action(isFallbackToPrefetch)}
215
- ${this.#status(isFallbackToPrefetch)}
216
- ${this.#targetHint()}
217
- ${this.#formSubmission()}
218
- ${this.#maybePrefetchFailureReason()}
219
- ${this.#maybePrerenderFailureReason()}
220
-
221
- ${this.#data.ruleSets.map(ruleSet => this.#renderRuleSet(ruleSet, pageURL))}
222
- </devtools-report>
223
- `, this.#shadow, {host: this});
224
- // clang-format on
225
- });
226
- }
193
+ const isPrerenderLike = (speculationAction: Protocol.Preload.SpeculationAction): boolean => {
194
+ return [
195
+ Protocol.Preload.SpeculationAction.Prerender,
196
+ Protocol.Preload.SpeculationAction.PrerenderUntilScript,
197
+ ].includes(speculationAction);
198
+ };
227
199
 
228
- #url(): Lit.LitTemplate {
229
- assertNotNullOrUndefined(this.#data);
230
- const attempt = this.#data.pipeline.getOriginallyTriggered();
200
+ const url = (): Lit.LitTemplate => {
201
+ assertNotNullOrUndefined(input.data);
202
+ const attempt = input.data.pipeline.getOriginallyTriggered();
231
203
 
232
- const prefetchStatus = this.#data.pipeline.getPrefetch()?.status;
204
+ const prefetchStatus = input.data.pipeline.getPrefetch()?.status;
233
205
 
234
206
  let value;
235
207
  if (attempt.action === Protocol.Preload.SpeculationAction.Prefetch && attempt.requestId !== undefined &&
236
208
  prefetchStatus !== SDK.PreloadingModel.PreloadingStatus.NOT_TRIGGERED) {
237
- // Disabled until https://crbug.com/1079231 is fixed.
238
- // clang-format off
239
209
  const {requestId, key: {url}} = attempt;
240
210
  const affectedRequest: {requestId?: Protocol.Network.RequestId, url?: string} = {requestId, url};
211
+ // clang-format off
241
212
  value = html`
242
213
  <devtools-request-link-icon
243
214
  .data=${
244
215
  {
245
216
  affectedRequest,
246
- requestResolver: this.#data.requestResolver || new Logs.RequestResolver.RequestResolver(Logs.NetworkLog.NetworkLog.instance()),
217
+ requestResolver: input.data.requestResolver || new Logs.RequestResolver.RequestResolver(Logs.NetworkLog.NetworkLog.instance()),
247
218
  displayURL: true,
248
219
  urlToDisplay: url,
249
220
  }
@@ -251,36 +222,24 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
251
222
  >
252
223
  </devtools-request-link-icon>
253
224
  `;
225
+ // clang-format on
254
226
  } else {
255
- // Disabled until https://crbug.com/1079231 is fixed.
256
- // clang-format off
257
227
  value = html`
258
228
  <div class="text-ellipsis" title=${attempt.key.url}>${attempt.key.url}</div>
259
229
  `;
260
- // clang-format on
261
230
  }
262
231
 
263
- // Disabled until https://crbug.com/1079231 is fixed.
264
- // clang-format off
265
232
  return html`
266
233
  <devtools-report-key>${i18n.i18n.lockedString('URL')}</devtools-report-key>
267
234
  <devtools-report-value>
268
235
  ${value}
269
236
  </devtools-report-value>
270
237
  `;
271
- // clang-format on
272
- }
273
-
274
- #isPrerenderLike(speculationAction: Protocol.Preload.SpeculationAction): boolean {
275
- return [
276
- Protocol.Preload.SpeculationAction.Prerender,
277
- Protocol.Preload.SpeculationAction.PrerenderUntilScript,
278
- ].includes(speculationAction);
279
- }
238
+ };
280
239
 
281
- #action(isFallbackToPrefetch: boolean): Lit.LitTemplate {
282
- assertNotNullOrUndefined(this.#data);
283
- const attempt = this.#data.pipeline.getOriginallyTriggered();
240
+ const action = (isFallbackToPrefetch: boolean): Lit.LitTemplate => {
241
+ assertNotNullOrUndefined(input.data);
242
+ const attempt = input.data.pipeline.getOriginallyTriggered();
284
243
 
285
244
  const action = PreloadingString.capitalizedAction(attempt.action);
286
245
 
@@ -291,7 +250,7 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
291
250
 
292
251
  let maybeInspectButton: Lit.LitTemplate = Lit.nothing;
293
252
  (() => {
294
- if (!this.#isPrerenderLike(attempt.action)) {
253
+ if (!isPrerenderLike(attempt.action)) {
295
254
  return;
296
255
  }
297
256
 
@@ -310,8 +269,6 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
310
269
  }
311
270
  UI.Context.Context.instance().setFlavor(SDK.Target.Target, prerenderTarget);
312
271
  };
313
- // Disabled until https://crbug.com/1079231 is fixed.
314
- // clang-format off
315
272
  maybeInspectButton = html`
316
273
  <devtools-button
317
274
  @click=${inspect}
@@ -324,11 +281,8 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
324
281
  ${i18nString(UIStrings.buttonInspect)}
325
282
  </devtools-button>
326
283
  `;
327
- // clang-format on
328
284
  })();
329
285
 
330
- // Disabled until https://crbug.com/1079231 is fixed.
331
- // clang-format off
332
286
  return html`
333
287
  <devtools-report-key>${i18nString(UIStrings.detailsAction)}</devtools-report-key>
334
288
  <devtools-report-value>
@@ -337,12 +291,11 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
337
291
  </div>
338
292
  </devtools-report-value>
339
293
  `;
340
- // clang-format on
341
- }
294
+ };
342
295
 
343
- #status(isFallbackToPrefetch: boolean): Lit.LitTemplate {
344
- assertNotNullOrUndefined(this.#data);
345
- const attempt = this.#data.pipeline.getOriginallyTriggered();
296
+ const status = (isFallbackToPrefetch: boolean): Lit.LitTemplate => {
297
+ assertNotNullOrUndefined(input.data);
298
+ const attempt = input.data.pipeline.getOriginallyTriggered();
346
299
 
347
300
  const detailedStatus = isFallbackToPrefetch ? i18nString(UIStrings.detailedStatusFallbackToPrefetch) :
348
301
  PreloadingUIUtils.detailedStatus(attempt);
@@ -353,11 +306,11 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
353
306
  ${detailedStatus}
354
307
  </devtools-report-value>
355
308
  `;
356
- }
309
+ };
357
310
 
358
- #maybePrefetchFailureReason(): Lit.LitTemplate {
359
- assertNotNullOrUndefined(this.#data);
360
- const attempt = this.#data.pipeline.getOriginallyTriggered();
311
+ const maybePrefetchFailureReason = (): Lit.LitTemplate => {
312
+ assertNotNullOrUndefined(input.data);
313
+ const attempt = input.data.pipeline.getOriginallyTriggered();
361
314
 
362
315
  if (attempt.action !== Protocol.Preload.SpeculationAction.Prefetch) {
363
316
  return Lit.nothing;
@@ -377,12 +330,12 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
377
330
  ${failureDescription}
378
331
  </devtools-report-value>
379
332
  `;
380
- }
333
+ };
381
334
 
382
- #targetHint(): Lit.LitTemplate {
383
- assertNotNullOrUndefined(this.#data);
384
- const attempt = this.#data.pipeline.getOriginallyTriggered();
385
- const hasTargetHint = this.#isPrerenderLike(attempt.action) && attempt.key.targetHint !== undefined;
335
+ const targetHint = (): Lit.LitTemplate => {
336
+ assertNotNullOrUndefined(input.data);
337
+ const attempt = input.data.pipeline.getOriginallyTriggered();
338
+ const hasTargetHint = isPrerenderLike(attempt.action) && attempt.key.targetHint !== undefined;
386
339
  if (!hasTargetHint) {
387
340
  return Lit.nothing;
388
341
  }
@@ -393,13 +346,13 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
393
346
  ${PreloadingUIUtils.detailedTargetHint(attempt.key)}
394
347
  </devtools-report-value>
395
348
  `;
396
- }
349
+ };
397
350
 
398
- #formSubmission(): Lit.LitTemplate {
399
- assertNotNullOrUndefined(this.#data);
400
- const attempt = this.#data.pipeline.getOriginallyTriggered();
351
+ const formSubmission = (): Lit.LitTemplate => {
352
+ assertNotNullOrUndefined(input.data);
353
+ const attempt = input.data.pipeline.getOriginallyTriggered();
401
354
  const hasFormSubmission = attempt.key.formSubmission !== undefined;
402
- if (!hasFormSubmission || !this.#isPrerenderLike(attempt.action)) {
355
+ if (!hasFormSubmission || !isPrerenderLike(attempt.action)) {
403
356
  return Lit.nothing;
404
357
  }
405
358
 
@@ -409,13 +362,13 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
409
362
  ${attempt.key.formSubmission ? i18nString(UIStrings.yes) : i18nString(UIStrings.no)}
410
363
  </devtools-report-value>
411
364
  `;
412
- }
365
+ };
413
366
 
414
- #maybePrerenderFailureReason(): Lit.LitTemplate {
415
- assertNotNullOrUndefined(this.#data);
416
- const attempt = this.#data.pipeline.getOriginallyTriggered();
367
+ const maybePrerenderFailureReason = (): Lit.LitTemplate => {
368
+ assertNotNullOrUndefined(input.data);
369
+ const attempt = input.data.pipeline.getOriginallyTriggered();
417
370
 
418
- if (!this.#isPrerenderLike(attempt.action)) {
371
+ if (!isPrerenderLike(attempt.action)) {
419
372
  return Lit.nothing;
420
373
  }
421
374
 
@@ -434,16 +387,15 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
434
387
  ${failureReason}
435
388
  </devtools-report-value>
436
389
  `;
437
- }
390
+ };
438
391
 
439
- #renderRuleSet(ruleSet: Protocol.Preload.RuleSet, pageURL: Platform.DevToolsPath.UrlString): Lit.LitTemplate {
392
+ const renderRuleSet = (ruleSet: Protocol.Preload.RuleSet,
393
+ pageURL: Platform.DevToolsPath.UrlString): Lit.LitTemplate => {
440
394
  const revealRuleSetView = (): void => {
441
395
  void Common.Revealer.reveal(new PreloadingHelper.PreloadingForward.RuleSetView(ruleSet.id));
442
396
  };
443
397
  const location = ruleSetLocationShort(ruleSet, pageURL);
444
398
 
445
- // Disabled until https://crbug.com/1079231 is fixed.
446
- // clang-format off
447
399
  return html`
448
400
  <devtools-report-key>${i18nString(UIStrings.detailsRuleSet)}</devtools-report-key>
449
401
  <devtools-report-value>
@@ -462,14 +414,54 @@ export class PreloadingDetailsReportView extends LegacyWrapper.LegacyWrapper.Wra
462
414
  </div>
463
415
  </devtools-report-value>
464
416
  `;
465
- // clang-format on
417
+ };
418
+
419
+ // clang-format off
420
+ Lit.render(html`
421
+ <style>${preloadingDetailsReportViewStyles}</style>
422
+ <style>${UI.inspectorCommonStyles}</style>
423
+ <devtools-report
424
+ .data=${{reportTitle: 'Speculative Loading Attempt'}}
425
+ jslog=${VisualLogging.section('preloading-details')}>
426
+ <devtools-report-section-header>${i18nString(UIStrings.detailsDetailedInformation)}</devtools-report-section-header>
427
+
428
+ ${url()}
429
+ ${action(isFallbackToPrefetch)}
430
+ ${status(isFallbackToPrefetch)}
431
+ ${targetHint()}
432
+ ${formSubmission()}
433
+ ${maybePrefetchFailureReason()}
434
+ ${maybePrerenderFailureReason()}
435
+
436
+ ${input.data.ruleSets.map(ruleSet => renderRuleSet(ruleSet, pageURL))}
437
+ </devtools-report>
438
+ `, target);
439
+ // clang-format on
440
+ };
441
+
442
+ export class PreloadingDetailsReportView extends UI.Widget.VBox {
443
+ #data: PreloadingDetailsReportViewData = null;
444
+ #view: typeof DEFAULT_VIEW;
445
+
446
+ constructor(element?: HTMLElement, view = DEFAULT_VIEW) {
447
+ super(element);
448
+ this.#view = view;
466
449
  }
467
- }
468
450
 
469
- customElements.define('devtools-resources-preloading-details-report-view', PreloadingDetailsReportView);
451
+ set data(data: PreloadingDetailsReportViewData) {
452
+ this.#data = data;
453
+ this.requestUpdate();
454
+ }
470
455
 
471
- declare global {
472
- interface HTMLElementTagNameMap {
473
- 'devtools-resources-preloading-details-report-view': PreloadingDetailsReportView;
456
+ override wasShown(): void {
457
+ super.wasShown();
458
+ this.requestUpdate();
459
+ }
460
+
461
+ override performUpdate(): void {
462
+ const viewInput = {
463
+ data: this.#data,
464
+ };
465
+ this.#view(viewInput, undefined, this.contentElement);
474
466
  }
475
467
  }
@@ -3,32 +3,30 @@
3
3
  * Use of this source code is governed by a BSD-style license that can be
4
4
  * found in the LICENSE file.
5
5
  */
6
- :host {
7
- display: flex;
8
- height: 100%;
9
- }
10
6
 
11
- devtools-report {
12
- flex-grow: 1;
7
+ @scope to (devtools-widget > *) {
8
+ devtools-report {
9
+ flex-grow: 1;
13
10
 
14
- button.link {
15
- color: var(--sys-color-primary);
16
- text-decoration: underline;
17
- padding: 0;
18
- border: none;
19
- background: none;
20
- font-family: inherit;
21
- font-size: inherit;
22
- height: 16px;
23
- }
11
+ button.link {
12
+ color: var(--sys-color-primary);
13
+ text-decoration: underline;
14
+ padding: 0;
15
+ border: none;
16
+ background: none;
17
+ font-family: inherit;
18
+ font-size: inherit;
19
+ height: 16px;
20
+ }
24
21
 
25
- button.link devtools-icon {
26
- vertical-align: sub;
22
+ button.link devtools-icon {
23
+ vertical-align: sub;
24
+ }
27
25
  }
28
- }
29
26
 
30
- .link {
31
- color: var(--sys-color-primary);
32
- text-decoration: underline;
33
- cursor: pointer;
27
+ .link {
28
+ color: var(--sys-color-primary);
29
+ text-decoration: underline;
30
+ cursor: pointer;
31
+ }
34
32
  }
@@ -3,107 +3,110 @@
3
3
  * Use of this source code is governed by a BSD-style license that can be
4
4
  * found in the LICENSE file.
5
5
  */
6
- .resource-service-worker-update-view {
7
- display: block;
8
- margin: 6px;
9
- color: var(--sys-color-on-surface-subtle);
10
- overflow: auto;
11
- }
12
-
13
- .service-worker-update-timing-table {
14
- border: 1px solid var(--sys-color-divider);
15
- border-spacing: 0;
16
- padding-left: 10px;
17
- padding-right: 10px;
18
- line-height: initial;
19
- table-layout: auto;
20
- overflow: hidden;
21
- }
22
-
23
- .service-worker-update-timing-row {
24
- position: relative;
25
- height: 20px;
26
- overflow: hidden;
27
- min-width: 80px;
28
- }
29
-
30
- .service-worker-update-timing-bar {
31
- position: absolute;
32
- min-width: 1px;
33
- top: 0;
34
- bottom: 0;
35
- }
36
-
37
- .service-worker-update-timing-bar-clickable::before {
38
- user-select: none;
39
- mask-image: var(--image-file-triangle-right);
40
- float: left;
41
- width: 14px;
42
- height: 14px;
43
- margin-right: 2px;
44
- content: "";
45
- position: relative;
46
- background-color: var(--icon-default);
47
- transition: transform 200ms;
48
- }
49
-
50
- .service-worker-update-timing-bar-clickable {
51
- position: relative;
52
- left: -12px;
53
- }
54
-
55
- .service-worker-update-timing-bar-clickable:focus-visible {
56
- background-color: var(--sys-color-state-focus-highlight);
57
- }
58
-
59
- .service-worker-update-timing-bar-clickable[aria-checked="true"]::before {
60
- transform: rotate(90deg);
61
- }
62
-
63
- .service-worker-update-timing-bar-details-collapsed {
64
- display: none;
65
- }
66
-
67
- .service-worker-update-timing-bar-details-expanded {
68
- display: table-row;
69
- }
70
-
71
- .service-worker-update-timing-bar-details:focus-visible {
72
- background-color: var(--sys-color-state-focus-highlight);
73
- }
74
-
75
- .service-worker-update-timing-bar.activate {
76
- top: 5px;
77
- height: 10px;
78
- background-color: var(--sys-color-yellow-bright);
79
- }
80
-
81
- .service-worker-update-timing-bar.wait {
82
- top: 5px;
83
- height: 10px;
84
- background-color: var(--sys-color-purple-bright);
85
- }
86
-
87
- .service-worker-update-timing-bar.install {
88
- top: 5px;
89
- height: 10px;
90
- background-color: var(--sys-color-cyan-bright);
91
- }
92
-
93
- .service-worker-update-timing-table > tr > td {
94
- padding: 4px 0;
95
- padding-right: 10px;
96
- }
97
-
98
- table.service-worker-update-timing-table > tr.service-worker-update-timing-table-header > td {
99
- border-top: 5px solid transparent;
100
- color: var(--sys-color-token-subtle);
101
- }
102
-
103
- table.service-worker-update-timing-table > tr.service-worker-update-timing-bar-details > td:first-child {
104
- padding-left: 12px;
105
- }
106
6
 
107
- table.service-worker-update-timing-table > tr.service-worker-update-timeline > td:first-child {
108
- padding-left: 12px;
7
+ @scope to (devtools-widget > *) {
8
+ .resource-service-worker-update-view {
9
+ display: block;
10
+ margin: 6px;
11
+ color: var(--sys-color-on-surface-subtle);
12
+ overflow: auto;
13
+ }
14
+
15
+ .service-worker-update-timing-table {
16
+ border: 1px solid var(--sys-color-divider);
17
+ border-spacing: 0;
18
+ padding-left: 10px;
19
+ padding-right: 10px;
20
+ line-height: initial;
21
+ table-layout: auto;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .service-worker-update-timing-row {
26
+ position: relative;
27
+ height: 20px;
28
+ overflow: hidden;
29
+ min-width: 80px;
30
+ }
31
+
32
+ .service-worker-update-timing-bar {
33
+ position: absolute;
34
+ min-width: 1px;
35
+ top: 0;
36
+ bottom: 0;
37
+ }
38
+
39
+ .service-worker-update-timing-bar-clickable::before {
40
+ user-select: none;
41
+ mask-image: var(--image-file-triangle-right);
42
+ float: left;
43
+ width: 14px;
44
+ height: 14px;
45
+ margin-right: 2px;
46
+ content: "";
47
+ position: relative;
48
+ background-color: var(--icon-default);
49
+ transition: transform 200ms;
50
+ }
51
+
52
+ .service-worker-update-timing-bar-clickable {
53
+ position: relative;
54
+ left: -12px;
55
+ }
56
+
57
+ .service-worker-update-timing-bar-clickable:focus-visible {
58
+ background-color: var(--sys-color-state-focus-highlight);
59
+ }
60
+
61
+ .service-worker-update-timing-bar-clickable[aria-checked="true"]::before {
62
+ transform: rotate(90deg);
63
+ }
64
+
65
+ .service-worker-update-timing-bar-details-collapsed {
66
+ display: none;
67
+ }
68
+
69
+ .service-worker-update-timing-bar-details-expanded {
70
+ display: table-row;
71
+ }
72
+
73
+ .service-worker-update-timing-bar-details:focus-visible {
74
+ background-color: var(--sys-color-state-focus-highlight);
75
+ }
76
+
77
+ .service-worker-update-timing-bar.activate {
78
+ top: 5px;
79
+ height: 10px;
80
+ background-color: var(--sys-color-yellow-bright);
81
+ }
82
+
83
+ .service-worker-update-timing-bar.wait {
84
+ top: 5px;
85
+ height: 10px;
86
+ background-color: var(--sys-color-purple-bright);
87
+ }
88
+
89
+ .service-worker-update-timing-bar.install {
90
+ top: 5px;
91
+ height: 10px;
92
+ background-color: var(--sys-color-cyan-bright);
93
+ }
94
+
95
+ .service-worker-update-timing-table > tbody > tr > td {
96
+ padding: 4px 0;
97
+ padding-right: 10px;
98
+ }
99
+
100
+ table.service-worker-update-timing-table > tbody > tr.service-worker-update-timing-table-header > td {
101
+ border-top: 5px solid transparent;
102
+ color: var(--sys-color-token-subtle);
103
+ }
104
+
105
+ table.service-worker-update-timing-table > tbody > tr.service-worker-update-timing-bar-details > td:first-child {
106
+ padding-left: 12px;
107
+ }
108
+
109
+ table.service-worker-update-timing-table > tbody > tr.service-worker-update-timeline > td:first-child {
110
+ padding-left: 12px;
111
+ }
109
112
  }